Changeset 3730:5c45a5df9a59 for plugins/dcCKEditor
- Timestamp:
- 03/08/18 17:58:39 (7 years ago)
- Branch:
- default
- Location:
- plugins/dcCKEditor
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dcCKEditor/_define.php
r3333 r3730 10 10 # 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 if (!defined('DC_RC_PATH')) { return;}12 if (!defined('DC_RC_PATH')) {return;} 13 13 14 14 $this->registerModule( 15 /* Name */ "dcCKEditor", 16 /* Description*/ "dotclear CKEditor integration", 17 /* Author */ "dotclear Team", 18 /* Version */ "1.1.0", 19 20 'permissions' =>'usage,contentadmin',21 'type' =>'plugin',22 'settings' =>array(23 24 25 26 15 "dcCKEditor", // Name 16 "dotclear CKEditor integration", // Description 17 "dotclear Team", // Author 18 "1.1.0", // Version 19 array( 20 'permissions' => 'usage,contentadmin', 21 'type' => 'plugin', 22 'settings' => array( 23 'self' => '', 24 'pref' => '#user-options.user_options_edition' 25 ) 26 ) 27 27 ); -
plugins/dcCKEditor/_install.php
r3090 r3730 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 if (!defined('DC_CONTEXT_ADMIN')) { return;}13 if (!defined('DC_CONTEXT_ADMIN')) {return;} 14 14 15 15 $version = $core->plugins->moduleInfo('dcCKEditor', 'version'); 16 if (version_compare($core->getVersion('dcCKEditor'), $version, '>=')) {16 if (version_compare($core->getVersion('dcCKEditor'), $version, '>=')) { 17 17 return; 18 18 } -
plugins/dcCKEditor/_post_config.php
r3670 r3730 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 if (!defined('DC_CONTEXT_ADMIN')) { return;}13 if (!defined('DC_CONTEXT_ADMIN')) {return;} 14 14 15 15 header('Content-type: text/javascript'); 16 16 17 17 if (!empty($_GET['context'])) { 18 18 $context = $_GET['context']; 19 19 } else { 20 20 $context = ''; 21 21 } 22 22 23 23 $__extraPlugins = new ArrayObject(); 24 $core->callBehavior('ckeditorExtraPlugins', $__extraPlugins,$context);24 $core->callBehavior('ckeditorExtraPlugins', $__extraPlugins, $context); 25 25 $extraPlugins = $__extraPlugins->getArrayCopy(); 26 26 … … 28 28 29 29 (function($) { 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 30 $.toolbarPopup = function toolbarPopup(url) { 31 if (dotclear.admin_base_url != '') { 32 var pos = url.indexOf(dotclear.admin_base_url); 33 if (pos == -1) { 34 url = dotclear.admin_base_url + url; 35 } 36 } 37 38 var args = Array.prototype.slice.call(arguments); 39 var width = 520, height = 420; 40 if (args[1]!==undefined) { 41 width = args[1].width || width; 42 height = args[1].height || height; 43 } 44 45 var popup_params = 'alwaysRaised=yes,dependent=yes,toolbar=yes,'; 46 popup_params += 'height='+height+',width='+width+',menubar=no,resizable=yes,scrollbars=yes,status=no'; 47 var popup_link = window.open(url,'dc_popup', popup_params); 48 }; 49 50 $.stripBaseURL = function stripBaseURL(url) { 51 if (dotclear.base_url != '') { 52 var pos = url.indexOf(dotclear.base_url); 53 if (pos == 0) { 54 url = url.substr(dotclear.base_url.length); 55 } 56 } 57 58 return url; 59 }; 60 61 /* Retrieve editor from popup */ 62 $.active_editor = null; 63 $.getEditorName = function getEditorName() { 64 return $.active_editor; 65 } 66 chainHandler(window,'onbeforeunload',function(e) { 67 if (e == undefined && window.event) { 68 e = window.event; 69 } 70 71 var editor = CKEDITOR.instances[$.getEditorName()]; 72 if (editor !== undefined && !confirmClosePage.formSubmit && editor.checkDirty()) { 73 e.returnValue = confirmClosePage.prompt; 74 return confirmClosePage.prompt; 75 } 76 return false; 77 }); 78 78 })(jQuery); 79 79 80 80 $(function() { 81 82 83 84 85 81 /* By default ckeditor load related resources with a timestamp to avoid cache problem when upgrading itself 82 * load_plugin_file.php does not allow other param that file to load (pf param), so remove timestamp 83 */ 84 85 CKEDITOR.timestamp = ''; 86 86 87 87 <?php if (!isset($dcckeditor_disable_native_spellchecker) || $dcckeditor_disable_native_spellchecker): ?> 88 88 CKEDITOR.config.disableNativeSpellChecker = true; 89 89 <?php else: ?> 90 91 <?php endif; 92 93 94 95 90 CKEDITOR.config.disableNativeSpellChecker = false; 91 <?php endif;?> 92 93 CKEDITOR.config.skin = 'dotclear,'+dotclear.dcckeditor_plugin_url+'/js/ckeditor-skins/dotclear/'; 94 CKEDITOR.config.baseHref = dotclear.base_url; 95 CKEDITOR.config.height = '<?php echo $core->auth->getOption('edit_size') * 14; ?>px'; 96 96 97 97 <?php if (!empty($dcckeditor_cancollapse_button)): ?> 98 99 <?php endif; 100 101 102 103 104 98 CKEDITOR.config.toolbarCanCollapse = true; 99 <?php endif;?> 100 101 CKEDITOR.plugins.addExternal('entrylink',dotclear.dcckeditor_plugin_url+'/js/ckeditor-plugins/entrylink/'); 102 CKEDITOR.plugins.addExternal('dclink',dotclear.dcckeditor_plugin_url+'/js/ckeditor-plugins/dclink/'); 103 CKEDITOR.plugins.addExternal('media',dotclear.dcckeditor_plugin_url+'/js/ckeditor-plugins/media/'); 104 CKEDITOR.plugins.addExternal('img',dotclear.dcckeditor_plugin_url+'/js/ckeditor-plugins/img/'); 105 105 106 106 <?php if (!empty($dcckeditor_textcolor_button) || !empty($dcckeditor_background_textcolor_button)): ?> 107 108 109 <?php endif; 107 // button add "More Colors..." can be added if colordialog plugin is enabled 108 CKEDITOR.config.colorButton_enableMore = true; 109 <?php endif;?> 110 110 111 111 <?php 112 113 114 printf("\tCKEDITOR.plugins.addExternal('%s','%s');\n",$plugin['name'],$plugin['url']);115 116 117 ?> 118 119 120 121 112 if (!empty($extraPlugins) && count($extraPlugins) > 0) { 113 foreach ($extraPlugins as $plugin) { 114 printf("\tCKEDITOR.plugins.addExternal('%s','%s');\n", $plugin['name'], $plugin['url']); 115 } 116 } 117 ?> 118 if (dotclear.ckeditor_context === undefined || dotclear.ckeditor_tags_context[dotclear.ckeditor_context] === undefined) { 119 return; 120 } 121 $(dotclear.ckeditor_tags_context[dotclear.ckeditor_context].join(',')).ckeditor({ 122 122 123 123 <?php 124 125 if (!empty($extraPlugins) && count($extraPlugins)>0) {126 127 $defautExtraPlugins .= ','. $plugin['name'];128 129 130 ?> 131 132 133 134 135 136 137 138 124 $defautExtraPlugins = 'entrylink,dclink,media,justify,colorbutton,format,img'; 125 if (!empty($extraPlugins) && count($extraPlugins) > 0) { 126 foreach ($extraPlugins as $plugin) { 127 $defautExtraPlugins .= ',' . $plugin['name']; 128 } 129 } 130 ?> 131 extraPlugins: '<?php echo $defautExtraPlugins; ?>', 132 133 keystrokes: [ 134 [ CKEDITOR.CTRL + (CKEDITOR.env.mac ? CKEDITOR.ALT : CKEDITOR.SHIFT) + 135 dotclear.msg.link_accesskey.toUpperCase().charCodeAt(0),'dcLinkCommand' ], // Ctrl+Alt+l 136 [ CKEDITOR.CTRL + (CKEDITOR.env.mac ? CKEDITOR.ALT : CKEDITOR.SHIFT) + 137 dotclear.msg.img_select_accesskey.toUpperCase().charCodeAt(0),'mediaCommand' ], // Ctrl+Alt+m 138 ], 139 139 140 140 <?php if (!empty($dcckeditor_format_select)): ?> 141 142 143 144 145 146 147 <?php endif;?>148 149 150 151 152 153 154 155 156 157 158 159 <?php endif; 160 161 162 163 164 165 166 167 141 // format tags 142 143 <?php if (!empty($dcckeditor_format_tags)): ?> 144 format_tags: '<?php echo $dcckeditor_format_tags; ?>', 145 <?php else: ?> 146 format_tags: 'p;h1;h2;h3;h4;h5;h6;pre;address', 147 <?php endif;?> 148 149 // following definition are needed to be specialized 150 format_p: { element: 'p' }, 151 format_h1: { element: 'h1' }, 152 format_h2: { element: 'h2' }, 153 format_h3: { element: 'h3' }, 154 format_h4: { element: 'h4' }, 155 format_h5: { element: 'h5' }, 156 format_h6: { element: 'h6' }, 157 format_pre: { element: 'pre' }, 158 format_address: { element: 'address' }, 159 <?php endif;?> 160 161 entities: false, 162 removeButtons: '', 163 allowedContent: true, 164 toolbar: [ 165 { 166 name: 'basicstyles', 167 items: [ 168 168 169 169 <?php if (!empty($dcckeditor_format_select)): ?> 170 171 <?php endif;?> 172 173 170 'Format', 171 <?php endif;?> 172 173 'Bold','Italic','Underline','Strike','Subscript','Superscript','Code','Blockquote', 174 174 175 175 <?php if (!empty($dcckeditor_list_buttons)): ?> 176 177 <?php endif; 178 179 180 181 176 'NumberedList','BulletedList', 177 <?php endif;?> 178 179 'RemoveFormat' 180 ] 181 }, 182 182 183 183 <?php if (!empty($dcckeditor_clipboard_buttons)): ?> 184 185 186 187 188 <?php endif; 184 { 185 name: 'clipoard', 186 items: ['Cut','Copy','Paste','PasteText','PasteFromWord'] 187 }, 188 <?php endif;?> 189 189 190 190 <?php if (!empty($dcckeditor_alignment_buttons)): ?> 191 192 193 194 195 <?php endif; 191 { 192 name: 'paragraph', 193 items: ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'] 194 }, 195 <?php endif;?> 196 196 197 197 <?php if (!empty($dcckeditor_table_button)): ?> 198 199 200 201 202 <?php endif; 203 204 205 206 207 208 198 { 199 name: 'table', 200 items: ['Table'] 201 }, 202 <?php endif;?> 203 204 { 205 name: 'custom', 206 items: [ 207 'EntryLink','dcLink','Media','img','-', 208 'Source' 209 209 210 210 <?php if (!empty($dcckeditor_textcolor_button)): ?> 211 212 <?php endif; 211 ,'TextColor' 212 <?php endif;?> 213 213 214 214 <?php if (!empty($dcckeditor_background_textcolor_button)): ?> 215 216 <?php endif; 217 218 219 220 221 222 223 224 215 ,'BGColor' 216 <?php endif;?> 217 ] 218 }, 219 { 220 name: 'special', 221 items: [ 222 'Maximize' 223 ] 224 }, 225 225 226 226 <?php // add extra buttons comming from dotclear plugins 227 if (!empty($extraPlugins) && count($extraPlugins)>0) {228 229 $extra_icons= '';230 231 $extra_icons .= sprintf("'%s',",$plugin['button']);232 233 printf($extraPlugins_str,$extra_icons);234 235 ?> 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 227 if (!empty($extraPlugins) && count($extraPlugins) > 0) { 228 $extraPlugins_str = "{name: 'extra', items: [%s]},\n"; 229 $extra_icons = ''; 230 foreach ($extraPlugins as $plugin) { 231 $extra_icons .= sprintf("'%s',", $plugin['button']); 232 } 233 printf($extraPlugins_str, $extra_icons); 234 } 235 ?> 236 ] 237 }); 238 239 CKEDITOR.on('instanceLoaded',function(e) { 240 241 // Retrieve textarea element of the instance, then its line-height (in px) and rows values, 242 // then apply line-height * rows (min = 6) to the inner height of the instance. 243 244 var ta = document.getElementById(e.editor.name); 245 if (ta !== undefined) { 246 var ta_rows = ta.rows; 247 var ta_line_height = parseFloat(window.getComputedStyle(ta,null).getPropertyValue('line-height')); 248 if (ta_rows > 0 && ta_line_height > 0) { 249 var ta_height = String(Math.max(ta_rows,6) * ta_line_height); 250 e.editor.resize('100%',ta_height,true); 251 } 252 } 253 254 }); 255 256 CKEDITOR.on('instanceReady',function(e) { 257 if (typeof dotclear_htmlFontSize !== 'undefined') { 258 e.editor.document.$.documentElement.style.setProperty('--html-font-size',dotclear_htmlFontSize); 259 } 260 261 if ($('label[for="post_excerpt"] a img').attr('src') == dotclear.img_minus_src) { 262 $('#cke_post_excerpt').removeClass('hide'); 263 } else { 264 $('#cke_post_excerpt').addClass('hide'); 265 } 266 267 $('#excerpt-area label').click(function() { 268 $('#cke_post_excerpt').toggleClass('hide',$('#post_excerpt').hasClass('hide')); 269 }); 270 271 }); 272 273 // @TODO: find a better way to retrieve active editor 274 for (var id in CKEDITOR.instances) { 275 CKEDITOR.instances[id].on('focus',function(e) { 276 $.active_editor = e.editor.name; 277 }); 278 } 279 279 }); -
plugins/dcCKEditor/_prepend.php
r2854 r3730 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 if (!defined('DC_RC_PATH')) { return;}13 if (!defined('DC_RC_PATH')) {return;} 14 14 15 $__autoload['dcCKEditorBehaviors'] = dirname(__FILE__) .'/inc/dc.ckeditor.behaviors.php';15 $__autoload['dcCKEditorBehaviors'] = dirname(__FILE__) . '/inc/dc.ckeditor.behaviors.php'; -
plugins/dcCKEditor/inc/_config.php
r3090 r3730 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 if (!defined('DC_CONTEXT_ADMIN')) { return;}13 if (!defined('DC_CONTEXT_ADMIN')) {return;} 14 14 15 15 $dcckeditor_was_actived = $dcckeditor_active; 16 16 17 17 if (!empty($_POST['saveconfig'])) { 18 19 $dcckeditor_active = (empty($_POST['dcckeditor_active']))?false:true;20 18 try { 19 $dcckeditor_active = (empty($_POST['dcckeditor_active'])) ? false : true; 20 $core->blog->settings->dcckeditor->put('active', $dcckeditor_active, 'boolean'); 21 21 22 23 24 $dcckeditor_alignement_buttons = (empty($_POST['dcckeditor_alignment_buttons']))?false:true;25 22 // change other settings only if they were in html page 23 if ($dcckeditor_was_actived) { 24 $dcckeditor_alignement_buttons = (empty($_POST['dcckeditor_alignment_buttons'])) ? false : true; 25 $core->blog->settings->dcckeditor->put('alignment_buttons', $dcckeditor_alignement_buttons, 'boolean'); 26 26 27 $dcckeditor_list_buttons = (empty($_POST['dcckeditor_list_buttons']))?false:true;28 27 $dcckeditor_list_buttons = (empty($_POST['dcckeditor_list_buttons'])) ? false : true; 28 $core->blog->settings->dcckeditor->put('list_buttons', $dcckeditor_list_buttons, 'boolean'); 29 29 30 $dcckeditor_textcolor_button = (empty($_POST['dcckeditor_textcolor_button']))?false:true;31 30 $dcckeditor_textcolor_button = (empty($_POST['dcckeditor_textcolor_button'])) ? false : true; 31 $core->blog->settings->dcckeditor->put('textcolor_button', $dcckeditor_textcolor_button, 'boolean'); 32 32 33 $dcckeditor_background_textcolor_button = (empty($_POST['dcckeditor_background_textcolor_button']))?false:true;34 33 $dcckeditor_background_textcolor_button = (empty($_POST['dcckeditor_background_textcolor_button'])) ? false : true; 34 $core->blog->settings->dcckeditor->put('background_textcolor_button', $dcckeditor_background_textcolor_button, 'boolean'); 35 35 36 $dcckeditor_cancollapse_button = (empty($_POST['dcckeditor_cancollapse_button']))?false:true;37 36 $dcckeditor_cancollapse_button = (empty($_POST['dcckeditor_cancollapse_button'])) ? false : true; 37 $core->blog->settings->dcckeditor->put('cancollapse_button', $dcckeditor_cancollapse_button, 'boolean'); 38 38 39 $dcckeditor_format_select = (empty($_POST['dcckeditor_format_select']))?false:true;40 39 $dcckeditor_format_select = (empty($_POST['dcckeditor_format_select'])) ? false : true; 40 $core->blog->settings->dcckeditor->put('format_select', $dcckeditor_format_select, 'boolean'); 41 41 42 43 $allowed_tags = array('p','h1','h2','h3','h4','h5','h6','pre','address');44 45 $tags= explode(';', $_POST['dcckeditor_format_tags']);46 47 48 49 50 51 52 53 54 55 56 57 58 59 42 // default tags : p;h1;h2;h3;h4;h5;h6;pre;address 43 $allowed_tags = array('p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'address'); 44 if (!empty($_POST['dcckeditor_format_tags'])) { 45 $tags = explode(';', $_POST['dcckeditor_format_tags']); 46 $new_tags = true; 47 foreach ($tags as $tag) { 48 if (!in_array($tag, $allowed_tags)) { 49 $new_tags = false; 50 break; 51 } 52 } 53 if ($new_tags) { 54 $dcckeditor_format_tags = $_POST['dcckeditor_format_tags']; 55 } 56 } else { 57 $dcckeditor_format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address'; 58 } 59 $core->blog->settings->dcckeditor->put('format_tags', $dcckeditor_format_tags, 'string'); 60 60 61 $dcckeditor_table_button = (empty($_POST['dcckeditor_table_button'])) ? false : true; 62 $core->blog->settings->dcckeditor->put('table_button', $dcckeditor_table_button, 'boolean'); 61 63 62 $dcckeditor_table_button = (empty($_POST['dcckeditor_table_button']))?false:true;63 $core->blog->settings->dcckeditor->put('table_button', $dcckeditor_table_button, 'boolean');64 $dcckeditor_clipboard_buttons = (empty($_POST['dcckeditor_clipboard_buttons'])) ? false : true; 65 $core->blog->settings->dcckeditor->put('clipboard_buttons', $dcckeditor_clipboard_buttons, 'boolean'); 64 66 65 $dcckeditor_clipboard_buttons = (empty($_POST['dcckeditor_clipboard_buttons']))?false:true; 66 $core->blog->settings->dcckeditor->put('clipboard_buttons', $dcckeditor_clipboard_buttons, 'boolean'); 67 $dcckeditor_disable_native_spellchecker = (empty($_POST['dcckeditor_disable_native_spellchecker'])) ? false : true; 68 $core->blog->settings->dcckeditor->put('disable_native_spellchecker', $dcckeditor_disable_native_spellchecker, 'boolean'); 69 } 67 70 68 $dcckeditor_disable_native_spellchecker = (empty($_POST['dcckeditor_disable_native_spellchecker']))?false:true; 69 $core->blog->settings->dcckeditor->put('disable_native_spellchecker', $dcckeditor_disable_native_spellchecker, 'boolean'); 70 } 71 72 dcPage::addSuccessNotice(__('The configuration has been updated.')); 73 http::redirect($p_url); 74 } catch(Exception $e) { 75 $core->error->add($e->getMessage()); 76 } 71 dcPage::addSuccessNotice(__('The configuration has been updated.')); 72 http::redirect($p_url); 73 } catch (Exception $e) { 74 $core->error->add($e->getMessage()); 75 } 77 76 } 78 77 79 include dirname(__FILE__) .'/../tpl/index.tpl';78 include dirname(__FILE__) . '/../tpl/index.tpl'; -
plugins/dcCKEditor/inc/dc.ckeditor.behaviors.php
r3669 r3730 13 13 class dcCKEditorBehaviors 14 14 { 15 protected static $p_url = 'index.php?pf=dcCKEditor';15 protected static $p_url = 'index.php?pf=dcCKEditor'; 16 16 protected static $config_url = 'plugin.php?p=dcCKEditor&config=1'; 17 17 … … 24 24 * @param syntax <b>string</b> wanted syntax (xhtml) 25 25 */ 26 public static function adminPostEditor($editor='',$context='',array $tags=array(),$syntax='xhtml') { 27 if (empty($editor) || $editor != 'dcCKEditor' || $syntax != 'xhtml') { return;} 26 public static function adminPostEditor($editor = '', $context = '', array $tags = array(), $syntax = 'xhtml') 27 { 28 if (empty($editor) || $editor != 'dcCKEditor' || $syntax != 'xhtml') {return;} 28 29 29 30 $config_js = self::$config_url; 30 31 if (!empty($context)) { 31 $config_js .= '&context=' .$context;32 $config_js .= '&context=' . $context; 32 33 } 33 34 34 35 $res = 35 '<script type="text/javascript">'."\n".36 dcPage::jsVar('dotclear.ckeditor_context', $context).37 'dotclear.ckeditor_tags_context = '.sprintf('{%s:["%s"]};'."\n", $context, implode('","', $tags)).38 'var CKEDITOR_BASEPATH = "'.DC_ADMIN_URL.self::$p_url.'/js/ckeditor/";'."\n".39 dcPage::jsVar('dotclear.admin_base_url', DC_ADMIN_URL).40 dcPage::jsVar('dotclear.base_url', $GLOBALS['core']->blog->host).41 dcPage::jsVar('dotclear.dcckeditor_plugin_url',DC_ADMIN_URL.self::$p_url).42 43 44 45 46 47 48 };' ."\n".49 "dotclear.msg.img_select_title = '".html::escapeJS(__('Media chooser'))."'; "."\n".50 "dotclear.msg.img_select_accesskey = '".html::escapeJS(__('m'))."'; "."\n".51 "dotclear.msg.post_link_title = '".html::escapeJS(__('Link to an entry'))."'; "."\n".52 "dotclear.msg.link_title = '".html::escapeJS(__('Link'))."'; "."\n".53 "dotclear.msg.link_accesskey = '".html::escapeJS(__('l'))."'; "."\n".54 "dotclear.msg.img_title = '".html::escapeJS(__('External image'))."'; "."\n".55 "dotclear.msg.url_cannot_be_empty = '".html::escapeJS(__('URL field cannot be empty.'))."';"."\n".56 "</script>\n".57 dcPage::jsLoad(self::$p_url.'/js/ckeditor/ckeditor.js').58 dcPage::jsLoad(self::$p_url.'/js/ckeditor/adapters/jquery.js').59 36 '<script type="text/javascript">' . "\n" . 37 dcPage::jsVar('dotclear.ckeditor_context', $context) . 38 'dotclear.ckeditor_tags_context = ' . sprintf('{%s:["%s"]};' . "\n", $context, implode('","', $tags)) . 39 'var CKEDITOR_BASEPATH = "' . DC_ADMIN_URL . self::$p_url . '/js/ckeditor/";' . "\n" . 40 dcPage::jsVar('dotclear.admin_base_url', DC_ADMIN_URL) . 41 dcPage::jsVar('dotclear.base_url', $GLOBALS['core']->blog->host) . 42 dcPage::jsVar('dotclear.dcckeditor_plugin_url', DC_ADMIN_URL . self::$p_url) . 43 'CKEDITOR_GETURL = function(resource) { 44 // If this is not a full or absolute path. 45 if ( resource.indexOf(":/") == -1 && resource.indexOf("/") !== 0 ) { 46 resource = this.basePath + resource; 47 } 48 return resource; 49 };' . "\n" . 50 "dotclear.msg.img_select_title = '" . html::escapeJS(__('Media chooser')) . "'; " . "\n" . 51 "dotclear.msg.img_select_accesskey = '" . html::escapeJS(__('m')) . "'; " . "\n" . 52 "dotclear.msg.post_link_title = '" . html::escapeJS(__('Link to an entry')) . "'; " . "\n" . 53 "dotclear.msg.link_title = '" . html::escapeJS(__('Link')) . "'; " . "\n" . 54 "dotclear.msg.link_accesskey = '" . html::escapeJS(__('l')) . "'; " . "\n" . 55 "dotclear.msg.img_title = '" . html::escapeJS(__('External image')) . "'; " . "\n" . 56 "dotclear.msg.url_cannot_be_empty = '" . html::escapeJS(__('URL field cannot be empty.')) . "';" . "\n" . 57 "</script>\n" . 58 dcPage::jsLoad(self::$p_url . '/js/ckeditor/ckeditor.js') . 59 dcPage::jsLoad(self::$p_url . '/js/ckeditor/adapters/jquery.js') . 60 dcPage::jsLoad($config_js); 60 61 61 62 63 '<script type="text/javascript">'."\n".64 dcPage::jsVar('dotclear_htmlFontSize',$GLOBALS['core']->auth->user_prefs->interface->htmlfontsize)."\n".65 66 62 if ($GLOBALS['core']->auth->user_prefs->interface->htmlfontsize) { 63 $res .= 64 '<script type="text/javascript">' . "\n" . 65 dcPage::jsVar('dotclear_htmlFontSize', $GLOBALS['core']->auth->user_prefs->interface->htmlfontsize) . "\n" . 66 "</script>\n"; 67 } 67 68 68 return $res; 69 } 70 71 public static function adminPopupMedia($editor='') { 72 if (empty($editor) || $editor!='dcCKEditor') { return;} 73 74 return dcPage::jsLoad(self::$p_url.'/js/popup_media.js'); 69 return $res; 75 70 } 76 71 77 public static function adminPopupLink($editor='') { 78 if (empty($editor) || $editor!='dcCKEditor') { return;} 72 public static function adminPopupMedia($editor = '') 73 { 74 if (empty($editor) || $editor != 'dcCKEditor') {return;} 79 75 80 return dcPage::jsLoad(self::$p_url.'/js/popup_link.js');76 return dcPage::jsLoad(self::$p_url . '/js/popup_media.js'); 81 77 } 82 78 83 public static function adminPopupPosts($editor='') { 84 if (empty($editor) || $editor!='dcCKEditor') { return;} 79 public static function adminPopupLink($editor = '') 80 { 81 if (empty($editor) || $editor != 'dcCKEditor') {return;} 85 82 86 return dcPage::jsLoad(self::$p_url.'/js/popup_posts.js');83 return dcPage::jsLoad(self::$p_url . '/js/popup_link.js'); 87 84 } 88 85 89 public static function adminMediaURLParams($p) { 86 public static function adminPopupPosts($editor = '') 87 { 88 if (empty($editor) || $editor != 'dcCKEditor') {return;} 89 90 return dcPage::jsLoad(self::$p_url . '/js/popup_posts.js'); 91 } 92 93 public static function adminMediaURLParams($p) 94 { 90 95 if (!empty($_GET['editor'])) { 91 96 $p['editor'] = html::sanitizeURL($_GET['editor']); … … 93 98 } 94 99 95 public static function getTagsContext() { 100 public static function getTagsContext() 101 { 96 102 return self::$tagsContext; 97 103 } -
plugins/dcCKEditor/index.php
r3090 r3730 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 if (!defined('DC_CONTEXT_ADMIN')) { return;}13 if (!defined('DC_CONTEXT_ADMIN')) {return;} 14 14 15 15 $is_admin = $core->auth->check('admin,contentadmin', $core->blog->id) || $core->auth->isSuperAdmin(); 16 16 17 17 $core->blog->settings->addNameSpace('dcckeditor'); 18 $dcckeditor_active = $core->blog->settings->dcckeditor->active;19 $dcckeditor_alignment_buttons = $core->blog->settings->dcckeditor->alignment_buttons;20 $dcckeditor_list_buttons = $core->blog->settings->dcckeditor->list_buttons;21 $dcckeditor_textcolor_button = $core->blog->settings->dcckeditor->textcolor_button;18 $dcckeditor_active = $core->blog->settings->dcckeditor->active; 19 $dcckeditor_alignment_buttons = $core->blog->settings->dcckeditor->alignment_buttons; 20 $dcckeditor_list_buttons = $core->blog->settings->dcckeditor->list_buttons; 21 $dcckeditor_textcolor_button = $core->blog->settings->dcckeditor->textcolor_button; 22 22 $dcckeditor_background_textcolor_button = $core->blog->settings->dcckeditor->background_textcolor_button; 23 $dcckeditor_cancollapse_button = $core->blog->settings->dcckeditor->cancollapse_button;24 $dcckeditor_format_select = $core->blog->settings->dcckeditor->format_select;25 $dcckeditor_format_tags = $core->blog->settings->dcckeditor->format_tags;26 $dcckeditor_table_button = $core->blog->settings->dcckeditor->table_button;27 $dcckeditor_clipboard_buttons = $core->blog->settings->dcckeditor->clipboard_buttons;23 $dcckeditor_cancollapse_button = $core->blog->settings->dcckeditor->cancollapse_button; 24 $dcckeditor_format_select = $core->blog->settings->dcckeditor->format_select; 25 $dcckeditor_format_tags = $core->blog->settings->dcckeditor->format_tags; 26 $dcckeditor_table_button = $core->blog->settings->dcckeditor->table_button; 27 $dcckeditor_clipboard_buttons = $core->blog->settings->dcckeditor->clipboard_buttons; 28 28 $dcckeditor_disable_native_spellchecker = $core->blog->settings->dcckeditor->disable_native_spellchecker; 29 29 30 30 if (!empty($_GET['config'])) { 31 31 // text/javascript response stop stream just after including file 32 include_once (dirname(__FILE__).'/_post_config.php');32 include_once dirname(__FILE__) . '/_post_config.php'; 33 33 exit(); 34 34 } else { 35 include_once (dirname(__FILE__).'/inc/_config.php');35 include_once dirname(__FILE__) . '/inc/_config.php'; 36 36 } -
plugins/dcCKEditor/tpl/index.tpl
r3725 r3730 7 7 <body> 8 8 <?php echo dcPage::breadcrumb(array(__('Plugins') => 9 '', __('dcCKEditor') => '')).dcPage::notices(); ?>10 <?php if ($is_admin): ?>9 '', __('dcCKEditor') => '')) . dcPage::notices(); ?> 10 <?php if ($is_admin): ?> 11 11 <h3 class="hidden-if-js"> 12 <?php echo __('Settings'); ?>12 <?php echo __('Settings'); ?> 13 13 </h3> 14 <form action="<?php echo $p_url; ?>" enctype="multipart/form-data" method="post">14 <form action="<?php echo $p_url; ?>" enctype="multipart/form-data" method="post"> 15 15 <div class="fieldset"> 16 16 <h3> 17 <?php echo __('Plugin activation'); ?>17 <?php echo __('Plugin activation'); ?> 18 18 </h3> 19 19 <p> 20 20 <label class="classic" for="dcckeditor_active"> 21 <?php echo form::checkbox('dcckeditor_active', 1, $dcckeditor_active); ?>22 <?php echo __('Enable dcCKEditor plugin'); ?>21 <?php echo form::checkbox('dcckeditor_active', 1, $dcckeditor_active); ?> 22 <?php echo __('Enable dcCKEditor plugin'); ?> 23 23 </label> 24 24 </p> 25 25 </div> 26 <?php if ($dcckeditor_active): ?>26 <?php if ($dcckeditor_active): ?> 27 27 <div class="fieldset"> 28 28 <h3> … … 32 32 <?php echo form::checkbox('dcckeditor_alignment_buttons', 1, $dcckeditor_alignment_buttons); ?> 33 33 <label class="classic" for="dcckeditor_alignment_buttons"> 34 <?php echo __('Add alignment buttons'); ?>34 <?php echo __('Add alignment buttons'); ?> 35 35 </label> 36 36 </p> … … 38 38 <?php echo form::checkbox('dcckeditor_list_buttons', 1, $dcckeditor_list_buttons); ?> 39 39 <label class="classic" for="dcckeditor_list_buttons"> 40 <?php echo __('Add lists buttons'); ?>40 <?php echo __('Add lists buttons'); ?> 41 41 </label> 42 42 </p> … … 44 44 <?php echo form::checkbox('dcckeditor_textcolor_button', 1, $dcckeditor_textcolor_button); ?> 45 45 <label class="classic" for="dcckeditor_textcolor_button"> 46 <?php echo __('Add text color button'); ?>46 <?php echo __('Add text color button'); ?> 47 47 </label> 48 48 </p> … … 50 50 <?php echo form::checkbox('dcckeditor_background_textcolor_button', 1, $dcckeditor_background_textcolor_button); ?> 51 51 <label class="classic" for="dcckeditor_background_textcolor_button"> 52 <?php echo __('Add background text color button'); ?>52 <?php echo __('Add background text color button'); ?> 53 53 </label> 54 54 </p> … … 56 56 <?php echo form::checkbox('dcckeditor_cancollapse_button', 1, $dcckeditor_cancollapse_button); ?> 57 57 <label class="classic" for="dcckeditor_cancollapse_button"> 58 <?php echo __('Add collapse button'); ?>58 <?php echo __('Add collapse button'); ?> 59 59 </label> 60 60 </p> 61 61 <p> 62 <?php echo form::checkbox('dcckeditor_format_select', 1, $dcckeditor_format_select); ?>62 <?php echo form::checkbox('dcckeditor_format_select', 1, $dcckeditor_format_select); ?> 63 63 <label class="classic" for="dcckeditor_format_select"> 64 <?php echo __('Add format selection'); ?>64 <?php echo __('Add format selection'); ?> 65 65 </label> 66 66 </p> 67 67 <p> 68 68 <label class="classic" for="dcckeditor_format_tags"> 69 <?php echo __('Custom formats'); ?>69 <?php echo __('Custom formats'); ?> 70 70 </label> 71 <?php echo form::field('dcckeditor_format_tags', 100, 255, $dcckeditor_format_tags); ?>71 <?php echo form::field('dcckeditor_format_tags', 100, 255, $dcckeditor_format_tags); ?> 72 72 </p> 73 73 <p class="clear form-note"> 74 <?php echo __('Default formats are p;h1;h2;h3;h4;h5;h6;pre;address'); ?>74 <?php echo __('Default formats are p;h1;h2;h3;h4;h5;h6;pre;address'); ?> 75 75 </p> 76 76 <p> 77 <?php echo form::checkbox('dcckeditor_table_button', 1, $dcckeditor_table_button); ?>77 <?php echo form::checkbox('dcckeditor_table_button', 1, $dcckeditor_table_button); ?> 78 78 <label class="classic" for="dcckeditor_table_button"> 79 <?php echo __('Add table button'); ?>79 <?php echo __('Add table button'); ?> 80 80 </label> 81 81 </p> 82 82 <p> 83 <?php echo form::checkbox('dcckeditor_clipboard_buttons', 1, $dcckeditor_clipboard_buttons); ?>83 <?php echo form::checkbox('dcckeditor_clipboard_buttons', 1, $dcckeditor_clipboard_buttons); ?> 84 84 <label class="classic" for="dcckeditor_clipboard_buttons"> 85 <?php echo __('Add clipboard buttons'); ?>85 <?php echo __('Add clipboard buttons'); ?> 86 86 </label> 87 87 </p> 88 88 <p class="clear form-note"> 89 <?php echo __('Copy, Paste, Paste Text, Paste from Word'); ?>89 <?php echo __('Copy, Paste, Paste Text, Paste from Word'); ?> 90 90 </p> 91 91 <p> 92 <?php echo form::checkbox('dcckeditor_disable_native_spellchecker', 1, $dcckeditor_disable_native_spellchecker); ?>92 <?php echo form::checkbox('dcckeditor_disable_native_spellchecker', 1, $dcckeditor_disable_native_spellchecker); ?> 93 93 <label class="classic" for="dcckeditor_disable_native_spellchecker"> 94 <?php echo __('Disables the built-in spell checker if the browser provides one'); ?>94 <?php echo __('Disables the built-in spell checker if the browser provides one'); ?> 95 95 </label> 96 96 </p> … … 100 100 <input name="p" type="hidden" value="dcCKEditor"/> 101 101 <?php echo $core-> 102 formNonce();?>103 <input name="saveconfig" type="submit" value="<?php echo __('Save configuration'); ?>"/>102 formNonce(); ?> 103 <input name="saveconfig" type="submit" value="<?php echo __('Save configuration'); ?>"/> 104 104 </p> 105 105 </form>
Note: See TracChangeset
for help on using the changeset viewer.