Index: /CKEditor.NET/trunk/CHANGES.html
===================================================================
--- /CKEditor.NET/trunk/CHANGES.html	(revision 6708)
+++ /CKEditor.NET/trunk/CHANGES.html	(revision 6709)
@@ -71,4 +71,6 @@
 	<ul>
 		<li><a href="http://dev.ckeditor.com/ticket/7283">#7283</a> : Entered text is not HTML encoded.</li>
+		<li><a href="http://dev.ckeditor.com/ticket/7285">#7285</a> : Certain configuration options are not properly escaped.</li>
+		<li><a href="http://dev.ckeditor.com/ticket/7558">#7558</a> : Custom toolbar does not work.</li>		
 		<li><a href="http://dev.ckeditor.com/ticket/7302">#7302</a> : It was impossible to customise the editor inside masterpage and if attributes were placed in front of the Control ID.</li>
 		<li><a href="http://dev.ckeditor.com/ticket/7590">#7590</a> : Error in Visual Studio when trying to reset values in the Properties window.</li>
Index: /CKEditor.NET/trunk/CKEditor.NET/CKEditorConfig.cs
===================================================================
--- /CKEditor.NET/trunk/CKEditor.NET/CKEditorConfig.cs	(revision 6708)
+++ /CKEditor.NET/trunk/CKEditor.NET/CKEditorConfig.cs	(revision 6709)
@@ -179,4 +179,20 @@
 					foreach (object[] item in (object[])propertyInfo.GetValue(obj, new object[0]))
 						oc.Append(", ").Append("\"" + item[0].ToString() + "\" : ").Append(item[1].ToString());
+				else if (customName == "stylesSet" && ((string[])propertyInfo.GetValue(obj, new object[0])).Length == 1 && !((string[])propertyInfo.GetValue(obj, new object[0]))[0].StartsWith("{"))
+				{
+					object staticValueToCompare = staticPropertyInfoDictionary[propertyInfo.Name];
+					if (!campareArray(((string[]) propertyInfo.GetValue(obj, new object[0])), (string[]) staticValueToCompare))
+					{
+						string[] valueToJSON = (string[]) propertyInfo.GetValue(obj, new object[0]);
+						sbJSON.Append("\"" + (string.IsNullOrEmpty(customName) ? propertyInfo.Name : customName) + "\" : ");
+						if ((valueToJSON[0].StartsWith("[") || valueToJSON[0].StartsWith("{")) &&
+							(valueToJSON[0].EndsWith("]") || valueToJSON[0].EndsWith("}")))
+							sbJSON.Append(EscapeStringForJavaScript(valueToJSON[0]).TrimStart(new char[] { '\'' }).TrimEnd(new char[] { '\'' }));
+						else
+							sbJSON.Append("\"" + EscapeStringForJavaScript(valueToJSON[0]).TrimStart(new char[] {'\''}).TrimEnd(new char[] {'\''}) + "\"");
+						sbJSON.Append(", ");
+					}
+					continue;
+				}
 				else if (customName == "on" && ((object[])propertyInfo.GetValue(obj, new object[0])).Length > 0)
 				{
@@ -202,4 +218,17 @@
 					}
 					sbJSON.Append("\"" + (string.IsNullOrEmpty(customName) ? propertyInfo.Name : customName) + "\" : ");
+					if (propertyInfo.Name == "toolbar" || propertyInfo.Name == "toolbar_Basic" || propertyInfo.Name == "toolbar_Full")
+					{
+						object toolObj;
+						if (propertyInfo.Name == "toolbar") toolObj = propertyInfo.GetValue(obj, new object[0]);
+						else toolObj = ((object[])propertyInfo.GetValue(obj, new object[0]))[0];
+						if (toolObj.GetType() == typeof(string) && ((string)toolObj).StartsWith("[") && ((string)toolObj).EndsWith("]"))
+						{
+							isObject = true;
+							GetFieldOrPropertyValue(ref sbJSON, toolObj, removeEnters, isObject);
+							sbJSON.Append(", ");
+							continue;
+						}
+					}
 					GetFieldOrPropertyValue(ref sbJSON, propertyInfo.GetValue(obj, new object[0]), removeEnters, isObject);
 					sbJSON.Append(", ");
@@ -447,6 +476,15 @@
 		/// Default Value: new string[] { "~/contents.css" };
 		/// </summary>
-		[CKSerializable]
 		public string[] contentsCss { get; set; }
+		[CKSerializable(Name = "contentsCss", IsObject = true)]
+		private string[] contentsCssSer
+		{
+			get
+			{
+				List<string> retVal = new List<string>();
+				ResolveParameters(contentsCss, retVal, true);
+				return retVal.ToArray();
+			}
+		}
 
 		/// <summary>
