示例#1
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\r\n\t\t\t{\r\n\t\t\t\teditor.config.dialog_backgroundCoverColor = '#000000';\r\n\t\t\t\teditor.config.dialog_backgroundCoverOpacity = 0.7;\r\n\t\t\t});");
     return $javascript->toRaw();
 }
 function beforeLoad(&$params)
 {
     //lets create JS object
     if (!$params->get('default_beez_template', '')) {
         // Only look for this file if this is a beez template
         return;
     }
     $javascript = new JCKJavascript();
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select('template');
     $query->from('#__template_styles');
     $query->where('client_id=0 AND home=1');
     $db->setQuery($query);
     $template = $db->loadResult();
     $base = str_replace("/administrator", "", JURI::base()) . 'templates/' . $template . '/css/';
     $templates = array();
     if (file_exists($base . 'layout.css')) {
         $templates[] = $base . 'layout.css';
     }
     if (file_exists($base . 'personal.css')) {
         $templates[] = $base . 'personal.css';
     }
     if (empty($templates)) {
         return;
     }
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\n\t\t\t{\n\t\t\t\teditor.config.contentsCss.push('" . implode("','", $templates) . "');\n\t\t\t});");
     if ($params->get('styles_css', true)) {
         $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\n\t\t\t\t{\n\t\t\t\t\tif(editor.config.stylesCss instanceof Array)\n\t\t\t\t\t\teditor.config.stylesCss.push('" . implode("','", $templates) . "');\n\t\t\t\t\telse if(editor.config.stylesCss) \n\t\t\t\t\t\teditor.config.stylesCss = [editor.config.stylesCss,'" . implode("','", $templates) . "'];\n\t\t\t\t\telse\n\t\t\t\t\t\teditor.config.stylesCss = ['" . implode("','", $templates) . "'];\n\t\t\t\t});");
     }
     return $javascript->toRaw();
 }
示例#3
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tif(editor.config.extraPlugins)\r\n\t\t\t\t\teditor.config.extraPlugins += ',webkitdrag,autolaunchfilebrowser,magicline,backgrounds';\r\n\t\t\t\telse \t\r\n\t\t\t\t\teditor.config.extraPlugins += 'webkitdrag,autolaunchfilebrowser,magicline,backgrounds';\r\n\t\t\t});");
     return $javascript->toRaw();
 }
示例#4
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\r\n\t\t\t{\r\n\t\t\t\tif(editor.config.extraPlugins)\r\n\t\t\t\t\teditor.config.extraPlugins += ',chromereadmorefix';\r\n\t\t\t\telse \t\r\n\t\t\t\t\teditor.config.extraPlugins += 'chromereadmorefix';\r\n\t\t\t});");
     return $javascript->toRaw();
 }
示例#5
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\n\t\t\t{\n\t\t\t\tif(editor.config.removePlugins)\n\t\t\t\t\teditor.config.removePlugins += ',jroverride';\n\t\t\t\telse \t\n\t\t\t\t\teditor.config.removePlugins += 'jroverride';\n\t\t\t});");
     return $javascript->toRaw();
 }
示例#6
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif(editor.config.extraPlugins)\n\t\t\t\t\teditor.config.extraPlugins += ',pastehtml,ie11selectionfix';\n\t\t\t\telse \t\n\t\t\t\t\teditor.config.extraPlugins += 'pastehtml,ie11selectionfix';\n\t\t\t});");
     return $javascript->toRaw();
 }
示例#7
0
 function afterLoad(&$params)
 {
     $javascript = new JCKJavascript();
     $script = "for(var m in CKEDITOR.jckplugins)\n\t\t{  \n\t\t\tvar jckplugin = CKEDITOR.jckplugins[m];\n\n\t\t\tif(jckplugin.options)\n\t\t\t{\n                                \n                for(var n = 0; n < jckplugin.options.length;n++)\n\t\t\t\t{\n\t\t\t\t\teval('editor.config.' + CKEDITOR.tools.removeSlashes(jckplugin.options[n]));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}";
     $javascript->addScriptDeclaration($script);
     return $javascript->toRaw();
 }
