-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsupercache.admin.view.php
More file actions
172 lines (150 loc) · 5.13 KB
/
supercache.admin.view.php
File metadata and controls
172 lines (150 loc) · 5.13 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
/**
* Super Cache module: admin view class
*
* Copyright (c) 2016 Kijin Sung <kijin@kijinsung.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class SuperCacheAdminView extends SuperCache
{
/**
* Menu definition.
*/
protected static $_menus = array(
'dispSupercacheAdminConfigBasic' => 'cmd_supercache_config_basic',
'dispSupercacheAdminConfigFullCache' => 'cmd_supercache_config_full_cache',
'dispSupercacheAdminConfigBoardCache' => 'cmd_supercache_config_board_cache',
'dispSupercacheAdminConfigWidgetCache' => 'cmd_supercache_config_widget_cache',
'dispSupercacheAdminConfigOther' => 'cmd_supercache_config_other',
);
/**
* Init method for common tasks.
*/
public function init()
{
// Set the default template path.
$this->setTemplatePath($this->module_path . 'tpl');
// Set the admin menu.
$lang = Context::get('lang');
foreach (self::$_menus as $key => $value)
{
self::$_menus[$key] = $lang->$value;
}
Context::set('sc_menus', self::$_menus);
}
/**
* Basic settings page.
*/
public function dispSuperCacheAdminConfigBasic()
{
// Get module configuration.
Context::set('sc_config', $config = $this->getConfig());
// Get current object cache option and system environment.
$object_cache_option = $this->_getCacheType();
if (!$object_cache_option || $object_cache_option === 'dummy')
{
$object_cache_option = 'default';
}
Context::set('sc_object_cache', $object_cache_option);
Context::set('is_rhymix', defined('RX_BASEDIR'));
Context::set('is_memcached_supported', getAdminModel('supercache')->isMemcachedSupported());
// Display the config page.
$this->setTemplateFile('basic');
}
/**
* Full cache settings page.
*/
public function dispSuperCacheAdminConfigFullCache()
{
// Get module configuration.
Context::set('sc_config', $config = $this->getConfig());
// Get the list of modules.
$site_srl = intval(Context::get('site_module_info')->site_srl) ?: 0;
$module_list = getModel('module')->getMidList((object)array('site_srl' => $site_srl));
Context::set('sc_modules', $module_list);
// Display the config page.
$this->setTemplateFile('full_cache');
}
/**
* Board cache settings page.
*/
public function dispSuperCacheAdminConfigBoardCache()
{
// Get module configuration.
Context::set('sc_config', $config = $this->getConfig());
// Get system capabilities.
$oAdminModel = getAdminModel('supercache');
Context::set('sc_list_replace', $oAdminModel->isListReplacementSupported());
Context::set('sc_offset_query', $oAdminModel->isOffsetQuerySupported());
// Get the list of modules.
$site_srl = intval(Context::get('site_module_info')->site_srl) ?: 0;
$module_list = getModel('module')->getMidList((object)array('site_srl' => $site_srl));
$module_list = array_filter($module_list, function($val) {
return in_array($val->module, array('board', 'bodex', 'beluxe'));
});
Context::set('sc_modules', $module_list);
// Display the config page.
$this->setTemplateFile('board_cache');
}
/**
* Widget cache settings page.
*/
public function dispSuperCacheAdminConfigWidgetCache()
{
// Get module configuration.
Context::set('sc_config', $config = $this->getConfig());
// Get the list of installed widgets.
$oWidgetModel = getModel('widget');
$widget_list = $oWidgetModel->getDownloadedWidgetList();
Context::set('widget_list', $widget_list);
// Get the list of blacklisted widgets.
Context::set('widget_blacklist', self::$_skipWidgetNames);
// Get the list of default-on widgets.
Context::set('widget_default_on', array(
'best_content' => true,
'content' => true,
'cameronListOne' => true,
'doorweb_content' => true,
'opageWidget' => true,
'treasurej_popular' => true,
));
// Get the list of modules.
$site_srl = intval(Context::get('site_module_info')->site_srl) ?: 0;
$module_list = getModel('module')->getMidList((object)array('site_srl' => $site_srl));
Context::set('sc_modules', $module_list);
// Display the config page.
$this->setTemplateFile('widget_cache');
}
/**
* Other settings page.
*/
public function dispSuperCacheAdminConfigOther()
{
// Get module configuration.
Context::set('sc_config', $config = $this->getConfig());
// Get gzip setting.
if (defined('RX_VERSION'))
{
Context::set('gzip_setting_changeable', true);
}
else
{
Context::set('gzip_setting_changeable', !defined('__OB_GZHANDLER_ENABLE__') || constant('__OB_GZHANDLER_ENABLE__'));
}
// Display the config page.
$this->setTemplateFile('other');
}
}