SetPseudoCacheValue() public static method

Sets a pseudo cache item value, only if the content cache is enabled.
public static SetPseudoCacheValue ( string name, string value ) : void
name string The name of the item to store the value of.
value string The value of the item.
return void
        /// <summary>
        /// Prints the footer.
        /// </summary>
        public void PrintFooter()
        {
            string f = Content.GetPseudoCacheValue(GetPseudoCacheItemName("Footer"));

            if (f == null)
            {
                f = FormattingPipeline.FormatWithPhase1And2(GetMetadataItemWithFallback(MetaDataItem.Footer, currentNamespace),
                                                            false, FormattingContext.Footer, currentPage);
                Content.SetPseudoCacheValue(GetPseudoCacheItemName("Footer"), f);
            }
            lblFooterDiv.Text = FormattingPipeline.FormatWithPhase3(f, FormattingContext.Footer, currentPage);
        }
        /// <summary>
        /// Prints the sidebar.
        /// </summary>
        public void PrintSidebar()
        {
            string s = Content.GetPseudoCacheValue(GetPseudoCacheItemName("Sidebar"));

            if (s == null)
            {
                s = FormattingPipeline.FormatWithPhase1And2(GetMetadataItemWithFallback(MetaDataItem.Sidebar, currentNamespace),
                                                            false, FormattingContext.Sidebar, currentPage);
                Content.SetPseudoCacheValue(GetPseudoCacheItemName("Sidebar"), s);
            }
            lblSidebarDiv.Text = FormattingPipeline.FormatWithPhase3(s, FormattingContext.Sidebar, currentPage);
        }
        /// <summary>
        /// Prints the header.
        /// </summary>
        public void PrintHeader()
        {
            string h = Content.GetPseudoCacheValue(GetPseudoCacheItemName("Header"));

            if (h == null)
            {
                h = FormattingPipeline.FormatWithPhase1And2(GetMetadataItemWithFallback(MetaDataItem.Header, currentNamespace),
                                                            false, FormattingContext.Header, currentPage);
                Content.SetPseudoCacheValue(GetPseudoCacheItemName("Header"), h);
            }
            lblHeaderDiv.Text = FormattingPipeline.FormatWithPhase3(h, FormattingContext.Header, currentPage);
        }
示例#4
0
        /// <summary>
        /// Prints the login notice.
        /// </summary>
        public void PrintLoginNotice()
        {
            string n = Content.GetPseudoCacheValue("LoginNotice");

            if (n == null)
            {
                n = Settings.Provider.GetMetaDataItem(MetaDataItem.LoginNotice, null);
                if (!string.IsNullOrEmpty(n))
                {
                    n = FormattingPipeline.FormatWithPhase1And2(n, false, FormattingContext.Other, null);
                    Content.SetPseudoCacheValue("LoginNotice", n);
                }
            }
            if (!string.IsNullOrEmpty(n))
            {
                lblDescription.Text = FormattingPipeline.FormatWithPhase3(n, FormattingContext.Other, null);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = Properties.Messages.AccessDeniedTitle + " - " + Settings.WikiTitle;

            string n = Content.GetPseudoCacheValue("AccessDeniedNotice");

            if (n == null)
            {
                n = Settings.Provider.GetMetaDataItem(MetaDataItem.AccessDeniedNotice, null);
                if (!string.IsNullOrEmpty(n))
                {
                    n = FormattingPipeline.FormatWithPhase1And2(n, false, FormattingContext.Other, null);
                    Content.SetPseudoCacheValue("AccessDeniedNotice", n);
                }
            }
            if (!string.IsNullOrEmpty(n))
            {
                lblDescription.Text = FormattingPipeline.FormatWithPhase3(n, FormattingContext.Other, null);
            }
        }
        /// <summary>
        /// Prints the page header and page footer.
        /// </summary>
        public void PrintPageHeaderAndFooter()
        {
            string h = Content.GetPseudoCacheValue(GetPseudoCacheItemName("PageHeader"));

            if (h == null)
            {
                h = GetMetadataItemWithFallback(MetaDataItem.PageHeader, currentNamespace);
                h = @"<div id=""PageInternalHeaderDiv"">" + FormattingPipeline.FormatWithPhase1And2(h, false, FormattingContext.PageHeader, currentPage) + "</div>";
                Content.SetPseudoCacheValue(GetPseudoCacheItemName("PageHeader"), h);
            }
            lblPageHeaderDiv.Text = FormattingPipeline.FormatWithPhase3(h, FormattingContext.PageHeader, currentPage);

            h = Content.GetPseudoCacheValue(GetPseudoCacheItemName("PageFooter"));
            if (h == null)
            {
                h = GetMetadataItemWithFallback(MetaDataItem.PageFooter, currentNamespace);
                h = @"<div id=""PageInternalFooterDiv"">" + FormattingPipeline.FormatWithPhase1And2(h, false, FormattingContext.PageFooter, currentPage) + "</div>";
                Content.SetPseudoCacheValue(GetPseudoCacheItemName("PageFooter"), h);
            }
            lblPageFooterDiv.Text = FormattingPipeline.FormatWithPhase3(h, FormattingContext.PageFooter, currentPage);
        }
        /// <summary>
        /// Prints the HTML head tag.
        /// </summary>
        public void PrintHtmlHead()
        {
            string h = Content.GetPseudoCacheValue(GetPseudoCacheItemName("Head"));

            if (h == null)
            {
                StringBuilder sb = new StringBuilder(100);

                if (Settings.RssFeedsMode != RssFeedsMode.Disabled)
                {
                    sb.AppendFormat(@"<link rel=""alternate"" title=""{0}"" href=""{1}######______NAMESPACE______######RSS.aspx"" type=""application/rss+xml"" />",
                                    Settings.WikiTitle, Settings.MainUrl);
                    sb.Append("\n");
                    sb.AppendFormat(@"<link rel=""alternate"" title=""{0}"" href=""{1}######______NAMESPACE______######RSS.aspx?Discuss=1"" type=""application/rss+xml"" />",
                                    Settings.WikiTitle + " - Discussions", Settings.MainUrl);
                    sb.Append("\n");
                }

                sb.Append("######______INCLUDES______######");
                h = sb.ToString();
                Content.SetPseudoCacheValue(GetPseudoCacheItemName("Head"), h);
            }

            // Use a Control to allow 3rd party plugins to programmatically access the Page header
            string nspace = currentNamespace;

            if (nspace == null)
            {
                nspace = "";
            }
            else if (nspace.Length > 0)
            {
                nspace += ".";
            }

            Literal c = new Literal();

            c.Text = h.Replace("######______INCLUDES______######", Tools.GetIncludes(currentNamespace)).Replace("######______NAMESPACE______######", nspace);
            Page.Header.Controls.Add(c);
        }