public void Create_WithNullMetaTag_ThrowsArgumentNullException()
 {
     UnitTestHelper.AssertThrowsArgumentNullException(() => MetaTags.Create(null));
 }
예제 #2
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["articleId"], out this.articleId))
            {
                base.GotoResourceNotFound("");
            }

            this.txtCatgoryId          = (HtmlInputHidden)this.FindControl("txtCatgoryId");
            this.litArticleAddedDate   = (FormatedTimeLabel)this.FindControl("litArticleAddedDate");
            this.litArticleContent     = (Literal)this.FindControl("litArticleContent");
            this.litArticleDescription = (Literal)this.FindControl("litArticleDescription");
            this.litArticleTitle       = (Literal)this.FindControl("litArticleTitle");
            this.lblFront      = (Label)this.FindControl("lblFront");
            this.lblNext       = (Label)this.FindControl("lblNext");
            this.lblFrontTitle = (Label)this.FindControl("lblFrontTitle");
            this.lblNextTitle  = (Label)this.FindControl("lblNextTitle");
            this.aFront        = (HtmlAnchor)this.FindControl("front");
            this.aNext         = (HtmlAnchor)this.FindControl("next");
            this.ariticlative  = (Common_ArticleRelative)this.FindControl("list_Common_ArticleRelative");
            if (!this.Page.IsPostBack)
            {
                ArticleInfo article = CommentBrowser.GetArticle(this.articleId);
                if ((article != null) && article.IsRelease)
                {
                    if (this.txtCatgoryId != null)
                    {
                        this.txtCatgoryId.Value = article.CategoryId.ToString();
                    }
                    PageTitle.AddSiteNameTitle(article.Title);
                    if (!string.IsNullOrEmpty(article.MetaKeywords))
                    {
                        MetaTags.AddMetaKeywords(article.MetaKeywords, HiContext.Current.Context);
                    }
                    if (!string.IsNullOrEmpty(article.MetaDescription))
                    {
                        MetaTags.AddMetaDescription(article.MetaDescription, HiContext.Current.Context);
                    }
                    this.litArticleTitle.Text       = article.Title;
                    this.litArticleDescription.Text = article.Description;
                    string str = HiContext.Current.HostPath + Globals.GetSiteUrls().UrlData.FormatUrl("ArticleDetails", new object[] { this.articleId });
                    this.litArticleContent.Text   = article.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
                    this.litArticleAddedDate.Time = article.AddedDate;
                    ArticleInfo info2 = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Front", article.CategoryId);
                    if ((info2 != null) && (info2.ArticleId > 0))
                    {
                        if (this.lblFront != null)
                        {
                            this.lblFront.Visible   = true;
                            this.aFront.HRef        = "ArticleDetails.aspx?ArticleId=" + info2.ArticleId;
                            this.lblFrontTitle.Text = info2.Title;
                        }
                    }
                    else if (this.lblFront != null)
                    {
                        this.lblFront.Visible = false;
                    }
                    ArticleInfo info3 = CommentBrowser.GetFrontOrNextArticle(this.articleId, "Next", article.CategoryId);
                    if ((info3 != null) && (info3.ArticleId > 0))
                    {
                        if (this.lblNext != null)
                        {
                            this.lblNext.Visible   = true;
                            this.aNext.HRef        = "ArticleDetails.aspx?ArticleId=" + info3.ArticleId;
                            this.lblNextTitle.Text = info3.Title;
                        }
                    }
                    else if (this.lblNext != null)
                    {
                        this.lblNext.Visible = false;
                    }
                }
            }
        }
