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


PHP HtmlEditorConfig::get方法代码示例

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


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

示例1: 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

示例2: 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

示例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: 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

示例5: __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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: init

 public function init()
 {
     parent::init();
     Requirements::css(CMS_DIR . '/css/ReportAdmin.css');
     // Set custom options for TinyMCE specific to ReportAdmin
     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');
 }
开发者ID:rixrix,项目名称:silverstripe-cms,代码行数:10,代码来源:ReportAdmin.php

示例11: 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

示例12: testSanitisation

 public function testSanitisation()
 {
     $tests = array(array('p,strong', '<p>Leave Alone</p><div>Strip parent<strong>But keep children</strong> in order</div>', '<p>Leave Alone</p>Strip parent<strong>But keep children</strong> in order', 'Non-whitelisted elements are stripped, but children are kept'), array('p,strong', '<div>A <strong>B <div>Nested elements are still filtered</div> C</strong> D</div>', 'A <strong>B Nested elements are still filtered C</strong> D', 'Non-whitelisted elements are stripped even when children of non-whitelisted elements'), array('p', '<p>Keep</p><script>Strip <strong>including children</strong></script>', '<p>Keep</p>', 'Non-whitelisted script elements are totally stripped, including any children'), array('p[id]', '<p id="keep" bad="strip">Test</p>', '<p id="keep">Test</p>', 'Non-whitelisted attributes are stripped'), array('p[default1=default1|default2=default2|force1:force1|force2:force2]', '<p default1="specific1" force1="specific1">Test</p>', '<p default1="specific1" force1="force1" default2="default2" force2="force2">Test</p>', 'Default attributes are set when not present in input, forced attributes are always set'));
     $config = HtmlEditorConfig::get('htmleditorsanitisertest');
     foreach ($tests as $test) {
         list($validElements, $input, $output, $desc) = $test;
         $config->setOptions(array('valid_elements' => $validElements));
         $sanitiser = new HtmlEditorSanitiser($config);
         $htmlValue = Injector::inst()->create('HTMLValue', $input);
         $sanitiser->sanitise($htmlValue);
         $this->assertEquals($output, $htmlValue->getContent(), $desc);
     }
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:13,代码来源:HtmlEditorSanitiserTest.php

示例13: init

 public function init()
 {
     parent::init();
     //set the report we are currently viewing from the URL
     $this->reportClass = isset($this->urlParams['ReportClass']) && $this->urlParams['ReportClass'] !== 'index' ? $this->urlParams['ReportClass'] : null;
     $allReports = SS_Report::get_reports();
     $this->reportObject = isset($allReports[$this->reportClass]) ? $allReports[$this->reportClass] : null;
     // Set custom options for TinyMCE specific to ReportAdmin
     HtmlEditorConfig::get('cms')->setOption('content_css', 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(FRAMEWORK_DIR . '/javascript/HtmlEditorField.js');
     Requirements::javascript(REPORTS_DIR . '/javascript/ReportAdmin.js');
 }
开发者ID:helpfulrobot,项目名称:silverstripe-reports,代码行数:14,代码来源:ReportAdmin.php

示例14: preRequest

 public function preRequest(\SS_HTTPRequest $request, \Session $session, \DataModel $model)
 {
     // Check languages to set
     $languages = array();
     foreach (SpellController::get_locales() as $locale) {
         $languages[] = i18n::get_locale_name($locale) . '=' . $locale;
     }
     // Set settings
     $editor = Config::inst()->get(__CLASS__, 'editor');
     HtmlEditorConfig::get($editor)->enablePlugins('spellchecker');
     HtmlEditorConfig::get($editor)->addButtonsToLine(2, 'spellchecker');
     $token = SecurityToken::inst();
     HtmlEditorConfig::get($editor)->setOption('spellchecker_rpc_url', $token->addToUrl('spellcheck/'));
     HtmlEditorConfig::get($editor)->setOption('browser_spellcheck', false);
     HtmlEditorConfig::get($editor)->setOption('spellchecker_languages', '+' . implode(', ', $languages));
     return true;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-spellcheck,代码行数:17,代码来源:SpellRequestFilter.php

示例15: init

 function 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.
     $req = $this->owner->getRequest();
     $id = $req->param('ID');
     if ($req->requestVar("Locale")) {
         $this->owner->Locale = $req->requestVar("Locale");
     } elseif ($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();
         }
     }
     Translatable::set_current_locale($this->owner->Locale);
     // if a locale is set, it needs to match to the current record
     $requestLocale = $req->requestVar("Locale") ? $req->requestVar("Locale") : $req->requestVar("locale");
     $page = $this->owner->currentPage();
     if ($requestLocale && $page && $page->Locale != $requestLocale) {
         $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 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:roed,项目名称:silverstripe-translatable,代码行数:43,代码来源:TranslatableCMSMainExtension.php


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