@@ -471,11 +509,4 @@
 		[CKSerializable]
 		public string contentsLanguage { get; set; }
-
-		/// <summary>
-		/// A comma separated list of plugins that are not related to editor instances. Reserved to plugins that extend the core code only.
-		/// There are no ways to override this setting, except by editing the source code of CKEditor (_source/core/config.js).
-		/// </summary>
-		[CKSerializable]
-		public string corePlugins { get; set; }
 
 		/// <summary>
@@ -824,5 +855,5 @@
 		/// Default Value: "8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px"
 		/// </summary>
-		[CKSerializable(IsObject = true)]
+		[CKSerializable]
 		public string fontSize_sizes { get; set; }
 
@@ -989,6 +1020,15 @@
 		/// Default Value: []
 		/// </summary>
-		[CKSerializable]
 		public string[] indentClasses { get; set; }
+		[CKSerializable(Name = "indentClasses", IsObject = true)]
+		private string[] indentClassesSer
+		{
+			get
+			{
+				List<string> retVal = new List<string>();
+				ResolveParameters(indentClasses, retVal, true);
+				return retVal.ToArray();
+			}
+		}
 
 		/// <summary>
@@ -1095,6 +1135,6 @@
 		/// Default Value: []
 		/// </summary>
-		public string [] protectedSource { get; set; }
-
+		public string[] protectedSource { get; set; }
+		
 		/// <summary>
 		/// The dialog contents to removed. It's a string composed by dialog name and tab name with a colon between them. 
@@ -1446,7 +1486,20 @@
 		/// Default Value: ["'default'"]
 		/// </summary>
-		[CKSerializable(IsObject = true)]
-		public string stylesSet { get; set; }
-
+		public string[] stylesSet { get; set; }
+		[CKSerializable(Name = "stylesSet", IsObject = true)]
+		private string[] stylesSetSer
+		{
+			get
+			{
+				if (stylesSet != null && stylesSet.Length == 1 && stylesSet[0].Contains("{") && stylesSet[0].Contains("}"))
+				{
+					stylesSet[0] = stylesSet[0].Replace("\t", string.Empty).Replace("\r", string.Empty).Replace("\n", string.Empty);
+					return stylesSet;
+				}
+				List<string> retVal = new List<string>();
+				ResolveParameters(stylesSet, retVal, true);
+				return retVal.ToArray();
+			}
+		}
 		/// <summary>
 		/// The editor tabindex value.
@@ -1468,6 +1521,15 @@
 		/// Default Value: new string[] { "~/plugins/templates/templates/default.js" };
 		/// </summary>
-		[CKSerializable]
 		public string[] templates_files { get; set; }
+		[CKSerializable(Name = "templates_files", IsObject = true)]
+		private string[] templates_filesSer
+		{
+			get
+			{
+				List<string> retVal = new List<string>();
+				ResolveParameters(templates_files, retVal, true);
+				return retVal.ToArray();
+			}
+		}
 
 		/// <summary>
@@ -1675,5 +1737,4 @@
 			GlobalConfigObj.contentsLangDirection = contentsLangDirections.Ui;
 			GlobalConfigObj.contentsLanguage = string.Empty;
-			GlobalConfigObj.corePlugins = string.Empty;
 			GlobalConfigObj.coreStyles_bold = @"{ element : 'strong', overrides : 'b' }";
 			GlobalConfigObj.coreStyles_italic = @"{ element : 'em', overrides : 'i' }";
@@ -1834,5 +1895,5 @@
 			GlobalConfigObj.startupOutlineBlocks = false;
 			GlobalConfigObj.startupShowBorders = true;
-			GlobalConfigObj.stylesSet = "default";
+			GlobalConfigObj.stylesSet = new string[] { "default" };
 			GlobalConfigObj.tabIndex = 0;
 			GlobalConfigObj.tabSpaces = 0;
@@ -1889,8 +1950,7 @@
 			this.colorButton_colors = CKEditorConfig.GlobalConfig.colorButton_colors;
 			this.colorButton_foreStyle = CKEditorConfig.GlobalConfig.colorButton_foreStyle;
-			this.contentsCss = ResoleResolveUrl(CKEditorConfig.GlobalConfig.contentsCss, editorPath);
+			this.contentsCss = ResolveUrl(CKEditorConfig.GlobalConfig.contentsCss, editorPath);
 			this.contentsLangDirection = CKEditorConfig.GlobalConfig.contentsLangDirection;
 			this.contentsLanguage = CKEditorConfig.GlobalConfig.contentsLanguage;
-			this.corePlugins = CKEditorConfig.GlobalConfig.corePlugins;
 			this.coreStyles_bold = CKEditorConfig.GlobalConfig.coreStyles_bold;
 			this.coreStyles_italic = CKEditorConfig.GlobalConfig.coreStyles_italic;
