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'); }
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'); }
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); }
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'); }
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()); } }
/** * 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(); }
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}"); }
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); }
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']); }
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'); }
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'); }
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); } }
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'); }
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; }
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'); }
private static function include_js_internal($configName) { require_once 'tinymce/tiny_mce_gzip.php'; $configObj = HtmlEditorConfig::get_active(); if (Config::inst()->get('HtmlEditorField', 'use_gzip')) { $internalPlugins = array(); foreach ($configObj->getPlugins() as $plugin => $path) { if (!$path) { $internalPlugins[] = $plugin; } } $tag = TinyMCE_Compressor::renderTag(array('url' => THIRDPARTY_DIR . '/tinymce/tiny_mce_gzip.php', 'plugins' => implode(',', $internalPlugins), 'themes' => 'advanced', 'languages' => $configObj->getOption('language')), true); preg_match('/src="([^"]*)"/', $tag, $matches); Requirements::javascript(html_entity_decode($matches[1])); } else { 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\t\t" . str_replace("ssTinyMceConfig", "ssTinyMceConfig" . $configName, $config->generateJS()) . "\n\t\t\t", "htmlEditorConfig-{$configName}"); }
/** * Get the HtmlEditorConfig for this user to be used in the CMS. * This is set by the group. If multiple configurations are set, * the one with the highest priority wins. * * @return string */ function getHtmlEditorConfigForCMS() { $currentName = ''; $currentPriority = 0; foreach ($this->Groups() as $group) { $configName = $group->HtmlEditorConfig; if ($configName) { $config = HtmlEditorConfig::get($group->HtmlEditorConfig); if ($config && $config->getOption('priority') > $currentPriority) { $currentName = $configName; } } } // If can't find a suitable editor, just default to cms return $currentName ? $currentName : 'cms'; }
<?php HtmlEditorConfig::get('cms')->enablePlugins(['viewtemplate' => Director::BaseURL() . 'viewtemplate/javascript/tinymce_viewtemplate/editor_plugin_src.js']); HtmlEditorConfig::get('cms')->addButtonsToLine(1, 'viewtemplate');
// Define path constant $path = str_replace('\\', '/', __DIR__); $path_fragments = explode('/', $path); $dir_name = $path_fragments[count($path_fragments) - 1]; define('ABC_SOCIAL_DIR', $dir_name); // attach the social extensions to the config and page classes SiteConfig::add_extension('SocialMediaConfig'); Page::add_extension('SocialMediaPageExtension'); // attach common behaviours to the social updates FBUpdate::add_extension('SocialUpdatePageExtension'); Tweet::add_extension('SocialUpdatePageExtension'); InstagramUpdate::add_extension('SocialUpdatePageExtension'); // add the embed functionality if (!Config::inst()->get('SocialGlobalConf', 'disable_wysiwyg_embed')) { ShortcodeParser::get('default')->register('social_embed', array('SocialMediaPageExtension', 'SocialEmbedParser')); HtmlEditorConfig::get('cms')->enablePlugins(array('social_embed' => '../../../' . ABC_SOCIAL_DIR . '/js/editor-plugin.js')); HtmlEditorConfig::get('cms')->addButtonsToLine(2, 'social_embed'); } // allow script tags // maybe we could try using requirements and stripping the script tags // HtmlEditorConfig::get('cms') // ->setOption( // 'extended_valid_elements', // 'img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap|data*],' . // 'iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],' . // 'object[width|height|data|type],' . // 'param[name|value],' . // 'map[class|name|id],' . // 'area[shape|coords|href|target|alt],ol[class|start],' . // 'script[type|src|lang|async|charset]' // );
<?php // turn off resizing in TinyMCE as it makes no sense for responsive images HtmlEditorConfig::get('cms')->setOption('advimagescale_noresize_all', 'false'); HtmlEditorConfig::get('cms')->setOption('object_resizing', false);
//(v2.4) Log errors to an email address //SS_Log::add_writer(new SS_LogEmailWriter('*****@*****.**'), SS_Log::ERR); // //(v2.4) Log errors to a file //SS_Log::add_writer(new SS_LogFileWriter('error_log.txt'), SS_Log::ERR); // /** * Extended URL rules for the CMS module * * @package cms */ Director::addRules(50, array('processes//$Action/$ID/$Batch' => 'BatchProcess_Controller', 'admin/help//$Action/$ID' => 'CMSHelp', 'admin/bulkload//$Action/$ID/$OtherID' => 'BulkLoaderAdmin', 'admin/cms//$Action/$ID/$OtherID' => 'CMSMain', 'PageComment//$Action/$ID' => 'PageComment_Controller', 'dev/buildcache/$Action' => 'RebuildStaticCacheTask')); CMSMenu::add_director_rules(); // Default CMS HTMLEditorConfig HtmlEditorConfig::get('cms')->setOptions(array('friendly_name' => 'Default CMS', 'priority' => '50', 'mode' => 'none', 'language' => i18n::get_tinymce_lang(), 'body_class' => 'typography', 'document_base_url' => Director::absoluteBaseURL(), 'urlconverter_callback' => "nullConverter", 'setupcontent_callback' => "sapphiremce_setupcontent", 'cleanup_callback' => "sapphiremce_cleanup", 'use_native_selects' => true, 'valid_elements' => "@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align],address[class|align],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class]", 'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]")); HtmlEditorConfig::get('cms')->enablePlugins('media', 'fullscreen'); HtmlEditorConfig::get('cms')->enablePlugins(array('ssbuttons' => '../../../cms/javascript/tinymce_ssbuttons/editor_plugin_src.js')); HtmlEditorConfig::get('cms')->insertButtonsBefore('formatselect', 'styleselect'); HtmlEditorConfig::get('cms')->insertButtonsBefore('advcode', 'ssimage', 'ssflash', 'sslink', 'unlink', 'anchor', 'separator'); HtmlEditorConfig::get('cms')->insertButtonsAfter('advcode', 'fullscreen', 'separator'); HtmlEditorConfig::get('cms')->removeButtons('tablecontrols'); HtmlEditorConfig::get('cms')->addButtonsToLine(3, 'tablecontrols'); // Register default side reports SS_Report::register("SideReport", "SideReport_EmptyPages"); SS_Report::register("SideReport", "SideReport_RecentlyEdited"); SS_Report::register("SideReport", "SideReport_ToDo"); if (class_exists('SubsiteReportWrapper')) { SS_Report::register('ReportAdmin', 'SubsiteReportWrapper("BrokenLinksReport")', -20); } else { SS_Report::register('ReportAdmin', 'BrokenLinksReport', -20); }
<?php global $project; $project = 'mysite'; global $database; require_once "conf/ConfigureFromEnv.php"; // Set the site locale i18n::set_locale('en_US'); // enable fulltext search FulltextSearchable::enable(); // set valid styles for the text editor field in CMS HtmlEditorConfig::get('cms')->setOption('valid_styles', array('*' => 'width,height,color,font-size,font-weight,font-style,text-decoration'));
$project = 'mysite'; global $databaseConfig; $databaseConfig = array("type" => 'MySQLDatabase', "server" => 'localhost', "username" => 'root', "password" => 'omega', "database" => 'vp', "path" => ''); MySQLDatabase::set_connection_charset('utf8'); // Set the current theme. More themes can be downloaded from // http://www.silverstripe.org/themes/ SSViewer::set_theme('simple'); // Set the site locale i18n::set_locale('en_US'); FulltextSearchable::enable(); // Enable nested URLs for this site (e.g. page/sub-page/) if (class_exists('SiteTree')) { SiteTree::enable_nested_urls(); } Director::set_environment_type("dev"); // add a button to remove formatting HtmlEditorConfig::get('cms')->insertButtonsBefore('styleselect', 'removeformat'); // tell the button which tags it may remove HtmlEditorConfig::get('cms')->setOption('removeformat_selector', 'b,strong,em,i,span,ins'); //remove font->span conversion HtmlEditorConfig::get('cms')->setOption('convert_fonts_to_spans', 'false,'); HtmlEditorConfig::get('cms')->setOptions(array('valid_elements' => "@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class],small", 'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],#iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]")); // TinyMCE cleanup on paste HtmlEditorConfig::get('cms')->setOption('paste_auto_cleanup_on_paste', 'true'); HtmlEditorConfig::get('cms')->setOption('paste_remove_styles', 'true'); HtmlEditorConfig::get('cms')->setOption('paste_remove_styles_if_webkit', 'true'); HtmlEditorConfig::get('cms')->setOption('paste_strip_class_attributes', 'true'); GD::set_default_quality(80); ShortcodeParser::get()->register('blogfeed', array('Page_Controller', 'BlogFeedHandler')); ShortcodeParser::get()->register('spotlight', array('Page_Controller', 'StaffSpotlightHandler')); Object::add_extension("BlogEntry", "BlogFieldExtension");
<?php if (!defined('RESPONSIVE_WYSIWYG_IMAGES_DIR')) { define('RESPONSIVE_WYSIWYG_IMAGES_DIR', rtrim(basename(dirname(__FILE__)))); } HtmlEditorConfig::get('cms')->enablePlugins(array('responsive_wysiwyg_images' => sprintf('../../../%s/javascript/editor_plugin.js', RESPONSIVE_WYSIWYG_IMAGES_DIR))); ShortcodeParser::get('default')->register('responsiveimage', array('ResponisveWYSIWYGImages', 'shortcode_handler'));
<?php HtmlEditorConfig::get('cms')->enablePlugins(array('htmleditorstylinghook' => '../../../' . basename(dirname(__FILE__)) . '/javascript/editor_plugin.js'));
<?php define('KICKASSETS_DIR', basename(__DIR__)); // IE9 doesn't get to play with us. if (!preg_match('/(?i)msie [5-9]/', $_SERVER['HTTP_USER_AGENT'])) { CMSMenu::remove_menu_item('AssetAdmin'); } else { CMSMenu::remove_menu_item('KickAssets'); } if (KickAssets::config()->use_on_uploadfield) { Config::inst()->update('LeftAndMain', 'extra_requirements_javascript', array(KICKASSETS_DIR . '/javascript/kickassets-uploadfield.js' => array())); } if (KickAssets::config()->use_on_tinymce) { HtmlEditorConfig::get('cms')->enablePlugins(array('kickassets' => '../../../' . KICKASSETS_DIR . '/javascript/kickassets-tinymce.js')); HtmlEditorConfig::get('cms')->insertButtonsAfter('ssmedia', 'kickassets'); }
* merge_cells * directionality * ltr * rtl * layer * moveforward * movebackward * absolute * insertlayer * save * save * cancel * style * styleprops * xhtmlxtras * cite * abbr * acronym * ins * del * attribs * template * template * */ HtmlEditorConfig::get('cms')->enablePlugins(array('youtube' => '../../../mysite/code/tinymce/youtube.js')); HtmlEditorConfig::get('cms')->setButtonsForLine(1, 'styleselect', 'formatselect', 'separator', 'bullist', 'numlist', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'image', 'separator', 'sslink', 'unlink', 'separator', 'bold', 'italic', 'underline', 'blockquote'); HtmlEditorConfig::get('cms')->setButtonsForLine(2, 'undo', 'redo', 'cut', 'copy', 'paste', 'table', 'code', 'youtube'); HtmlEditorConfig::get('cms')->setButtonsForLine(3, ''); HtmlEditorConfig::get('cms')->disablePlugins('table', 'contextmenu');
<?php define('KEYBOARD_SHORTCUTS_BASE', basename(dirname(__FILE__))); HtmlEditorConfig::get('cms')->enablePlugins(array('sskeyboardshortcuts' => '../../../' . KEYBOARD_SHORTCUTS_BASE . '/javascript/tinymce/editor_plugin_src.js'));
/** * Setting font and font size dropdown * Font dropdown is populated with configured fonts * This should be called from _config.php * Unfortunately this means that it's called on all page requests - TODO: this could be alterated with a proper if statement * * Resources * https://stojg.se/blog/2013-03-29-customize-tinymce-for-silverstripe-cms * http://www.balbuss.com/some-simple-tinymce-editor-settings-in-silverstripe/ * * Gists * http://www.sspaste.com/paste/show/513dfaf026629 * https://gist.github.com/colymba/6121825 * https://gist.github.com/ryanwachtl/6251297 * * TinyMCE Configuration * http://www.tinymce.com/wiki.php/configuration * */ public static function set_html_editor_config() { //HtmlEditorConfig::get("cms")->setButtonsForLine(3, "fontselect,fontsizeselect"); HtmlEditorConfig::get("cms")->addButtonsToLine(3, "|,fontselect,fontsizeselect"); //Font dropdown //notes: http://maxfoundry.com/blog/how-to-add-google-web-fonts-to-your-tinymce-editor-in-wordpress/ //http://stackoverflow.com/questions/12247339/how-to-enable-font-family-and-color-options-in-tinymce-editor $dropdownList = ''; foreach (self::enabled_fonts() as $font) { $fontNice = str_replace('+', ' ', $font); $dropdownList .= "{$fontNice}={$fontNice};"; } //there seems to be an issue with the last not being able to be selected //thus, I'm just adding a "default" there $dropdownList .= "Default=;"; HtmlEditorConfig::get('cms')->setOption('theme_advanced_fonts', $dropdownList); //Adding google fonts to the CSS that's rendered in tinyMCE $theme = Config::inst()->get('SSViewer', 'theme'); //we're calling fonts without styles - as the comma in the url messes up with //the tinyMCE config $googleFonts = WebfontsUtility::GoogleFontRequirements_string(true, false); HtmlEditorConfig::get('cms')->setOption('content_css', "{$googleFonts}, /webfonts/localfonts.css"); }
* @package cwsoft-shortcode * @version 2.2.4 * @author cwsoft (http://cwsoft.de) * @copyright cwsoft * @license http://www.gnu.org/licenses/gpl-3.0.html */ // ensure module is stored in folder "cwsoft-shortcode" $moduleName = 'cwsoft-shortcode'; $folderName = basename(dirname(__FILE__)); if ($folderName != $moduleName) { user_error(_t('_config.WRONG_MODULE_FOLDER', 'Please rename the folder "{folderName}" into "{moduleName}" to get the {moduleName} module working properly.', array('moduleName' => $moduleName, 'folderName' => $folderName)), E_USER_ERROR); } // include external files into head section Requirements::set_write_js_to_body(false); // register short code tags accessible from pages of type cwsCodePage ShortcodeParser::get()->register('cwsHideMailto', array('cwsShortCodeHideMailto', 'cwsShortCodeHideMailtoHandler')); ShortcodeParser::get()->register('cwsRandomImage', array('cwsShortCodeRandomImage', 'cwsShortCodeRandomImageHandler')); ShortcodeParser::get()->register('cwsRandomQuote', array('cwsShortCodeRandomQuote', 'cwsShortCodeRandomQuoteHandler')); // increase quality of created thumbnails if (class_exists('GDBackend')) { // SilverStripe >= 3.1.0 GDBackend::set_default_quality(95); } else { // SilverStripe 3.0.x GD::set_default_quality(95); } // Note: If you see unparsed placeholders like "{#shortcode.dlg_description}" when using the TinyMCE cwsoft-shortcode plugin, // you need to add a plugin language file for your locale to the folder "./plugins/shortcode/langs". Supported locales: EN, DE. HtmlEditorConfig::get('cms')->enablePlugins(array('shortcode' => '../../../cwsoft-shortcode/plugins/shortcode/editor_plugin_src.js')); HtmlEditorConfig::get('cms')->addButtonsToLine(1, 'shortcode');