예제 #3
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(base.GetParameter("helpId", false), out this.helpId))
     {
         base.GotoResourceNotFound();
     }
     this.litHelpAddedDate   = (FormatedTimeLabel)this.FindControl("litHelpAddedDate");
     this.litHelpDescription = (Literal)this.FindControl("litHelpDescription");
     this.litHelpContent     = (Literal)this.FindControl("litHelpContent");
     this.litHelpTitle       = (Literal)this.FindControl("litHelpTitle");
     this.lblFront           = (Label)this.FindControl("lblFront");
     this.lblNext            = (Label)this.FindControl("lblNext");
     this.lblFrontTitle      = (Label)this.FindControl("lblFrontTitle");
     this.lblNextTitle       = (Label)this.FindControl("lblNextTitle");
     this.aFront             = (HtmlAnchor)this.FindControl("front");
     this.aNext = (HtmlAnchor)this.FindControl("next");
     if (!this.Page.IsPostBack)
     {
         HelpInfo help = CommentBrowser.GetHelp(this.helpId);
         if (help != null)
         {
             PageTitle.AddSiteNameTitle(help.Title);
             if (!string.IsNullOrEmpty(help.Meta_Keywords))
             {
                 MetaTags.AddMetaKeywords(help.Meta_Keywords, HiContext.Current.Context);
             }
             if (!string.IsNullOrEmpty(help.Meta_Description))
             {
                 MetaTags.AddMetaDescription(help.Meta_Description, HiContext.Current.Context);
             }
             this.litHelpTitle.Text       = help.Title;
             this.litHelpDescription.Text = help.Description;
             string str = HiContext.Current.HostPath + base.GetRouteUrl("HelpDetails", new
             {
                 this.helpId
             });
             this.litHelpContent.Text   = help.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
             this.litHelpAddedDate.Time = help.AddedDate;
             HelpInfo frontOrNextHelp = CommentBrowser.GetFrontOrNextHelp(this.helpId, help.CategoryId, "Front");
             if (frontOrNextHelp != null && frontOrNextHelp.HelpId > 0)
             {
                 if (this.lblFront != null)
                 {
                     this.lblFront.Visible   = true;
                     this.aFront.HRef        = "HelpDetails.aspx?helpId=" + frontOrNextHelp.HelpId;
                     this.lblFrontTitle.Text = frontOrNextHelp.Title;
                 }
             }
             else if (this.lblFront != null)
             {
                 this.lblFront.Visible = false;
             }
             HelpInfo frontOrNextHelp2 = CommentBrowser.GetFrontOrNextHelp(this.helpId, help.CategoryId, "Next");
             if (frontOrNextHelp2 != null && frontOrNextHelp2.HelpId > 0)
             {
                 if (this.lblNext != null)
                 {
                     this.lblNext.Visible   = true;
                     this.aNext.HRef        = "HelpDetails.aspx?helpId=" + frontOrNextHelp2.HelpId;
                     this.lblNextTitle.Text = frontOrNextHelp2.Title;
                 }
             }
             else if (this.lblNext != null)
             {
                 this.lblNext.Visible = false;
             }
         }
     }
 }
예제 #4
0
        private string SEO(string seoResource, MetaTags metaType)
        {
            string          tempResource = seoResource;
            string          tempValue    = "";
            MatchCollection matchCol     = _regTokens.Matches(tempResource);

            if (matchCol.Count > 0)
            {
                foreach (Match match in matchCol)
                {
                    switch (metaType)
                    {
                    case MetaTags.Title:
                        switch (match.Value.ToUpper())
                        {
                        case "[PAGETITLE]":
                            tempValue = BasePage.Title;
                            break;

                        case "[STORETITLE]":
                            tempValue = StoreSettings.Name;
                            break;

                        case "[MANUFACTURER]":
                            tempValue = _product.Manufacturer;
                            break;

                        case "[MODELNUMBER]":
                            tempValue = _product.ModelNumber;
                            break;

                        case "[MODELNAME]":
                            tempValue = _product.ModelName;
                            break;

                        case "[PRODUCTTITLE]":
                            tempValue = _product.ProductTitle;
                            break;

                        case "[PRODUCTSUMMARY]":
                            tempValue = _product.Summary;
                            break;

                        default:
                            tempValue = match.Value;
                            break;
                        }
                        break;

                    case MetaTags.Keywords:
                        switch (match.Value.ToUpper())
                        {
                        case "[PAGEKEYWORDS]":
                            tempValue = BasePage.KeyWords;
                            break;

                        case "[STOREKEYWORDS]":
                            tempValue = StoreSettings.Keywords;
                            break;

                        case "[PRODUCTKEYWORDS]":
                            tempValue = _product.Keywords;
                            break;

                        default:
                            tempValue = match.Value;
                            break;
                        }
                        break;

                    case MetaTags.Description:
                        switch (match.Value.ToUpper())
                        {
                        case "[PAGEDESCRIPTION]":
                            tempValue = BasePage.Description;
                            break;

                        case "[STOREDESCRIPTION]":
                            tempValue = StoreSettings.Description;
                            break;

                        case "[PRODUCTSUMMARY]":
                            tempValue = _product.Summary;
                            break;

                        case "[PRODUCTDESCRIPTION]":
                            tempValue = _product.Description;
                            break;

                        default:
                            tempValue = match.Value;
                            break;
                        }
                        break;
                    }
                    tempResource = tempResource.Replace(match.Value, tempValue);
                }
            }
            return(tempResource.Trim());
        }
