BlogEngine.Core.Web.Extensions.ExtensionManager.ExtensionEnabled C# (CSharp) Method

ExtensionEnabled() public static method

Enabled / Disabled
public static ExtensionEnabled ( string extensionName ) : bool
extensionName string /// Name of the extension. ///
return bool
        public static bool ExtensionEnabled(string extensionName)
        {
            LoadExtensions();
            ManagedExtension extension = GetExtension(extensionName);

            if (Blog.CurrentInstance.IsPrimary)
            {
                return extension == null ? false : extension.Enabled;
            }
            else
            {
                if (extension != null)
                {
                    // if the extension is disabled at the primary blog, then
                    // it is automatically considered disabled for all child blogs.
                    if (!extension.Enabled) { return false; }

                    if (extension.Blogs != null && extension.Blogs.Contains(Blog.CurrentInstance.Id))
                    {
                        // when non-primary blog disables extension,
                        // this blog added to Blogs list for this extension
                        return false;
                    }
                }
                return true;
            }
        }