本文整理汇总了PHP中WFModelEditor::addKeys方法的典型用法代码示例。如果您正苦于以下问题:PHP WFModelEditor::addKeys方法的具体用法?PHP WFModelEditor::addKeys怎么用?PHP WFModelEditor::addKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WFModelEditor
的用法示例。
在下文中一共展示了WFModelEditor::addKeys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}