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