-
Notifications
You must be signed in to change notification settings - Fork 1
/
CKE_Themes.php
64 lines (48 loc) · 1.55 KB
/
CKE_Themes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
<?php
defined('is_running') or die('Not an entry point...');
class CKE_Themes {
public static $config;
/* hook */
public static function CKEditorConfig($options){
global $addonRelativeCode;
self::LoadPluginConfig();
if ( self::$config['theme'] !== 'System default' ) {
$options['skin'] = self::$config['theme'].',' . $addonRelativeCode . '/themes/'.self::$config['theme'].'/';
}
return $options;
}
public static function InlineEdit_Scripts($scripts, $type){
self::LoadPluginConfig();
if ( self::$config['bottom_bar'] == '1' && $type === 'text' ) {
$scripts[]=array('code' => 'gp_ckconfig.sharedSpaces = {top: "ckeditor_top", bottom: "ckeditor_bottom"};
gp_ckconfig.removePlugins = "floatingspace,maximize,resize";');
}
return $scripts;
}
public static function GetHead(){
global $page, $addonRelativeCode, $addonPathCode;
self::LoadPluginConfig();
if( \gp\tool::LoggedIn() ){
if ( self::$config['theme'] !== 'System default') {
$page->head_js[] = $addonRelativeCode . '/CKE_Themes.js';
\gp\tool\Plugins::css('CKE_Themes.css', false);
$css_aux = '/themes/'.self::$config['theme'].'.css';
if ( file_exists($addonPathCode . $css_aux)) {
\gp\tool\Plugins::css($css_aux, false);
}
}
}
}
public static function LoadPluginConfig(){
global $addonPathCode, $addonPathData;
$config_file = $addonPathData . '/config.php';
if( file_exists($config_file) ){
include $config_file ;
}else{
$config = array (
'theme' => 'System default',
);
}
self::$config = $config;
}
}