示例#8
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif(editor.config.extraPlugins)\n\t\t\t\t\teditor.config.extraPlugins += ',adddialogfieldexample,codemirrorresize,ietoolbarcollasperfix';\n\t\t\t\telse \t\n\t\t\t\t\teditor.config.extraPlugins += 'adddialogfieldexample,codemirrorresize,ietoolbarcollasperfix';\n\t\t\t});");
     return $javascript->toRaw();
 }
示例#9
0
 function beforeLoad(&$params)
 {
     $basePath = JPATH_CONFIGURATION . '/administrator/components/com_jckman/editor/lang';
     $languages = JFolder::files($basePath, '.js$', 1, true);
     $js = "";
     $default = $params->get("joomlaLang", "en");
     foreach ($languages as $language) {
         $content = file_get_contents($language);
         $content = preg_replace("/\\/\\*.*?\\*\\//s", "", $content);
         $content = str_replace('"', "'", $content);
         $language = str_replace("\\", "/", $language);
         $parts = explode("/", $language);
         $lang = preg_replace("/\\.js\$/", "", array_pop($parts));
         $plugin = array_pop($parts);
         if ($lang != $default && $lang != 'en' || $plugin == 'lang') {
             //make sure we always load in default english file
             continue;
         }
         $content = preg_replace("/\\)\$/", ");", trim($content));
         if ($plugin == 'jflash') {
             $plug = 'flash';
         } else {
             $plug = $plugin;
         }
         $js .= "CKEDITOR.on('" . $plugin . "PluginLoaded', function(evt)\r\n            {\r\n               editor.lang." . $plug . " = null;\r\n               evt.data.lang = ['" . $default . "'];             \r\n               " . $content . "           \r\n            });";
     }
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration($js);
     return $javascript->toRaw();
 }
示例#10
0
 function beforeLoad(&$params)
 {
     $magicline_enabled = $params->get('magicline_enabled', 1);
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("CKEDITOR.config.magicline_enabled = " . (int) $magicline_enabled . ";");
     return $javascript->toRaw();
 }
示例#11
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $startupFocus = $params->get('startupFocus', 0);
     $javascript->addScriptDeclaration("\r\n\t\t\teditor.config['startupFocus'] = " . (int) $startupFocus . ";");
     return $javascript->toRaw();
 }
示例#12
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $toolbar = $params->get('jck_toolbar', '');
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function(evt)\r\n\t\t\t{\r\n\t\t\t\tvar editor = evt.editor;\r\n\t\t\t\tvar toolbarName = '" . $toolbar . " ';\r\n\t\t\t\tif(!toolbarName)\r\n\t\t\t\t\treturn;\r\n\t\t\t\tvar toolbar =  editor.config.toolbar_" . $toolbar . ";\r\n\t           \t\t\t\r\n\t\t\t\tvar sortArray = []; \r\n\t\t\t\tvar element;\r\n\t\t\t\tvar removes = editor.config.removePlugins.split(',');\t\r\n\t\t    \r\n\t\t\t\tfor(var i= 0; i < toolbar.length;i++)\t\r\n\t\t\t\t{\t\r\n\t\t\t\t\telement = toolbar[i]\r\n\t\t\t\t     \r\n\t\t\t\t\tif(element instanceof Array)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar buttons = [];\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\tfor(var j = 0; j < element.length;j++)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar button = element[j];\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif(!button) \r\n\t\t\t\t\t\t\t  continue;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tvar title = button.toLowerCase() ;\r\n\t\t\t\t\t\t\tif(title == 'flash')\r\n\t\t\t\t\t\t\t\ttitle = 'jflash';\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif(title == 'about')\r\n\t\t\t\t\t\t\t\ttitle = 'jabout';\r\n\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif(CKEDITOR.tools.indexOf(removes,title ) != -1)\r\n\t\t\t\t\t\t\t\tcontinue\r\n\t\t\t\t\t\t\tbuttons.push(button);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telement = buttons;\r\n\t\t\t\t\t\tif(element.length)\r\n\t\t\t\t\t\t\tsortArray.push(element);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\t\r\n\t\t\t\t\r\n\t\t\t\ttoolbar = sortArray;\r\n\t\t\t\t\r\n\t\t\t\t//cleanup\r\n\t\t\t\tif( typeof toolbar[toolbar.length] == 'string')\r\n\t\t\t\t\tdelete  toolbar[toolbar.length];\r\n\t\t\t\t\r\n\t\t\t\tif( typeof toolbar[0] == 'string')\r\n\t\t\t\t\tdelete  toolbar[0];\r\n\t\t\t\t\t\t\r\n\t\t\t\teditor.config.toolbar_" . $toolbar . " = toolbar;\r\n\t\t\t});");
     return $javascript->toRaw();
 }
示例#13
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $EnableImageDragndrop = $params->get('EnableImageDragndrop', 1);
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\r\n\t\t\t{\r\n\t\t\t\teditor.config.EnableImageDragndrop = " . (int) $EnableImageDragndrop . ";\r\n\t\t\t});");
     return $javascript->toRaw();
 }
