<?php
$props = $scriptProperties;
/* set rich text content placeholders and includes necessary js files */
$tinyPath = $modx->getOption('core_path') . 'components/tinymce/';
$modx->regClientStartupScript($modx->getOption('manager_url') .
'assets/ext3/adapter/ext/ext-base.js');
$modx->regClientStartupScript($modx->getOption('manager_url') .
'assets/ext3/ext-all.js');
$modx->regClientStartupScript($modx->getOption('manager_url') .
'assets/modext/core/modx.js');
$whichEditor = $modx->getOption('which_editor', null, '');
$plugin = $modx->getObject('modPlugin', array('name' => $whichEditor));
if ($whichEditor == 'TinyMCE') {
//$tinyUrl = $this->modx->getOption('assets_url').'components/tinymcefe/';
$tinyUrl = $modx->getOption('assets_url') . 'components/tinymce/';
/* OnRichTextEditorInit */
$tinyproperties = $plugin->getProperties();
require_once $tinyPath . 'tinymce.class.php';
$tiny = new TinyMCE($modx, $tinyproperties, $tinyUrl);
// if (isset($this->props['forfrontend']) || $this->modx->isFrontend()) {
if (isset($props['forfrontend']) || $modx->context->get('key') !=
'mgr') {
$def = $modx->getOption('cultureKey', null, $modx->getOption('manager_language', null,
'en'));
$tinyproperties['language'] = $modx->getOption('fe_editor_lang', array(),
$def);
$tinyproperties['frontend'] = true;
unset($def);
}
$tinyproperties['cleanup'] = true;
/* prevents "bogus" bug */
$tinyproperties['width'] = empty($props['tinywidth']) ? '95%' : $props['tinywidth'];
$tinyproperties['height'] = empty($props['tinyheight']) ? '400px' : $props['tinyheight'];
//$tinyproperties['tiny.custom_buttons1'] = 'image';
//$tinyproperties['tiny.custom_buttons2'] = '';
$tiny->setProperties($tinyproperties);
$html = $tiny->initialize();
$modx->regClientStartupScript($tiny->config['assetsUrl'] .
'jscripts/tiny_mce/langs/' . $tiny->properties['language'] . '.js');
$modx->regClientStartupScript($tiny->config['assetsUrl'] .
'tiny.browser.js');
//mod by Bruno
if ($props['hasimagetv']) {
$rt_configs = array("selector" => "rt_imagetv", "width" => $props['imageTvWidth'],
"height" => $props['imageTvHeight'], "buttons1" => "image", "buttons2" => "",
"theme_advanced_buttons1" => "image", "theme_advanced_buttons2" => "", );
$cfg = '';
foreach ($rt_configs as $cf_key => $cf_value) {
$cfg .= 'Tiny.config.' . $cf_key . ' = "' . $cf_value . '";';
}
$js .= $cfg . ' MODx.loadRTE();';
}
$modx->regClientStartupHTMLBlock('<script type="text/javascript">
Ext.onReady(function() {
MODx.loadRTE();
' . $js . '
});
</script>');
}
/* end if ($whichEditor == 'TinyMCE') */$tinyproperties['width'] = empty($props['tinywidth']) ? '95%' : $props['tinywidth'];
<?php
$props = $scriptProperties;
/* set rich text content placeholders and includes necessary js files */
$tinyPath = $modx->getOption('core_path') . 'components/tinymce/';
$modx->regClientStartupScript($modx->getOption('manager_url') .
'assets/ext3/adapter/ext/ext-base.js');
$modx->regClientStartupScript($modx->getOption('manager_url') .
'assets/ext3/ext-all.js');
$modx->regClientStartupScript($modx->getOption('manager_url') .
'assets/modext/core/modx.js');
$whichEditor = $modx->getOption('which_editor', null, '');
$plugin = $modx->getObject('modPlugin', array('name' => $whichEditor));
if ($whichEditor == 'TinyMCE') {
//$tinyUrl = $this->modx->getOption('assets_url').'components/tinymcefe/';
$tinyUrl = $modx->getOption('assets_url') . 'components/tinymce/';
/* OnRichTextEditorInit */
$tinyproperties = $plugin->getProperties();
require_once $tinyPath . 'tinymce.class.php';
$tiny = new TinyMCE($modx, $tinyproperties, $tinyUrl);
// if (isset($this->props['forfrontend']) || $this->modx->isFrontend()) {
if (isset($props['forfrontend']) || $modx->context->get('key') !=
'mgr') {
$def = $modx->getOption('cultureKey', null, $modx->getOption('manager_language', null,
'en'));
$tinyproperties['language'] = $modx->getOption('fe_editor_lang', array(),
$def);
$tinyproperties['frontend'] = true;
unset($def);
}
$tinyproperties['cleanup'] = true;
/* prevents "bogus" bug */
$tinyproperties['width'] = empty($props['tinywidth']) ? '50%' : $props['tinywidth'];
$tinyproperties['height'] = empty($props['tinyheight']) ? '400px' : $props['tinyheight'];
$tinyproperties['nowrap'] = empty($props['nowrap']) ? 'No' : $props['nowrap'];
//$tinyproperties['tiny.custom_buttons1'] = 'image';
//$tinyproperties['tiny.custom_buttons2'] = '';
$tiny->setProperties($tinyproperties);
$html = $tiny->initialize();
$modx->regClientStartupScript($tiny->config['assetsUrl'] .
'jscripts/tiny_mce/langs/' . $tiny->properties['language'] . '.js');
$modx->regClientStartupScript($tiny->config['assetsUrl'] .
'tiny.browser.js');
//mod by Bruno
if ($props['hasimagetv']) {
$rt_configs = array("selector" => "rt_imagetv", "nowrap" => $props['nowrap'], "width" => $props['imageTvWidth'],
"height" => $props['imageTvHeight'], "buttons1" => "image", "buttons2" => "",
"theme_advanced_buttons1" => "image", "theme_advanced_buttons2" => "", );
$cfg = '';
foreach ($rt_configs as $cf_key => $cf_value) {
$cfg .= 'Tiny.config.' . $cf_key . ' = "' . $cf_value . '";';
}
$js .= $cfg . ' MODx.loadRTE();';
}
$modx->regClientStartupHTMLBlock('<script type="text/javascript">
Ext.onReady(function() {
MODx.loadRTE();
' . $js . '
});
</script>');
}
/* end if ($whichEditor == 'TinyMCE') */ $plugin=$modx->getObject('modPlugin',array('name'=>'TinyMCE'));
/* set rich text content placeholders and includes necessary js files */
$modx->regClientStartupScript($modx->getOption('manager_url').'assets/ext3/adapter/ext/ext-base.js');
$modx->regClientStartupScript($modx->getOption('manager_url').'assets/ext3/ext-all.js');
$modx->regClientStartupScript($modx->getOption('manager_url').'assets/modext/core/modx.js');
$tinyPath = $modx->getOption('core_path').'components/tinymce/';
$tinyUrl = $modx->getOption('assets_url').'components/tinymce/';
/* @var $plugin modPlugin */
$tinyproperties=$plugin->getProperties();
require_once $tinyPath.'tinymce.class.php';
$tiny = new TinyMCE($modx, $tinyproperties);
$tinyproperties['language'] = $modx->getOption('cultureKey',null,$modx->getOption('manager_language',null,'en'));
$tinyproperties['frontend'] = true;
$tinyproperties['cleanup'] = true; /* prevents "bogus" bug */
$tinyproperties['width'] = '95%'; // set your width here
$tinyproperties['height'] = '400px'; // your height here
$tiny->setProperties($tinyproperties);
$tiny->initialize();
$modx->regClientStartupHTMLBlock('<script type="text/javascript">
delete Tiny.config.setup; // remove manager specific initialization code (depending on ModExt)
Ext.onReady(function() {
MODx.loadRTE();
});
</script>');
$tinyproperties['nowrap'] = 'No';
$tinyproperties['nowrap'] = false;