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