BlogConfigurationSettings.cs :  » Bloggers » SubText » Subtext » Framework » Configuration » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Bloggers » SubText 
SubText » Subtext » Framework » Configuration » BlogConfigurationSettings.cs
#region Disclaimer/Info

///////////////////////////////////////////////////////////////////////////////////////////////////
// Subtext WebLog
// 
// Subtext is an open source weblog system that is a fork of the .TEXT
// weblog system.
//
// For updated news and information please visit http://subtextproject.com/
// Subtext is hosted at Google Code at http://code.google.com/p/subtext/
// The development mailing list is at subtext@googlegroups.com 
//
// This project is licensed under the BSD license.  See the License.txt file for more information.
///////////////////////////////////////////////////////////////////////////////////////////////////

#endregion

using System;
using System.Collections.Specialized;
using System.Configuration;
using System.Xml.Serialization;

namespace Subtext.Framework.Configuration{
    /// <summary>
    /// Contains various configuration settings stored in the 
    /// web.config file.
    /// </summary>
    [Serializable]
    public class BlogConfigurationSettings
    {
        private Tracking _tracking;
        private NameValueCollection _allowedHtmlTags;

        public BlogConfigurationSettings()
        {
            QueuedThreads = 5;
            ItemCount = 15;
            CategoryListPostCount = 10;
            ServerTimeZone = -2037797565; //PST
        }

        public Tracking Tracking
        {
            get
            {
                _tracking = _tracking ?? new Tracking();
                return _tracking;
            }
            set { _tracking = value; }
        }

        public bool UseWww { get; set; }

        public int QueuedThreads { get; set; }

        public bool AllowServiceAccess { get; set; }

        public bool AllowScriptsInPosts { get; set; }

        public bool UseHashedPasswords { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether or not to allow images.
        /// </summary>
        /// <value>
        ///   <c>true</c> if [allow images]; otherwise, <c>false</c>.
        /// </value>
        public bool AllowImages { get; set; }

        /// <summary>
        /// Gets or sets the default number of items to display 
        /// for syndication feeds.
        /// </summary>
        /// <value></value>
        public int ItemCount { get; set; }

        /// <summary>
        /// Gets or sets the number of posts to display 
        /// on the category list pages.
        /// </summary>
        /// <value></value>
        public int CategoryListPostCount { get; set; }

        /// <summary>
        /// Gets or sets the server time zone.
        /// </summary>
        /// <value></value>
        public int ServerTimeZone { get; set; }

        /// <summary>
        /// Gets a value indicating whether invisible captcha enabled.  This is 
        /// configured within the "InvisibleCaptchaEnabled" app setting. It is not 
        /// set per blog, but system-wide. This gives hosters a way to opt-out of 
        /// this feature in case it ends up being problematci.
        /// </summary>
        /// <value>
        ///   <c>true</c> if [invisible captcha enabled]; otherwise, <c>false</c>.
        /// </value>
        public bool InvisibleCaptchaEnabled
        {
            get
            {
                if(String.IsNullOrEmpty(ConfigurationManager.AppSettings["InvisibleCaptchaEnabled"]))
                {
                    return true;
                }

                bool enabled;
                if(bool.TryParse(ConfigurationManager.AppSettings["InvisibleCaptchaEnabled"], out enabled))
                {
                    return enabled;
                }
                return true;
            }
        }

        /// <summary>
        /// Returns a <see cref="NameValueCollection"/> containing the allowed 
        /// HTML tags within a user comment.  The value contains a comma 
        /// separated list of allowed attributes.
        /// </summary>
        /// <value>The allowed HTML tags.</value>
        [XmlIgnore]
        public NameValueCollection AllowedHtmlTags
        {
            get
            {
                if(_allowedHtmlTags == null)
                {
                    _allowedHtmlTags = ((NameValueCollection)(ConfigurationManager.GetSection("AllowableCommentHtml")));
                }
                return _allowedHtmlTags;
            }
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.