function getStyles() { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); wfimport('admin.helpers.extension'); $view = JRequest::getCmd('view', 'cpanel'); $component = WFExtensionHelper::getComponent(); $params = new WFParameter($component->params); $theme = $params->get('preferences.theme', 'jce'); $site_path = JPATH_COMPONENT_SITE . DS . 'editor' . DS . 'libraries' . DS . 'css'; $admin_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'media' . DS . 'css'; // Load styles $styles = array(); if (!JFolder::exists($site_path . DS . 'jquery' . DS . $theme)) { $theme = 'jce'; } if (JFolder::exists($site_path . DS . 'jquery' . DS . $theme)) { $files = JFolder::files($site_path . DS . 'jquery' . DS . $theme, '\\.css'); foreach ($files as $file) { $styles[] = 'components/com_jce/editor/libraries/css/jquery/' . $theme . '/' . $file; } } // admin global css $styles = array_merge($styles, array('administrator/components/com_jce/media/css/global.css')); if (JFile::exists($admin_path . DS . $view . '.css')) { $styles[] = 'administrator/components/com_jce/media/css/' . $view . '.css'; } return $styles; }
public static function getConfig(&$settings) { wfimport('admin.models.editor'); $model = new WFModelEditor(); $wf = WFEditor::getInstance(); $settings['inline_styles'] = $wf->getParam('editor.inline_styles', 1, 1); // Paragraph handling $forced_root_block = $wf->getParam('editor.forced_root_block', '', 'p', 'string', false); // set as boolean if disabled if (is_numeric($forced_root_block)) { $settings['forced_root_block'] = (bool) intval($forced_root_block); if ($wf->getParam('editor.force_br_newlines', 0, 0, 'boolean') === false) { // legacy $settings['force_p_newlines'] = $wf->getParam('editor.force_p_newlines', 1, 0, 'boolean'); } } else { if (strpos($forced_root_block, '|') !== false) { // multiple values foreach (explode('|', $forced_root_block) as $option) { list($key, $value) = explode(':', $option); $settings[$key] = (bool) $value; } } else { $settings['forced_root_block'] = $forced_root_block; } } //$settings['removeformat_selector'] = $wf->getParam('editor.removeformat_selector', 'span,b,strong,em,i,font,u,strike', 'span,b,strong,em,i,font,u,strike'); // Relative urls $settings['relative_urls'] = $wf->getParam('editor.relative_urls', 1, 1, 'boolean'); if ($settings['relative_urls'] == 0) { $settings['remove_script_host'] = false; } }
/** * Check for extension updates * @return String JSON string of updates */ function check() { $result = false; // Get all extensions and version numbers $data = array('task' => 'check', 'jversion' => WF_JOOMLA15 ? '1.5' : '1.7'); wfimport('admin.helpers.extension'); $component = WFExtensionHelper::getComponent(); $params = new WFParameter($component->params, '', 'preferences'); // get update key $key = $params->get('updates_key', ''); $type = $params->get('updates_type', ''); // encode it if (!empty($key)) { $data['key'] = urlencode($key); } if ($type) { $data['type'] = $type; } $req = array(); // create request data foreach ($this->getVersions() as $type => $extension) { foreach ($extension as $item => $value) { $data[$type . '[' . urlencode($item) . ']'] = urlencode($value); } } foreach ($data as $key => $value) { $req[] = $key . '=' . urlencode($value); } // connect $result = $this->connect($this->url, implode('&', $req)); return $result; }
function display($tpl = null) { wfimport('admin.models.updates'); $mainframe = JFactory::getApplication(); $model = $this->getModel(); $installer = WFInstaller::getInstance(); $version = $model->getVersion(); // Check Groups DB if (!$installer->profiles) { $link = JHTML::link('index.php?option=com_jce&task=repair&table=profiles', WFText::_('WF_DB_CREATE_RESTORE')); $mainframe->enqueueMessage(WFText::_('WF_DB_PROFILES_ERROR') . ' - ' . $link, 'error'); } $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $canUpdate = WFModelUpdates::canUpdate(); $options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE'))); $this->document->addScript('components/com_jce/media/js/cpanel.js?version=' . $model->getVersion()); $this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.CPanel.init(' . json_encode($options) . ')});'); WFToolbarHelper::preferences(); WFToolbarHelper::updates($canUpdate); WFToolbarHelper::help('cpanel.about'); $this->assignRef('icons', $icons); $this->assignRef('model', $model); $this->assignRef('installer', $installer); $this->assignRef('params', $params); $this->assignRef('version', $version); parent::display($tpl); }
function display($tpl = null) { wfimport('admin.models.updates'); $mainframe = JFactory::getApplication(); $model = $this->getModel(); $version = $model->getVersion(); $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $canUpdate = WFModelUpdates::canUpdate() && WFModel::authorize('installer'); $options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE'))); JHtml::_('behavior.modal'); $this->addScript('components/com_jce/media/js/cpanel.js'); $this->addScriptDeclaration('jQuery.jce.Cpanel.options = ' . json_encode($options) . ';'); // load styles $this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/cpanel.css'); if (WFModel::authorize('preferences')) { WFToolbarHelper::preferences(); } if (WFModel::authorize('installer')) { WFToolbarHelper::updates($canUpdate); } WFToolbarHelper::help('cpanel.about'); $views = array('config', 'profiles', 'installer', 'browser', 'mediabox'); $icons = array(); foreach ($views as $view) { // check if its allowed... if (WFModel::authorize($view) === false) { continue; } $attribs = array('target="_self"'); $title = 'WF_' . strtoupper($view); $description = 'WF_' . strtoupper($view) . '_DESC'; $link = 'index.php?option=com_jce&view=' . $view; if ($view == 'browser') { $link = WFModel::getBrowserLink(); $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $width = (int) $params->get('browser_width', 790); $height = (int) $params->get('browser_height', 560); if (empty($link)) { continue; } $attribs = array('target="_blank"', 'class="browser"', 'onclick="Joomla.modal(this, \'' . $link . '\', ' . $width . ', ' . $height . ');return false;"'); $title = 'WF_' . strtoupper($view) . '_TITLE'; $description = 'WF_CPANEL_' . strtoupper($view); } // if its mediabox, check the plugin is installed and enabled if ($view == 'mediabox' && !JPluginHelper::isEnabled('system', 'jcemediabox')) { continue; } $icons[] = '<li class="cpanel-icon wf-tooltip" title="' . WFText::_($title) . '::' . WFText::_($description) . '"><a id="wf-browser-link" href="' . $link . '"' . implode(' ', $attribs) . '><span class="' . $view . '"></span>' . WFText::_($title) . '</a></li>'; } $this->assign('icons', $icons); $this->assign('model', $model); $this->assign('params', $params); $this->assign('version', $version); parent::display($tpl); }
public static function getConfig(&$settings) { $wf = WFEditor::getInstance(); wfimport('admin.models.editor'); $model = new WFModelEditor(); $tags = array(); if ($wf->getParam('media.iframes', 0)) { $tags[] = 'iframe'; } if ($wf->getParam('media.audio', 1)) { $tags[] = 'audio'; } if ($wf->getParam('media.video', 1)) { $tags[] = 'video'; } if (in_array('audio', $tags) || in_array('video', $tags)) { $tags[] = 'source'; } if ($wf->getParam('media.embed', 1)) { $tags[] = 'embed'; } if ($wf->getParam('media.object', 1)) { $tags[] = 'object'; $tags[] = 'param'; } $model->removeKeys($settings['invalid_elements'], $tags); $settings['media_strict'] = $wf->getParam('media.strict', 1, 1); $settings['media_version_flash'] = $wf->getParam('media.version_flash', '10,1,53,64', '10,1,53,64'); $settings['media_version_windowsmedia'] = $wf->getParam('media.version_windowsmedia', '10,00,00,3646', '10,00,00,3646'); $settings['media_version_shockwave'] = $wf->getParam('media.version_shockwave', '10,2,0,023', '10,2,0,023'); $settings['media_version_quicktime'] = $wf->getParam('media.version_quicktime', '7,3,0,0', '7,3,0,0'); $settings['media_version_java'] = $wf->getParam('media.version_java', '1,5,0,0', '1,5,0,0'); }
public static function getConfig(&$settings) { wfimport('admin.models.editor'); $model = new WFModelEditor(); $wf = WFEditor::getInstance(); $settings['inline_styles'] = $wf->getParam('editor.inline_styles', 1, 1); // Paragraph handling $settings['forced_root_block'] = $wf->getParam('editor.forced_root_block', 'p', '', false); // set as boolean if disabled if (is_numeric($settings['forced_root_block'])) { $settings['forced_root_block'] = (bool) $settings['forced_root_block']; if ($wf->getParam('editor.force_br_newlines', 0, 0, 'boolean') === false) { // legacy $settings['force_p_newlines'] = $wf->getParam('editor.force_p_newlines', 1, 0, 'boolean'); } } if (strpos($settings['forced_root_block'], '|') !== false) { // multiple values $values = explode('|', $settings['forced_root_block']); foreach ($values as $value) { $kv = explode(':', $value); if (count($kv) == 2) { $settings[$kv[0]] = (bool) $kv[1]; } else { $settings['forced_root_block'] = (bool) $kv[0]; } } } $settings['removeformat_selector'] = $wf->getParam('editor.removeformat_selector', 'span,b,strong,em,i,font,u,strike', 'span,b,strong,em,i,font,u,strike'); // Relative urls $settings['relative_urls'] = $wf->getParam('editor.relative_urls', 1, 1, 'boolean'); if ($settings['relative_urls'] == 0) { $settings['remove_script_host'] = false; } }
function compile() { WFToken::checkToken() or die('RESTRICTED ACCESS'); wfimport('admin.classes.packer'); $base = dirname(dirname(__FILE__)); $editor = JRequest::getWord('editor', 'codemirror'); $theme = JRequest::getWord('theme', 'textmate'); switch (JRequest::getWord('type', 'base')) { case 'base': $files = array(); $files[] = $base . DS . 'js' . DS . 'codemirror' . DS . 'base.js'; $type = 'javsacript'; break; case 'parser': $files = array(); $files[] = $base . DS . 'js' . DS . 'codemirror' . DS . 'parser.js'; // javascript $type = 'javsacript'; break; case 'css': $path = $base . DS . 'css' . DS . 'codemirror'; $files = array($path . DS . 'editor.css', $path . DS . 'theme' . DS . $theme . '.css'); $type = 'css'; break; } $packer = new WFPacker(array('type' => $type)); // set files $packer->setFiles($files); // pack! $packer->pack(true, $this->getParam('editor.compress_gzip', 0)); }
public function execute($task) { // Load language $language = JFactory::getLanguage(); $language->load('com_jce', JPATH_ADMINISTRATOR); $layout = JRequest::getCmd('layout'); $plugin = JRequest::getCmd('plugin'); if ($layout) { switch ($layout) { case 'editor': if ($task == 'pack' || $task == 'loadlanguages') { wfimport('admin.models.editor'); $model = new WFModelEditor(); if ($task == 'loadlanguages') { $model->loadLanguages(); } else { $model->pack(); } } break; case 'plugin': $file = basename(JRequest::getCmd('file', $plugin)); $path = WF_EDITOR_PLUGINS . '/' . $plugin; if (is_dir($path) && file_exists($path . '/' . $file . '.php')) { include_once $path . '/' . $file . '.php'; } else { throw new InvalidArgumentException('File ' . $file . ' not found!'); } break; } exit; } else { throw new InvalidArgumentException('No Layout'); } }
public static function getConfig(&$settings) { $wf = WFEditor::getInstance(); wfimport('admin.models.editor'); $model = new WFModelEditor(); $settings['cleanup_pluginmode'] = $wf->getParam('cleanup.pluginmode', 0, 0, 'boolean'); $settings['verify_html'] = $wf->getParam('editor.verify_html', 0, 1, 'boolean'); // set schema $settings['schema'] = $wf->getParam('editor.schema', 'html4', 'html4'); // Get Extended elements $settings['extended_valid_elements'] = $wf->getParam('editor.extended_elements', '', ''); // Configuration list of invalid elements as array $settings['invalid_elements'] = explode(',', $wf->getParam('editor.invalid_elements', '', '')); // Add elements to invalid list (removed by plugin) $model->addKeys($settings['invalid_elements'], self::$invalid_elements); // remove extended_valid_elements if ($settings['extended_valid_elements']) { preg_match_all('#(\\w+)(\\[([^\\]]+)\\])?#', $settings['extended_valid_elements'], $extended); if ($extended && count($extended) > 1) { $settings['invalid_elements'] = array_diff($settings['invalid_elements'], $extended[1]); } } // remove it if it is the same as the default if ($settings['invalid_elements'] === self::$invalid_elements) { $settings['invalid_elements'] = array(); } $settings['invalid_attributes'] = $wf->getParam('editor.invalid_attributes', 'dynsrc,lowsrc', 'dynsrc,lowsrc', 'string', true); $settings['invalid_attribute_values'] = $wf->getParam('editor.invalid_attribute_values', '', '', 'string', true); }
public static function getConfig(&$settings) { require_once(dirname(__FILE__) . '/filemanager.php'); // set plugin JRequest::setVar('plugin', 'filemanager'); $plugin = new WFFileManagerPlugin(); if ($plugin->getParam('inline_upload', $plugin->getParam('dragdrop_upload', 1, 0), 0)) { // backwards compatability if (method_exists($plugin, 'getFileTypes')) { $types = $plugin->getFileTypes(); } else { $settings['filemanager_dragdrop_upload'] = true; $types = $plugin->getBrowser()->getFileSystem()->get('filetypes'); } $settings['filemanager_upload'] = json_encode(array( 'max_size' => $plugin->getParam('max_size', 1024), 'filetypes' => $types )); } // remove iframe if we have enabled google docs stuff if ($plugin->getParam('googledocs_enable', 1)) { wfimport('admin.models.editor'); $model = new WFModelEditor(); $model->removeKeys($settings['invalid_elements'], array('iframe')); } }
/** * Display Preview content * @return void */ public function showPreview() { $db = JFactory::getDBO(); $user = JFactory::getUser(); $dispatcher = JDispatcher::getInstance(); $language = JFactory::getLanguage(); // reset document type $document =& JFactory::getDocument(); $document->setType('html'); // required by module loadposition jimport('joomla.application.module.helper'); wfimport('admin.helpers.extension'); // Get variables $component_id = JRequest::getInt('component_id'); // get post data $data = JRequest::getVar('data', '', 'POST', 'STRING', JREQUEST_ALLOWRAW); // cleanup data $data = preg_replace(array('#<!DOCTYPE([^>]+)>#i', '#<(head|title|meta)([^>]*)>([\\w\\W]+)<\\/1>#i', '#<\\/?(html|body)([^>]*)>#i'), '', rawurldecode($data)); $component = WFExtensionHelper::getComponent($component_id); $params = new JParameter($component->params); $article = JTable::getInstance('content'); $article->id = 0; $article->created_by = $user->get('id'); $article->parameters = new JParameter(''); $article->text = $data; $limitstart = 0; JPluginHelper::importPlugin('content'); require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php'; // set error reporting to error only error_reporting(E_ERROR); $dispatcher->trigger('onPrepareContent', array(&$article, &$params, $limitstart)); $this->processURLS($article); return $article->text; }
public function fetchElement($name, $value, &$node, $control_name) { jimport('joomla.plugin.helper'); wfimport('admin.helpers.extension'); $language = JFactory::getLanguage(); $plugins = JPluginHelper::getPlugin('search'); // use tested defaults if (!$value) { $value = array('categories', 'contacts', 'content', 'newsfeeds', 'weblinks'); } else { $value = (array) $value; } //$html = '<span style="display:inline-block;"><input class="checkbox-list-toggle-all" type="checkbox"'. $checked .' /><label>'. WFText::_('WF_PROFILES_TOGGLE_ALL') . '</label>'; $html = '<span style="display:inline-block;" data-parent="' . preg_replace(array('#^params#', '#([^\\w]+)#'), '', $control_name) . $node->attributes()->parent . '"><ul class="checkbox-list">'; foreach ($plugins as $item) { $plugin = WFExtensionHelper::getPlugin(null, $item->name, 'search'); $extension = 'plg_' . $plugin->folder . '_' . $plugin->element; $language->load($extension) || $language->load($extension, JPATH_ADMINISTRATOR); $language->load($extension . '.sys') || $language->load($extension . '.sys', JPATH_ADMINISTRATOR); $checked = in_array($plugin->element, $value) ? ' checked="checked"' : ''; $html .= '<li><input type="checkbox" name="' . $control_name . '[' . $name . '][]" value="' . $plugin->element . '"' . $checked . ' /><label>' . JText::_($plugin->name) . '</label></li>'; } $html .= '</ul></span>'; return $html; }
function display($tpl = null) { wfimport('admin.models.updates'); $mainframe = JFactory::getApplication(); $model = $this->getModel(); $version = $model->getVersion(); $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $canUpdate = WFModelUpdates::canUpdate() && $model->authorize('installer'); $options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE'))); $this->document->addScript('components/com_jce/media/js/cpanel.js?version=' . $model->getVersion()); $this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.CPanel.init(' . json_encode($options) . ')});'); if ($model->authorize('preferences')) { WFToolbarHelper::preferences(); } if ($model->authorize('installer')) { WFToolbarHelper::updates($canUpdate); } WFToolbarHelper::help('cpanel.about'); $this->assignRef('icons', $icons); $this->assignRef('model', $model); $this->assignRef('installer', $installer); $this->assignRef('params', $params); $this->assignRef('version', $version); parent::display($tpl); }
public static function getConfig(&$settings) { $wf = WFEditor::getInstance(); wfimport('admin.models.editor'); $model = new WFModelEditor(); // Encoding $settings['entity_encoding'] = $wf->getParam('editor.entity_encoding'); // keep $nbsp = (bool) $wf->getParam('editor.keep_nbsp', 1); // use named encoding with limited entities set if raw/utf-8 and keep_nbsp === true if ($settings['entity_encoding'] === 'raw' && $nbsp) { $settings['entity_encoding'] = ''; $settings['entities'] = '160,nbsp,173,shy'; } // set "plugin mode" $settings['cleanup_pluginmode'] = $wf->getParam('editor.cleanup_pluginmode', 0, 0); // get verify html (default is true) $settings['verify_html'] = $wf->getParam('editor.verify_html', 1, 1, 'boolean', false); $settings['pad_empty_tags'] = $wf->getParam('editor.pad_empty_tags', 1, 1, 'boolean'); // set schema $settings['schema'] = $wf->getParam('editor.schema', 'mixed'); if ($settings['schema'] === "html5") { $settings['schema'] = "html5-strict"; } // Get Extended elements $settings['extended_valid_elements'] = $wf->getParam('editor.extended_elements', '', ''); // Configuration list of invalid elements as array $settings['invalid_elements'] = explode(',', preg_replace('#\\s+#', '', $wf->getParam('editor.invalid_elements', '', ''))); // Add elements to invalid list (removed by plugin) $model->addKeys($settings['invalid_elements'], self::$invalid_elements); // process extended_valid_elements if ($settings['extended_valid_elements']) { $extended_elements = explode(',', $settings['extended_valid_elements']); $elements = array(); // add wildcard attributes if none specified for ($i = 0; $i < count($extended_elements); $i++) { $pos = strpos($extended_elements[$i], '['); if ($pos === false) { $elements[] = $extended_elements[$i]; $extended_elements[$i] .= '[*]'; } else { $elements[] = substr($extended_elements[$i], 0, $pos); } } // restore settings to array $settings['extended_valid_elements'] = implode(',', $extended_elements); if (!empty($elements)) { $settings['invalid_elements'] = array_diff($settings['invalid_elements'], $elements); } } // remove it if it is the same as the default if ($settings['invalid_elements'] === self::$invalid_elements) { $settings['invalid_elements'] = array(); } $settings['invalid_attributes'] = $wf->getParam('editor.invalid_attributes', 'dynsrc,lowsrc', 'dynsrc,lowsrc', 'string', true); $settings['invalid_attribute_values'] = $wf->getParam('editor.invalid_attribute_values', '', '', 'string', true); }
public static function getConfig(&$settings) { wfimport('admin.models.editor'); $model = new WFModelEditor(); $wf = WFEditor::getInstance(); $include = (array) $wf->getParam('styleselect.styles', array('stylesheet', 'custom')); if (in_array('custom', $include)) { // theme styles list (legacy) $theme_advanced_styles = $wf->getParam('editor.theme_advanced_styles', ''); // list of custom styles $custom_classes = $wf->getParam('styleselect.custom_classes', ''); if (!empty($custom_classes)) { $settings['styleselect_custom_classes'] = $custom_classes; } // add legacy to custom_style_classes if (!empty($theme_advanced_styles)) { $list1 = explode(",", $custom_classes); $list2 = explode(",", $theme_advanced_styles); $settings['styleselect_custom_classes'] = implode(",", array_merge($list1, $list2)); } $custom_styles = json_decode($wf->getParam('styleselect.custom_styles', $wf->getParam('editor.custom_styles', ''))); if (!empty($custom_styles)) { $styles = array(); $blocks = array('section', 'nav', 'article', 'aside', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'footer', 'address', 'main', 'p', 'pre', 'blockquote', 'figure', 'figcaption', 'div'); foreach ((array) $custom_styles as $style) { if (isset($style->styles)) { $style->styles = self::cleanJSON($style->styles); } if (isset($style->attributes)) { $style->attributes = self::cleanJSON($style->attributes, " ", "="); } if (!isset($style->element)) { $style->element = 'span'; if (!isset($style->selector)) { $style->selector = '*'; } } if (in_array($style->element, $blocks)) { $style->block = $style->element; } else { $style->inline = $style->element; } // remove $style->remove = "all"; $styles[] = $style; } if (!empty($styles)) { $settings['style_formats'] = htmlentities(json_encode($styles), ENT_NOQUOTES, "UTF-8"); } } } // set this value false if stylesheet not included if (in_array('stylesheet', $include) === false) { $settings['styleselect_stylesheet'] = false; } }
/** * Custom Constructor */ public function __construct($default = array()) { parent::__construct($default); $this->registerTask('apply', 'save'); $this->registerTask('unpublish', 'publish'); // load helpers wfimport('admin.helpers.parameter'); wfimport('admin.helpers.extension'); wfimport('admin.helpers.xml'); }
/** * Display Preview content * @return void */ public function showPreview() { $db = JFactory::getDBO(); $user = JFactory::getUser(); $dispatcher = JDispatcher::getInstance(); $language = JFactory::getLanguage(); // reset document type $document =& JFactory::getDocument(); $document->setType('html'); // required by module loadposition jimport('joomla.application.module.helper'); // load paramter class jimport('joomla.html.parameter'); wfimport('admin.helpers.extension'); // Get variables $component_id = JRequest::getInt('component_id'); // get post data $data = JRequest::getVar('data', '', 'POST', 'STRING', JREQUEST_ALLOWRAW); // cleanup data $data = preg_replace(array('#<!DOCTYPE([^>]+)>#i', '#<(head|title|meta)([^>]*)>([\\w\\W]+)<\\/1>#i', '#<\\/?(html|body)([^>]*)>#i'), '', rawurldecode($data)); $component = WFExtensionHelper::getComponent($component_id); // create params registry object $params = new JRegistry(); // create empty params string if (!isset($component->params)) { $component->params = ''; } // process attribs (com_content etc.) if ($component->attribs) { $params->loadString($component->attribs); } else { if (class_exists('JParameter')) { $params = new JParameter($component->params); } else { $params->loadString($component->params); } } $article = JTable::getInstance('content'); $article->id = 0; $article->created_by = $user->get('id'); $article->parameters = new JRegistry(); $article->text = $data; // allow this to be skipped as some plugins can cause FATAL errors. if ((bool) $this->getParam('process_content', 1)) { $limitstart = 0; JPluginHelper::importPlugin('content'); require_once JPATH_SITE . '/components/com_content/helpers/route.php'; // set error reporting to error only error_reporting(E_ERROR); $dispatcher->trigger('onPrepareContent', array(&$article, &$params, $limitstart)); } $this->processURLS($article); return $article->text; }
/** * Custom Constructor */ function __construct($default = array()) { parent::__construct($default); $view = JRequest::getWord('view', 'cpanel'); $this->registerTask('apply', 'save'); $this->registerTask('unpublish', 'publish'); // load classes wfimport('admin.classes.installer'); // load helpers wfimport('admin.helpers.parameter'); wfimport('admin.helpers.extension'); wfimport('admin.helpers.xml'); $document = JFactory::getDocument(); $document->setTitle(WFText::_('WF_ADMINISTRATION') . ' :: ' . WFText::_('WF_' . strtoupper($view))); $language = JFactory::getLanguage(); $language->load('com_jce', JPATH_ADMINISTRATOR); $model = $this->getModel($view); // jquery versions $document->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/jquery/jquery-' . WF_JQUERY . '.min.js?version=' . $model->getVersion()); $document->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/jquery/jquery-ui-' . WF_JQUERYUI . '.custom.min.js?version=' . $model->getVersion()); // jQuery noConflict $document->addScriptDeclaration('jQuery.noConflict();'); $scripts = array(); switch ($view) { case 'help': $scripts[] = 'help.js'; break; default: // load Joomla! core javascript if (method_exists('JHtml', 'core')) { JHtml::core(); } require_once JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'toolbar.php'; JToolBarHelper::title(WFText::_('WF_ADMINISTRATION') . ' ›› ' . WFText::_('WF_' . strtoupper($view)), 'logo.png'); $params = WFParameterHelper::getComponentParams(); $theme = $params->get('preferences.theme', 'jce'); $scripts = array_merge(array('tips.js', 'html5.js')); // Load admin scripts $document->addScript(JURI::root(true) . '/administrator/components/com_jce/media/js/jce.js?version=' . $model->getVersion()); $options = array('labels' => array('ok' => WFText::_('WF_LABEL_OK'), 'cancel' => WFText::_('WF_LABEL_CANCEL'), 'select' => WFText::_('WF_LABEL_SELECT'), 'save' => WFText::_('WF_LABEL_SAVE'), 'saveclose' => WFText::_('WF_LABEL_SAVECLOSE'), 'alert' => WFText::_('WF_LABEL_ALERT'), 'required' => WFText::_('WF_MESSAGE_REQUIRED'))); $document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.init(' . json_encode($options) . ');});'); $installer = WFInstaller::getInstance(); $installer->check(); break; } // Load site scripts foreach ($scripts as $script) { $document->addScript(JURI::root(true) . '/components/com_jce/editor/libraries/js/' . $script . '?version=' . $model->getVersion()); } require_once dirname(__FILE__) . DS . 'helpers' . DS . 'system.php'; $app = JFactory::getApplication(); $app->registerEvent('onAfterRender', 'WFSystemHelper'); }
function fetchElement($name, $value, &$node, $control_name) { $attributes = array(); foreach ($node->attributes() as $k => $v) { if ($v != '') { $attributes[$k] = (string) $v; } } /* * Required to avoid a cycle of encoding & * html_entity_decode was used in place of htmlspecialchars_decode because * htmlspecialchars_decode is not compatible with PHP 4 */ $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES); $attributes['class'] = (string) $node->attributes()->class ? (string) $node->attributes()->class . ' text_area' : 'text_area'; $control = $control_name . '[' . $name . ']'; $html = ''; $attributes['value'] = $value; $attributes['type'] = 'text'; $attributes['name'] = $control; $attributes['id'] = preg_replace('#[^a-z0-9_-]#i', '', $control_name . $name); // pattern data attribute for editable select input box if ((string) $node->attributes()->parent) { $prefix = preg_replace(array('#^params#', '#([^\\w]+)#'), '', $control_name); $items = array(); foreach (explode(';', (string) $node->attributes()->parent) as $item) { $items[] = $prefix . $item; } $attributes['data-parent'] = implode(';', $items); } $filter = isset($attributes['data-filter']) ? $attributes['data-filter'] : ''; $html .= '<input'; foreach ($attributes as $k => $v) { if (!in_array($k, array('default', 'label', 'description'))) { $html .= ' ' . $k . ' = "' . $v . '"'; } } $html .= ' />'; $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $width = (int) $params->get('browser_width', 780); $height = (int) $params->get('browser_height', 560); wfimport('admin.models.model'); $model = new WFModel(); $link = $model->getBrowserLink($attributes['id'], $filter); $html .= '<a href="' . $link . '" id="' . $attributes['id'] . '_browser' . '" class="browser" target="_blank" onclick="Joomla.modal(this, \'' . $link . '\', ' . $width . ', ' . $height . ');return false;" title="' . WFText::_('WF_BROWSER_TITLE') . '"><span class="browser"></span></a>'; return $html; }
public static function getConfig(&$settings) { wfimport('admin.models.editor'); $model = new WFModelEditor(); $wf = WFEditor::getInstance(); // html5 block elements $html5 = array('section', 'article', 'aside', 'figure'); // get current schema $schema = $wf->getParam('editor.schema', 'html4'); $verify = (bool) $wf->getParam('editor.verify_html', 0); $legacy = $wf->getParam('editor.theme_advanced_blockformats'); $default = 'p,div,address,pre,h1,h2,h3,h4,h5,h6,code,samp,span,section,article,aside,figure,dt,dd'; // get blockformats from parameter $blockformats = $wf->getParam('formatselect.blockformats', $default, $default); // handle empty list if (empty($blockformats)) { if (!empty($legacy)) { $blockformats = $legacy; } else { $blockformats = $default; } } $list = array(); $blocks = array(); // make an array if (is_string($blockformats)) { $blockformats = explode(',', $blockformats); } // create label / value list using default foreach ($blockformats as $v) { if (array_key_exists($v, self::$formats)) { $key = self::$formats[$v]; } // skip html5 blocks for html4 schema if ($verify && $schema == 'html4' && in_array($v, $html5)) { continue; } if (isset($key)) { $list[$key] = $v; } $blocks[] = $v; // add div container if ($v === 'div') { $list['advanced.div_container'] = 'div_container'; } } // Format list / Remove Format $settings['formatselect_blockformats'] = json_encode($list); }
protected static function check($tag) { $file = JPATH_SITE . '/language/' . $tag . '/' . $tag . '.com_jce.xml'; if (file_exists($file)) { wfimport('admin.classes.xml'); $xml = WFXMLElement::load($file); if ($xml) { $version = (string) $xml->attributes()->version; if ($version == '2.0') { return true; } } } return false; }
public function getPlugins($plugins = array()) { wfimport('admin.models.plugins'); $model = new WFModelplugins(); $commands = array(); if (empty($plugins)) { $commands = $model->getCommands(); } // only need plugins with xml files foreach ($model->getPlugins() as $plugin => $properties) { if (is_file(JPATH_SITE . $properties->path . '/' . $plugin . '.xml')) { $plugins[$plugin] = $properties; } } return array_merge($commands, $plugins); }
function fetchElement($name, $value, &$node, $control_name) { $attributes = array(); foreach ($node->attributes() as $k => $v) { if ($v != '') { $attributes[$k] = (string) $v; } } /* * Required to avoid a cycle of encoding & * html_entity_decode was used in place of htmlspecialchars_decode because * htmlspecialchars_decode is not compatible with PHP 4 */ $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES); $attributes['class'] = (string) $node->attributes()->class ? (string) $node->attributes()->class . ' text_area' : 'text_area'; $control = $control_name . '[' . $name . ']'; $html = ''; $attributes['value'] = $value; $attributes['type'] = 'text'; $attributes['name'] = $control; $attributes['id'] = preg_replace('#[^a-z0-9_-]#i', '', $control_name . $name); // pattern data attribute for editable select input box if ((string) $node->attributes()->parent) { $prefix = preg_replace(array('#^params#', '#([^\\w]+)#'), '', $control_name); $items = array(); foreach (explode(';', (string) $node->attributes()->parent) as $item) { $items[] = $prefix . $item; } $attributes['data-parent'] = implode(';', $items); } $filter = isset($attributes['data-filter']) ? $attributes['data-filter'] : ''; $html .= '<input'; foreach ($attributes as $k => $v) { if (!in_array($k, array('default', 'label', 'description'))) { $html .= ' ' . $k . ' = "' . $v . '"'; } } $html .= ' />'; $options = array('width' => 780, 'height' => 560, 'modal' => true, 'id' => $attributes['id'] . '_browser'); wfimport('admin.models.model'); $model = new WFModel(); $html .= '<a href="' . $model->getBrowserLink($attributes['id'], $filter) . '" class="dialog browser" target="_blank" data-options="' . str_replace('"', "'", json_encode($options)) . '" title="' . WFText::_('WF_BROWSER_TITLE') . '"><span class="browser"></span></a>'; return $html; }
public static function getConfig(&$settings) { $wf = WFEditor::getInstance(); wfimport('admin.models.editor'); $model = new WFModelEditor(); // Encoding $settings['entity_encoding'] = $wf->getParam('editor.entity_encoding'); // keep $nbsp = (bool) $wf->getParam('editor.keep_nbsp', 1); // use named encoding with limited entities set if raw/utf-8 and keep_nbsp === true if ($settings['entity_encoding'] === 'raw' && $nbsp) { $settings['entity_encoding'] = ''; $settings['entities'] = '160,nbsp,173,shy'; } // set "plugin mode" $settings['cleanup_pluginmode'] = $wf->getParam('editor.cleanup_pluginmode', 0, 0); // get verify html (default is true) $settings['verify_html'] = $wf->getParam('editor.verify_html', 1, 1, 'boolean', false); $settings['pad_empty_tags'] = $wf->getParam('editor.pad_empty_tags', 1, 1, 'boolean'); // set schema $settings['schema'] = $wf->getParam('editor.schema', 'mixed'); if ($settings['schema'] === "html5") { $settings['schema'] = "html5-strict"; } // Get Extended elements $settings['extended_valid_elements'] = $wf->getParam('editor.extended_elements', '', ''); // Configuration list of invalid elements as array $settings['invalid_elements'] = explode(',', preg_replace('#\\s+#', '', $wf->getParam('editor.invalid_elements', '', ''))); // Add elements to invalid list (removed by plugin) $model->addKeys($settings['invalid_elements'], self::$invalid_elements); // remove extended_valid_elements if ($settings['extended_valid_elements']) { preg_match_all('#(\\w+)(\\[([^\\]]+)\\])?#', $settings['extended_valid_elements'], $extended); if ($extended && count($extended) > 1) { $settings['invalid_elements'] = array_diff($settings['invalid_elements'], $extended[1]); } } // remove it if it is the same as the default if ($settings['invalid_elements'] === self::$invalid_elements) { $settings['invalid_elements'] = array(); } $settings['invalid_attributes'] = $wf->getParam('editor.invalid_attributes', 'dynsrc,lowsrc', 'dynsrc,lowsrc', 'string', true); $settings['invalid_attribute_values'] = $wf->getParam('editor.invalid_attribute_values', '', '', 'string', true); }
/** * Method to handle the onInit event. * - Initializes the JCE WYSIWYG Editor * * @access public * @param $toString Return javascript and css as a string * @return string JavaScript Initialization string * @since 1.5 */ public function onInit() { $app = JFactory::getApplication(); $language = JFactory::getLanguage(); $document = JFactory::getDocument(); // set IE mode //$document->setMetaData('X-UA-Compatible', 'IE=Edge', true); // Check for existence of Admin Component if (!is_dir(JPATH_SITE . '/components/com_jce') || !is_dir(JPATH_ADMINISTRATOR . '/components/com_jce')) { JError::raiseWarning('SOME_ERROR_CODE', 'WF_COMPONENT_MISSING'); } $language->load('plg_editors_jce', JPATH_ADMINISTRATOR); $language->load('com_jce', JPATH_ADMINISTRATOR); // load constants and loader require_once JPATH_ADMINISTRATOR . '/components/com_jce/includes/base.php'; wfimport('admin.models.editor'); $model = new WFModelEditor(); return $model->buildEditor(); }
function display($tpl = null) { $db = JFactory::getDBO(); $lang = JFactory::getLanguage(); $lang->load('plg_system_jcemediabox'); $client = JRequest::getWord('client', 'site'); $model = $this->getModel(); $plugin = JPluginHelper::getPlugin('system', 'jcemediabox'); $params = $this->getParams($plugin->params); $this->assign('params', $params); $this->assign('client', $client); wfimport('admin.models.editor'); $options = array('stylesheets' => (array) WFModelEditor::getStyleSheets(), 'labels' => array('picker' => WFText::_('WF_COLORPICKER_PICKER'), 'palette' => WFText::_('WF_COLORPICKER_PALETTE'), 'named' => WFText::_('WF_COLORPICKER_NAMED'), 'template' => WFText::_('WF_COLORPICKER_TEMPLATE'), 'color' => WFText::_('WF_COLORPICKER_COLOR'), 'apply' => WFText::_('WF_COLORPICKER_APPLY'), 'name' => WFText::_('WF_COLORPICKER_NAME')), 'parent' => '#jce'); $this->addScriptDeclaration('jQuery(document).ready(function($){$("input.color").colorpicker(' . json_encode($options) . ');});'); WFToolbarHelper::apply(); WFToolbarHelper::save(); WFToolbarHelper::help('mediabox.config'); parent::display($tpl); }
public static function getConfig(&$settings) { // Get JContentEditor instance wfimport('admin.models.editor'); $model = new WFModelEditor(); $wf = WFEditor::getInstance(); if (!in_array('code', $settings['plugins'])) { $settings['plugins'][] = 'code'; } $settings['code_php'] = $wf->getParam('editor.allow_php', 0, 0, 'boolean'); $settings['code_script'] = $wf->getParam('editor.allow_javascript', 0, 0, 'boolean'); $settings['code_style'] = $wf->getParam('editor.allow_css', 0, 0, 'boolean'); $settings['code_cdata'] = $wf->getParam('editor.cdata', 1, 1, 'boolean'); // Invalid Elements if ($settings['code_script']) { $model->removeKeys($settings['invalid_elements'], 'script'); } if ($settings['code_style']) { $model->removeKeys($settings['invalid_elements'], 'style'); } }
function display($tpl = null) { wfimport('admin.models.updates'); $app = JFactory::getApplication(); $model = $this->getModel(); $state = $model->getState(); $layout = JRequest::getWord('layout', 'install'); $plugins = ''; $extensions = ''; $languages = ''; JHtml::_('behavior.modal'); if (WFModel::authorize('uninstall')) { WFToolbarHelper::deleteList('', 'remove', 'WF_INSTALLER_UNINSTALL'); } WFToolbarHelper::updates(WFModelUpdates::canUpdate()); WFToolbarHelper::help('installer.about'); $options = array('extensions' => array('zip', 'tar', 'gz', 'gzip', 'tgz', 'tbz2', 'bz2', 'bzip2'), 'width' => 300, 'button' => 'install_button', 'task' => 'install', 'iframe' => false, 'labels' => array('browse' => WFText::_('WF_LABEL_BROWSE'), 'alert' => WFText::_('WF_INSTALLER_FILETYPE_ERROR'))); $this->addScript('components/com_jce/media/js/installer.js'); $this->addScript('components/com_jce/media/js/uploads.js'); $this->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Installer.init(' . json_encode($options) . ');});'); // load styles $this->addStyleSheet(JURI::root(true) . '/administrator/components/com_jce/media/css/installer.css'); $state->set('install.directory', $app->getCfg('tmp_path')); $plugins = $model->getPlugins(); $extensions = $model->getExtensions(); $languages = $model->getLanguages(); $related = $model->getRelated(); $this->assign('plugins', $plugins); $this->assign('extensions', $extensions); $this->assign('languages', $languages); $this->assign('related', $related); $result = $state->get('install.result'); $this->assign('showMessage', count($result)); $this->assign('model', $model); $this->assign('state', $state); $ftp = JClientHelper::setCredentialsFromRequest('ftp'); $this->assign('ftp', $ftp); $this->setLayout($layout); parent::display($tpl); }
function display($tpl = null) { wfimport('admin.models.updates'); $mainframe = JFactory::getApplication(); $model = $this->getModel(); $state = $this->get('State'); $layout = JRequest::getWord('layout', 'install'); // Set toolbar items for the page //JToolBarHelper::title(WFText::_('WF_INSTALLER_TITLE').' : '.WFText::_('WF_INSTALLER_'.$layout), 'install.png'); // Are there messages to display ? $showMessage = false; $plugins = ''; $extensions = ''; $languages = ''; WFToolbarHelper::updates(WFModelUpdates::canUpdate()); WFToolbarHelper::help('installer.about'); $options = array('extensions' => array('zip', 'tar', 'gz', 'gzip', 'tgz', 'tbz2', 'bz2', 'bzip2'), 'width' => 300, 'button' => 'install_button', 'task' => 'install', 'iframe' => false, 'labels' => array('browse' => WFText::_('WF_LABEL_BROWSE'), 'alert' => WFText::_('WF_INSTALLER_FILETYPE_ERROR'))); $this->document->addScript('components/com_jce/media/js/installer.js?version=' . $model->getVersion()); $this->document->addScript('components/com_jce/media/js/uploads.js?version=' . $model->getVersion()); $this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.Installer.init({});$(":file").upload(' . json_encode($options) . ')});'); $state->set('install.directory', $mainframe->getCfg('config.tmp_path')); $plugins = $model->getPlugins(); $extensions = $model->getExtensions(); $languages = $model->getLanguages(); $related = $model->getRelated(); //$discover = $model->findPlugins(); //$this->assignRef('discover', $discover); $this->assignRef('plugins', $plugins); $this->assignRef('extensions', $extensions); $this->assignRef('languages', $languages); $this->assignRef('related', $related); $result = $state->get('result'); $this->assign('showMessage', count($result)); $this->assignRef('model', $model); $this->assignRef('state', $state); $ftp = JClientHelper::setCredentialsFromRequest('ftp'); $this->assignRef('ftp', $ftp); $this->setLayout($layout); parent::display($tpl); }