Skip to content

Commit 276d898

Browse files
committed
Default app settings removed from web.config
1 parent bda61df commit 276d898

4 files changed

Lines changed: 12 additions & 38 deletions

File tree

BlogEngine/BlogEngine.Core/BlogConfig.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public static string MobileServices
6363
{
6464
get
6565
{
66-
//return WebConfigurationManager.AppSettings["BlogEngine.MobileDevices"] ?? @"(iemobile|iphone|ipod|android|nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)";
67-
return _mobileServices ?? (_mobileServices = WebConfigurationManager.AppSettings["BlogEngine.MobileDevices"]);
66+
return _mobileServices ?? (_mobileServices = WebConfigurationManager.AppSettings["BlogEngine.MobileDevices"] ??
67+
@"(iemobile|iphone|ipod|android|nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)");
6868
}
6969
}
7070

@@ -209,10 +209,11 @@ public static int GenericPageSize
209209
{
210210
get
211211
{
212-
return (int) (_genericPageSize ?? (_genericPageSize =
213-
string.IsNullOrEmpty(WebConfigurationManager.AppSettings["BlogEngine.GenericPageSize"])
214-
? 20
215-
: int.Parse(WebConfigurationManager.AppSettings["BlogEngine.GenericPageSize"])));
212+
var tmp = WebConfigurationManager.AppSettings["BlogEngine.GenericPageSize"];
213+
if (!string.IsNullOrEmpty(tmp))
214+
_genericPageSize = int.Parse(tmp);
215+
216+
return _genericPageSize ?? 15;
216217
}
217218
}
218219

@@ -230,7 +231,8 @@ public static bool SingleSignOn
230231
{
231232
if (_singleSignOn == null)
232233
{
233-
string setting = WebConfigurationManager.AppSettings["BlogEngine.SingleSignOn"];
234+
string setting = WebConfigurationManager.AppSettings["BlogEngine.SingleSignOn"] ?? "false";
235+
234236
if (!string.IsNullOrEmpty(setting))
235237
{
236238
bool value;

BlogEngine/BlogEngine.Core/Utils.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ public static class Utils
7777
/// The regex mobile.
7878
/// </summary>
7979
private static readonly Regex RegexMobile =
80-
new Regex(
81-
ConfigurationManager.AppSettings.Get("BlogEngine.MobileDevices"),
82-
RegexOptions.IgnoreCase | RegexOptions.Compiled);
80+
new Regex(BlogConfig.MobileServices, RegexOptions.IgnoreCase | RegexOptions.Compiled);
8381

8482
/// <summary>
8583
/// The regex strip html.

BlogEngine/BlogEngine.NET/AppCode/App_Start/BlogEngineConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ static void RegisterBundles(BundleCollection bundles)
119119
.Include("~/Content/bootstrap.min.css")
120120
.Include("~/Content/toastr.css")
121121
.Include("~/Content/font-awesome.min.css")
122+
.Include("~/Content/editor.css")
122123
.Include("~/Admin/star-rating.css")
123124
.Include("~/Content/admin.css")
124125
);

BlogEngine/BlogEngine.NET/Web.Config

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,7 @@
2727
<!--<add name="BlogEngine" connectionString="Data Source=localhost;User ID=usernmae;Password=password;persist security info=False;initial catalog=BlogEngineFileStore;" providerName="System.Data.SqlClient"/>-->
2828
</connectionStrings>
2929
<appSettings>
30-
<!-- Set to WebForms causes some jQuery dependant scripts throw errors -->
31-
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
32-
<add key="BlogEngine.FileExtension" value=".aspx" />
33-
<!-- You can e.g. use "~/blog/" if BlogEngine.NET is not located in the root of the application -->
34-
<add key="BlogEngine.VirtualPath" value="~/" />
35-
<!-- The regex used to identify mobile devices so a different theme can be shown -->
36-
<add key="BlogEngine.MobileDevices" value="(iemobile|iphone|ipod|android|nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)" />
37-
<!-- The name of the role with administrator permissions -->
38-
<add key="BlogEngine.AdminRole" value="Administrators" />
39-
<!-- The name of the role for anonymous(non-authenticated) users. -->
40-
<add key="BlogEngine.AnonymousRole" value="Anonymous" />
41-
<!-- The name of the role for Editors -->
42-
<add key="BlogEngine.EditorsRole" value="Editors" />
43-
<!--This value is to provide an alternative location for storing data.-->
44-
<add key="StorageLocation" value="~/App_Data/" />
45-
<!--This value is the folder name under the StorageLocation that data for blog instances will be stored in.-->
46-
<add key="BlogInstancesFolderName" value="blogs" />
47-
<!--A comma separated list of script names to hard minify. It's case-sensitive. -->
48-
<add key="BlogEngine.HardMinify" value="blog.js,widget.js,WebResource.axd" />
49-
<!--Any data grid in the admin panel should use this value for default number of items per page.-->
50-
<add key="BlogEngine.GenericPageSize" value="15" />
51-
<!--Single Sign On Support.-->
52-
<add key="BlogEngine.SingleSignOn" value="false" />
53-
<!--Sitemap schema URL.-->
54-
<add key="BlogEngine.SiteMapUrlSet" value="http://www.sitemaps.org/schemas/sitemap/0.9" />
55-
<!--Default admin editor (~/admin/editors/summernote/editor.cshtml is default) -->
56-
<add key="BlogEngine.DefaultEditor" value="~/admin/editors/summernote/editor.cshtml" />
57-
<!--<add key="BlogEngine.GalleryFeedUrl" value="http://localhost/v01/nuget" />-->
30+
<!-- Override default application settings here -->
5831
</appSettings>
5932
<system.serviceModel>
6033
<services>

0 commit comments

Comments
 (0)