示例#14
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $script = "editor.on( 'configLoaded', function()\n\t\t{\n\t\t\tif(editor.config.extraPlugins)\n\t\t\t\teditor.config.extraPlugins += ',xml';\n\t\t\telse\n\t\t\t\teditor.config.extraPlugins += 'xml';\n\t\t});";
     $javascript->addScriptDeclaration($script);
     return $javascript->toRaw();
 }
示例#15
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $forcesimpleAmpersand = $params->get('forcesimpleAmpersand', 0);
     $javascript->addScriptDeclaration("\r\n\t\t\teditor.config['forcesimpleAmpersand'] = " . (int) $forcesimpleAmpersand . ";");
     return $javascript->toRaw();
 }
示例#16
0
 function afterLoad(&$params)
 {
     $mainframe = JFactory::getApplication();
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("\n\t\t\teditor.config['client'] = " . $mainframe->getClientId() . ";");
     return $javascript->toRaw();
 }
示例#17
0
 function intialize(&$params)
 {
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("(function(){");
     $javascript->addScriptDeclaration("var jfunctions = {};");
     $javascript->addScriptDeclaration("\r\r\n\t\tCKEDITOR.tools.extend(CKEDITOR.tools,\r\r\n\t\t{\r\r\n\t\t\tgetData : function(IdOrName)\r\r\n\t\t\t{\r\r\n\t\t\t\t return CKEDITOR.instances[IdOrName] && CKEDITOR.instances[IdOrName].getData() || oEditor && oEditor.getData();\t\r\r\n\t\t\t},\r\r\n\t\t\tsetData : function(IdOrName,ohtml)\r\r\n\t\t\t{\r\r\n\t\t\t\t if(oEditor) {oEditor.setData(ohtml);} \r\r\n\t\t\t\t else { CKEDITOR.instances[IdOrName].setData(ohtml);}\r\r\n\t\t\t},\r\r\n\t\t\taddHashFunction : function( fn, ref)\r\r\n\t\t\t{\r\r\n\t\t\t\tjfunctions[ref] =  function()\r\r\n\t\t\t\t{\r\r\n\t\t\t\t\tfn.apply( window, arguments );\r\r\n\t\t\t\t};\r\r\n\t\t\t},\r\r\n\t\t\tcallHashFunction : function( ref )\r\r\n\t\t\t{\r\r\n\t\t\t\tvar fn = jfunctions[ ref ];\r\r\n\t\t\t\treturn fn && fn.apply( window, Array.prototype.slice.call( arguments, 1 ) );\r\r\n\t\t\t}\r\r\n\t\t});");
     $javascript->addScriptDeclaration("})();");
     return $javascript->toRaw();
 }
 function afterLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $imagePath = $params->get('imagePath', 'images');
     $imagePath = preg_replace('/(^\\/|\\/$)/', '', $imagePath);
     $javascript->addScriptDeclaration("\r\r\n\t\t\teditor.config['imagePath'] = '" . $imagePath . "';");
     return $javascript->toRaw();
 }
