1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

SVN keywords fix

This commit is contained in:
secretr
2011-06-07 12:57:55 +00:00
parent 2d0960deb2
commit 94d76ee505
2 changed files with 106 additions and 110 deletions

View File

@@ -8,10 +8,8 @@
* *
* *
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/e_meta.php,v $ * $URL$
* $Revision$ * $Id$
* $Date$
* $Author$
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -21,15 +19,15 @@ if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php"))
require_once(e_PLUGIN."tinymce/wysiwyg.php"); require_once(e_PLUGIN."tinymce/wysiwyg.php");
if(deftrue('TINYMCE_CONFIG')) if(deftrue('TINYMCE_CONFIG'))
{ {
$wy = new wysiwyg(TINYMCE_CONFIG); $wy = new wysiwyg(TINYMCE_CONFIG);
} }
else else
{ {
$wy = new wysiwyg(); $wy = new wysiwyg();
} }
$wy -> render(); $wy -> render();
} }
?> ?>

View File

@@ -3,10 +3,8 @@
+ ----------------------------------------------------------------------------+ + ----------------------------------------------------------------------------+
| e107 website system - Tiny MCE controller file. | e107 website system - Tiny MCE controller file.
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/wysiwyg.php,v $ | $URL$
| $Revision$ | $Id$
| $Date$
| $Author$
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -16,28 +14,28 @@ class wysiwyg
var $js; var $js;
var $config = array(); var $config = array();
var $configName; var $configName;
function wysiwyg($config=FALSE) function __construct($config=FALSE)
{ {
$this->getConfig($config); $this->getConfig($config);
global $pref;
$pref = e107::getConfig();
/* /*
if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip") && (ini_get("zlib.output_compression") == false) && file_exists(e_PLUGIN."tinymce/tiny_mce_gzip.php")) if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip") && (ini_get("zlib.output_compression") == false) && file_exists(e_PLUGIN."tinymce/tiny_mce_gzip.php"))
{ {
//unset($tinymce_plugins[7]); // 'zoom' causes an error with the gzip version. //unset($tinymce_plugins[7]); // 'zoom' causes an error with the gzip version.
$text = "<script type='text/javascript' src='".e_PLUGIN_ABS."tinymce/tiny_mce_gzip.js'></script> $text = "<script type='text/javascript' src='".e_PLUGIN_ABS."tinymce/tiny_mce_gzip.js'></script>
<script type='text/javascript'> <script type='text/javascript'>
tinyMCE_GZ.init({ tinyMCE_GZ.init({
plugins : '".implode(",",$tinymce_plugins)."', plugins : '".implode(",",$tinymce_plugins)."',
@@ -51,22 +49,22 @@ class wysiwyg
} }
else else
{*/ {*/
$text = "<script type='text/javascript' src='".e_PLUGIN_ABS."tinymce/tiny_mce.js'></script>\n"; $text = "<script type='text/javascript' src='".e_PLUGIN_ABS."tinymce/tiny_mce.js'></script>\n";
//} //}
$text .= "<script type='text/javascript'>\n"; $text .= "<script type='text/javascript'>\n";
$text .= "\n /* TinyMce Config: ".$this->configName." */"; $text .= "\n /* TinyMce Config: ".$this->configName." */";
$text .= $this->tinyMce_config(); $text .= $this->tinyMce_config();
$text .= "\t\t start_tinyMce(); \n $text .= "\t\t start_tinyMce(); \n
function tinymce_e107Paths(type, source) { function tinymce_e107Paths(type, source) {
"; ";
$tp = e107::getParser(); $tp = e107::getParser();
$paths = array( $paths = array(
e107::getFolder('images'), e107::getFolder('images'),
e107::getFolder('plugins'), e107::getFolder('plugins'),
@@ -74,64 +72,64 @@ class wysiwyg
e107::getFolder('media_files'), e107::getFolder('media_files'),
e107::getFolder('media_videos') e107::getFolder('media_videos')
); );
$text .= " $text .= "
switch (type) { switch (type) {
case 'get_from_editor': case 'get_from_editor':
// Convert HTML to e107-BBcode // Convert HTML to e107-BBcode
source = source.replace(/target=\"_blank\"/, 'rel=\"external\"'); source = source.replace(/target=\"_blank\"/, 'rel=\"external\"');
source = source.replace(/^\s*|\s*$/g,''); source = source.replace(/^\s*|\s*$/g,'');
"; ";
// Convert TinyMce Paths to e107 paths. // Convert TinyMce Paths to e107 paths.
foreach($paths as $k=>$path) foreach($paths as $k=>$path)
{ {
//echo "<br />$path = ".$tp->createConstants($path); //echo "<br />$path = ".$tp->createConstants($path);
$text .= "\t\tsource = source.replace(/(\"|])".str_replace("/","\/",$path)."/g,'$1".$tp->createConstants($path)."');\n"; $text .= "\t\tsource = source.replace(/(\"|])".str_replace("/","\/",$path)."/g,'$1".$tp->createConstants($path)."');\n";
} }
$text .= " $text .= "
break; break;
case 'insert_to_editor': // Convert e107Paths for TinyMce case 'insert_to_editor': // Convert e107Paths for TinyMce
source = source.replace(/rel=\"external\"/, 'target=\"_blank\"'); source = source.replace(/rel=\"external\"/, 'target=\"_blank\"');
"; ";
// Convert e107 paths to TinyMce Paths. // Convert e107 paths to TinyMce Paths.
foreach($paths as $k=>$path) foreach($paths as $k=>$path)
{ {
$const = str_replace("}","\}",$tp->createConstants($path)); $const = str_replace("}","\}",$tp->createConstants($path));
$text .= "\t\tsource = source.replace(/".$const."/gi,'".$path."');\n"; $text .= "\t\tsource = source.replace(/".$const."/gi,'".$path."');\n";
} }
$text .= " $text .= "
break; break;
} }
return source; return source;
} }
// ]]> // ]]>
function triggerSave() function triggerSave()
{ {
tinyMCE.triggerSave(); tinyMCE.triggerSave();
} }
</script>\n </script>\n
"; ";
$this->js = $text; $this->js = $text;
} }
function tinymce_lang() function tinymce_lang()
{ {
$lang = e_LANGUAGE; $lang = e_LANGUAGE;
@@ -156,28 +154,28 @@ class wysiwyg
"Spanish" => "es", "Spanish" => "es",
"Swedish" => "sv" "Swedish" => "sv"
); );
if(!$tinylang[$lang]) if(!$tinylang[$lang])
{ {
$tinylang[$lang] = "en"; $tinylang[$lang] = "en";
} }
return $tinylang[$lang]; return $tinylang[$lang];
} }
function tinyMce_config() function tinyMce_config()
{ {
$text = " $text = "
function start_tinyMce() function start_tinyMce()
{ {
//<![CDATA[ //<![CDATA[
tinyMCE.init({ \n\n"; tinyMCE.init({ \n\n";
$newConfig = array(); $newConfig = array();
foreach($this->config as $key=>$val) foreach($this->config as $key=>$val)
{ {
if($val != 'true' && $val !='false') if($val != 'true' && $val !='false')
@@ -186,66 +184,66 @@ class wysiwyg
} }
$newConfig[] = "\t\t ".$key." : ".$val; $newConfig[] = "\t\t ".$key." : ".$val;
} }
// foreach($this->config as $key=>$val) // foreach($this->config as $key=>$val)
// { // {
// if($val != 'true' && $val !='false') // if($val != 'true' && $val !='false')
// { // {
// $val = "'".$val."'"; // $val = "'".$val."'";
// } // }
// $text .= "\t\t ".$key." : '".$val."',\n"; // $text .= "\t\t ".$key." : '".$val."',\n";
// } // }
$text .= implode(",\n",$newConfig); $text .= implode(",\n",$newConfig);
/* /*
if($tinyMcePrefs['customjs']) if($tinyMcePrefs['customjs'])
{ {
$text .= "\n, $text .= "\n,
// Start Custom TinyMce JS ----- // Start Custom TinyMce JS -----
".$pref['tinymce']['customjs']." ".$pref['tinymce']['customjs']."
// End Custom TinyMce JS --- // End Custom TinyMce JS ---
"; ";
} }
*/ */
$text .= " $text .= "
}); });
} }
"; ";
return $text; return $text;
} }
function getConfig($config=FALSE) function getConfig($config=FALSE)
{ {
$sql = e107::getDb(); $sql = e107::getDb();
if($config) if($config)
{ {
$query = "SELECT * FROM #tinymce WHERE tinymce_id = ".$config." LIMIT 1"; $query = "SELECT * FROM #tinymce WHERE tinymce_id = ".$config." LIMIT 1";
} }
else else
{ {
$query = "SELECT * FROM #tinymce WHERE tinymce_userclass REGEXP '".e_CLASS_REGEXP."' AND NOT (tinymce_userclass REGEXP '(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)') ORDER BY Field(tinymce_userclass,250,254,253) LIMIT 1"; $query = "SELECT * FROM #tinymce WHERE tinymce_userclass REGEXP '".e_CLASS_REGEXP."' AND NOT (tinymce_userclass REGEXP '(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)') ORDER BY Field(tinymce_userclass,250,254,253) LIMIT 1";
} }
$sql -> db_Select_gen($query); $sql -> db_Select_gen($query);
$config = $sql->db_Fetch(); $config = $sql->db_Fetch();
//TODO Cache! //TODO Cache!
$plug_array = explode(",",$config['tinymce_plugins']); $plug_array = explode(",",$config['tinymce_plugins']);
$this->configName = $config['tinymce_name']; $this->configName = $config['tinymce_name'];
$this->config = array( $this->config = array(
'language' => $this->tinymce_lang(), 'language' => $this->tinymce_lang(),
'mode' => 'textareas', 'mode' => 'textareas',
@@ -254,9 +252,9 @@ class wysiwyg
'theme' => 'advanced', 'theme' => 'advanced',
'plugins' => $this->filter_plugins($config['tinymce_plugins']) 'plugins' => $this->filter_plugins($config['tinymce_plugins'])
); );
$this->config += array( $this->config += array(
'theme_advanced_buttons1' => $config['tinymce_buttons1'], 'theme_advanced_buttons1' => $config['tinymce_buttons1'],
'theme_advanced_buttons2' => $config['tinymce_buttons2'], 'theme_advanced_buttons2' => $config['tinymce_buttons2'],
'theme_advanced_buttons3' => $config['tinymce_buttons3'], 'theme_advanced_buttons3' => $config['tinymce_buttons3'],
@@ -285,18 +283,18 @@ class wysiwyg
'verify_css_classes' => 'false' 'verify_css_classes' => 'false'
); );
// if(!in_array('e107bbcode',$plug_array)) // if(!in_array('e107bbcode',$plug_array))
{ {
$this->config['cleanup_callback'] = 'tinymce_e107Paths'; $this->config['cleanup_callback'] = 'tinymce_e107Paths';
} }
$paste_plugin = (strpos($config['tinymce_plugins'],'paste')!==FALSE) ? TRUE : FALSE; $paste_plugin = (strpos($config['tinymce_plugins'],'paste')!==FALSE) ? TRUE : FALSE;
if($paste_plugin) if($paste_plugin)
{ {
$this->config += array( $this->config += array(
'remove_linebreaks' => 'false', // remove line break stripping by tinyMCE so that we can read the HTML 'remove_linebreaks' => 'false', // remove line break stripping by tinyMCE so that we can read the HTML
'paste_create_paragraphs' => 'false', // for paste plugin - double linefeeds are converted to paragraph elements 'paste_create_paragraphs' => 'false', // for paste plugin - double linefeeds are converted to paragraph elements
'paste_create_linebreaks' => 'false', // for paste plugin - single linefeeds are converted to hard line break elements 'paste_create_linebreaks' => 'false', // for paste plugin - single linefeeds are converted to hard line break elements
@@ -306,49 +304,49 @@ class wysiwyg
'paste_unindented_list_class' => 'unindentedList', // for paste plugin - specify what class to assign to the UL list of middot cl's 'paste_unindented_list_class' => 'unindentedList', // for paste plugin - specify what class to assign to the UL list of middot cl's
'paste_convert_headers_to_strong' => 'true', // for paste plugin - converts H1-6 elements to strong elements on paste 'paste_convert_headers_to_strong' => 'true', // for paste plugin - converts H1-6 elements to strong elements on paste
'paste_insert_word_content_callback' => 'convertWord', // for paste plugin - This callback is executed when the user pastes word content 'paste_insert_word_content_callback' => 'convertWord', // for paste plugin - This callback is executed when the user pastes word content
'auto_cleanup_word' => 'false' // auto clean pastes from Word 'auto_cleanup_word' => 'false' // auto clean pastes from Word
); );
} }
if(ADMIN) if(ADMIN)
{ {
$this->config['external_link_list_url'] = e_PLUGIN_ABS."tiny_mce/filelist.php"; $this->config['external_link_list_url'] = e_PLUGIN_ABS."tiny_mce/filelist.php";
} }
} }
function filter_plugins($plugs) function filter_plugins($plugs)
{ {
$smile_pref = e107::getConfig()->getPref('smiley_activate'); $smile_pref = e107::getConfig()->getPref('smiley_activate');
$admin_only = array("ibrowser","code"); $admin_only = array("ibrowser","code");
$plug_array = explode(",",$plugs); $plug_array = explode(",",$plugs);
foreach($plug_array as $val) foreach($plug_array as $val)
{ {
if(in_array($val,$admin_only) && !ADMIN) if(in_array($val,$admin_only) && !ADMIN)
{ {
continue; continue;
} }
if(!$smile_pref && ($val=="emoticons")) if(!$smile_pref && ($val=="emoticons"))
{ {
continue; continue;
} }
$tinymce_plugins[] = $val; $tinymce_plugins[] = $val;
} }
return implode(",",$tinymce_plugins); return implode(",",$tinymce_plugins);
} }
function render() function render()
{ {
echo $this->js; echo $this->js;