Changeset 3730:5c45a5df9a59 for plugins/dcCKEditor/inc
- Timestamp:
- 03/08/18 17:58:39 (8 years ago)
- Branch:
- default
- Location:
- plugins/dcCKEditor/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.