示例#19
0
 function beforeLoad(&$params)
 {
     $css = $params->get('jcktypography', false);
     if (!$css) {
         return false;
     }
     //lets create JS object
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\r\n\t\t\t{\r\n\t\t\t\tvar styleDefinitions = editor.config.stylesSet;\r\n\t\t\t       styleDefinitions.push( { name : 'Caption Photo', element : 'img', attributes : { 'class' : 'caption photo' } });\r\n\t\t\t       styleDefinitions.push( { name : 'Caption PhotoBlack', element : 'img', attributes : { 'class' : 'caption photoblack' } });\r\n\t\t\t       styleDefinitions.push( { name : 'Caption PhotoBlue', element : 'img', attributes : { 'class' : 'caption photoblue' } });\r\n\t\t\t       styleDefinitions.push( { name : 'Caption PhotoGreen', element : 'img', attributes : { 'class' : 'caption photogreen' } });\r\n\t\t\t       styleDefinitions.push( { name : 'Caption PhotoRed', element : 'img', attributes : { 'class' : 'caption photored' } });\r\n\t\t\t       styleDefinitions.push( { name : 'Caption PhotoYellow', element : 'img', attributes : { 'class' : 'caption photoyellow' } });\r\n\t\t\t});");
     return $javascript->toRaw();
 }
示例#20
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $script = "editor.on( 'configLoaded', function()\n\t\t{\n\t\t\tif(editor.config.extraPlugins)\n\t\t\t\teditor.config.extraPlugins += ',mobilefloatpanelfix,mobileviewport,mobilemodalfix';\n\t\t\telse\n\t\t\t\teditor.config.extraPlugins += 'mobilefloatpanelfix,mobileviewport,mobilemodalfix';\n\t\t});";
     if (defined('JCK_MOBILE')) {
         $script .= chr(13) . "editor.colorButton_enableMore = false;\n\t\t\t\n\t\t\teditor.on( 'configLoaded', function()\n\t\t\t{\n\t\t\t  editor.config.startupFocus = 1;\n\t\t\t  editor.config.resize_minWidth = 100;\n\t\t\t  if(editor.config.removePlugins)\n\t\t\t\t\teditor.config.removePlugins += ',jfilebrowser';\n\t\t\t\telse \t\n\t\t\t\t\teditor.config.removePlugins += 'jfilebrowser';\n\t\t\t});";
     }
     $javascript->addScriptDeclaration($script);
     return $javascript->toRaw();
 }
示例#21
0
 function afterLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $imagePath = $params->get('imagePath', 'images');
     $imagePath = preg_replace('/(^\\/|\\/$)/', '', $imagePath);
     $ftfamily = $params->get('ftfamily', '');
     $ftsize = $params->get('ftsize', '');
     $bgcolor = $params->get('bgcolor', '#ffffff');
     $ftcolor = $params->get('ftcolor', '');
     $javascript->addScriptDeclaration("\n\t\t\teditor.config['imagePath'] = '" . $imagePath . "';" . ($ftfamily ? "editor.config['ftfamily'] = '" . $ftfamily . "';" : "") . ($ftsize ? "editor.config['ftsize'] = '" . $ftsize . "';" : "") . "\n\t\t\teditor.config['bgcolor'] = '" . $bgcolor . "';" . ($ftcolor ? "editor.config['ftcolor'] = '" . $ftcolor . "';" : ""));
     return $javascript->toRaw();
 }
示例#22
0
 function afterLoad(&$params)
 {
     $mainframe = JFactory::getApplication();
     //lets create JS object
     $javascript = new JCKJavascript();
     $user = JFactory::getUser();
     $username = $user->get('username');
     $email = $user->get('email');
     $clientid = $mainframe->getClientId();
     $cacheKey = md5('jckeditor' . $username . $email . $clientid);
     $javascript->addScriptDeclaration("\r\r\n\t\t\teditor.config['client'] = '" . $cacheKey . "';");
     return $javascript->toRaw();
 }
 function afterLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $plugin = JPluginHelper::getPlugin('content', 'jw_allvideos');
     if (empty($plugin) && !isset($plugin->params)) {
         return;
     }
     $avParams = new JParameter($plugin->params);
     $allAudioPath = $avParams->get('afolder', 'images/stories/audio');
     $allVideoPath = $avParams->get('vfolder', 'images/stories/video');
     $javascript->addScriptDeclaration("\r\r\n\t\t\teditor.config['allAudioPath'] = '" . $allAudioPath . "';\r\r\n\t\t\teditor.config['allVideoPath'] = '" . $allVideoPath . "';");
     return $javascript->toRaw();
 }
