本文整理汇总了PHP中WFEditor类的典型用法代码示例。如果您正苦于以下问题:PHP WFEditor类的具体用法?PHP WFEditor怎么用?PHP WFEditor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WFEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfig
public function getConfig(&$settings)
{
$model = JModel::getInstance('editor', 'WFModel');
$wf = WFEditor::getInstance();
// Add format plugin to plugins list
if (!in_array('format', $settings['plugins'])) {
$settings['plugins'][] = 'format';
}
// Encoding
$settings['entity_encoding'] = $wf->getParam('editor.entity_encoding', 'raw', 'named');
$settings['inline_styles'] = $wf->getParam('editor.inline_styles', 1, 1);
// Paragraph handling
$settings['forced_root_block'] = $wf->getParam('editor.forced_root_block', 'p', 'p');
$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', 'dt' => 'advanced.dt', 'dd' => 'advanced.dd', 'samp' => 'advanced.samp', 'span' => 'advanced.span');
$tmpblocks = $wf->getParam('editor.theme_advanced_blockformats', 'p,div,address,pre,h1,h2,h3,h4,h5,h6,code,samp,span', 'p,address,pre,h1,h2,h3,h4,h5,h6');
$list = array();
$blocks = array();
if (is_string($tmpblocks)) {
$tmpblocks = explode(',', $tmpblocks);
}
foreach ($tmpblocks as $k => $v) {
$key = $formats[$v];
if ($key) {
$list[$key] = $v;
}
$blocks[] = $v;
}
$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);
// add span 'format'
$settings['formats'] = "{span : {inline : 'span'}}";
// new lines (paragraphs or linebreaks)
if ($wf->getParam('editor.newlines', 0)) {
$settings['force_br_newlines'] = 1;
$settings['force_p_newlines'] = 0;
$settings['forced_root_block'] = false;
}
// Relative urls
$settings['relative_urls'] = $wf->getParam('editor.relative_urls', 1, 1);
if ($settings['relative_urls'] == 0) {
$settings['remove_script_host'] = 0;
}
// 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', '', '');
}
示例2: getConfig
public static function getConfig(&$settings)
{
$wf = WFEditor::getInstance();
$number = $wf->getParam('lists.number_styles');
$bullet = $wf->getParam('lists.bullet_styles');
if (!empty($number)) {
if (count($number) < count(self::$defaultNumList)) {
$items = array();
foreach ($number as $item) {
$title = $item == 'default' ? 'def' : str_replace('-', '_', $item);
$style = $item == 'default' ? '' : $item;
$items[] = array('title' => 'advlist.' . $title, 'styles' => array('listStyleType' => $style));
}
$settings['advlist_number_styles'] = json_encode($items);
}
}
if (!empty($bullet)) {
if (count($bullet) < count(self::$defaultBulletList)) {
$items = array();
foreach ($bullet as $item) {
$title = $item == 'default' ? 'def' : str_replace('-', '_', $item);
$style = $item == 'default' ? '' : $item;
$items[] = array('title' => 'advlist.' . $title, 'styles' => array('listStyleType' => $style));
}
$settings['advlist_bullet_styles'] = json_encode($items);
}
}
}
示例3: getConfig
public static function getConfig(&$settings)
{
$wf = WFEditor::getInstance();
//$settings['article_hide_xtd_btns'] = $wf->getParam('article.hide_xtd_btns', 0, 0);
$settings['article_show_readmore'] = $wf->getParam('article.show_readmore', 1, 1);
$settings['article_show_pagebreak'] = $wf->getParam('article.show_pagebreak', 1, 1);
}
示例4: getConfig
public static function getConfig(&$settings)
{
$wf = WFEditor::getInstance();
// legacy
$state = $wf->getParam('editor.visualchars', 0);
$settings['visualchars_default_state'] = $wf->getParam('editor.visualchars_state', $state, 0, 'boolean');
}
示例5: getConfig
public static function getConfig(&$settings)
{
$wf = WFEditor::getInstance();
$engine = $wf->getParam('spellchecker.engine', 'browser', 'browser');
$url = JURI::base(true) . '/index.php?option=com_jce&view=editor&layout=plugin&plugin=spellchecker&component_id=' . $settings['component_id'];
switch ($engine) {
default:
case 'browser':
$languages = '';
$settings['spellchecker_browser_state'] = $wf->getParam('spellchecker.browser_state', 0, 0);
break;
case 'googlespell':
$languages = $wf->getParam('spellchecker.googlespell_languages', '');
// use a default
if (!$languages) {
$languages = $wf->getParam('spellchecker.languages', 'English=en', '');
}
break;
case 'pspell':
case 'pspellshell':
case 'enchantspell':
$languages = $wf->getParam('spellchecker.languages', 'English=en', '');
break;
}
$settings['spellchecker_rpc_url'] = $url;
// cast as array
if ($languages) {
$languages = (array) $languages;
}
if (!empty($languages)) {
$settings['spellchecker_languages'] = '+' . implode(',', $languages);
}
$settings['spellchecker_engine'] = $engine;
}
示例6: getConfig
public static function getConfig(&$settings)
{
$wf = WFEditor::getInstance();
$model = JModel::getInstance('editor', 'WFModel');
$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);
}
示例7: getConfig
public function getConfig(&$settings)
{
$wf = WFEditor::getInstance();
$settings['spellchecker_languages'] = '+' . $wf->getParam('spellchecker.languages', 'English=en', '');
$settings['spellchecker_engine'] = $wf->getParam('spellchecker.engine', 'googlespell', 'googlespell');
$settings['spellchecker_rpc_url'] = JURI::base(true) . '/index.php?option=com_jce&view=editor&layout=plugin&plugin=spellchecker&component_id=' . $settings['component_id'];
}
示例8: 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');
}
示例9: getConfig
public static function getConfig(&$settings)
{
$wf = WFEditor::getInstance();
$width = $wf->getParam('table.width');
$height = $wf->getParam('table.height');
if ($width && preg_match('#^[0-9\\.]$#', $width)) {
$width .= 'px';
}
if ($height && preg_match('#^[0-9\\.]$#', $height)) {
$height .= 'px';
}
$settings['table_default_width'] = $width;
$settings['table_default_height'] = $height;
$settings['table_default_border'] = $wf->getParam('table.border', 0, 0);
$settings['table_default_align'] = $wf->getParam('table.align', '', '');
$settings['table_default_cellpadding'] = $wf->getParam('table.cellpadding', 0, 0);
$settings['table_default_cellspacing'] = $wf->getParam('table.cellspacing', 0, 0);
$settings['table_default_rows'] = $wf->getParam('table.rows', 2, 2);
$settings['table_default_cols'] = $wf->getParam('table.cols', 2, 2);
$settings['table_cell_limit'] = $wf->getParam('table.cell_limit', 0, 0);
$settings['table_row_limit'] = $wf->getParam('table.row_limit', 0, 0);
$settings['table_col_limit'] = $wf->getParam('table.col_limit', 0, 0);
$settings['table_pad_empty_cells'] = $wf->getParam('table.pad_empty_cells', 1, 1);
$settings['table_classes'] = $wf->getParam('table.classes', "", "");
}
示例10: getConfig
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;
}
}
示例11: getConfig
public function getConfig(&$settings)
{
$wf = WFEditor::getInstance();
$model = JModel::getInstance('editor', 'WFModel');
if ($wf->getParam('media.iframes', 0)) {
$model->removeKeys($settings['invalid_elements'], array('iframe'));
}
if ($wf->getParam('media.audio', 1)) {
$model->removeKeys($settings['invalid_elements'], array('audio', 'source'));
}
if ($wf->getParam('media.video', 1)) {
$model->removeKeys($settings['invalid_elements'], array('video', 'source'));
}
if ($wf->getParam('media.embed', 1)) {
$model->removeKeys($settings['invalid_elements'], array('embed'));
}
if ($wf->getParam('media.object', 1)) {
$model->removeKeys($settings['invalid_elements'], array('object', 'param'));
}
$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');
}
示例12: getConfig
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;
}
}
示例13: getFonts
/**
* Get a list of editor font families
*
* @return string font family list
* @param string $add Font family to add
* @param string $remove Font family to remove
*/
protected static function getFonts()
{
$wf = WFEditor::getInstance();
$fonts = $wf->getParam('fontselect.fonts');
// get fonts using legacy parameters
if (empty($fonts)) {
$fonts = self::$fonts;
$add = $wf->getParam('editor.theme_advanced_fonts_add');
$remove = $wf->getParam('editor.theme_advanced_fonts_remove');
if (empty($remove) && empty($add)) {
return implode(';', $fonts);
}
$remove = preg_split('/[;,]+/', $remove);
if (count($remove)) {
foreach ($fonts as $key => $value) {
foreach ($remove as $gone) {
if ($gone && preg_match('/^' . $gone . '=/i', $value)) {
// Remove family
unset($fonts[$key]);
}
}
}
}
foreach (explode(";", $add) as $new) {
// Add new font family
if (preg_match('/([^\\=]+)(\\=)([^\\=]+)/', trim($new)) && !in_array($new, $fonts)) {
$fonts[] = $new;
}
}
natcasesort($fonts);
$fonts = implode(';', $fonts);
}
return $fonts;
}
示例14: getRootDir
/**
* Return the full user directory path. Create if required
*
* @param string The base path
* @access public
* @return Full path to folder
*/
public function getRootDir()
{
static $root;
if (!isset($root)) {
$user = JFactory::getUser();
$wf = WFEditor::getInstance();
$profile = $wf->getProfile();
// Get base directory as shared parameter
$root = $this->get('dir', '');
// Remove whitespace
$root = trim($root);
if (!empty($root)) {
// Convert slashes / Strip double slashes
$root = preg_replace('/[\\\\]+/', '/', $root);
// Remove first leading slash
$root = ltrim($root, '/');
// Force default directory if base param starts with a variable or a . eg $id
if (preg_match('/[\\.\\$]/', $root[0])) {
$root = 'images';
}
jimport('joomla.user.helper');
// Joomla! 1.6+
if (method_exists('JUserHelper', 'getUserGroups')) {
$groups = JUserHelper::getUserGroups($user->id);
// get keys only
$groups = array_keys($groups);
// get the first group
$group_id = array_shift($groups);
// Joomla! 2.5?
if (is_int($group_id)) {
// usergroup table
$group = JTable::getInstance('Usergroup');
$group->load($group_id);
// usertype
$usertype = $group->title;
} else {
$usertype = $group_id;
}
} else {
$usertype = $user->usertype;
}
// Replace any path variables
$pattern = array('/\\$id/', '/\\$username/', '/\\$user(group|type)/', '/\\$(group|profile)/', '/\\$day/', '/\\$month/', '/\\$year/');
$replace = array($user->id, $user->username, $usertype, $profile->name, date('d'), date('m'), date('Y'));
$root = preg_replace($pattern, $replace, $root);
// split into path parts to preserve /
$parts = explode('/', $root);
$textcase = $wf->getParam('editor.websafe_textcase');
if (!empty($textcase)) {
$textcase = array_shift($textcase);
}
// clean path parts
$parts = WFUtility::makeSafe($parts, $wf->getParam('editor.websafe_mode', 'utf-8'), $wf->getParam('editor.websafe_allow_spaces', 0), $textcase);
//join path parts
$root = implode('/', $parts);
}
}
return $root;
}
示例15: 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'));
}
}