本文整理汇总了PHP中WFModelEditor类的典型用法代码示例。如果您正苦于以下问题:PHP WFModelEditor类的具体用法?PHP WFModelEditor怎么用?PHP WFModelEditor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WFModelEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfig
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');
}
示例2: execute
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');
}
}
示例3: getConfig
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);
}
示例4: getConfig
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'));
}
}
示例5: getConfig
public static function getConfig(&$settings)
{
$wf = WFEditor::getInstance();
$model = new WFModelEditor();
if ($wf->getParam('mediamanager.aggregator.youtube.enable', 1) || $wf->getParam('mediamanager.aggregator.vimeo.enable', 1)) {
$model->removeKeys($settings['invalid_elements'], array('iframe'));
}
}
示例6: getConfig
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);
}
示例7: getConfig
public static function getConfig(&$settings)
{
$wf = WFEditor::getInstance();
$model = new WFModelEditor();
$doctypes = array('XHTML 1.0 Transitional' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', 'XHTML 1.0 Frameset' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">', 'XHTML 1.0 Strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', 'XHTML 1.1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', 'HTML 4.01 Transitional' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', 'HTML 4.01 Strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', 'HTML 4.01 Frameset' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">', 'HTML 5' => '<!DOCTYPE HTML>');
$doctype = $wf->getParam('fullpage.default_doctype', 'HTML 4.01 Transitional', 'HTML 4.01 Transitional');
$settings['fullpage_fonts'] = $model->getEditorFonts();
$settings['fullpage_fontsizes'] = $wf->getParam('editor.theme_advanced_font_sizes', '8pt,10pt,12pt,14pt,18pt,24pt,36pt');
$settings['fullpage_default_doctype'] = isset($doctypes[$doctype]) ? addslashes($doctypes[$doctype]) : '';
$settings['fullpage_hide_in_source_view'] = $wf->getParam('fullpage.hide_in_source_view', 0, 0);
$settings['fullpage_default_encoding'] = $wf->getParam('fullpage.default_encoding');
$settings['fullpage_default_xml_pi'] = $wf->getParam('fullpage.default_xml_pi', 0, 0);
$settings['fullpage_default_font_family'] = $wf->getParam('fullpage.default_font_family');
$settings['fullpage_default_title'] = $wf->getParam('fullpage.default_title', 'Untitled Document', 'Untitled Document');
$settings['fullpage_default_font_size'] = $wf->getParam('fullpage.default_font_size');
$settings['fullpage_default_text_color'] = $wf->getParam('fullpage.default_text_color');
$model->removeKeys($settings['invalid_elements'], array('html', 'head', 'meta', 'title', 'body', 'link'));
}
示例8: getConfig
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);
}
示例9: onInit
/**
* 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();
}
示例10: getConfig
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');
}
}
示例11: display
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);
}
示例12: getProfile
/**
* Get an appropriate editor profile
* @access public
* @return $profile Object
*/
public function getProfile($plugin = null)
{
if (!isset(self::$profile)) {
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$option = $this->getComponentOption();
$query = $db->getQuery(true);
if (is_object($query)) {
$query->select('*')->from('#__wf_profiles')->where('published = 1')->order('ordering ASC');
} else {
$query = 'SELECT * FROM #__wf_profiles' . ' WHERE published = 1' . ' ORDER BY ordering ASC';
}
$db->setQuery($query);
$profiles = $db->loadObjectList();
if ($option == 'com_jce') {
$component_id = JRequest::getInt('component_id');
if ($component_id) {
$component = WFExtensionHelper::getComponent($component_id);
$option = isset($component->element) ? $component->element : $component->option;
}
}
// get the Joomla! area (admin or site)
$area = $mainframe->isAdmin() ? 2 : 1;
if (!class_exists('Wf_Mobile_Detect')) {
// load mobile detect class
require_once dirname(__FILE__) . '/mobile.php';
}
$mobile = new Wf_Mobile_Detect();
// set device values
if ($mobile->isMobile()) {
$device = 'phone';
} else {
if ($mobile->isTablet()) {
$device = 'tablet';
} else {
$device = 'desktop';
}
}
// Joomla! 1.6+
if (method_exists('JUser', 'getAuthorisedGroups')) {
$keys = $user->getAuthorisedGroups();
} else {
$keys = array($user->gid);
}
foreach ($profiles as $item) {
// at least one user group or user must be set
if (empty($item->types) && empty($item->users)) {
continue;
}
// check user groups - a value should always be set
$groups = array_intersect($keys, explode(',', $item->types));
// user not in the current group...
if (empty($groups)) {
// no additional users set or no user match
if (empty($item->users) || in_array($user->id, explode(',', $item->users)) === false) {
continue;
}
}
// check component
if ($option !== 'com_jce' && $item->components && in_array($option, explode(',', $item->components)) === false) {
continue;
}
// set device default as 'desktop,tablet,mobile'
if (!isset($item->device) || empty($item->device)) {
$item->device = 'desktop,tablet,phone';
}
// check device
if (in_array($device, explode(',', $item->device)) === false) {
continue;
}
// check area
if (!empty($item->area) && (int) $item->area != $area) {
continue;
}
// check for individual plugin - use Editor Model as it adds "core" plugins to profile set
if ($plugin) {
wfimport('admin.models.editor');
$model = new WFModelEditor();
$plugins = (array) $model->getPlugins();
if (in_array($plugin, $plugins) === false) {
continue;
}
}
// decrypt params
if (!empty($item->params)) {
wfimport('admin.helpers.encrypt');
$item->params = WFEncryptHelper::decrypt($item->params);
}
// assign item to profile
self::$profile = $item;
// return
return self::$profile;
}
return null;
//.........这里部分代码省略.........
示例13: getConfig
public static function getConfig(&$settings)
{
wfimport('admin.models.editor');
$model = new WFModelEditor();
$wf = WFEditor::getInstance();
// Add format plugin to plugins list
if (!in_array('format', $settings['plugins'])) {
$settings['plugins'][] = 'format';
}
$settings['inline_styles'] = $wf->getParam('editor.inline_styles', 1, 1);
// Paragraph handling
$settings['forced_root_block'] = $wf->getParam('editor.forced_root_block', 'p');
// 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');
$formats = array('p' => 'advanced.paragraph', 'address' => 'advanced.address', 'pre' => 'advanced.pre', 'h1' => 'advanced.h1', 'h2' => 'advanced.h2', 'h3' => 'advanced.h3', 'h4' => 'advanced.h4', 'h5' => 'advanced.h5', 'h6' => 'advanced.h6', 'div' => 'advanced.div', 'blockquote' => 'advanced.blockquote', 'code' => 'advanced.code', 'samp' => 'advanced.samp', 'span' => 'advanced.span', 'section' => 'advanced.section', 'article' => 'advanced.article', 'hgroup' => 'advanced.hgroup', 'aside' => 'advanced.aside', 'figure' => 'advanced.figure', 'dt' => 'advanced.dt', 'dd' => 'advanced.dd', 'div_container' => 'advanced.div_container');
$html5 = array('section', 'article', 'hgroup', 'aside', 'figure');
$schema = $wf->getParam('editor.schema', 'html4');
$verify = (bool) $wf->getParam('editor.verify_html', 0);
$tmpblocks = $wf->getParam('editor.theme_advanced_blockformats', 'p,div,address,pre,h1,h2,h3,h4,h5,h6,code,samp,span,section,article,hgroup,aside,figure,dt,dd', 'p,address,pre,h1,h2,h3,h4,h5,h6');
$list = array();
$blocks = array();
// make an array
if (is_string($tmpblocks)) {
$tmpblocks = explode(',', $tmpblocks);
}
foreach ($tmpblocks as $v) {
$key = $formats[$v];
// skip html5 blocks for html4 schema
if ($verify && $schema == 'html4' && in_array($v, $html5)) {
continue;
}
if ($key) {
$list[$key] = $v;
}
$blocks[] = $v;
if ($v == 'div') {
$list['advanced.div_container'] = 'div_container';
}
}
$selector = $settings['removeformat_selector'] == '' ? 'span,b,strong,em,i,font,u,strike' : $settings['removeformat_selector'];
$selector = explode(',', $selector);
// set the root block
$rootblock = !$settings['forced_root_block'] ? 'p' : $settings['forced_root_block'];
if ($k = array_search($rootblock, $blocks) !== false) {
unset($blocks[$k]);
}
// remove format selector
$settings['removeformat_selector'] = implode(',', array_unique(array_merge($blocks, $selector)));
// Format list / Remove Format
$settings['theme_advanced_blockformats'] = json_encode($list);
// Relative urls
$settings['relative_urls'] = $wf->getParam('editor.relative_urls', 1, 1, 'boolean');
if ($settings['relative_urls'] == 0) {
$settings['remove_script_host'] = false;
}
// Fonts
$settings['theme_advanced_fonts'] = $model->getEditorFonts($wf->getParam('editor.theme_advanced_fonts_add', ''), $wf->getParam('editor.theme_advanced_fonts_remove', ''));
$settings['theme_advanced_font_sizes'] = $wf->getParam('editor.theme_advanced_font_sizes', '8pt,10pt,12pt,14pt,18pt,24pt,36pt');
//$settings['theme_advanced_default_foreground_color'] = $wf->getParam('editor.theme_advanced_default_foreground_color', '#000000');
//$settings['theme_advanced_default_background_color'] = $wf->getParam('editor.theme_advanced_default_background_color', '#FFFF00');
// colour picker custom colours
$settings['custom_colors'] = $wf->getParam('editor.custom_colors', '', '');
// Styles list
$styles = $wf->getParam('editor.theme_advanced_styles', '');
if ($styles) {
$settings['theme_advanced_styles'] = implode(';', explode(',', $styles));
}
}
示例14: defined
<?php
/**
* @package JCE
* @copyright Copyright (c) 2009-2013 Ryan Demmer. All rights reserved.
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
defined('_JEXEC') or die('RESTRICTED');
wfimport('admin.models.editor');
$model = new WFModelEditor();
echo $model->getToken('source');
示例15: tiny_mce
/**
* Text area with WYSIWYG
*
* @param type $element
*
* @return type
*/
static function tiny_mce($element)
{
// Load js and style sheet for frontend
$base = JUri::root();
$jCfg = JFactory::getConfig();
$language = JFactory::getLanguage();
$text_direction = 'data-direction="ltr"';
if ($language->isRTL()) {
$text_direction = 'data-direction="rtl"';
}
$urlbase = 'data-url=' . $base;
if (file_exists(JPATH_ROOT . "/media/editors/tinymce/langs/" . $language->getTag() . ".js")) {
$langPrefix = $language->getTag();
} elseif (file_exists(JPATH_ROOT . "/media/editors/tinymce/langs/" . substr($language->getTag(), 0, strpos($language->getTag(), '-')) . ".js")) {
$langPrefix = substr($language->getTag(), 0, strpos($language->getTag(), '-'));
} else {
$langPrefix = "en";
}
$langPrefix = "data-lang=" . $langPrefix;
$jceData = "";
if (file_exists(JPATH_ROOT . '/media/editors/tinymce/tinymce.min.js') && $jCfg->get('editor') != 'jce') {
if ($jCfg->get('editor') != 'tinymce') {
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/tinymce.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/plugins/table/plugin.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/plugins/link/plugin.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/plugins/image/plugin.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/plugins/code/plugin.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/plugins/hr/plugin.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/plugins/charmap/plugin.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/plugins/autolink/plugin.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/plugins/lists/plugin.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/plugins/importcss/plugin.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/themes/modern/theme.min.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/skins/lightgray/content.inline.min.css', 'css');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/skins/lightgray/content.min.css', 'css');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/skins/lightgray/skin.min.css', 'css');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'media/editors/tinymce/skins/lightgray/skin.ie7.min.css', 'css');
}
$editor = 'tinymce';
} elseif ($jCfg->get('editor') == 'jce') {
include_once JPATH_ROOT . "/administrator/components/com_jce/includes/loader.php";
include_once JPATH_ROOT . "/administrator/components/com_jce/models/editor.php";
include_once JPATH_ROOT . "/components/com_jce/editor/libraries/classes/token.php";
// create token
$token = WFToken::getToken();
$jceData .= " data-token=" . $token;
// etag - version
$editor = new WFModelEditor();
$setting = $editor->getEditorSettings();
$etag = $setting['etag'];
$jceData .= " data-etag=" . $etag;
// get current component
$option = JFactory::getApplication()->input->get('option');
$component = WFExtensionHelper::getComponent(null, $option);
// set default component id
$component_id = 0;
$component_id = isset($component->extension_id) ? $component->extension_id : ($component->id ? $component->id : 0);
$jceData .= " data-component_id=" . $component_id;
$editor = 'jce';
} else {
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'plugins/system/jsnframework/assets/3rd-party/jquery-jwysiwyg/jquery.wysiwyg.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'plugins/system/jsnframework/assets/3rd-party/jquery-jwysiwyg/jquery.wysiwyg.css', 'css');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'plugins/system/jsnframework/assets/3rd-party/jquery-jwysiwyg/jquery.wysiwyg-0.9.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'plugins/system/jsnframework/assets/3rd-party/jquery-jwysiwyg/jquery.wysiwyg-0.9.css', 'css');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'plugins/system/jsnframework/assets/3rd-party/jquery-jwysiwyg/controls/wysiwyg.colorpicker.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'plugins/system/jsnframework/assets/3rd-party/jquery-jwysiwyg/controls/wysiwyg.table.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'plugins/system/jsnframework/assets/3rd-party/jquery-jwysiwyg/controls/wysiwyg.cssWrap.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'plugins/system/jsnframework/assets/3rd-party/jquery-jwysiwyg/controls/wysiwyg.image.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag($base . 'administrator/components/com_pagebuilder/assets/js/jquery-jwysiwyg/controls/wysiwyg.link.js', 'js');
JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_ASSETS_URL . 'css/jwysiwyg.css', 'css');
}
$element = self::get_extra_info($element);
$label = self::get_label($element);
$type = !empty($element["input-type"]) ? $element["input-type"] : "text";
$role = isset($element['role']) ? "role_{$element['role']}" : '';
$role2 = isset($element['role_2']) ? 'data-role="title"' : '';
$output = "<textarea type='{$type}' class='{$element['class']} jsn_tiny_mce {$role} {$editor}' id='{$element['id']}' name='{$element['id']}' {$role2} {$text_direction} {$urlbase} {$langPrefix} {$jceData} DATA_INFO>{$element['std']}</textarea>";
return self::final_element($element, $output, $label);
}