PluginProbe
CSS & JavaScript Toolbox / 8.3.2
CSS & JavaScript Toolbox v8.3.2
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 8.3.2, at css-js-toolbox.php

379 lines 9.0 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/
5 Description: The CSS & JavaScript Toolbox plugin on WordPress.org is no longer supported. This has been replaced by our new code management plugin also on WordPress.org called <a href="https://wordpress.org/plugins/easy-code-manager">Easy Code Manager</a>.
6 Version: 8.3.2
7 Author: Wipeout Media
8 Author URI: http://css-javascript-toolbox.com
9 License:
10
11 The Software is package as a WordPress¨ plugin. The PHP code associated with the Software is licensed under the GPL version 2.0 license (as found at http://www.gnu.org/licenses/gpl-2.0.txt GNU/GPLv2 or "GPLv2"). You may redistribute, repackage, and modify the PHP code as you see fit and as consistent with GPLv2.
12
13 The remaining portions of the Software ("Proprietary Portion"), which includes all images, cascading style sheets, and JavaScript are NOT licensed under GPLv2 and are considered proprietary to Licensor and are solely licensed under the remaining terms of this Agreement. The Proprietary Portion may not be redistributed, repackaged, or otherwise modified.
14 */
15
16 // Disallow direct access.
17 defined( 'ABSPATH' ) or die( 'Access denied' );
18
19
20 /** * */
21 define( 'CJTOOLBOX_PLUGIN_BASE', basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
22
23 /** * */
24 define( 'CJTOOLBOX_PLUGIN_FILE', __FILE__ );
25
26 /** CJT Name */
27 define( 'CJTOOLBOX_NAME', plugin_basename( dirname( __FILE__ ) ) );
28
29 /** CJT Text Domain used for localize texts */
30 define( 'CJTOOLBOX_TEXT_DOMAIN', CJTOOLBOX_NAME );
31
32 /** */
33 define( 'CJTOOLBOX_LANGUAGES', CJTOOLBOX_NAME . '/locals/languages/' );
34
35 /** CJT Absoulte path */
36 define( 'CJTOOLBOX_PATH', dirname( __FILE__ ) );
37
38 /** Dont use!! @deprecated */
39 define( 'CJTOOLBOX_INCLUDE_PATH', CJTOOLBOX_PATH . '/framework' );
40
41 /** Access Points path */
42 define( 'CJTOOLBOX_ACCESS_POINTS', CJTOOLBOX_PATH . '/access.points' );
43
44 /** Frmaework path */
45 define('CJTOOLBOX_FRAMEWORK', CJTOOLBOX_INCLUDE_PATH); // Alias to include path!
46
47 // Class Autoload Added @since 6.2.
48 require 'autoload.inc.php';
49
50 // Import dependencies
51 require_once CJTOOLBOX_FRAMEWORK . '/php/includes.class.php';
52 require_once CJTOOLBOX_FRAMEWORK . '/events/definition.class.php';
53 require_once CJTOOLBOX_FRAMEWORK . '/events/events.class.php';
54 require_once CJTOOLBOX_FRAMEWORK . '/events/wordpress.class.php';
55 require_once CJTOOLBOX_FRAMEWORK . '/events/hookable.interface.php';
56 require_once CJTOOLBOX_FRAMEWORK . '/events/hookable.class.php';
57
58 // Initialize events engine/system!
59 CJTWordpressEvents::__init( array( 'hookType' => CJTWordpressEvents::HOOK_ACTION ) );
60 CJTWordpressEvents::$paths[ 'subjects' ][ 'core' ] = CJTOOLBOX_FRAMEWORK . '/events/subjects';
61 CJTWordpressEvents::$paths[ 'observers' ][ 'core' ] = CJTOOLBOX_FRAMEWORK . '/events/observers';
62
63 /**
64 * CJT Plugin interface.
65 *
66 * The CJT Plugin is maximum deferred.
67 * All functionality here is just to detect if the request should be processed!
68 *
69 * The main class is located css-js-toolbox.class.php cssJSToolbox class
70 * The plugin is fully developed using Model-View-Controller design pattern.
71 *
72 * access.points directory has all the entry points that processed by the Plugin.
73 *
74 * @package CJT
75 * @author Ahmed Said
76 * @version 6
77 */
78 class CJTPlugin extends CJTHookableClass
79 {
80
81 /**
82 *
83 */
84 const DB_VERSION = '1.6';
85
86 /**
87 * put your comment there...
88 *
89 * @var mixed
90 */
91 CONST ENV_PHP_MIN_VERSION = '5.3';
92
93 /**
94 *
95 */
96 const FW_Version = '4.0';
97
98 /**
99 *
100 */
101 const VERSION = '8.3.2' ;
102
103 /**
104 *
105 */
106 const DB_VERSION_OPTION_NAME = 'cjtoolbox_db_version';
107
108 /**
109 *
110 */
111 const PLUGIN_REQUEST_ID = 'cjtoolbox';
112
113 /**
114 * put your comment there...
115 *
116 * @var mixed
117 */
118 protected $accessPoints;
119
120 /**
121 * put your comment there...
122 *
123 * @var mixed
124 */
125 protected $extensions;
126
127 /**
128 * put your comment there...
129 *
130 * @var mixed
131 */
132 protected $installed;
133
134 /**
135 * put your comment there...
136 *
137 * @var CJTPlugin
138 */
139 protected static $instance;
140
141 /**
142 * put your comment there...
143 *
144 * @var mixed
145 */
146 protected $mainAC;
147
148 /**
149 * put your comment there...
150 *
151 * @var mixed
152 */
153 protected $onloaddbversion = array( 'parameters' => array( 'dbVersion' ) );
154
155 /**
156 * put your comment there...
157 *
158 * @var mixed
159 */
160 protected $onimportcontroller = array( 'parameters' => array( 'file' ) );
161
162 /**
163 * put your comment there...
164 *
165 * @var mixed
166 */
167 protected $onimportmodel = array( 'parameters' => array( 'file' ) );
168
169 /**
170 * put your comment there...
171 *
172 * @var mixed
173 */
174 protected $onload = array( 'parameters' => array( 'instance' ) );
175
176 /**
177 * put your comment there...
178 *
179 */
180 protected function __construct()
181 {
182 // Hookable!
183 parent::__construct();
184
185 // Allow access points to utilize from CJTPlugin functionality
186 // even if the call is recursive inside getInstance/construct methods!!!
187 self::$instance = $this;
188
189 // Installation version
190 $dbVersion = $this->onloaddbversion( get_option( self::DB_VERSION_OPTION_NAME ) );
191 $this->installed = ( ( $dbVersion ) == self::DB_VERSION );
192
193 // Load plugin and all installed extensions!.
194 $this->load();
195 $this->loadExtensions();
196
197 // Run MAIN access point!
198 $this->main();
199 }
200
201 /**
202 * put your comment there...
203 *
204 */
205 public function & extensions()
206 {
207 return $this->extensions;
208 }
209
210 /**
211 * put your comment there...
212 *
213 */
214 public function getAccessPoint( $name )
215 {
216 return $this->accessPoints[ $name ];
217 }
218
219 /**
220 * put your comment there...
221 *
222 */
223 public static function getInstance()
224 {
225
226 if ( ! self::$instance )
227 {
228 self::$instance = new CJTPlugin();
229 }
230
231 return self::$instance;
232 }
233
234 /**
235 * put your comment there...
236 *
237 */
238 public static function isCompatibleEnvironment()
239 {
240
241 if ( version_compare( PHP_VERSION, self::ENV_PHP_MIN_VERSION, '<' ) )
242 {
243
244 $importHTMLFileCode = 'require "includes" . DIRECTORY_SEPARATOR . "html" . DIRECTORY_SEPARATOR . "incompatible_environment_message.html.php";';
245
246 add_action( 'admin_notices', create_function( '', $importHTMLFileCode ) );
247
248 return false;
249 }
250
251 return true;
252 }
253 /**
254 * put your comment there...
255 *
256 */
257 public function isInstalled()
258 {
259 return $this->installed;
260 }
261
262 /**
263 * put your comment there...
264 *
265 */
266 public function listen()
267 {
268 // For now we've only admin access points! Future versions might has something changed!
269 if ( is_admin() )
270 {
271
272 // Import access points core classes.
273 require_once 'framework/access-points/page.class.php';
274 require_once 'framework/access-points/directory-spider.class.php';
275
276 // Get access points!
277 $accessPoints = CJTAccessPointsDirectorySpider::getInstance( 'CJT', CJTOOLBOX_ACCESS_POINTS );
278
279 // For every access point create instance and LISTEN to the request!
280 foreach ( $accessPoints as $name => $info )
281 {
282 /**
283 * @var CJTAccessPoint
284 */
285 $this->accessPoints[ $name ] = $point = $accessPoints->point()->listen();
286
287 // We need to do some work with there is a connected access point.
288 $point->onconnected = array( & $this, 'onconnected' );
289
290 }
291
292 }
293
294 return $this;
295 }
296
297 /**
298 * put your comment there...
299 *
300 */
301 protected function load()
302 {
303 // Bootstrap the Plugin!
304 cssJSToolbox::getInstance();
305
306 // Load MVC framework core!
307 require_once $this->onimportmodel( CJTOOLBOX_MVC_FRAMEWOK . '/model.inc.php' );
308 require_once $this->onimportcontroller( CJTOOLBOX_MVC_FRAMEWOK . '/controller.inc.php' );
309
310 return $this;
311 }
312
313 /**
314 * put your comment there...
315 *
316 */
317 protected function loadExtensions()
318 {
319 // Load extensions lib!
320 require_once 'framework/extensions/extensions.class.php';
321
322 $this->extensions = new CJTExtensions();
323 $this->extensions->load();
324
325 return $this;
326 }
327
328 /**
329 * Run MAIN access point!
330 *
331 * @return $this
332 */
333 protected function main()
334 {
335 // Fire laod event
336 $this->onload( $this );
337
338 // Access point base class is a dependency!
339 require_once 'framework/access-points/access-point.class.php';
340
341 // Run Main Acces Point!
342 include_once 'access.points/main.accesspoint.php';
343
344 $this->mainAC = new CJTMainAccessPoint();
345 $this->mainAC->listen();
346 }
347
348 /**
349 * Called When any In-Listen-State (ILS) Access point is
350 * connected (called by Wordpress hooking system).
351 *
352 * @return boolean TRUE.
353 */
354 public function onconnected( $observer, $state )
355 {
356
357 // In all cases that we'll process the request load the localization file.
358 load_plugin_textdomain( CJTOOLBOX_TEXT_DOMAIN, false, CJTOOLBOX_LANGUAGES );
359
360 do_action( CJTPluggableHelper::ACTION_CJT_TEXT_DOMAIN_LOADED );
361
362 // Always connet the access point!
363 return $state;
364
365 }
366
367 }// End Class
368
369 // Dont run if environment (e.g PHP version) is incomaptible
370 if ( ! CJTPlugin::isCompatibleEnvironment() )
371 {
372 return;
373 }
374
375 // Initialize events!
376 CJTPlugin::define( 'CJTPlugin', array( 'hookType' => CJTWordpressEvents::HOOK_FILTER ) );
377
378 // Let's Go!
379 CJTPlugin::getInstance();