示例#24
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $defaultColor = $params->get('uicolor', '#D6E6F4');
     $user = JFactory::getUser();
     $color = $user->getParam('jckuicolor', $defaultColor);
     if ($color == $defaultColor) {
         //already set so just exit
         return;
     }
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\n\t\t\t{\n\t\t\t\teditor.config.uiColor = '" . $color . "';\n\t\t\t});");
     return $javascript->toRaw();
 }
示例#25
0
 function afterLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $imagePath = $params->get('imagePath', 'images');
     $imagePath = preg_replace('/(^\\/|\\/$)/', '', $imagePath);
     $ftfamily = $params->get('ftfamily', '');
     $ftsize = $params->get('ftsize', '');
     $bgcolor = $params->get('bgcolor', '#ffffff');
     $ftcolor = $params->get('ftcolor', '');
     $autolaunchFilebrowser = $params->get('autolaunchFilebrowser', 1);
     $magicline_enabled = $params->get('magicline_enabled', 1);
     $javascript->addScriptDeclaration("\r\n\t\t\teditor.config['imagePath'] = '" . $imagePath . "';" . ($autolaunchFilebrowser ? "editor.config['autolaunchFilebrowser'] = '" . $autolaunchFilebrowser . "';" : "") . ($magicline_enabled ? "CKEDITOR.config['magicline_enabled'] = '" . $magicline_enabled . "';" : "") . ($ftfamily ? "editor.config['ftfamily'] = '" . $ftfamily . "';" : "") . ($ftsize ? "editor.config['ftsize'] = '" . $ftsize . "';" : "") . "\r\n\t\t\teditor.config['bgcolor'] = '" . $bgcolor . "';" . ($ftcolor ? "editor.config['ftcolor'] = '" . $ftcolor . "';" : ""));
     return $javascript->toRaw();
 }
示例#26
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $ftfamily = $params->get('ftfamily', '');
     $ftsize = $params->get('ftsize', '');
     if ($ftsize) {
         $ftsize .= strpos($ftsize, 'px') || strpos($ftsize, 'pt') || strpos($ftsize, '%') ? '' : 'px';
     }
     $script = '';
     $script .= $ftfamily ? "editor.addCss( 'body { font-family: " . $ftfamily . "; }' );" : "";
     $script .= $ftsize ? "editor.addCss( 'body { font-size: " . $ftsize . "; }' );" : "";
     $javascript->addScriptDeclaration($script);
     return $javascript->toRaw();
 }
示例#27
0
 function afterLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     $plugin = JPluginHelper::getPlugin('content', 'jw_sigpro');
     if (empty($plugin)) {
         $plugin = JPluginHelper::getPlugin('content', 'jwsig');
     }
     if (empty($plugin) && !isset($plugin->params)) {
         return;
     }
     $sigParams = new JParameter($plugin->params);
     $sigPath = $sigParams->get('galleries_rootfolder', 'images/stories');
     $sigPath = preg_replace('/(^\\/|\\/$)/', '', $sigPath);
     $sigPath = preg_replace('/(^\\/|\\/$)/', '', $sigPath);
     $javascript->addScriptDeclaration("\r\n\t\t\teditor.config['sigPath'] = '" . $sigPath . "';");
     return $javascript->toRaw();
 }
