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


PHP HtmlEditorConfig::require_js方法代码示例

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


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

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

示例2: getCarouselEditFields

 /**
  * Retrieve the fields used by SortableUploadField internal form.
  *
  * @return FieldList
  */
 public function getCarouselEditFields()
 {
     // This is *required* otherwise TinyMCE in SilverStripe 3.3 will
     // not be enabled and the <textarea> will simply disappear
     // without apparent reasons
     if (method_exists('HtmlEditorConfig', 'require_js')) {
         HtmlEditorConfig::require_js();
     }
     $fields = FieldList::create();
     $fields->push(CarouselCaptionField::create('Content', _t('CarouselPage.Caption')));
     return $fields;
 }
开发者ID:ntd,项目名称:silverstripe-carousel,代码行数:17,代码来源:CarouselPage.php

示例3: __construct

 public function __construct($controller, $name)
 {
     parent::__construct();
     Requirements::javascript(FRAMEWORK_DIR . "/thirdparty/jquery/jquery.js");
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
     Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js');
     HtmlEditorConfig::require_js();
     Requirements::javascript(FRAMEWORK_DIR . "/javascript/HtmlEditorField.js");
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
     $this->controller = $controller;
     $this->name = $name;
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:13,代码来源:HtmlEditorField.php

示例4: __construct

 /**
  * @see TextareaField::__construct()
  */
 public function __construct($name, $title = null, $value = '')
 {
     parent::__construct($name, $title, $value);
     $this->extraClasses[] = 'htmleditor';
     HtmlEditorConfig::require_js();
     // when updating the resampled image, find the orginal.
     // ideally this would live server side in HtmlEditorField_Toolbar(), however
     // injecting it with a function would be overkill.
     Requirements::customScript("\n(function(\$) {\n\t\$.entwine('ss', function(\$) {\n\t\t\$('form.htmleditorfield-form').entwine({\n\t\t\tupdateFromEditor: function() {\t\t\n\t\t\t\tvar self = this, node = this.getSelection();\n\t\t\t\tif(node.is('img')) {\n\t\t\t\t\tmyfixurl = node.data('url') || node.attr('src');\n\t\t\t\t\tmyfixurl = myfixurl.replace('-10x', '');\n\t\t\t\t\tmyfixurl = myfixurl.replace(/_resampled\\/(.+)\\//, '');\n\t\t\t\t\tnode.attr('src', myfixurl);\n\t\t\t\t}\n\t\t\t\tthis.redraw();\n\t\t\t\tthis._super();\n\t\t\t},\n\t\t});\n\t});\n})(jQuery);");
 }
开发者ID:otago,项目名称:silverstripe-retinaimages,代码行数:13,代码来源:RetinaImage.php

示例5: init


//.........这里部分代码省略.........
         $cssFiles[] = FRAMEWORK_ADMIN_DIR . '/css/editor.css';
         // Use theme from the site config
         if (class_exists('SiteConfig') && ($config = SiteConfig::current_site_config()) && $config->Theme) {
             $theme = $config->Theme;
         } elseif (Config::inst()->get('SSViewer', 'theme_enabled') && Config::inst()->get('SSViewer', 'theme')) {
             $theme = Config::inst()->get('SSViewer', 'theme');
         } else {
             $theme = false;
         }
         if ($theme) {
             $cssFiles[] = THEMES_DIR . "/{$theme}/css/editor.css";
         } else {
             if (project()) {
                 $cssFiles[] = project() . '/css/editor.css';
             }
         }
         // Remove files that don't exist
         foreach ($cssFiles as $k => $cssFile) {
             if (!file_exists(BASE_PATH . '/' . $cssFile)) {
                 unset($cssFiles[$k]);
             }
         }
         $htmlEditorConfig->setOption('content_css', implode(',', $cssFiles));
     }
     // Using uncompressed files as they'll be processed by JSMin in the Requirements class.
     // Not as effective as other compressors or pre-compressed+finetuned files,
     // but overall the unified minification into a single file brings more performance benefits
     // than a couple of saved bytes (after gzip) in individual files.
     // We also re-compress already compressed files through JSMin as this causes weird runtime bugs.
     Requirements::combine_files('lib.js', array(THIRDPARTY_DIR . '/jquery/jquery.js', FRAMEWORK_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js', FRAMEWORK_ADMIN_DIR . '/javascript/lib.js', THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js', THIRDPARTY_DIR . '/json-js/json2.js', THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js', THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js', THIRDPARTY_DIR . '/jquery-query/jquery.query.js', THIRDPARTY_DIR . '/jquery-form/jquery.form.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jlayout.border.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jlayout/lib/jquery.jlayout.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js', THIRDPARTY_DIR . '/jstree/jquery.jstree.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js', FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js', FRAMEWORK_ADMIN_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js', FRAMEWORK_DIR . '/javascript/i18n.js', FRAMEWORK_DIR . '/javascript/TreeDropdownField.js', FRAMEWORK_DIR . '/javascript/DateField.js', FRAMEWORK_DIR . '/javascript/HtmlEditorField.js', FRAMEWORK_DIR . '/javascript/TabSet.js', FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js', FRAMEWORK_DIR . '/javascript/GridField.js'));
     if (Director::isDev()) {
         Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/leaktools.js');
     }
     $leftAndMainIncludes = array_unique(array_merge(array(FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Layout.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.ActionTabSet.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Panel.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Tree.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Content.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.EditForm.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Menu.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Preview.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.BatchActions.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldHelp.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.FieldDescriptionToggle.js', FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.TreeDropdownField.js'), Requirements::add_i18n_javascript(FRAMEWORK_DIR . '/javascript/lang', true, true), Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR . '/javascript/lang', true, true)));
     if ($this->config()->session_keepalive_ping) {
         $leftAndMainIncludes[] = FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.Ping.js';
     }
     Requirements::combine_files('leftandmain.js', $leftAndMainIncludes);
     // TODO Confuses jQuery.ondemand through document.write()
     if (Director::isDev()) {
         Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/src/jquery.entwine.inspector.js');
     }
     HtmlEditorConfig::require_js();
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/jquery-notice/jquery.notice.css');
     Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/smoothness/jquery-ui.css');
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.css');
     Requirements::css(THIRDPARTY_DIR . '/jstree/themes/apple/style.css');
     Requirements::css(FRAMEWORK_DIR . '/css/TreeDropdownField.css');
     Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/screen.css');
     Requirements::css(FRAMEWORK_DIR . '/css/GridField.css');
     // Browser-specific requirements
     $ie = isset($_SERVER['HTTP_USER_AGENT']) ? strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') : false;
     if ($ie) {
         $version = substr($_SERVER['HTTP_USER_AGENT'], $ie + 5, 3);
         if ($version == 7) {
             Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/ie7.css');
         } else {
             if ($version == 8) {
                 Requirements::css(FRAMEWORK_ADMIN_DIR . '/css/ie8.css');
             }
         }
     }
     // Custom requirements
     $extraJs = $this->stat('extra_requirements_javascript');
     if ($extraJs) {
         foreach ($extraJs as $file => $config) {
             if (is_numeric($file)) {
                 $file = $config;
             }
             Requirements::javascript($file);
         }
     }
     $extraCss = $this->stat('extra_requirements_css');
     if ($extraCss) {
         foreach ($extraCss as $file => $config) {
             if (is_numeric($file)) {
                 $file = $config;
                 $config = array();
             }
             Requirements::css($file, isset($config['media']) ? $config['media'] : null);
         }
     }
     $extraThemedCss = $this->stat('extra_requirements_themedCss');
     if ($extraThemedCss) {
         foreach ($extraThemedCss as $file => $config) {
             if (is_numeric($file)) {
                 $file = $config;
                 $config = array();
             }
             Requirements::themedCSS($file, isset($config['media']) ? $config['media'] : null);
         }
     }
     $dummy = null;
     $this->extend('init', $dummy);
     // The user's theme shouldn't affect the CMS, if, for example, they have
     // replaced TableListField.ss or Form.ss.
     Config::inst()->update('SSViewer', 'theme_enabled', false);
     //set the reading mode for the admin to stage
     Versioned::reading_stage('Stage');
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:101,代码来源:LeftAndMain.php

示例6: __construct

 public function __construct($name, $title = null, $value = '')
 {
     parent::__construct($name, $title, $value);
     HtmlEditorConfig::require_js();
     Requirements::customScript("ssTinyMceConfig.mode = 'specific_textareas';ssTinyMceConfig.editor_selector='frontendhtmleditor';tinyMCE.init(ssTinyMceConfig);");
 }
开发者ID:helpfulrobot,项目名称:andrelohmann-silverstripe-legacyfields,代码行数:6,代码来源:FrontendHtmlEditorField.php


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