@@ -2004,5 +2064,5 @@
 			this.tabIndex = CKEditorConfig.GlobalConfig.tabIndex;
 			this.tabSpaces = CKEditorConfig.GlobalConfig.tabSpaces;
-			this.templates_files = ResoleResolveUrl(CKEditorConfig.GlobalConfig.templates_files, editorPath);
+			this.templates_files = ResolveUrl(CKEditorConfig.GlobalConfig.templates_files, editorPath);
 			this.templates_replaceContent = CKEditorConfig.GlobalConfig.templates_replaceContent;
 			this.theme = CKEditorConfig.GlobalConfig.theme;
@@ -2021,5 +2081,5 @@
 				this.CKEditorInstanceEventHandler = new List<object>(CKEditorConfig.GlobalConfig.CKEditorInstanceEventHandler);
 		}
-		private string[] ResoleResolveUrl(string[] value, string resolvedStr)
+		private string[] ResolveUrl(string[] value, string resolvedStr)
 		{
 			for (int i = 0; i < value.Length; i++)
@@ -2028,4 +2088,25 @@
 			return value;
 		}
+		private void ResolveParameters(string[] parIn, List<string> retVal, bool addAp)
+		{
+			foreach (string item in parIn)
+			{
+				if (item.StartsWith("[") || item.EndsWith("]"))
+					ResolveParameters(item.Trim().Replace("[", string.Empty).Replace("]", string.Empty).Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries), retVal, addAp);
+				else if (addAp && !item.StartsWith("'") && !item.EndsWith("'"))
+					retVal.Add("'" + item.Trim().Replace("\t", string.Empty).Replace("\r", string.Empty).Replace("\n", string.Empty) + "'");
+				else
+					retVal.Add(item.Trim().Replace("\t", string.Empty).Replace("\r", string.Empty).Replace("\n", string.Empty));
+			}
+		}
+		private string ResolveParameters(string parIn, bool addAp)
+		{
+			if (parIn.StartsWith("[") && parIn.EndsWith("]"))
+				return parIn;
+			else if (addAp && !parIn.StartsWith("'") && !parIn.EndsWith("'"))
+				return "'" + parIn + "'";
+			else
+				return parIn;
+		}
 		#endregion
 	}
Index: /CKEditor.NET/trunk/CKEditor.NET/CKEditorControl.cs
===================================================================
--- /CKEditor.NET/trunk/CKEditor.NET/CKEditorControl.cs	(revision 6708)
+++ /CKEditor.NET/trunk/CKEditor.NET/CKEditorControl.cs	(revision 6709)
@@ -150,5 +150,5 @@
 		[Category("CKEditor Other Settings")]
 		[Description("The editor tabindex value.")]
-		[DefaultValue(typeof(short),"0")]
+		[DefaultValue(typeof(short), "0")]
 		public override short TabIndex { get { return (short)config.tabIndex; } set { config.tabIndex = value; } }
 
@@ -164,5 +164,5 @@
 		[DefaultValue(200)]
 		public int AutoGrowMinHeight { get { return config.autoGrow_minHeight; } set { config.autoGrow_minHeight = value; } }
-		
+
 		[Category("CKEditor Other Settings")]
 		[Description("Whether the replaced element (usually a textarea) is to be updated automatically when posting the form containing the editor.")]
@@ -208,8 +208,9 @@
 				return retVal;
 			}
