");
+ sbTest.AppendLine("
");
+ sbTest.AppendLine("
");
+ sbTest.AppendLine(" ");
+ sbTest.AppendLine("
");
+ sbTest.AppendLine("
");
+ sbTest.AppendLine("
");
+ sbTest.AppendLine("");
+ sbTest.AppendLine("");
+ return sbTest.ToString();
+ }
+
+ var pubId = config.PublisherId.Trim();
+ if (!pubId.StartsWith("pub-", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(pubId))
+ {
+ pubId = "pub-" + pubId;
+ }
+ var clientKey = string.IsNullOrEmpty(pubId) ? "ca-pub-3940256099942544" : "ca-" + pubId;
+
+ var slot = "6300978111"; // Google 공식 샘플 슬롯
+ if (!string.IsNullOrEmpty(config.BannerAdUnitId))
+ {
+ var slashIdx = config.BannerAdUnitId.LastIndexOf('/');
+ if (slashIdx >= 0 && slashIdx < config.BannerAdUnitId.Length - 1)
+ {
+ slot = config.BannerAdUnitId.Substring(slashIdx + 1);
+ }
+ else
+ {
+ slot = config.BannerAdUnitId;
+ }
+ }
+
+ var title = HtmlEncoder.Default.Encode(ad.Title ?? (isTest ? "Nice job! Google AdMob 공식 테스트 광고" : "Google AdMob 공식 배너"));
+ var desc = HtmlEncoder.Default.Encode(ad.Description ?? (isTest ? "[테스트 모드 활성] 단위: ca-app-pub-3940256099942544/6300978111" : "Everything2Everything 공식 후원 파트너십"));
+ var targetUrl = ad.TargetUrl ?? (isTest ? "https://developers.google.com/admob/android/test-ads" : "https://admob.google.com");
+ var ctaText = HtmlEncoder.Default.Encode(ad.CtaText ?? (isTest ? "테스트 안내" : "자세히 보기"));
+ var badge = HtmlEncoder.Default.Encode(ad.BadgeText ?? (isTest ? "TEST AD" : "Google AdMob"));
+ var testAttr = isTest ? " data-ad-test=\"on\"" : "";
+
+ var sb = new StringBuilder();
+ sb.AppendLine("");
+ sb.AppendLine("");
+ sb.AppendLine("");
+ sb.AppendLine("");
+ sb.AppendLine("
");
+ sb.AppendLine(" ");
+ sb.AppendLine("
");
+ sb.Append("
");
+ sb.Append(" ").Append(badge).AppendLine("");
+ sb.AppendLine("
");
+ sb.AppendLine("
");
+ sb.Append("
").Append(title).AppendLine("
");
+ sb.Append("
").Append(desc).AppendLine("
");
+ sb.AppendLine("
");
+ sb.AppendLine("
");
+ sb.AppendLine("
");
+ sb.Append("
");
+ sb.Append("
").Append(ctaText).AppendLine("");
+ sb.AppendLine("
");
+ sb.AppendLine("
");
+ sb.AppendLine("
");
+ sb.AppendLine("
AdChoices");
+ sb.AppendLine("
");
+ sb.AppendLine("
");
+ sb.AppendLine("
");
+ sb.AppendLine(" ");
+ sb.AppendLine("
");
+ sb.Append(" ");
+ sb.AppendLine("
");
+ sb.AppendLine("
");
+ sb.AppendLine("");
+ sb.AppendLine("");
+ sb.AppendLine("");
+ return sb.ToString();
+ }
+}
diff --git a/src/Everything2Everything.Core/Ads/AdItem.cs b/src/Everything2Everything.Core/Ads/AdItem.cs
index b6bac2a..2fb3db8 100644
--- a/src/Everything2Everything.Core/Ads/AdItem.cs
+++ b/src/Everything2Everything.Core/Ads/AdItem.cs
@@ -18,4 +18,5 @@ public class AdItem
public AdType Type { get; set; } = AdType.Banner;
public bool IsActive { get; set; } = true;
public int DisplayOrder { get; set; } = 0;
+ public string? HtmlContent { get; set; }
}
diff --git a/src/Everything2Everything.Core/Ads/AdMobConfig.cs b/src/Everything2Everything.Core/Ads/AdMobConfig.cs
index 7162de9..4b3ab12 100644
--- a/src/Everything2Everything.Core/Ads/AdMobConfig.cs
+++ b/src/Everything2Everything.Core/Ads/AdMobConfig.cs
@@ -1,3 +1,5 @@
+using System;
+
namespace Everything2Everything.Core.Ads;
///