当前位置: 首页>>代码示例>>PHP>>正文


PHP HtmlEditorConfig类代码示例

本文整理汇总了PHP中HtmlEditorConfig的典型用法代码示例。如果您正苦于以下问题:PHP HtmlEditorConfig类的具体用法?PHP HtmlEditorConfig怎么用?PHP HtmlEditorConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HtmlEditorConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGenerateJSWritesPlugins

	function testGenerateJSWritesPlugins() {
		$c = new HtmlEditorConfig();
		$c->enablePlugins(array('plugin1'));
		$c->enablePlugins(array('plugin2' => '/mypath/plugin2'));

		$this->assertContains('plugin1', $c->generateJS());
		$this->assertContains('tinymce.PluginManager.load("plugin2", "/mypath/plugin2");', $c->generateJS());
	}
开发者ID:redema,项目名称:sapphire,代码行数:8,代码来源:HtmlEditorConfigTest.php

示例2: __construct

 /**
  * Construct a sanitiser from a given HtmlEditorConfig
  *
  * Note that we build data structures from the current state of HtmlEditorConfig - later changes to
  * the passed instance won't cause this instance to update it's whitelist
  *
  * @param HtmlEditorConfig $config
  */
 public function __construct(HtmlEditorConfig $config)
 {
     $valid = $config->getOption('valid_elements');
     if ($valid) {
         $this->addValidElements($valid);
     }
     $valid = $config->getOption('extended_valid_elements');
     if ($valid) {
         $this->addValidElements($valid);
     }
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:19,代码来源:HtmlEditorSanitiser.php

示例3: init

 function init()
 {
     HtmlEditorConfig::get('cms')->setOption('theme_advanced_blockformats', 'p,h1');
     HtmlEditorConfig::get('cms')->setButtonsForLine(1, 'undo, redo, separator, cut, copy, pastetext, separator, ssimage, sslink, unlink, separator, fullscreen, advcode, formatselect');
     HtmlEditorConfig::get('cms')->setButtonsForLine(2);
     HtmlEditorConfig::get('cms')->setButtonsForLine(3);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-widgets-sidetext,代码行数:7,代码来源:SideTextWidget.php

示例4: sanitizeHTML

 /**
  * Strips out not allowed tags, mainly this is to remove the kapost beacon script so it doesn't conflict with the cms
  * @param {string} $str String to be sanitized
  * @return {string} HTML to be used
  */
 public final function sanitizeHTML($str)
 {
     $htmlValue = Injector::inst()->create('HTMLValue', $str);
     $santiser = Injector::inst()->create('HtmlEditorSanitiser', HtmlEditorConfig::get_active());
     $santiser->sanitise($htmlValue);
     return $htmlValue->getContent();
 }
开发者ID:webbuilders-group,项目名称:silverstripe-kapost-bridge,代码行数:12,代码来源:KapostObject.php

示例5: init

 public function init()
 {
     parent::init();
     // Locale" attribute is either explicitly added by LeftAndMain Javascript logic,
     // or implied on a translated record (see {@link Translatable->updateCMSFields()}).
     // $Lang serves as a "context" which can be inspected by Translatable - hence it
     // has the same name as the database property on Translatable.
     if ($this->getRequest()->requestVar("Locale")) {
         $this->Locale = $this->getRequest()->requestVar("Locale");
     } elseif ($this->getRequest()->requestVar("locale")) {
         $this->Locale = $this->getRequest()->requestVar("locale");
     } else {
         $this->Locale = Translatable::default_locale();
     }
     Translatable::set_current_locale($this->Locale);
     // collect languages for TinyMCE spellchecker plugin.
     // see http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
     $langName = i18n::get_locale_name($this->Locale);
     HtmlEditorConfig::get('cms')->setOption('spellchecker_languages', "+{$langName}={$this->Locale}");
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.js');
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.Tree.js');
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.EditForm.js');
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain.Translatable.js');
     Requirements::css(CMS_DIR . '/css/CMSMain.css');
     CMSBatchActionHandler::register('publish', 'CMSBatchAction_Publish');
     CMSBatchActionHandler::register('unpublish', 'CMSBatchAction_Unpublish');
     CMSBatchActionHandler::register('delete', 'CMSBatchAction_Delete');
     CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive');
 }
开发者ID:rodneyway,项目名称:silverstripe-cms,代码行数:29,代码来源:CMSMain.php

示例6: init

 public function init()
 {
     // In LeftAndMain::init() the current theme is unset.
     // we need to restore the current theme here for make the dropdown of template list.
     $theme = SSViewer::current_theme();
     parent::init();
     if (isset($theme) && $theme) {
         SSViewer::set_theme($theme);
     }
     Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
     Requirements::javascript(SAPPHIRE_DIR . '/javascript/tiny_mce_improvements.js');
     //TODO what is going on here? where did that hover.js go? can't find it.
     //TODO We need to reimplement a hover.js?
     Requirements::javascript(CMS_DIR . '/javascript/hover.js');
     Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/controls.js');
     Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain_left.js');
     Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain_right.js');
     Requirements::javascript(CMS_DIR . '/javascript/CMSMain_left.js');
     Requirements::javascript(CMS_DIR . '/javascript/SecurityAdmin.js');
     Requirements::javascript(NEWSLETTER_DIR . '/javascript/NewsletterAdmin_left.js');
     Requirements::javascript(NEWSLETTER_DIR . '/javascript/NewsletterAdmin_right.js');
     Requirements::javascript(NEWSLETTER_DIR . '/javascript/ProgressBar.js');
     // We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
     if (!Director::is_ajax()) {
         Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
         HtmlEditorConfig::get('cms')->setOption('ContentCSS', project() . '/css/editor.css');
         HtmlEditorConfig::get('cms')->setOption('Lang', i18n::get_tinymce_lang());
     }
     // Always block the HtmlEditorField.js otherwise it will be sent with an ajax request
     Requirements::block(SAPPHIRE_DIR . '/javascript/HtmlEditorField.js');
     Requirements::css(NEWSLETTER_DIR . '/css/NewsletterAdmin.css');
 }
开发者ID:roed,项目名称:silverstripe-newsletter,代码行数:32,代码来源:NewsletterAdmin.php

示例7: init

 function init()
 {
     $req = $this->owner->getRequest();
     // Ignore being called on LeftAndMain base class,
     // which is the case when requests are first routed through AdminRootController
     // as an intermediary rather than the endpoint controller
     if (!$this->owner->stat('tree_class')) {
         return;
     }
     // Locale" attribute is either explicitly added by LeftAndMain Javascript logic,
     // or implied on a translated record (see {@link Translatable->updateCMSFields()}).
     // $Lang serves as a "context" which can be inspected by Translatable - hence it
     // has the same name as the database property on Translatable.
     $id = $req->param('ID');
     if ($req->requestVar("Locale")) {
         $this->owner->Locale = $req->requestVar("Locale");
     } else {
         if ($id && is_numeric($id)) {
             $record = DataObject::get_by_id($this->owner->stat('tree_class'), $id);
             if ($record && $record->Locale) {
                 $this->owner->Locale = $record->Locale;
             }
         } else {
             $this->owner->Locale = Translatable::default_locale();
             if ($this->owner->class == 'CMSPagesController') {
                 // the CMSPagesController always needs to have the locale set,
                 // otherwise page editing will cause an extra
                 // ajax request which looks weird due to multiple "loading"-flashes
                 $getVars = $req->getVars();
                 if (isset($getVars['url'])) {
                     unset($getVars['url']);
                 }
                 return $this->owner->redirect(Controller::join_links($this->owner->Link(), $req->param('Action'), $req->param('ID'), $req->param('OtherID'), ($query = http_build_query($getVars)) ? "?{$query}" : null));
             }
         }
     }
     Translatable::set_current_locale($this->owner->Locale);
     // If a locale is set, it needs to match to the current record
     $requestLocale = $req->requestVar("Locale");
     $page = $this->owner->currentPage();
     if ($req->httpMethod() == 'GET' && $requestLocale && $page && $page->hasExtension('Translatable') && $page->Locale != $requestLocale && $req->latestParam('Action') != 'EditorToolbar') {
         $transPage = $page->getTranslation($requestLocale);
         if ($transPage) {
             Translatable::set_current_locale($transPage->Locale);
             return $this->owner->redirect(Controller::join_links($this->owner->Link('show'), $transPage->ID));
         } else {
             if ($this->owner->class != 'CMSPagesController') {
                 // If the record is not translated, redirect to pages overview
                 return $this->owner->redirect(Controller::join_links(singleton('CMSPagesController')->Link(), '?Locale=' . $requestLocale));
             }
         }
     }
     // collect languages for TinyMCE spellchecker plugin.
     // see http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
     $langName = i18n::get_locale_name($this->owner->Locale);
     HtmlEditorConfig::get('cms')->setOption('spellchecker_languages', "+{$langName}={$this->owner->Locale}");
     Requirements::javascript('translatable/javascript/CMSMain.Translatable.js');
     Requirements::css('translatable/css/CMSMain.Translatable.css');
 }
开发者ID:helpfulrobot,项目名称:silverstripe-translatable,代码行数:59,代码来源:TranslatableCMSMainExtension.php

示例8: include_js

    /**
     * This basically merges HtmlEditorField::include_js() and HTMLEditorConfig::generateJS() to output all
     * configuration sets to a customTinyMceConfigs javascript array.
     * This is output in addition to the standard ssTinyMceConfig because a) we can't stop the default output
     * with extensions; and b) the default setting is still used for any HTMLEditorField that doesn't specify
     * it's own config.
     *
     * Calls Requirements::javascript() to load the scripts.
     */
    public static function include_js()
    {
        require_once 'tinymce/tiny_mce_gzip.php';
        $availableConfigs = HtmlEditorConfig::get_available_configs_map();
        $pluginsForTag = array();
        $languages = array();
        //$allConfigs = array();
        $settingsJS = '';
        $externalPluginsForJS = array();
        $activeConfig = HtmlEditorConfig::get_active();
        foreach ($availableConfigs as $identifier => $friendlyName) {
            $configObj = CustomHtmlEditorConfig::get($identifier);
            $internalPluginsForJS = array();
            $configObj->getConfig()->setOption('language', i18n::get_tinymce_lang());
            if (!$configObj->getConfig()->getOption('content_css')) {
                $configObj->getConfig()->setOption('content_css', $activeConfig->getOption('content_css'));
            }
            $settings = $configObj->getSettings();
            foreach ($configObj->getPlugins() as $plugin => $path) {
                if (!$path) {
                    $pluginsForTag[$plugin] = $plugin;
                    $internalPluginsForJS[$plugin] = $plugin;
                } else {
                    $internalPluginsForJS[$plugin] = '-' . $plugin;
                    $externalPluginsForJS[$plugin] = sprintf('tinymce.PluginManager.load("%s", "%s");' . "\n", $plugin, $path);
                }
            }
            $language = $configObj->getConfig()->getOption('language');
            if ($language) {
                $languages[$language] = $language;
            }
            $settings['plugins'] = implode(',', $internalPluginsForJS);
            $buttons = $configObj->getButtons();
            foreach ($buttons as $i => $buttons) {
                $settings['theme_advanced_buttons' . $i] = implode(',', $buttons);
            }
            $settingsJS .= "customTinyMceConfigs['" . $identifier . "'] = " . Convert::raw2json($settings) . ";\n";
        }
        if (Config::inst()->get('HtmlEditorField', 'use_gzip')) {
            $tag = TinyMCE_Compressor::renderTag(array('url' => THIRDPARTY_DIR . '/tinymce/tiny_mce_gzip.php', 'plugins' => implode(',', $pluginsForTag), 'themes' => 'advanced', 'languages' => implode(',', $languages)), true);
            preg_match('/src="([^"]*)"/', $tag, $matches);
            Requirements::javascript($matches[1]);
        } else {
            Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
        }
        $externalPluginsJS = implode('', $externalPluginsForJS);
        $script = <<<JS
\t\t\tif((typeof tinyMCE != 'undefined')) {
\t\t\t\t{$externalPluginsJS}

\t\t\t\tif (typeof customTinyMceConfigs == 'undefined') {
\t\t\t\t\tvar customTinyMceConfigs = [];
\t\t\t\t}
\t\t\t\t{$settingsJS}
\t\t\t}

JS;
        Requirements::customScript($script, 'htmlEditorConfigs');
    }
开发者ID:helpfulrobot,项目名称:nathancox-customhtmleditorfield,代码行数:68,代码来源:CustomHTMLEditorLeftAndMainExtension.php

示例9: getEditorConfig

 /**
  * Returns the {@see HtmlEditorConfig} instance to use for sanitisation
  *
  * @return HtmlEditorConfig
  */
 protected function getEditorConfig()
 {
     $editorConfig = $this->config()->editor_config;
     if ($editorConfig) {
         return HtmlEditorConfig::get($editorConfig);
     }
     return HtmlEditorConfig::get_active();
 }
开发者ID:sekjal,项目名称:silverstripe-userforms,代码行数:13,代码来源:EditableLiteralField.php

示例10: __construct

 public function __construct()
 {
     parent::__construct();
     // This may get called before the schema is created.
     if (!DB::getConn()->isSchemaUpdating()) {
         HtmlEditorConfig::get('cms')->setOption('viewtemplate', ViewTemplate::get()->map('Title')->toArray());
     }
 }
开发者ID:helpfulrobot,项目名称:satrun77-viewtemplate,代码行数:8,代码来源:ViewTemplatePageExtension.php

示例11: include_js

 public static function include_js($configName)
 {
     Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
     $config = HtmlEditorConfig::get($configName);
     $config->setOption('mode', 'none');
     $config->setOption('editor_selector', "htmleditor{$configName}");
     Requirements::customScript("\n\t\tBehaviour.register({\n\t\t'textarea.htmleditor{$configName}' : {\n\t\tinitialize : function() {\n\t\tif(typeof tinyMCE != 'undefined'){\n\t\tvar oldsettings = tinyMCE.settings;\n\t\t" . $config->generateJS() . "\n\t\ttinyMCE.execCommand('mceAddControl', true, this.id);\n\t\ttinyMCE.settings = oldsettings;\n\t\tthis.isChanged = function() {\n\t\treturn tinyMCE.getInstanceById(this.id).isDirty();\n\t\t}\n\t\tthis.resetChanged = function() {\n\t\tinst = tinyMCE.getInstanceById(this.id);\n\t\tif (inst) inst.startContent = tinymce.trim(inst.getContent({format : 'raw', no_events : 1}));\n\t\t}\n\t\t}\n\t\t}\n\t\t}\n\t\t})\n\t\t", "htmlEditorConfig-{$configName}");
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-mysite-ssu-flava,代码行数:8,代码来源:HTMLEditorFieldSmall.php

示例12: testRequireJSIncludesAllConfigs

 public function testRequireJSIncludesAllConfigs()
 {
     $a = HtmlEditorConfig::get('configA');
     $c = HtmlEditorConfig::get('configB');
     $aAttributes = $a->getAttributes();
     $cAttributes = $c->getAttributes();
     $this->assertNotEmpty($aAttributes['data-config']);
     $this->assertNotEmpty($cAttributes['data-config']);
 }
开发者ID:assertchris,项目名称:silverstripe-framework,代码行数:9,代码来源:HtmlEditorConfigTest.php

示例13: testRequireJSIncludesAllConfigs

 public function testRequireJSIncludesAllConfigs()
 {
     $c = HtmlEditorConfig::get('configA');
     $c = HtmlEditorConfig::get('configB');
     HtmlEditorConfig::require_js();
     $js = Requirements::get_custom_scripts();
     $this->assertContains('"configA":{', $js);
     $this->assertContains('"configB":{', $js);
 }
开发者ID:miamollie,项目名称:echoAerial,代码行数:9,代码来源:HtmlEditorConfigTest.php

示例14: init

	public function init() {
	    parent::init();
	    // Remove all the junk that will break ModelAdmin
	    $config = HtmlEditorConfig::get_active();
	    $buttons = array('undo','redo','separator','cut','copy','paste','pastetext','pasteword','spellchecker','separator','sslink','unlink','anchor','separator','advcode','search','replace','selectall','visualaid','separator');
	    $config->setButtonsForLine(2,$buttons);
	    Requirements::javascript('remodeladmin/javascript/remodeladmin.js');
	    Requirements::css('remodeladmin/css/remodeladmin.css');

	}
开发者ID:nathancox,项目名称:remodeladmin,代码行数:10,代码来源:RemodelAdmin.php

示例15: alternateAccessCheck

 function alternateAccessCheck()
 {
     // html display simplification
     $lines = array('pastetext', 'ssmedia', 'separator', 'bold', 'italic', 'underline', 'strikethrough', 'hr', 'separator', 'styleselect', 'formatselect', 'separator', 'bullist', 'numlist', 'blockquote', 'sslink', 'unlink', 'anchor', 'separator', 'code');
     $config = HtmlEditorConfig::get('cms');
     $config->setButtonsForLine(1, $lines);
     $config->setButtonsForLine(2, null);
     $config->setButtonsForLine(3, null);
     HtmlEditorConfig::get('cms')->setOption('theme_advanced_blockformats', 'p,h1,h2,h3,h4');
 }
开发者ID:helpfulrobot,项目名称:dospuntocero-litecms,代码行数:10,代码来源:LiteCMS.php


注:本文中的HtmlEditorConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。