示例#28
0
 public function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     //lets create JS object
     $javascript = new JCKJavascript();
     $css = $params->get('jcktypography', false);
     $bgcolor = $params->get('bgcolor', '#ffffff');
     if ($css) {
         $stylesheet = str_replace("administrator/", "", JURI::base()) . "plugins/editors/jckeditor/typography/typography.php";
         $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\r\n\t\t\t\t{\r\n\t\t\t\t\tif(editor.config.contentsCss instanceof Array)\r\n\t\t\t\t\t\teditor.config.contentsCss.unshift('" . $stylesheet . "');\r\n\t\t\t\t\telse if(editor.config.contentsCss)\t\r\n\t\t\t\t\t\teditor.config.contentsCss = ['" . $stylesheet . "',editor.config.contentsCss];\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\teditor.config.contentsCss = ['" . $stylesheet . "'];\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(editor.config.stylesCss instanceof Array)\r\n\t\t\t\t\t\teditor.config.stylesCss.unshift('" . $stylesheet . "');\r\n\t\t\t\t\telse if(editor.config.stylesCss)\t\r\n\t\t\t\t\t\t\teditor.config.stylesCss = ['" . $stylesheet . "',editor.config.stylesCss];\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\teditor.config.stylesCss = '" . $stylesheet . "';\t\r\n\t\t\t\t\t});");
     }
     $mainframe = JFactory::getApplication();
     $path_root = '../';
     if ($mainframe->isSite()) {
         $path_root = '';
     }
     $stylesheet = $this->_getStylesPath($params, $path_root);
     $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\r\n\t\t\t{\r\n\t\t\t\tif(editor.config.stylesCss instanceof Array)\r\n\t\t\t\t\teditor.config.stylesCss.push('" . $stylesheet . "');\r\n\t\t\t\telse\tif(editor.config.stylesCss)\r\n\t\t\t\t\teditor.config.stylesCss = ['" . $stylesheet . "',editor.config.stylesCss];\r\n\t\t\t\telse\r\n\t\t\t\t\teditor.config.stylesCss = ['" . $stylesheet . "'];\t\r\n\t\t\t\teditor.config.stylesCss.push('body {  background: " . $bgcolor . " none; }');\t\r\n\t\t\t\t\r\n\t\t\t\tif(CKEDITOR.tools.indexOf( editor.config.contentsCss,  '" . $stylesheet . "') == -1)\r\n\t\t\t\t{\t\r\n\t\t\t\t\teditor.config.contentsCss.push('" . $stylesheet . "');\r\n\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\tif(editor.config.extraPlugins)\r\n\t\t\t\t\teditor.config.extraPlugins += ',cmsstylesheet';\r\n\t\t\t\telse \t\r\n\t\t\t\t\teditor.config.extraPlugins += 'cmsstylesheet';\t\r\n\t\t\t\t\t\r\n\t\t\t});");
     return $javascript->toRaw();
 }