예제 #5
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["helpId"], out this.helpId))
     {
         base.GotoResourceNotFound();
     }
     this.litHelpAddedDate   = (FormatedTimeLabel)this.FindControl("litHelpAddedDate");
     this.litHelpDescription = (Literal)this.FindControl("litHelpDescription");
     this.litHelpContent     = (Literal)this.FindControl("litHelpContent");
     this.litHelpTitle       = (Literal)this.FindControl("litHelpTitle");
     this.lblFront           = (Label)this.FindControl("lblFront");
     this.lblNext            = (Label)this.FindControl("lblNext");
     this.lblFrontTitle      = (Label)this.FindControl("lblFrontTitle");
     this.lblNextTitle       = (Label)this.FindControl("lblNextTitle");
     this.aFront             = (HtmlAnchor)this.FindControl("front");
     this.aNext = (HtmlAnchor)this.FindControl("next");
     if (!this.Page.IsPostBack)
     {
         HelpInfo help = CommentBrowser.GetHelp(this.helpId);
         if (help != null)
         {
             PageTitle.AddTitle(help.Title, HiContext.Current.Context);
             if (!string.IsNullOrEmpty(help.MetaKeywords))
             {
                 MetaTags.AddMetaKeywords(help.MetaKeywords, HiContext.Current.Context);
             }
             if (!string.IsNullOrEmpty(help.MetaDescription))
             {
                 MetaTags.AddMetaDescription(help.MetaDescription, HiContext.Current.Context);
             }
             this.litHelpTitle.Text       = help.Title;
             this.litHelpDescription.Text = help.Description;
             string str = HiContext.Current.HostPath + Globals.GetSiteUrls().UrlData.FormatUrl("HelpDetails", new object[] { this.helpId });
             this.litHelpContent.Text   = help.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
             this.litHelpAddedDate.Time = help.AddedDate;
             HelpInfo info2 = CommentBrowser.GetFrontOrNextHelp(this.helpId, help.CategoryId, "Front");
             if ((info2 != null) && (info2.HelpId > 0))
             {
                 if (this.lblFront != null)
                 {
                     this.lblFront.Visible   = true;
                     this.aFront.HRef        = "HelpDetails.aspx?helpId=" + info2.HelpId;
                     this.lblFrontTitle.Text = info2.Title;
                 }
             }
             else if (this.lblFront != null)
             {
                 this.lblFront.Visible = false;
             }
             HelpInfo info3 = CommentBrowser.GetFrontOrNextHelp(this.helpId, help.CategoryId, "Next");
             if ((info3 != null) && (info3.HelpId > 0))
             {
                 if (this.lblNext != null)
                 {
                     this.lblNext.Visible   = true;
                     this.aNext.HRef        = "HelpDetails.aspx?helpId=" + info3.HelpId;
                     this.lblNextTitle.Text = info3.Title;
                 }
             }
             else if (this.lblNext != null)
             {
                 this.lblNext.Visible = false;
             }
         }
     }
 }
예제 #6
0
 public bool SaveMetaConfig(MetaTags config)
 {
     return(metaTagFileService.SaveConfig(config));
 }