-			set { config.contentsCss = value.Split(new char[] { ',' }); }
-		}
-
-		[Category("CKEditor Other Settings")][Description(@"The writting direction of the language used to write the editor contents. Allowed values are: 
+			set { config.contentsCss = value.Replace("\t", string.Empty).Split(new char[] { ',', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); }
+		}
+
+		[Category("CKEditor Other Settings")]
+		[Description(@"The writing direction of the language used to write the editor contents. Allowed values are: 
 'ui' - which indicate content direction will be the same with the user interface language direction;
 'ltr' - for Left-To-Right language (like English);
@@ -222,9 +223,4 @@
 		[DefaultValue("")]
 		public string ContentsLanguage { get { return config.contentsLanguage; } set { config.contentsLanguage = value; } }
-
-		[Category("CKEditor Other Settings")][Description(@"A comma separated list of plugins that are not related to editor instances. Reserved to plugins that extend the core code only.
-There are no ways to override this setting, except by editing the source code of CKEditor (_source/core/config.js).")]
-		[DefaultValue("")]
-		public string CorePlugins { get { return config.corePlugins; } set { config.corePlugins = value; } }
 
 		[Category("CKEditor Basic Settings")]
@@ -460,5 +456,5 @@
 		[Description("Whether escape HTML when editor update original input element.")]
 		[DefaultValue(true)]
-		public bool HtmlEncodeOutput {get { return config.htmlEncodeOutput; } set { config.htmlEncodeOutput = value; } }
+		public bool HtmlEncodeOutput { get { return config.htmlEncodeOutput; } set { config.htmlEncodeOutput = value; } }
 
 		[Category("CKEditor Other Settings")]
@@ -583,9 +579,11 @@
 
 		[Category("CKEditor Other Settings")]
-		[DefaultValue("ID of bottom cntrol's shared")]
+		[Description("ID of bottom cntrol's shared")]
+		[DefaultValue("")]
 		public string SharedSpacesBottom { get { return config.sharedSpacesBottom; } set { config.sharedSpacesBottom = value; } }
 
 		[Category("CKEditor Other Settings")]
-		[DefaultValue("ID of top cntrol's shared")]
+		[Description("ID of top cntrol's shared")]
+		[DefaultValue("")]
 		public string SharedSpacesTop { get { return config.sharedSpacesTop; } set { config.sharedSpacesTop = value; } }
 
@@ -619,4 +617,5 @@
 		public bool StartupShowBorders { get { return config.startupShowBorders; } set { config.startupShowBorders = value; } }
 
+		[PersistenceMode(PersistenceMode.Attribute)]
 		[Category("CKEditor Other Settings")]
 		[Description(@"The ""styles definition set"" to use in the editor. They will be used in the styles combo and the Style selector of the div container.
@@ -626,5 +625,22 @@
 Previously this setting was available as config.stylesCombo_stylesSet")]
 		[DefaultValue("default")]
-		public string StylesSet { get { return config.stylesSet; } set { config.stylesSet = value; } }
+		[Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
+		public string StylesSet
+		{
+			get
+			{
+				string retVal = string.Empty;
+				foreach (string item in config.stylesSet) retVal += item + ",";
+				if (retVal.EndsWith(",")) retVal = retVal.Remove(retVal.Length - 1);
+				return retVal;
+			}
+			set
+			{
+				if (value.Contains("{") && value.Contains("}"))
+					config.stylesSet = new string[] { value };
+				else
+					config.stylesSet = value.Replace("\t", string.Empty).Split(new char[] { ',', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
+			}
+		}
 
 		[Category("CKEditor Other Settings")]
@@ -648,5 +664,5 @@
 				return retVal;
 			}
-			set { config.templates_files = value.Split(new char[] { ',' }); }
+			set { config.templates_files = value.Replace("\t", string.Empty).Split(new char[] { ',', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); }
 		}
 
@@ -659,5 +675,5 @@
 		[Category("CKEditor Basic Settings")]
 		[Description("The toolbox (alias toolbar) definition. It is a toolbar name or an array of toolbars (strips), each one being also an array, containing a list of UI items.")]
-		[DefaultValue( "Full")]
+		[DefaultValue("Full")]
 		[Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
 		public string Toolbar
@@ -694,6 +710,12 @@
 			set
 			{
-				string[] valueTab = value.Split(new string[] { "\r\n"}, int.MaxValue, StringSplitOptions.RemoveEmptyEntries);
-				if (valueTab.Length == 1 && (valueTab[0] == "Full" || valueTab[0] == "Basic"))
+				value = value.Trim();
+				if (value.StartsWith("[") && value.EndsWith("]"))
+				{
+					config.toolbar = value.Replace("\t", string.Empty).Replace("\r", string.Empty).Replace("\n", string.Empty);
+					return;
+				}
+				string[] valueTab = value.Split(new string[] { "\r\n" }, int.MaxValue, StringSplitOptions.RemoveEmptyEntries);
+				if (valueTab.Length == 1 && !valueTab[0].Contains("|"))
 				{
 					config.toolbar = valueTab[0];
@@ -757,4 +779,10 @@
 			set
 			{
+				value = value.Trim();
+				if (value.StartsWith("[") && value.EndsWith("]"))
+				{
+					config.toolbar_Basic = new object[] { value.Replace("\t", string.Empty).Replace("\r", string.Empty).Replace("\n", string.Empty) };
+					return;
+				}
 				string[] valueTab = value.Split(new string[] { "\r\n" }, int.MaxValue, StringSplitOptions.RemoveEmptyEntries);
 				object[] retVal = new object[valueTab.Length];
@@ -826,4 +854,10 @@
 			set
 			{
+				value = value.Trim();
+				if (value.StartsWith("[") && value.EndsWith("]"))
+				{
+					config.toolbar_Full = new object[] { value.Replace("\t", string.Empty).Replace("\r", string.Empty).Replace("\n", string.Empty) };
+					return;
+				}
 				string[] valueTab = value.Split(new string[] { "\r\n" }, int.MaxValue, StringSplitOptions.RemoveEmptyEntries);
 				object[] retVal = new object[valueTab.Length];
