public function checkForTinyMCE()
 {
     /* If we want to use Tiny, we'll need some extra files. */
     $useTiny = $this->modx->getOption('gallery.use_richtext', $this->gallery->config, false);
     if ($useTiny) {
         $tinyCorePath = $this->modx->getOption('tiny.core_path', null, $this->modx->getOption('core_path') . 'components/tinymce/');
         if (file_exists($tinyCorePath . 'tinymce.class.php')) {
             /* First fetch the gallery+tiny specific settings */
             $cb1 = $this->modx->getOption('gallery.tiny.buttons1', null, 'undo,redo,selectall,pastetext,pasteword,charmap,separator,image,modxlink,unlink,media,separator,code,help');
             $cb2 = $this->modx->getOption('gallery.tiny.buttons2', null, 'bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull');
             $cb3 = $this->modx->getOption('gallery.tiny.buttons3', null, 'styleselect,formatselect,separator,styleprops');
             $cb4 = $this->modx->getOption('gallery.tiny.buttons4', null, '');
             $cb5 = $this->modx->getOption('gallery.tiny.buttons5', null, '');
             $plugins = $this->modx->getOption('gallery.tiny.custom_plugins', null, '');
             $theme = $this->modx->getOption('gallery.tiny.theme', null, '');
             $bfs = $this->modx->getOption('gallery.tiny.theme_advanced_blockformats', null, '');
             $css = $this->modx->getOption('gallery.tiny.theme_advanced_css_selectors', null, '');
             /** @var modAction $browserAction */
             $browserAction = $this->modx->getObject('modAction', array('controller' => 'browser'));
             /* If the settings are empty, override them with the generic tinymce settings. */
             $tinyProperties = array('accessibility_warnings' => false, 'browserUrl' => $browserAction ? $this->modx->getOption('manager_url', null, MODX_MANAGER_URL) . 'index.php?a=' . $browserAction->get('id') . '&source=1' : null, 'cleanup' => true, 'cleanup_on_startup' => false, 'compressor' => '', 'execcommand_callback' => 'Tiny.onExecCommand', 'file_browser_callback' => 'Tiny.loadBrowser', 'force_p_newlines' => true, 'force_br_newlines' => false, 'formats' => array('alignleft' => array('selector' => 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', 'classes' => 'justifyleft'), 'alignright' => array('selector' => 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', 'classes' => 'justifyright'), 'alignfull' => array('selector' => 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', 'classes' => 'justifyfull')), 'frontend' => false, 'plugin_insertdate_dateFormat' => '%Y-%m-%d', 'plugin_insertdate_timeFormat' => '%H:%M:%S', 'preformatted' => false, 'resizable' => true, 'relative_urls' => true, 'remove_script_host' => true, 'theme_advanced_disable' => '', 'theme_advanced_resizing' => true, 'theme_advanced_resize_horizontal' => true, 'theme_advanced_statusbar_location' => 'bottom', 'theme_advanced_toolbar_align' => 'left', 'theme_advanced_toolbar_location' => 'top', 'height' => $this->modx->getOption('gallery.tiny.height', null, 200), 'width' => $this->modx->getOption('gallery.tiny.width', null, '95%'), 'tiny.custom_buttons1' => !empty($cb1) ? $cb1 : $this->modx->getOption('tiny.custom_buttons1', null, 'undo,redo,selectall,separator,pastetext,pasteword,separator,search,replace,separator,nonbreaking,hr,charmap,separator,image,modxlink,unlink,anchor,media,separator,cleanup,removeformat,separator,fullscreen,print,code,help'), 'tiny.custom_buttons2' => !empty($cb2) ? $cb2 : $this->modx->getOption('tiny.custom_buttons2', null, 'bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect,separator,styleprops'), 'tiny.custom_buttons3' => !empty($cb3) ? $cb3 : $this->modx->getOption('tiny.custom_buttons3', null, ''), 'tiny.custom_buttons4' => !empty($cb4) ? $cb4 : $this->modx->getOption('tiny.custom_buttons4', null, ''), 'tiny.custom_buttons5' => !empty($cb5) ? $cb5 : $this->modx->getOption('tiny.custom_buttons5', null, ''), 'tiny.custom_plugins' => !empty($plugins) ? $plugins : $this->modx->getOption('tiny.custom_plugins', null, 'style,advimage,advlink,modxlink,searchreplace,print,contextmenu,paste,fullscreen,noneditable,nonbreaking,xhtmlxtras,visualchars,media'), 'tiny.editor_theme' => !empty($theme) ? $theme : $this->modx->getOption('tiny.editor_theme', null, 'cirkuit'), 'tiny.skin_variant' => $this->modx->getOption('tiny.skin_variant', null, ''), 'tiny.theme_advanced_blockformats' => !empty($bfs) ? $bfs : $this->modx->getOption('tiny.theme_advanced_blockformats', null, 'p,h1,h2,h3,h4,h5,h6,div,blockquote,code,pre,address'), 'tiny.css_selectors' => !empty($css) ? $css : $this->modx->getOption('tiny.css_selectors', null, ''));
             require_once $tinyCorePath . 'tinymce.class.php';
             $tiny = new TinyMCE($this->modx, $tinyProperties);
             $tiny->setProperties($tinyProperties);
             $html = $tiny->initialize();
             $this->addHtml($html);
         }
     }
 }
Exemple #2
0
 /**
  * Creates one instance of the tinyMCE object
  *
  * @param array $config The configuration
  *
  * @return TinyMCE $instance The instance of tinyMCE object
  */
 public function &instance($config)
 {
     static $instance;
     if (!isset($instance)) {
         $instance = new TinyMCE($config);
     } else {
         $instance->setConfig($config);
     }
     return $instance;
 }
Exemple #3
0
 public function loadCustomCssJs()
 {
     $this->addJavascript($this->gcCalendar->config['managerPath'] . 'assets/modext/util/datetime.js');
     $this->addJavascript($this->gcCalendar->config['jsUrl'] . 'ensible/Extensible-config.js');
     /* If we want to use Tiny, we'll need some extra files. */
     $tinyCorePath = $this->modx->getOption('tiny.core_path', null, $this->modx->getOption('core_path') . 'components/tinymce/');
     if (file_exists($tinyCorePath . 'tinymce.class.php')) {
         /* First fetch the gallery+tiny specific settings */
         $cb1 = 'undo,redo,selectall,separator,pastetext,separator,nonbreaking,separator,modxlink,unlink,separator,code,separator,cleanup,removeformat';
         $cb2 = 'bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,formatselect';
         $cb3 = '';
         $cb4 = '';
         $cb5 = '';
         $plugins = '';
         $theme = '';
         $bfs = '';
         $css = '';
         /* If the settings are empty, override them with the generic tinymce settings. */
         $tinyProperties = array('height' => 200, 'width' => 362, 'tiny.custom_buttons1' => !empty($cb1) ? $cb1 : $this->modx->getOption('tiny.custom_buttons1'), 'tiny.custom_buttons2' => !empty($cb2) ? $cb2 : $this->modx->getOption('tiny.custom_buttons2'), 'tiny.custom_buttons3' => $cb3, 'tiny.custom_buttons4' => !empty($cb4) ? $cb4 : $this->modx->getOption('tiny.custom_buttons4'), 'tiny.custom_buttons5' => !empty($cb5) ? $cb5 : $this->modx->getOption('tiny.custom_buttons5'), 'tiny.custom_plugins' => !empty($plugins) ? $plugins : $this->modx->getOption('tiny.custom_plugins'), 'tiny.editor_theme' => !empty($theme) ? $theme : $this->modx->getOption('tiny.editor_theme'), 'tiny.theme_advanced_blockformats' => !empty($bfs) ? $bfs : $this->modx->getOption('tiny.theme_advanced_blockformats'), 'tiny.css_selectors' => !empty($css) ? $css : $this->modx->getOption('tiny.css_selectors'));
         require_once $tinyCorePath . 'tinymce.class.php';
         $tiny = new TinyMCE($this->modx, $tinyProperties);
         $tiny->setProperties($tinyProperties);
         $html = $tiny->initialize();
         $this->modx->regClientHTMLBlock($html);
     }
     $this->addJavascript($this->gcCalendar->config['jsUrl'] . 'mgr/widgets/CheckColumn.js');
     $this->addJavascript($this->gcCalendar->config['jsUrl'] . 'mgr/widgets/cust/window.dates.js');
     $this->addJavascript($this->gcCalendar->config['jsUrl'] . 'mgr/widgets/cust/grid.dates.js');
     $this->addJavascript($this->gcCalendar->config['jsUrl'] . 'mgr/widgets/gcCalendar.grid.js');
     $this->addJavascript($this->gcCalendar->config['jsUrl'] . 'mgr/widgets/gcCalendar.calendars.js');
     $this->addJavascript($this->gcCalendar->config['jsUrl'] . 'mgr/widgets/gcCalendar.categories.js');
     $this->addJavascript($this->gcCalendar->config['jsUrl'] . 'mgr/widgets/gcCalendar.ensible.js');
     $this->addJavascript($this->gcCalendar->config['jsUrl'] . 'mgr/widgets/gcCalendar.window.js');
     $this->addJavascript($this->gcCalendar->config['jsUrl'] . 'mgr/widgets/home.panel.js');
     $this->addLastJavascript($this->gcCalendar->config['jsUrl'] . 'mgr/sections/index.js');
 }
Exemple #4
0
 *
 * Events: OnRichTextEditorInit, OnRichTextEditorRegister,
 * OnBeforeManagerPageInit, OnRichTextBrowserInit
 *
 * @author Jeff Whitfield <*****@*****.**>
 * @author Shaun McCormick <*****@*****.**>
 *
 * @package tinymce
 * @subpackage build
 */
if ($modx->event->name == 'OnRichTextEditorRegister') {
    $modx->event->output('TinyMCE');
    return;
}
require_once $modx->getOption('tiny.core_path', null, $modx->getOption('core_path') . 'components/tinymce/') . 'tinymce.class.php';
$tiny = new TinyMCE($modx, $scriptProperties);
$useEditor = $modx->getOption('use_editor', null, false);
$whichEditor = $modx->getOption('which_editor', null, '');
/* Handle event */
switch ($modx->event->name) {
    case 'OnRichTextEditorInit':
        if ($useEditor && $whichEditor == 'TinyMCE') {
            if (isset($forfrontend) || $modx->isFrontend()) {
                $def = $modx->getOption('cultureKey', null, $modx->getOption('manager_language', null, 'en'));
                $tiny->properties['language'] = $modx->getOption('fe_editor_lang', array(), $def);
                $tiny->properties['frontend'] = true;
                unset($def);
            }
            /* commenting these out as it causes problems with richtext tvs */
            //if (isset($scriptProperties['resource']) && !$resource->get('richtext')) return;
            //if (!isset($scriptProperties['resource']) && !$modx->getOption('richtext_default',null,false)) return;
Exemple #5
0
     $tinyCorePath = $modx->getOption('tiny.core_path', null, $modx->getOption('core_path') . 'components/tinymce/');
     if (file_exists($tinyCorePath . 'tinymce.class.php')) {
         /* First fetch the mxcalendarstiny specific settings */
         $cb1 = $modx->getOption('mxcalendars.tiny.buttons1');
         $cb2 = $modx->getOption('mxcalendars.tiny.buttons2');
         $cb3 = $modx->getOption('mxcalendars.tiny.buttons3');
         $cb4 = $modx->getOption('mxcalendars.tiny.buttons4');
         $cb5 = $modx->getOption('mxcalendars.tiny.buttons5');
         $plugins = $modx->getOption('mxcalendars.tiny.custom_plugins');
         $theme = $modx->getOption('mxcalendars.tiny.theme');
         $bfs = $modx->getOption('mxcalendars.tiny.theme_advanced_blockformats');
         $css = $modx->getOption('mxcalendars.tiny.theme_advanced_css_selectors');
         /* If the settings are empty, override them with the generic tinymce settings. */
         $tinyProperties = array('height' => $modx->getOption('mxcalendars.tiny.height', null, 200), 'width' => $modx->getOption('mxcalendars.tiny.width', null, 400), 'tiny.custom_buttons1' => !empty($cb1) ? $cb1 : $modx->getOption('tiny.custom_buttons1'), 'tiny.custom_buttons2' => !empty($cb2) ? $cb2 : $modx->getOption('tiny.custom_buttons2'), 'tiny.custom_buttons3' => !empty($cb3) ? $cb3 : $modx->getOption('tiny.custom_buttons3'), 'tiny.custom_buttons4' => !empty($cb4) ? $cb4 : $modx->getOption('tiny.custom_buttons4'), 'tiny.custom_buttons5' => !empty($cb5) ? $cb5 : $modx->getOption('tiny.custom_buttons5'), 'tiny.custom_plugins' => !empty($plugins) ? $plugins : $modx->getOption('tiny.custom_plugins'), 'tiny.editor_theme' => !empty($theme) ? $theme : $modx->getOption('tiny.editor_theme'), 'tiny.theme_advanced_blockformats' => !empty($bfs) ? $bfs : $modx->getOption('tiny.theme_advanced_blockformats'), 'tiny.css_selectors' => !empty($css) ? $css : $modx->getOption('tiny.css_selectors'));
         require_once $tinyCorePath . 'tinymce.class.php';
         $tiny = new TinyMCE($modx, $tinyProperties);
         $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>');
     }
 } else {
     $rte_redactor = $this->modx->getOption('redactor.core_path', $config, $this->modx->getOption('core_path') . 'components/redactor/');
     require_once $rte_redactor . 'model/redactor/redactor.class.php';
     $rte = new Redactor($modx);
     $rte->initialize();
     //$useEditor = $this->modx->getOption('use_editor');
function elements_modplugin_3($scriptProperties = array())
{
    global $modx;
    if (is_array($scriptProperties)) {
        extract($scriptProperties, EXTR_SKIP);
    }
    /**
     * TinyMCE RichText Editor Plugin
     *
     * Events: OnRichTextEditorInit, OnRichTextEditorRegister,
     * OnBeforeManagerPageInit, OnRichTextBrowserInit
     *
     * @author Jeff Whitfield <*****@*****.**>
     * @author Shaun McCormick <*****@*****.**>
     *
     * @var modX $modx
     * @var array $scriptProperties
     *
     * @package tinymce
     * @subpackage build
     */
    if ($modx->event->name == 'OnRichTextEditorRegister') {
        $modx->event->output('TinyMCE');
        return;
    }
    require_once $modx->getOption('tiny.core_path', null, $modx->getOption('core_path') . 'components/tinymce/') . 'tinymce.class.php';
    $tiny = new TinyMCE($modx, $scriptProperties);
    $useEditor = $tiny->context->getOption('use_editor', false);
    $whichEditor = $tiny->context->getOption('which_editor', '');
    /* Handle event */
    switch ($modx->event->name) {
        case 'OnRichTextEditorInit':
            if ($useEditor && $whichEditor == 'TinyMCE') {
                unset($scriptProperties['chunk']);
                if (isset($forfrontend) || $modx->context->get('key') != 'mgr') {
                    $def = $tiny->context->getOption('cultureKey', $tiny->context->getOption('manager_language', 'en'));
                    $tiny->properties['language'] = $modx->getOption('fe_editor_lang', array(), $def);
                    $tiny->properties['frontend'] = true;
                    unset($def);
                }
                /* commenting these out as it causes problems with richtext tvs */
                //if (isset($scriptProperties['resource']) && !$resource->get('richtext')) return;
                //if (!isset($scriptProperties['resource']) && !$modx->getOption('richtext_default',null,false)) return;
                $tiny->setProperties($scriptProperties);
                $html = $tiny->initialize();
                $modx->event->output($html);
                unset($html);
            }
            break;
        case 'OnRichTextBrowserInit':
            if ($useEditor && $whichEditor == 'TinyMCE') {
                $inRevo20 = (bool) version_compare($modx->version['full_version'], '2.1.0-rc1', '<');
                $modx->getVersionData();
                $source = $tiny->context->getOption('default_media_source', null, 1);
                $modx->controller->addHtml('<script type="text/javascript">var inRevo20 = ' . ($inRevo20 ? 1 : 0) . ';MODx.source = "' . $source . '";</script>');
                $modx->controller->addJavascript($tiny->config['assetsUrl'] . 'jscripts/tiny_mce/tiny_mce_popup.js');
                if (file_exists($tiny->config['assetsPath'] . 'jscripts/tiny_mce/langs/' . $tiny->properties['language'] . '.js')) {
                    $modx->controller->addJavascript($tiny->config['assetsUrl'] . 'jscripts/tiny_mce/langs/' . $tiny->properties['language'] . '.js');
                } else {
                    $modx->controller->addJavascript($tiny->config['assetsUrl'] . 'jscripts/tiny_mce/langs/en.js');
                }
                $modx->controller->addJavascript($tiny->config['assetsUrl'] . 'tiny.browser.js');
                $modx->event->output('Tiny.browserCallback');
            }
            return '';
            break;
        default:
            break;
    }
    return;
}
<?php

if (!defined('MODX_BASE_PATH')) {
    die('What are you doing? Get out of here!');
}
// Set the name of the plugin folder
global $usersettings, $settings;
// Set path and base setting variables
$params['mce_path'] = $mce_path;
$params['mce_url'] = $mce_url;
$plugin_dir = 'tinymce';
include_once "{$mce_path}functions.php";
$mce = new TinyMCE();
// Handle event
$e =& $modx->event;
switch ($e->name) {
    case "OnRichTextEditorRegister":
        // register only for backend
        $e->output('TinyMCE');
        break;
    case "OnRichTextEditorInit":
        if ($editor !== 'TinyMCE') {
            return;
        }
        $html = $mce->get_mce_script();
        $e->output($html);
        break;
    case "OnInterfaceSettingsRender":
        $html = $mce->get_mce_settings();
        $e->output($html);
        break;
 /** Initialize variables and placeholders.
  *  Uses $_POST on postback.
  *  Checks for an existing resource to edit in $_POST.
  *  Sets errors on failure.
  *
  *  @access public
  *  @param string $context - current context key
  */
 public function init($context)
 {
     $this->context = $context;
     $language = $this->modx->getOption('language', $this->props, '');
     $language = !empty($language) ? $language : $this->modx->getOption('cultureKey', NULL, $this->modx->getOption('manager_language', NULL, 'en'));
     switch ($context) {
         case 'mgr':
             break;
         case 'web':
         default:
             $this->modx->lexicon->load($language . ':newspublisher:default');
             break;
     }
     $this->duplicateButton = $this->modx->getOption('duplicatebutton', $this->props, false);
     $this->deleteButton = $this->modx->getOption('deletebutton', $this->props, false);
     $this->confirmDelete = $this->modx->getOption('confirmdelete', $this->props, true);
     /* set tab properties */
     $this->useTabs = isset($this->props['usetabs']) ? !empty($this->props['usetabs']) : false;
     $this->tabs = isset($this->props['tabs']) ? $this->props['tabs'] : null;
     $this->activeTab = isset($this->props['activetab']) && !empty($this->props['activetab']) ? $this->props['activetab'] : '';
     $this->classKey = !isset($this->props['classkey']) || empty($this->props['classkey']) ? 'modDocument' : $this->props['classkey'];
     $this->allowedTags = $this->modx->getOption('allowedtags', $this->props, '<p><br><a><i><em><b><strong><pre><table><th><td><tr><img><span><div><h1><h2><h3><h4><h5><font><ul><ol><li><dl><dt><dd><object><blockquote><code>');
     /* inject NP CSS file */
     /* Empty but sent parameter means use no CSS file at all */
     if ($this->props['cssfile'] === '0') {
         /* 0 sent, -- no css file */
         $css = false;
     } elseif (empty($this->props['cssfile'])) {
         /* nothing sent - use default */
         $css = $this->assetsUrl . 'css/newspublisher.css';
     } else {
         /* set but not empty -- use it */
         $css = $this->assetsUrl . 'css/' . $this->props['cssfile'];
     }
     if ($css !== false) {
         $this->modx->regClientCSS($css . '?v=' . $this->version);
     }
     $this->prefix = empty($this->props['prefix']) ? 'np' : $this->props['prefix'];
     /* see if we're editing an existing doc */
     $this->existing = false;
     if (isset($_POST['np_existing']) && $_POST['np_existing'] == 'true') {
         $this->existing = is_numeric($_POST['np_doc_id']) ? $_POST['np_doc_id'] : false;
     }
     /* see if it's a repost */
     $this->setPostback(isset($_POST['hidSubmit']) && $_POST['hidSubmit'] == 'true');
     $this->showNotify = (bool) $this->modx->getOption('shownotify', $this->props, false, true);
     if ($this->showNotify) {
         if ($this->isPostBack) {
             $this->notifyChecked = $this->modx->getOption('np_launch_notify', $_POST, false);
         } else {
             $this->notifyChecked = $this->modx->getOption('notifychecked', $this->props, false, true);
         }
         $this->launchNotify = $this->notifyChecked;
     }
     if ($this->isPostBack) {
         /* $fs = array(); */
         foreach ($_POST as $k => $v) {
             /* Don't use arrays for HTML select/radio fields with a single element.
              * The nested arrays cause problems when saving fields */
             if (is_array($v) && count($v) == 1) {
                 $_POST[$k] = reset($v);
             }
         }
         /* No need to convert tags here. MODX will have removed them
            if allow_tags_in_post System Setting is off */
         $this->modx->toPlaceholders($_POST, $this->prefix);
     }
     if ($this->existing) {
         $this->resource = $this->modx->getObject('modResource', $this->existing);
         if ($this->resource) {
             if (isset($_POST['Duplicate'])) {
                 if (!$this->resource->checkPolicy('copy')) {
                     $this->setError($this->modx->lexicon('np_copy_permission_denied'));
                     return;
                 }
                 $result = $this->duplicate($this->resource->get('id'), $this->resource->get('context_key'));
                 if ($result !== true) {
                     $this->setError($result);
                     return;
                 }
             }
             if (isset($_POST['Delete'])) {
                 if (!$this->resource->checkPolicy('delete')) {
                     $this->setError($this->modx->lexicon('np_no_delete_permission'));
                     return;
                 }
                 $result = $this->deleteResource($this->resource->get('id'));
                 $this->setError($result);
                 return;
             }
             if (!($this->modx->hasPermission('view_document') && $this->resource->checkPolicy('view'))) {
                 if (!$this->modx->hasPermission('view_document')) {
                     $this->setError($this->modx->lexicon('np_view_permission_denied'));
                 }
                 if (!$this->resource->checkPolicy('view')) {
                     $this->setError($this->modx->lexicon('np_view_this_permission_denied'));
                 }
                 return;
             }
             if (!$this->isPostBack) {
                 $ph = $this->resource->toArray();
                 if ($ph['parent'] == 0) {
                     $ph['parent'] = $ph['context_key'];
                 } else {
                     $this->parentId = $this->resource->get('parent');
                 }
                 if ($this->hasToken($ph)) {
                     if ($this->modx->hasPermission('allow_modx_tags')) {
                         $ph = $this->convertTags($ph);
                     } else {
                         /* return error if there are any MODX tags */
                         $this->setError($this->modx->lexicon('np_no_modx_tags'));
                         return;
                     }
                 }
                 $this->modx->toPlaceholders($ph, $this->prefix);
                 unset($ph);
             }
         } else {
             $this->setError($this->modx->lexicon('np_no_resource') . $this->existing);
             return;
         }
         /* need to forward this from $_POST so we know it's an existing doc */
         $stuff = '<input type="hidden" name="np_existing" value="true" />' . "\n" . '<input type="hidden" name="np_doc_id" value="' . $this->resource->get('id') . '" />';
         $this->modx->toPlaceholder('post_stuff', $stuff, $this->prefix);
     } else {
         /* new document */
         if (!$this->modx->hasPermission('new_document')) {
             $this->setError($this->modx->lexicon('np_create_permission_denied'));
             return;
         }
         $this->resource = $this->modx->newObject($this->classKey);
         /* get folder id where we should store the new resource,
            else store under current document */
         if (isset($this->props['parent'])) {
             $this->props['parentid'] = $this->props['parent'];
             unset($this->props['parent']);
         }
         $temp = $this->modx->getOption('parentid', $this->props, '');
         if (empty($temp)) {
             $this->parentId = (int) $this->modx->resource->get('id');
         } else {
             $this->parentId = is_numeric($temp) ? (int) $temp : $temp;
         }
         unset($temp);
         $this->resource->set('parent', $this->parentId);
         $this->aliasTitle = $this->props['aliastitle'] ? true : false;
         $this->clearcache = isset($_POST['clearcache']) ? $_POST['clearcache'] : $this->props['clearcache'];
         $this->hideMenu = isset($_POST['hidemenu']) ? $_POST['hidemenu'] : $this->_setDefault('hidemenu', $this->parentId);
         $this->resource->set('hidemenu', $this->hideMenu);
         $this->cacheable = isset($_POST['cacheable']) ? $_POST['cacheable'] : $this->_setDefault('cacheable', $this->parentId);
         $this->resource->set('cacheable', $this->cacheable);
         $this->searchable = isset($_POST['searchable']) ? $_POST['searchable'] : $this->_setDefault('searchable', $this->parentId);
         $this->resource->set('searchable', $this->searchable);
         $this->published = isset($_POST['published']) ? $_POST['published'] : $this->_setDefault('published', $this->parentId);
         $this->resource->set('published', $this->published);
         $this->richtext = isset($_POST['richtext']) ? $_POST['richtext'] : $this->_setDefault('richtext', $this->parentId);
         $this->resource->set('richtext', $this->richtext);
         if (!empty($this->props['groups'])) {
             $this->groups = $this->_setDefault('groups', $this->parentId);
         }
         $this->header = !empty($this->props['headertpl']) ? $this->modx->getChunk($this->props['headertpl']) : '';
         $this->footer = !empty($this->props['footertpl']) ? $this->modx->getChunk($this->props['footertpl']) : '';
     }
     if (!empty($this->props['badwords'])) {
         $this->badwords = str_replace(' ', '', $this->props['badwords']);
         $this->badwords = "/" . str_replace(',', '|', $this->badwords) . "/i";
     }
     $this->stopOnBadTv = $this->modx->getOption('stopOnBadTv', $this->props, true);
     $this->modx->lexicon->load('core:resource');
     $this->template = (int) $this->_getTemplate();
     $temp = $this->modx->getOption('templates', $this->props, '');
     $this->templates = empty($temp) ? array() : explode(',', $temp);
     $this->parents = $this->getParents();
     // echo "<br />$this->parents init: " . print_r($this->parents, true). '<br />';
     if ($this->props['initdatepicker']) {
         $this->modx->regClientCSS($this->assetsUrl . 'datepicker/css/datepicker.css');
         $this->modx->regClientStartupHTMLBlock('<script type=text/javascript src="' . $this->assetsUrl . 'datepicker/js/datepicker.packed.js">{"lang":"' . $language . '"}</script>');
     }
     $this->listboxMax = $this->props['listboxmax'] ? $this->props['listboxmax'] : 8;
     $this->multipleListboxMax = $this->props['multiplelistboxmax'] ? $this->props['multiplelistboxmax'] : 8;
     $this->intMaxlength = !empty($this->props['intmaxlength']) ? $this->props['intmaxlength'] : 10;
     $this->textMaxlength = !empty($this->props['textmaxlength']) ? $this->props['textmaxlength'] : 60;
     /* new code from Markus Schlegel */
     if ($this->props['initrte']) {
         $whichEditor = $this->modx->getOption('which_editor', $this->props, 'TinyMCE');
         if ($whichEditor == 'TinyMCE') {
             $_REQUEST['a'] = '';
             /* fixes E_NOTICE bug in TinyMCE */
             $plugin = $this->modx->getObject('modPlugin', array('name' => 'TinyMCE'));
             /* set rich text content placeholders and includes necessary js files */
             $this->modx->regClientStartupScript($this->modx->getOption('manager_url') . 'assets/ext3/adapter/ext/ext-base.js');
             $this->modx->regClientStartupScript($this->modx->getOption('manager_url') . 'assets/ext3/ext-all.js');
             $this->modx->regClientStartupScript($this->modx->getOption('manager_url') . 'assets/modext/core/modx.js');
             $tinyPath = $this->modx->getOption('core_path') . 'components/tinymce/';
             $tinyUrl = $this->modx->getOption('assets_url') . 'components/tinymce/';
             /* @var $plugin modPlugin */
             $tinyproperties = $plugin->getProperties();
             /* Added by Markus for 2.3 */
             $actionObj = $this->modx->getObject('modAction', array('namespace' => 'core', 'controller' => 'browser'));
             $action = $actionObj ? $actionObj->get('id') : 'browser';
             $tinyproperties["browserUrl"] = $this->modx->getOption('manager_url', null, MODX_MANAGER_URL) . 'index.php?a=' . $action;
             /* ************* */
             require_once $tinyPath . 'tinymce.class.php';
             $tiny = new TinyMCE($this->modx, $tinyproperties);
             $tinyproperties['language'] = $this->modx->getOption('fe_editor_lang', array(), $language);
             $tinyproperties['frontend'] = true;
             $tinyproperties['cleanup'] = true;
             /* prevents "bogus" bug */
             $tinyproperties['width'] = empty($this->props['tinywidth']) ? '95%' : $this->props['tinywidth'];
             $tinyproperties['height'] = empty($this->props['tinyheight']) ? '400px' : $this->props['tinyheight'];
             $tinyproperties['resource'] = $this->resource;
             $tiny->setProperties($tinyproperties);
             $tiny->initialize();
             $this->modx->regClientStartupHTMLBlock('<script type="text/javascript">
                 delete Tiny.config.setup; // remove manager specific initialization code (depending on ModExt)
                 Ext.onReady(function() {
                     MODx.loadRTE();
                 });
             </script>');
         }
         /* end if ($whichEditor == 'TinyMCE') */
     }
     /* end if ($richtext) */
 }
Exemple #9
0
//$modx->regClientStartupScript($xdbedit->config['jsUrl'].'widgets/modx.panel.resource.js');
//$modx->regClientStartupScript($context->getOption('manager_url').'assets/modext/widgets/resource/modx.panel.resource.tv.js');
//$modx->regClientStartupScript($context->getOption('manager_url').'assets/modext/sections/resource/create.js');
//$modx->regClientStartupScript($xdbedit->config['jsUrl'].'widgets/comments.grid.js');
$modx->regClientStartupScript($xdbedit->config['jsUrl'] . 'widgets/grids/' . $xdbedit->getTask() . '.grid.js');
$modx->regClientStartupScript($xdbedit->config['jsUrl'] . 'widgets/xdbedit.panel.js');
$modx->regClientStartupScript($xdbedit->config['jsUrl'] . 'sections/home.js');
$useEditor = $modx->getOption('use_editor', null, false);
$whichEditor = $modx->getOption('which_editor', null, '');
$plugin = $modx->getObject('modPlugin', array('name' => $whichEditor));
/* OnRichTextEditorInit */
if ($useEditor && $whichEditor == 'TinyMCE') {
    $tinyproperties = $plugin->getProperties();
    $tinyUrl = $xdbedit->config['jsUrl'] . 'tinymce/';
    require_once $xdbedit->config['modelPath'] . 'tinymce/tinymce.class.php';
    $tiny = new TinyMCE($modx, $tinyproperties, $tinyUrl);
    if (isset($forfrontend)) {
        $def = $modx->getOption('cultureKey', null, $modx->getOption('manager_language', null, 'en'));
        $tiny->properties['language'] = $modx->getOption('fe_editor_lang', array(), $def);
        $tiny->properties['frontend'] = true;
        unset($def);
    }
    /* commenting these out as it causes problems with richtext tvs */
    //if (isset($scriptProperties['resource']) && !$resource->get('richtext')) return;
    //if (!isset($scriptProperties['resource']) && !$modx->getOption('richtext_default',null,false)) return;
    $tiny->setProperties($tinyproperties);
    $html = $tiny->initialize();
    //$modx->event->output($html);
    //unset($html);
}
/* OnRichTextBrowserInit */
 /**
  * Initializes tinyMCE
  **/
 function initTinymce()
 {
     $this->config["elements"] = $this->getName() . '_tarea';
     $this->config["language"] = $this->getLanguage();
     $this->config["rootpath"] = $this->rootpath;
     $this->config["area_width"] = $this->_width;
     $this->config["area_height"] = $this->_height;
     $this->config["fonts"] = $this->getFonts();
     //$this->config["file_browser_callback"] = "ajaxfilemanager";
     /*$this->config["callback"] = 'function ajaxfilemanager(field_name, url, type, win) {
     			var ajaxfilemanagerurl = "../../../../../editors/tinymce/jscripts/plugins/ajaxfilemanager/ajaxfilemanager.php";
     			switch (type) {
     				case "image":
     					break;
     				case "media":
     					break;
     				case "flash":
     					break;
     				case "file":
     					break;
     				default:
     					return false;
     			}
                 tinyMCE.activeEditor.windowManager.open({
                     url: ajaxfilemanagerurl,
                     width: 782,
                     height: 440,
                     inline : "yes",
                     close_previous : "no"
                 },{
                     window : win,
                     input : field_name
                 });
     
     /*            return false;
     			var fileBrowserWindow = new Array();
     			fileBrowserWindow["file"] = ajaxfilemanagerurl;
     			fileBrowserWindow["title"] = "Ajax File Manager";
     			fileBrowserWindow["width"] = "782";
     			fileBrowserWindow["height"] = "440";
     			fileBrowserWindow["close_previous"] = "no";
     			tinyMCE.openWindow(fileBrowserWindow, {
     			  window : win,
     			  input : field_name,
     			  resizable : "yes",
     			  inline : "yes",
     			  editor_id : tinyMCE.getWindowArg("editor_id")
     			});
     
     			return false;
     		}';*/
     require_once dirname(__FILE__) . "/tinymce.php";
     $this->tinymce = TinyMCE::instance($this->config);
 }
 /**
  * Generate and return HTML code for editor
  *
  * @access public
  * @return string HTML code element
  */
 function toHtml()
 {
     require_once 'TinyMCE.php';
     $editor = new TinyMCE($this->getName());
     $editor->value = $this->getValue();
     return $editor->toHTML();
 }
 public function loadCustomCssJs()
 {
     parent::loadCustomCssJs();
     $namespace = "articleseditor";
     $manager_url = $this->modx->getOption('manager_url');
     $path = "{$manager_url}components/{$namespace}/";
     # $assets_url = $this->getOption('assets');
     $assets_url = $this->modx->getOption("{$namespace}.manager_url", null, $path);
     $this->addCss("{$assets_url}css/mgr.css");
     $this->addJavascript("{$assets_url}js/widgets/window.js");
     $this->addJavascript("{$assets_url}js/widgets/image_manager.js");
     $this->addJavascript("{$assets_url}js/widgets/panel.js");
     $this->addJavascript("{$assets_url}js/widgets/tabs.js");
     $this->addJavascript("{$assets_url}js/widgets/grid.js");
     $this->addJavascript("{$assets_url}js/widgets/combo.js");
     $this->addHtml('<script type="text/javascript">
         Ext.onReady(function(){MODx.add("articleseditor-panel-mainpanel")});
     </script>');
     //$this->addJavascript($this->config['jsUrl'].'group_edit.js');
     /*$this->addJavascript($this->modx->getOption('manager_url').'assets/modext/util/datetime.js');
       $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/widgets/element/modx.panel.tv.renders.js');
       $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
       $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/widgets/resource/modx.panel.resource.tv.js');
       $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/sections/resource/update.js');
       $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/sections/resource/create.js');*/
     /*$this->addJavascript($this->config['jsUrl'].'widgets/resources.grid.js');
       $this->addJavascript($this->config['jsUrl'].'shop/widgets/resources.grid.js');
       $this->addJavascript($this->config['jsUrl'].'widgets/home.panel.js');
       $this->addJavascript($this->config['jsUrl'].'widgets/modx.panel.resource.js');
       $this->addJavascript($this->config['jsUrl'].'sections/index.js');*/
     #         $html = <<<HTML
     #         <script type="text/javascript" src="/public/components/tinymce/jscripts/tiny_mce/tiny_mce.js?v=233pl"></script>
     #         <script type="text/javascript" src="/public/components/tinymce/xconfig.js?v=233pl"></script>
     #         <script type="text/javascript" src="/public/components/tinymce/tiny.js?v=233pl"></script>
     #         <script type="text/javascript">
     #         //<![CDATA[
     #         var inRevo20 = 0;MODx.source = '12';Tiny.lang = {"toggle_editor":"Toggle Editor: ","setting_base_url":"TinyMCE Document Base URL","setting_base_url_desc":"Allows the setting of a base URL property to override the document_base_url TinyMCE settings. Useful for rootrelative environments.","setting_convert_fonts_to_spans":"Convert Fonts to Spans","setting_convert_fonts_to_spans_desc":"If you set this option to true, TinyMCE will convert all font elements to span elements and generate span elements instead of font elements. This option should be used in order to get more W3C compatible code, since font elements are deprecated.","setting_convert_newlines_to_brs":"Convert Newlines to BRs","setting_convert_newlines_to_brs_desc":"If you set this option to true, newline characters codes get converted into br elements. This option is set to false by default.","setting_css_selectors":"CSS Selectors","setting_css_selectors_desc":"Here you can enter a list of selectors that should be available in the editor. Enter them as follows:<br \/>\"displayName=selectorName;displayName2=selectorName2\"<br \/>For instance, say you have <b>.mono<\/b> and <b>.smallText<\/b> selectors in your CSS file, you could add them here as:<br \/>\"Monospaced text=mono;Small text=smallText\"<br \/>Note that the last entry should not have a semi-colon after it.","setting_custom_buttons1":"Custom Buttons Row 1","setting_custom_buttons1_desc":"Enter the buttons to use as a comma separated list for the first row. Be sure that each button has the required plugin enabled in the \"Custom Plugins\" setting.","setting_custom_buttons2":"Custom Buttons Row 2","setting_custom_buttons2_desc":"Enter the buttons to use as a comma separated list for the second row. Be sure that each button has the required plugin enabled in the \"Custom Plugins\" setting.","setting_custom_buttons3":"Custom Buttons Row 3","setting_custom_buttons3_desc":"Enter the buttons to use as a comma separated list for the third row. Be sure that each button has the required plugin enabled in the \"Custom Plugins\" setting.","setting_custom_buttons4":"Custom Buttons Row 4","setting_custom_buttons4_desc":"Enter the buttons to use as a comma separated list for the fourth row. Be sure that each button has the required plugin enabled in the \"Custom Plugins\" setting.","setting_custom_buttons5":"Custom Buttons Row 5","setting_custom_buttons5_desc":"Enter the buttons to use as a comma separated list for the fifth row. Be sure that each button has the required plugin enabled in the \"Custom Plugins\" setting.","setting_custom_plugins":"Custom Plugins","setting_custom_plugins_desc":"A comma-separated list of TinyMCE plugins to use.","setting_editor_theme":"Editor Theme","setting_element_format":"Element Format","setting_element_format_desc":"This option enables control if elements should be in html or xhtml mode. xhtml is the default state for this option. This means that for example &lt;br \/&gt; will be &lt;br&gt; if you set this option to \"html\".","setting_entity_encoding":"Entity Encoding","setting_entity_encoding_desc":"This option controls how entities\/characters get processed by TinyMCE. Available values are \"named\", \"numeric\" and \"raw\".","setting_fix_nesting":"Auto-fix Nesting","setting_fix_nesting_desc":"This option controls if invalid contents should be corrected before insertion in IE. IE has a bug that produced an invalid DOM tree if the input contents are not correct so this option tries to fix this using preprocessing of the HTML string. This option is disabled by default since it might be a bit slow.","setting_fix_table_elements":"Auto-fix Table Elements","setting_fix_table_elements_desc":"This option enables you to specify that table elements should be moved outside paragraphs or other block elements. If you enable this option block elements will be split into two chunks when a table is found within it. This option is disabled by default.","setting_font_size_classes":"Font Size Classes","setting_font_size_classes_desc":"This option allows specification of a comma separated list of class names that is to be used when the user selects font sizes. This option is only used when the convert_fonts_to_spans option is enabled. This list of classes should be 7 items. This option is not used by default, but can be useful if you want to have custom classes for each font size for browser compatibility.","setting_font_size_style_values":"Font Size Style Values","setting_font_size_style_values_desc":"This option allows specification of a comma separated list of style values that is to be used when the user selects font sizes. This option is only used when the convert_fonts_to_spans option is enabled. This list of style values should be 7 items. This option is not used by default, but can be useful if you want to have custom CSS values for each font size for browser compatibility. Defaults to: xx-small,x-small,small,medium,large,x-large,xx-large.","setting_forced_root_block":"Forced Root Block","setting_forced_root_block_desc":"This option enables you to make sure that any non block elements or text nodes are wrapped in block elements. For example &lt;strong&gt;something&lt;\/strong&gt; will result in output like: &lt;p&gt;&lt;strong&gt;something&lt;\/strong&gt;&lt;\/p&gt;.","setting_indentation":"Indentation","setting_indentation_desc":"This option allows specification of the indentation level for indent\/outdent buttons in the UI. This defaults to 30px but can be any value.","setting_invalid_elements":"Invalid Elements","setting_invalid_elements_desc":"This option should contain a comma separated list of element names to exclude from the content. Elements in this list will be removed when TinyMCE executes a cleanup.","setting_nowrap":"Prevent Editor Wrap","setting_nowrap_desc":"This nowrap option enables you to control how whitespace is to be wordwrapped within the editor. This option is set to false by default, but if you enable it by setting it to true editor contents will never wrap.","setting_object_resizing":"Object Resizing","setting_object_resizing_desc":"This option gives you the ability to turn on\/off the inline resizing controls of tables and images in Firefox\/Mozilla. These are enabled by default.","setting_remove_linebreaks":"Remove Linebreaks","setting_remove_linebreaks_desc":"This option controls whether line break characters should be removed from output HTML.","setting_remove_redundant_brs":"Remove Redundant BRs","setting_remove_redundant_brs_desc":"This option is enabled by default and will control the output of trailing BR elements at the end of block elements. Since IE cannot render these properly we need to remove them by default to ensure proper output across all browsers. So for some browsers this BR at the end of the LI at the example below is redundant.","setting_removeformat_selector":"RemoveFormat Selector","setting_removeformat_selector_desc":"This option allows specification of which elements should be removed when you press the removeformat button. This is a CSS selector pattern.","setting_path_options":"Path Options","setting_path_options_desc":"Either \"rootrelative\", \"docrelative\", or \"fullpathurl\".","setting_table_inline_editing":"Table Inline Editing","setting_table_inline_editing_desc":"This option gives you the ability to turn on\/off the inline table editing controls in Firefox\/Mozilla. According to the TinyMCE documentation, these controls are somewhat buggy and not redesignable, so they are disabled by default.","setting_template_list":"Template List","setting_template_list_desc":"Specify a list of templates for the template plugin. They must be comma-separated, and then have the format name:URL:description. For example, MyTemp:assets\/templates\/mytemp.html:My very own template","setting_template_list_snippet":"Template List Snippet","setting_template_list_snippet_desc":"Enter the name of a snippet that will generate a list of templates compatible with the tiny.template_list format (name:URL:description). If a snippet is named, the results returned by the snippet call will be used rather than any value present in tiny.template_list","setting_template_selected_content_classes":"Template Selected Content Classes","setting_template_selected_content_classes_desc":"Specify a list of CSS class names for the template plugin. They must be separated by spaces. Any template element with one of the specified CSS classes will have its content replaced by the selected editor content when first inserted.","setting_theme_advanced_blockformats":"HTML Block Elements","setting_theme_advanced_blockformats_desc":"This option should contain a comma separated list of formats that will be available in the format drop down list. This option is only available if the advanced theme is used.","setting_theme_advanced_font_sizes":"Advanced Theme Font Sizes","setting_theme_advanced_font_sizes_desc":"This option should contain a comma separated list of font sizes to include. Each item in the list should be a valid value for the font-style CSS property (10px, 12pt, 1em, etc.). Example: Big text=30px,Small text=small,My Text Size=.mytextsize","setting_skin":"TinyMCE Skin","setting_skin_desc":"This option enables you to specify what skin you want to use with your theme. A skin is basically a CSS file that gets loaded from the skins directory inside the theme. The advanced theme that TinyMCE comes with has two skins, these are called \"default\" and \"o2k7\". We added another skin named \"cirkuit\" that is chosen by default.","setting_skin_variant":"TinyMCE Skin Variant","setting_skin_variant_desc":"This option enables you to specify a variant for the skin, for example \"silver\" or \"black\". \"default\" skin does not offer any variant, whereas \"o2k7\" default offers \"silver\" or \"black\" variants to the default one. For the \"cirkuit\" skin there's one variant named \"silver\". When creating a skin, additional variants may also be created, by adding ui_[variant_name].css files alongside the default ui.css."};
     #         //]]>
     #         </script>
     #         <script type="text/javascript" src="/public/components/tinymce/tinymce.panel.js?v=233pl"></script>
     #         <script type="text/javascript">
     #         //<![CDATA[
     #         Tiny.config = {"accessibility_warnings":true,"browserUrl":"\/manager\/index.php?a=browser","cleanup":true,"cleanup_on_startup":false,"compressor":"","content_css":"\/css\/style.css","element_list":"","entities":"","execcommand_callback":"Tiny.onExecCommand","file_browser_callback":"Tiny.loadBrowser","force_p_newlines":true,"force_br_newlines":false,"formats":{"alignleft":{"selector":"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img","classes":"justifyleft"},"alignright":{"selector":"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img","classes":"justifyright"},"alignfull":{"selector":"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img","classes":"justifyfull"}},"frontend":false,"height":"400px","plugin_insertdate_dateFormat":"%Y-%m-%d","plugin_insertdate_timeFormat":"%H:%M:%S","preformatted":true,"resizable":true,"relative_urls":true,"remove_script_host":true,"resource_browser_path":"\/manager\/controllers\/browser\/index.php?","template_external_list_url":"\/public\/components\/tinymce\/template.list.php","theme_advanced_disable":"","theme_advanced_resizing":true,"theme_advanced_resize_horizontal":true,"theme_advanced_statusbar_location":"bottom","theme_advanced_toolbar_align":"left","theme_advanced_toolbar_location":"top","width":"95%","apply_source_formatting":true,"button_tile_map":false,"convert_fonts_to_spans":"1","convert_newlines_to_brs":"","convert_urls":true,"dialog_type":"window","directionality":"ltr","element_format":"xhtml","entity_encoding":"xhtml","force_hex_style_colors":true,"indentation":"30px","invalid_elements":"","nowrap":"","object_resizing":"1","path_options":"","remove_linebreaks":"","remove_trailing_nbsp":false,"skin":"cirkuit","skin_variant":"","table_inline_editing":"","template_selected_content_classes":"","theme_advanced_path":true,"editor":"TinyMCE","elements":["ta"],"id":0,"mode":"new","buttons1":"undo,redo,selectall,separator,pastetext,pasteword,separator,search,replace,separator,nonbreaking,hr,charmap,separator,image,modxlink,unlink,anchor,media,separator,cleanup,removeformat,separator,fullscreen,print,code,help","buttons2":"bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect,separator,styleprops","buttons3":"tablecontrols","buttons4":"","buttons5":"","css_path":"\/css\/style.css","fix_nesting":"","fix_table_elements":"","font_size_classes":"","font_size_style_values":"xx-small,x-small,small,medium,large,x-large,xx-large","forced_root_block":"p","language":"ru","plugins":"style,advimage,advlink,modxlink,searchreplace,print,contextmenu,paste,fullscreen,noneditable,nonbreaking,xhtmlxtras,visualchars,media, table","remove_redundant_brs":"1","removeformat_selector":"b,strong,em,i,span,ins","theme":"advanced","theme_advanced_blockformats":"p,h1,h2,h3,h4,h5,h6,div,blockquote,code,pre,address","theme_advanced_buttons1":"undo,redo,selectall,separator,pastetext,pasteword,separator,search,replace,separator,nonbreaking,hr,charmap,separator,image,modxlink,unlink,anchor,media,separator,cleanup,removeformat,separator,fullscreen,print,code,help","theme_advanced_buttons2":"bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect,separator,styleprops","theme_advanced_buttons3":"tablecontrols","theme_advanced_buttons4":"","theme_advanced_buttons5":"","theme_advanced_font_sizes":"80%,90%,100%,120%,140%,160%,180%,220%,260%,320%,400%,500%,700%","theme_advanced_styles":"","use_browser":"1","document_base_url":"\/"};
     #         Tiny.config.setup = function(ed) {
     #             ed.onInit.add(Tiny.onLoad);
     #             ed.onKeyUp.add(Tiny.onChange);
     #             ed.onChange.add(Tiny.onChange);
     #         };
     #         Tiny.templates = [];
     #
     #         Ext.onReady(function() {
     #         });
     #         //]]>
     #         </script>
     #
     # HTML;
     #
     #
     #         $this->addHtml($html);
     $scriptProperties = array();
     require_once $this->modx->getOption('tiny.core_path', null, $this->modx->getOption('core_path') . 'components/tinymce/') . 'tinymce.class.php';
     $tiny = new TinyMCE($this->modx, $scriptProperties);
     $def = $tiny->context->getOption('cultureKey', $tiny->context->getOption('manager_language', 'en'));
     $tiny->properties['language'] = $this->modx->getOption('fe_editor_lang', array(), $def);
     $tiny->properties['frontend'] = true;
     $tiny->setProperties($scriptProperties);
     $tiny->initialize();
 }
if (!defined('MODX_BASE_PATH')) {
    die('What are you doing? Get out of here!');
}
// Set the name of the plugin folder
$plugin_dir = "tinymce";
global $usersettings, $settings;
// Set path and base setting variables
if (!isset($mce_path)) {
    $mce_path = MODX_BASE_PATH . 'assets/plugins/' . $plugin_dir . '/';
    $mce_url = MODX_BASE_URL . 'assets/plugins/' . $plugin_dir . '/';
}
$params = $modx->event->params;
$params['mce_path'] = $mce_path;
$params['mce_url'] = $mce_url;
include_once $mce_path . 'functions.php';
$mce = new TinyMCE($params);
// Handle event
$e =& $modx->event;
switch ($e->name) {
    case "OnRichTextEditorRegister":
        // register only for backend
        $e->output("TinyMCE");
        break;
    case "OnRichTextEditorInit":
        if ($editor !== "TinyMCE") {
            return;
        }
        $params['css_selectors'] = $modx->config['tinymce_css_selectors'];
        $params['use_browser'] = $modx->config['use_browser'];
        $params['editor_css_path'] = $modx->config['editor_css_path'];
        if ($modx->isBackend() || intval($_GET['quickmanagertv']) == 1 && isset($_SESSION['mgrValidated'])) {
Exemple #14
0
function Tiny_MCE_getInstance($field = 'richeditor', $width = '100%', $height = '300px', $value = '')
{
    return TinyMCE::getInstance($field, $width, $height, $value);
}
 private function getTinyMCE($mode)
 {
     $tiny_css = $this->theme_path . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "tiny.css";
     $tiny = new TinyMCE($mode);
     //    $tiny->unsetTinyParam('skin_variant');
     $tiny->setTinyParam('content_css', $tiny_css);
     return $tiny;
 }