PluginProbe
CSS & JavaScript Toolbox / 7.1.1
CSS & JavaScript Toolbox v7.1.1
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
css-javascript-toolbox / css-js-toolbox.php

css-js-toolbox.php in CSS & JavaScript Toolbox 7.1.1, at css-js-toolbox.php

326 lines 7.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: CSS & JavaScript Toolbox
4 Plugin URI: http://css-javascript-toolbox.com/css-javascript-toolbox-free
5 Description: CJT Plugin for WordPress to easily add custom CSS and JavaScript to individual pages
6 Version: 7.1.1
7 Author: Wipeout Media
8 Author URI: http://css-javascript-toolbox.com
9 License:
10
11 Copyright (c) 2011, Wipeout Media.
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License
14 as published by the Free Software Foundation; either version 2
15 of the License, or (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 */
26
27 // Disallow direct access.
28 defined('ABSPATH') or die("Access denied");
29
30 /** * */
31 define('CJTOOLBOX_PLUGIN_BASE', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
32
33 /** * */
34 define('CJTOOLBOX_PLUGIN_FILE', __FILE__);
35
36 /** CJT Name */
37 define('CJTOOLBOX_NAME', plugin_basename(dirname(__FILE__)));
38
39 /** CJT Text Domain used for localize texts */
40 define('CJTOOLBOX_TEXT_DOMAIN', CJTOOLBOX_NAME);
41
42 /** */
43 define('CJTOOLBOX_LANGUAGES', CJTOOLBOX_NAME . '/locals/languages/');
44
45 /** CJT Absoulte path */
46 define('CJTOOLBOX_PATH', dirname(__FILE__));
47
48 /** Dont use!! @deprecated */
49 define('CJTOOLBOX_INCLUDE_PATH', CJTOOLBOX_PATH . '/framework');
50
51 /** Access Points path */
52 define('CJTOOLBOX_ACCESS_POINTS', CJTOOLBOX_PATH . '/access.points');
53
54 /** Frmaework path */
55 define('CJTOOLBOX_FRAMEWORK', CJTOOLBOX_INCLUDE_PATH); // Alias to include path!
56
57 // Class Autoload Added @since 6.2.
58 require 'autoload.inc.php';
59
60 // Import dependencies
61 require_once CJTOOLBOX_FRAMEWORK . '/php/includes.class.php';
62 require_once CJTOOLBOX_FRAMEWORK . '/events/definition.class.php';
63 require_once CJTOOLBOX_FRAMEWORK . '/events/events.class.php';
64 require_once CJTOOLBOX_FRAMEWORK . '/events/wordpress.class.php';
65 require_once CJTOOLBOX_FRAMEWORK . '/events/hookable.interface.php';
66 require_once CJTOOLBOX_FRAMEWORK . '/events/hookable.class.php';
67
68 // Initialize events engine/system!
69 CJTWordpressEvents::__init(array('hookType' => CJTWordpressEvents::HOOK_ACTION));
70 CJTWordpressEvents::$paths['subjects']['core'] = CJTOOLBOX_FRAMEWORK . '/events/subjects';
71 CJTWordpressEvents::$paths['observers']['core'] = CJTOOLBOX_FRAMEWORK . '/events/observers';
72
73 /**
74 * CJT Plugin interface.
75 *
76 * The CJT Plugin is maximum deferred.
77 * All functionality here is just to detect if the request should be processed!
78 *
79 * The main class is located css-js-toolbox.class.php cssJSToolbox class
80 * The plugin is fully developed using Model-View-Controller design pattern.
81 *
82 * access.points directory has all the entry points that processed by the Plugin.
83 *
84 * @package CJT
85 * @author Ahmed Said
86 * @version 6
87 */
88 class CJTPlugin extends CJTHookableClass {
89
90 /**
91 *
92 */
93 const DB_VERSION = '1.6';
94
95 /**
96 *
97 */
98 const Edition = 'free';
99
100 /**
101 *
102 */
103 const FW_Version = '2.0';
104
105 /**
106 *
107 */
108 const VERSION = '7.1.1-CE' ;
109
110 /**
111 *
112 */
113 const DB_VERSION_OPTION_NAME = 'cjtoolbox_db_version';
114
115 /**
116 *
117 */
118 const PLUGIN_REQUEST_ID = 'cjtoolbox';
119
120 /**
121 * put your comment there...
122 *
123 * @var mixed
124 */
125 protected $accessPoints;
126
127 /**
128 * put your comment there...
129 *
130 * @var mixed
131 */
132 protected $extensions;
133
134 /**
135 * put your comment there...
136 *
137 * @var mixed
138 */
139 protected $installed;
140
141 /**
142 * put your comment there...
143 *
144 * @var CJTPlugin
145 */
146 protected static $instance;
147
148 /**
149 * put your comment there...
150 *
151 * @var mixed
152 */
153 protected $mainAC;
154
155 /**
156 * put your comment there...
157 *
158 * @var mixed
159 */
160 protected $onloaddbversion = array('parameters' => array('dbVersion'));
161
162 /**
163 * put your comment there...
164 *
165 * @var mixed
166 */
167 protected $onimportbasefile = array('parameters' => array('file'));
168
169 /**
170 * put your comment there...
171 *
172 * @var mixed
173 */
174 protected $onimportcontroller = array('parameters' => array('file'));
175
176 /**
177 * put your comment there...
178 *
179 * @var mixed
180 */
181 protected $onimportmodel = array('parameters' => array('file'));
182
183 /**
184 * put your comment there...
185 *
186 */
187 protected function __construct() {
188 // Hookable!
189 parent::__construct();
190 // Allow access points to utilize from CJTPlugin functionality
191 // even if the call is recursive inside getInstance/construct methods!!!
192 self::$instance = $this;
193 // Read vars!
194 $dbVersion = $this->onloaddbversion(get_option(self::DB_VERSION_OPTION_NAME));
195 $this->installed = (($dbVersion) == self::DB_VERSION);
196 // Load plugin and all installed extensions!.
197 $this->load();
198 $this->loadExtensions();
199 // Run MAIN access point!
200 $this->main();
201 }
202
203 /**
204 * put your comment there...
205 *
206 */
207 public function extensions() {
208 return $this->extensions;
209 }
210
211 /**
212 * put your comment there...
213 *
214 */
215 public function getAccessPoint($name) {
216 return $this->accessPoints[$name];
217 }
218
219 /**
220 * put your comment there...
221 *
222 */
223 public static function getInstance() {
224 if (!self::$instance) {
225 self::$instance = new CJTPlugin();
226 }
227 return self::$instance;
228 }
229
230 /**
231 * put your comment there...
232 *
233 */
234 public function isInstalled() {
235 return $this->installed;
236 }
237
238 /**
239 * put your comment there...
240 *
241 */
242 public function listen() {
243 // For now we've only admin access points! Future versions might has something changed!
244 if (is_admin()) {
245 // Import access points core classes.
246 require_once 'framework/access-points/page.class.php';
247 require_once 'framework/access-points/directory-spider.class.php';
248 // Get access points!
249 $accessPoints = CJTAccessPointsDirectorySpider::getInstance('CJT', CJTOOLBOX_ACCESS_POINTS);
250 // For every access point create instance and LISTEN to the request!
251 foreach ($accessPoints as $name => $info) {
252 /**
253 * @var CJTAccessPoint
254 */
255 $this->accessPoints[$name] = $point = $accessPoints->point()->listen();
256 // We need to do some work with there is a connected access point.
257 $point->onconnected = array(&$this, 'onconnected');
258 }
259 }
260 // Chaining!
261 return $this;
262 }
263
264 /**
265 * put your comment there...
266 *
267 */
268 protected function load() {
269 // Bootstrap the Plugin!
270 require_once $this->onimportbasefile('css-js-toolbox.class.php');
271 cssJSToolbox::getInstance();
272 // Load MVC framework core!
273 require_once $this->onimportmodel(CJTOOLBOX_MVC_FRAMEWOK . '/model.inc.php');
274 require_once $this->onimportcontroller(CJTOOLBOX_MVC_FRAMEWOK . '/controller.inc.php');
275 // Chaining!
276 return $this;
277 }
278
279 /**
280 * put your comment there...
281 *
282 */
283 protected function loadExtensions() {
284 // Load extensions lib!
285 require_once 'framework/extensions/extensions.class.php';
286 $this->extensions = new CJTExtensions();
287 // Load all extensions!
288 $this->extensions->load();
289 // Chaining!
290 return $this;
291 }
292
293 /**
294 * Run MAIN access point!
295 *
296 * @return $this
297 */
298 protected function main() {
299 // Access point base class is a dependency!
300 require_once 'framework/access-points/access-point.class.php';
301 // Run Main Acces Point!
302 include_once 'access.points/main.accesspoint.php';
303 $this->mainAC = new CJTMainAccessPoint();
304 $this->mainAC->listen();
305 }
306
307 /**
308 * Called When any In-Listen-State (ILS) Access point is
309 * connected (called by Wordpress hooking system).
310 *
311 * @return boolean TRUE.
312 */
313 public function onconnected($observer, $state) {
314 // In all cases that we'll process the request load the localization file.
315 load_plugin_textdomain(CJTOOLBOX_TEXT_DOMAIN, false, CJTOOLBOX_LANGUAGES);
316 // Always connet the access point!
317 return $state;
318 }
319
320 }// End Class
321
322 // Initialize events!
323 CJTPlugin::define('CJTPlugin', array('hookType' => CJTWordpressEvents::HOOK_FILTER));
324
325 // Let's Go!
326 CJTPlugin::getInstance();