示例#29
0
 function beforeLoad(&$params)
 {
     //lets create JS object
     $javascript = new JCKJavascript();
     if ($this->_overwrite) {
         $javascript->addScriptDeclaration("editor.on( 'configLoaded', function()\r\n\t\t\t\t{\r\n\t\t\t\t\teditor.config.plugins = 'html5support,' + editor.config.plugins\r\n\t\t\t\t\tif(editor.config.extraPlugins)\r\n\t\t\t\t\t\teditor.config.extraPlugins += ',video,audio,uicolor,imagedragndrop,ie9selectionoverride';\r\n\t\t\t\t\telse \t\r\n\t\t\t\t\t\teditor.config.extraPlugins += 'video,audio,uicolor,imagedragndrop,ie9selectionoverride';\r\n\t\t\t\t\r\n\t\t\t\t\tif(editor.config.toolbar == 'Full')\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar toolbar = editor.config.toolbar_Full[editor.config.toolbar_Full.length-1];\r\n\t\t\t\t\t\tvar extra = ['Video','Audio','UIColor'];\r\n\t\t\t\t\t\teditor.config.toolbar_Full[editor.config.toolbar_Full.length-1] = toolbar.concat(extra);\r\n\t\t\t\t\t}\t\r\n\t\t\t\t});");
     }
     $config = JFactory::getConfig();
     $dbname = $config->get('db');
     $db = JFactory::getDBO();
     $query = "SELECT COUNT(1)\r\n\t\tFROM information_schema.tables \r\n\t\tWHERE table_schema = '" . $dbname . "' \r\n\t\tAND table_name = '" . $db->getPrefix() . "jcktoolbarplugins'";
     $db->setQuery($query);
     if (!$db->loadResult()) {
         return $javascript->toRaw();
     }
     $query = "SELECT COUNT(p.id) AS pcount,COUNT(tp.pluginid) AS tpcount FROM #__jckplugins p\r\n\t\tLEFT JOIN #__jcktoolbarplugins tp on tp.pluginid = p.id\r\n\t\tWHERE `name` IN('html5support','video','audio','uicolor') ";
     $db->setQuery($query);
     $info = $db->loadObject();
     if ($info && $info->tpcount) {
         return;
     }
     if (!$info->pcount) {
         $query = "INSERT INTO #__jckplugins (`title`,`name`,`type`,`row`,`published`,`editable`,`icon`,`iscore`,`params`, `parentid`) VALUES \r\n\t\t\t('','html5support','plugin',0,1,1,'',1,'',NULL)";
         $db->setQuery($query);
         if (!$db->query()) {
             return $javascript->toRaw();
         }
         $parentid = $db->insertid();
         $query = "INSERT INTO #__jckplugins (`title`,`name`,`type`,`row`,`published`,`editable`,`icon`,`iscore`,`params`, `parentid`) VALUES \r\n            ('Video','video','plugin',3,1,1,'images/icon.png',1,''," . $parentid . "),\t\r\n            ('Audio','audio','plugin',3,1,1,'images/icon.png',1,''," . $parentid . "),\t\r\n            ('UIColor','uicolor','plugin',3,1,1,'uicolor.gif',1,'',NULL),\t\r\n            ('','imagedragndrop','plugin',0,1,1,'',1,'',NULL),\r\n\t\t\t('','ie9selectionoverride','plugin',0,1,1,'',1,'',NULL)";
         $db->setQuery($query);
         if (!$db->query()) {
             return $javascript->toRaw();
         }
         $first = $db->insertid();
         $last = $first + 2;
         //get next layout row  details
         $query = "SELECT row as rowid,MAX(`ordering`) +1 AS rowordering FROM #__jcktoolbarplugins WHERE toolbarid = 1 \r\n                        GROUP BY row\r\n                        ORDER BY row DESC LIMIT 1";
         $db->setQuery($query);
         $rowDetail = $db->loadObject();
         $values = array();
         for ($i = $first; $i <= $last; $i++) {
             $values[] = '(1,' . $i . ',' . $rowDetail->rowid . ',' . $rowDetail->rowordering++ . ',1)';
         }
         $query = "INSERT INTO #__jcktoolbarplugins(toolbarid,pluginid,row,ordering,state) VALUES " . implode(",", $values);
         $db->setQuery($query);
         $db->query();
     }
     if ($this->_overwrite) {
         //Get toolbar plugins object
         jckimport('ckeditor.plugins');
         jckimport('ckeditor.plugins.toolbarplugins');
         $plugins = new JCKtoolbarPlugins();
         foreach (get_object_vars($plugins) as $key => $value) {
             if (strpos('p' . $key, '_')) {
                 unset($plugins->{$key});
             }
         }
         $plugins->html5support = 1;
         $plugins->video = 1;
         $plugins->audio = 1;
         $plugins->uicolor = 1;
         $plugins->imagedragndrop = 1;
         $plugins->ie9selectionoverride = 1;
         $config = new JRegistry('config');
         $config->loadObject($plugins);
         $cfgFile = '';
         $is1_6plus = file_exists(JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor');
         if ($is1_6plus) {
             $cfgFile = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor' . DS . 'plugins' . DS . 'toolbarplugins.php';
         } else {
             $cfgFile = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor' . DS . 'plugins' . DS . 'toolbarplugins.php';
         }
         // Get the config registry in PHP class format and write it to file
         if ($is1_6plus) {
             if (!JFile::write($cfgFile, $config->toString('PHP', array('class' => 'JCKToolbarPlugins extends JCKPlugins')))) {
                 return $javascript->toRaw();
             }
             //if fail then bail out
         } else {
             if (!JFile::write($cfgFile, $config->toString('PHP', 'config', array('class' => 'JCKToolbarPlugins extends JCKPlugins')))) {
                 return $javascript->toRaw();
             }
             //if fail then bail out
         }
         jckimport('ckeditor.toolbar');
         jckimport('ckeditor.toolbar.full');
         $toolbar = new JCKFull();
         //fix toolbar values or they will get wiped out
         foreach (get_object_vars($toolbar) as $k => $v) {
             if (is_null($v)) {
                 $toolbar->{$k} = '';
             }
             if ($k[0] == '_') {
                 $toolbar->{$k} = NULL;
             }
         }
         if (isset($toolbar->Video) || isset($toolbar->Audio) || isset($toolbar->UIColor)) {
             return false;
         }
         $toolbar->Video = '';
         $toolbar->Audio = '';
         $toolbar->UIColor = '';
         $toolbarConfig = new JRegistry('toolbar');
         $toolbarConfig->loadObject($toolbar);
         $filename = '';
         if ($is1_6plus) {
             $filename = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor' . DS . 'toolbar' . DS . 'full.php';
         } else {
             $filename = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'includes' . DS . 'ckeditor' . DS . 'toolbar' . DS . 'full.php';
         }
         // Get the config registry in PHP class format and write it to file
         if ($is1_6plus) {
             JFile::write($filename, $toolbarConfig->toString('PHP', array('class' => 'JCKFull extends JCKToolbar')));
         } else {
             JFile::write($filename, $toolbarConfig->toString('PHP', 'toolbar', array('class' => 'JCKFull extends JCKToolbar')));
         }
     }
     return $javascript->toRaw();
 }
示例#30
0
文件: env.php 项目: fur81/zofaxiopeu
 function intialize(&$params)
 {
     $javascript = new JCKJavascript();
     $javascript->addScriptDeclaration("\r\n\t\t\t\t\t\t\r\n\t\t\t(function()\r\n\t\t\t{\r\n\t\t\t\tvar mooTools = typeof MooTools != 'undefined' ? MooTools : false , \r\n\t\t\t\tbrowser = typeof Browser != 'undefined' ? Browser : false;\r\n\t\t\t\t\r\n\t\t\t\tCKEDITOR.env.ie9Compat = document.documentMode == 9;\r\n\t\t\t\t\r\n\t\t\t\tCKEDITOR.env.opera = mooTools && browser && browser.Engine && (browser.Engine.name == 'presto') && true || CKEDITOR.env.opera;\r\n\t\t\t\t\r\n\t\t\t\tCKEDITOR.env.version = \r\n\t\t\t\t\tmooTools && CKEDITOR.env.opera && browser && browser.Engine && browser.Engine.version && browser.Engine.version/100 || CKEDITOR.env.version;\r\n\t\t\t\t\r\n\t\t\t\tvar env = CKEDITOR.env;\r\n\t\t\t\t\tversion = CKEDITOR.env.version;\r\n\t\t\t\t\t\r\n\t\t\t\tvar agent = navigator.userAgent.toLowerCase();\t\r\n\t\t\t\t\r\n\t\t\t\tCKEDITOR.env.iOS = /(ipad|iphone|ipod)/.test(agent); \t\r\n\t\t\t\t\r\n\t\t\t\tCKEDITOR.env.isCompatible =\r\n\t\t\t\t\r\n\t\t\t\t// White list of mobile devices that supports. Patch 7190\r\n\t\t\t\tenv.iOS && version >= 534 || \r\n\t\t\t\t\r\n\t\t\t\t!env.mobile && (\r\n\t\t\t\t( env.ie && version >= 6 ) ||\r\n\t\t\t\t( env.gecko && version >= 10801 ) ||\r\n\t\t\t\t( env.opera && version >= 9.5 ) ||\r\n\t\t\t\t( env.air && version >= 1 ) ||\r\n\t\t\t\t( env.webkit && version >= 522 ) ||\r\n\t\t\t\tfalse );\t\r\n\t\t\t}\r\n\t\t\t)();");
     return $javascript->toRaw();
 }