";
@@ -98,9 +159,9 @@ class wysiwyg
{
$this->getConfig($config);
$text .= "\n /* TinyMce Config: ".$this->configName." */\n\n";
- $text .= "tinymce.init(";
- $text .= json_encode($this->config); // Moc: temporary fix for BC with PHP 5.3: https://github.com/e107inc/e107/issues/614
- $text .= ");";
+ $text .= "tinymce.init({\n";
+ $text .= $this->config; // Moc: temporary fix for BC with PHP 5.3: https://github.com/e107inc/e107/issues/614
+ $text .= "\n});";
return stripslashes($text);
}
@@ -165,26 +226,36 @@ class wysiwyg
}
- return $ext;
+ return json_encode($ext);
}
function convertBoolean($string)
{
- $string = str_replace("\n","",$string);
-
- if($string === 'true')
+
+ if(is_string($string))
{
- return true;
+ $string = trim($string);
+ $string = str_replace("\n","",$string);
}
- if($string === 'false')
+ if($string === true)
{
- return false;
+ return 'true';
}
-
- return $string;
+
+ if($string === false)
+ {
+ return 'false';
+ }
+
+ if($string === 'true' || $string === 'false' || $string[0] == '[')
+ {
+ return $string;
+ }
+
+ return '"'.$string.'"';
}
@@ -220,8 +291,8 @@ class wysiwyg
unset($config['@attributes']);
- $this->config = array(
- 'selector' => '.e-wysiwyg',
+ $ret = array(
+ 'selector' => '.e-wysiwyg',
'theme' => 'modern',
'plugins' => $this->filter_plugins($config['tinymce_plugins']),
'language' => $this->tinymce_lang()
@@ -232,24 +303,36 @@ class wysiwyg
// Loop thru XML parms.
foreach($config as $k=>$xml)
{
- if($k == 'external_plugins')
- {
- $this->config['external_plugins'] = $this->getExternalPlugins($xml);
- continue;
- }
-
- $this->config[$k] = $this->convertBoolean($xml);
+ $ret[$k] = $xml;
}
- $this->config['convert_fonts_to_spans'] = false;
- $this->config['content_css'] = 'http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css';
+ $ret['convert_fonts_to_spans'] = false;
+ $ret['content_css'] = e_PLUGIN_ABS.'tinymce4/editor.css,https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css,http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css';
- $this->config['relative_urls'] = false; //Media Manager prefers it like this.
- $this->config['preformatted'] = true;
- $this->config['document_base_url'] = SITEURL;
+ $ret['relative_urls'] = false; //Media Manager prefers it like this.
+ $ret['preformatted'] = true;
+ $ret['document_base_url'] = SITEURL;
+ if(!empty($ret['templates']))
+ {
+ $ret['templates'] = $tp->replaceConstants($ret['templates'],'abs'); // $this->getTemplates();
+ }
// $this->config['verify_css_classes'] = 'false';
+ $text = array();
+ foreach($ret as $k=>$v)
+ {
+ if($k == 'external_plugins')
+ {
+ $text[] = 'external_plugins: '. $this->getExternalPlugins($v);
+ continue;
+ }
+ $text[] = $k.': '.$this->convertBoolean($v);
+ }
+
+
+ $this->config = implode(",\n",$text);
+
return;
@@ -389,6 +472,16 @@ class wysiwyg
}
+ function getTemplates()
+ {
+ $templatePath = (is_readable(THEME."templates/tinymce/".$template)) ? THEME."templates/tinymce/".$template : e_PLUGIN."tinymce4/templates/".$template;
+
+
+
+
+ }
+
+
function filter_plugins($plugs)
{
|