| 1 | <?php |
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
|---|
| 3 | # |
|---|
| 4 | # This file is part of Dotclear 2. |
|---|
| 5 | # |
|---|
| 6 | # Copyright (c) 2003-2014 Olivier Meunier & Association Dotclear |
|---|
| 7 | # Licensed under the GPL version 2.0 license. |
|---|
| 8 | # See LICENSE file or |
|---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|---|
| 10 | # |
|---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
|---|
| 12 | |
|---|
| 13 | class dcCKEditorBehaviors |
|---|
| 14 | { |
|---|
| 15 | protected static $p_url = 'index.php?pf=dcCKEditor'; |
|---|
| 16 | protected static $config_url = 'plugin.php?p=dcCKEditor&config=1'; |
|---|
| 17 | |
|---|
| 18 | public static function adminPostEditor($editor='') { |
|---|
| 19 | if (empty($editor) || $editor!='dcCKEditor') { return;} |
|---|
| 20 | |
|---|
| 21 | return |
|---|
| 22 | '<script type="text/javascript">'."\n". |
|---|
| 23 | "//<![CDATA[\n". |
|---|
| 24 | 'var CKEDITOR_BASEPATH = "'.DC_ADMIN_URL.self::$p_url.'/js/ckeditor/";'."\n". |
|---|
| 25 | dcPage::jsVar('dotclear.base_url', $GLOBALS['core']->blog->host). |
|---|
| 26 | dcPage::jsVar('dotclear.dcckeditor_plugin_url',DC_ADMIN_URL.self::$p_url). |
|---|
| 27 | 'CKEDITOR_GETURL = function(resource) { |
|---|
| 28 | // If this is not a full or absolute path. |
|---|
| 29 | if ( resource.indexOf(":/") == -1 && resource.indexOf("/") !== 0 ) { |
|---|
| 30 | resource = this.basePath + resource; |
|---|
| 31 | } |
|---|
| 32 | return resource; |
|---|
| 33 | };'. |
|---|
| 34 | "dotclear.msg.img_select_title = '".html::escapeJS(__('Media chooser'))."'; ". |
|---|
| 35 | "dotclear.msg.post_link_title = '".html::escapeJS(__('Link to an entry'))."'; ". |
|---|
| 36 | "dotclear.msg.link_title = '".html::escapeJS(__('Link'))."'; ". |
|---|
| 37 | "\n//]]>\n". |
|---|
| 38 | "</script>\n". |
|---|
| 39 | dcPage::jsLoad(self::$p_url.'/js/ckeditor/ckeditor.js'). |
|---|
| 40 | dcPage::jsLoad(self::$p_url.'/js/ckeditor/adapters/jquery.js'). |
|---|
| 41 | dcPage::jsLoad(self::$config_url); |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | public static function adminPopupMedia() { |
|---|
| 45 | return dcPage::jsLoad(self::$p_url.'/js/popup_media.js'); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | public static function adminPopupLink() { |
|---|
| 49 | return dcPage::jsLoad(self::$p_url.'/js/popup_link.js'); |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | public static function adminPopupPosts() { |
|---|
| 53 | return dcPage::jsLoad(self::$p_url.'/js/popup_posts.js'); |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | public static function adminMediaURL($url) { |
|---|
| 57 | if (!empty($_GET['editor'])) { |
|---|
| 58 | $url .= '&editor='.$_GET['editor']; |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | return $url; |
|---|
| 62 | } |
|---|
| 63 | } |
|---|