Dotclear

source: plugins/dcCKEditor/inc/dc.ckeditor.behaviors.php @ 2738:d6b4c5ac9b33

Revision 2738:d6b4c5ac9b33, 2.0 KB checked in by Nicolas <nikrou77@…>, 11 years ago (diff)

Integrate dcCKEditor to distribution

Line 
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
13class 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            "\n//]]>\n".
35            "</script>\n".
36            dcPage::jsLoad(self::$p_url.'/js/ckeditor/ckeditor.js').
37            dcPage::jsLoad(self::$p_url.'/js/ckeditor/adapters/jquery.js').
38            dcPage::jsLoad(self::$config_url);
39     }
40
41    public static function adminPopupMedia() {
42     return dcPage::jsLoad(self::$p_url.'/js/popup_media.js');
43    }
44
45    public static function adminPopupLink() {
46     return dcPage::jsLoad(self::$p_url.'/js/popup_link.js');
47    }
48
49    public static function adminPopupPosts() {
50     return dcPage::jsLoad(self::$p_url.'/js/popup_posts.js');
51    }
52
53    public static function adminMediaURL($url) {
54        if (!empty($_GET['editor'])) {
55            $url .= '&editor='.$_GET['editor'];
56        }
57
58        return $url;
59    }
60}
Note: See TracBrowser for help on using the repository browser.

Sites map