PluginProbe
CSS & JavaScript Toolbox / 7.1
CSS & JavaScript Toolbox v7.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
← All changes | css-js-toolbox.php +128 -194 117.1 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: 11
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.1
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,262 @@
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 - const DB_VERSION = '1.7';
85 -
86 - /**
87 - * put your comment there...
88 - *
89 - * @var mixed
90 - */
91 - CONST ENV_PHP_MIN_VERSION = '5.3';
92 -
93 + const DB_VERSION = '1.6';
94 +
93 95 /**
94 - *
96 + *
95 97 */
96 - const FW_Version = '5.0';
97 -
98 + const Edition = 'free';
99 +
98 100 /**
99 - *
101 + *
100 102 */
101 - const VERSION = '11';
102 -
103 + const FW_Version = '2.0';
104 +
103 105 /**
104 - *
106 + *
105 107 */
108 + const VERSION = '7.1-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' ) );
175 -
181 + protected $onimportmodel = array('parameters' => array('file'));
182 +
176 183 /**
177 184 * put your comment there...
178 - *
185 + *
179 186 */
180 - protected function __construct()
181 - {
187 + protected function __construct() {
182 188 // Hookable!
183 189 parent::__construct();
184 -
185 190 // Allow access points to utilize from CJTPlugin functionality
186 191 // 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 -
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);
193 196 // Load plugin and all installed extensions!.
194 197 $this->load();
195 198 $this->loadExtensions();
196 -
197 199 // Run MAIN access point!
198 200 $this->main();
199 201 }
200 -
202 +
201 203 /**
202 204 * put your comment there...
203 - *
205 + *
204 206 */
205 - public function & extensions()
206 - {
207 - return $this->extensions;
207 + public function extensions() {
208 + return $this->extensions;
208 209 }
209 -
210 +
210 211 /**
211 212 * put your comment there...
212 - *
213 + *
213 214 */
214 - public function getAccessPoint( $name )
215 - {
216 - return $this->accessPoints[ $name ];
215 + public function getAccessPoint($name) {
216 + return $this->accessPoints[$name];
217 217 }
218 -
218 +
219 219 /**
220 220 * put your comment there...
221 - *
221 + *
222 222 */
223 - public static function getInstance()
224 - {
225 -
226 - if ( ! self::$instance )
227 - {
223 + public static function getInstance() {
224 + if (!self::$instance) {
228 225 self::$instance = new CJTPlugin();
229 226 }
230 -
231 227 return self::$instance;
232 228 }
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 - }
229 +
253 230 /**
254 231 * put your comment there...
255 - *
232 + *
256 233 */
257 - public function isInstalled()
258 - {
259 - return $this->installed;
234 + public function isInstalled() {
235 + return $this->installed;
260 236 }
261 -
237 +
262 238 /**
263 239 * put your comment there...
264 - *
240 + *
265 241 */
266 - public function listen()
267 - {
242 + public function listen() {
268 243 // For now we've only admin access points! Future versions might has something changed!
269 - if ( is_admin() )
270 - {
271 -
244 + if (is_admin()) {
272 245 // Import access points core classes.
273 246 require_once 'framework/access-points/page.class.php';
274 247 require_once 'framework/access-points/directory-spider.class.php';
275 -
276 248 // Get access points!
277 - $accessPoints = CJTAccessPointsDirectorySpider::getInstance( 'CJT', CJTOOLBOX_ACCESS_POINTS );
278 -
249 + $accessPoints = CJTAccessPointsDirectorySpider::getInstance('CJT', CJTOOLBOX_ACCESS_POINTS);
279 250 // For every access point create instance and LISTEN to the request!
280 - foreach ( $accessPoints as $name => $info )
281 - {
251 + foreach ($accessPoints as $name => $info) {
282 252 /**
283 253 * @var CJTAccessPoint
284 254 */
285 - $this->accessPoints[ $name ] = $point = $accessPoints->point()->listen();
286 -
255 + $this->accessPoints[$name] = $point = $accessPoints->point()->listen();
287 256 // We need to do some work with there is a connected access point.
288 - $point->onconnected = array( & $this, 'onconnected' );
289 -
257 + $point->onconnected = array(&$this, 'onconnected');
290 258 }
291 -
292 259 }
293 -
260 + // Chaining!
294 261 return $this;
295 262 }
296 -
263 +
297 264 /**
298 265 * put your comment there...
299 - *
266 + *
300 267 */
301 - protected function load()
302 - {
268 + protected function load() {
303 269 // Bootstrap the Plugin!
270 + require_once $this->onimportbasefile('css-js-toolbox.class.php');
304 271 cssJSToolbox::getInstance();
305 -
306 272 // 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 -
273 + require_once $this->onimportmodel(CJTOOLBOX_MVC_FRAMEWOK . '/model.inc.php');
274 + require_once $this->onimportcontroller(CJTOOLBOX_MVC_FRAMEWOK . '/controller.inc.php');
275 + // Chaining!
310 276 return $this;
311 277 }
312 -
278 +
313 279 /**
314 280 * put your comment there...
315 - *
281 + *
316 282 */
317 - protected function loadExtensions()
318 - {
283 + protected function loadExtensions() {
319 284 // Load extensions lib!
320 285 require_once 'framework/extensions/extensions.class.php';
321 -
322 286 $this->extensions = new CJTExtensions();
287 + // Load all extensions!
323 288 $this->extensions->load();
324 -
289 + // Chaining!
325 290 return $this;
326 291 }
327 -
292 +
328 293 /**
329 294 * Run MAIN access point!
330 - *
295 + *
331 296 * @return $this
332 297 */
333 - protected function main()
334 - {
335 - // Fire laod event
336 - $this->onload( $this );
337 -
298 + protected function main() {
338 299 // Access point base class is a dependency!
339 300 require_once 'framework/access-points/access-point.class.php';
340 -
341 301 // Run Main Acces Point!
342 302 include_once 'access.points/main.accesspoint.php';
343 -
344 303 $this->mainAC = new CJTMainAccessPoint();
345 304 $this->mainAC->listen();
346 305 }
347 -
306 +
348 307 /**
349 - * Called When any In-Listen-State (ILS) Access point is
308 + * Called When any In-Listen-State (ILS) Access point is
350 309 * connected (called by Wordpress hooking system).
351 - *
310 + *
352 311 * @return boolean TRUE.
353 312 */
354 - public function onconnected( $observer, $state )
355 - {
356 -
313 + public function onconnected($observer, $state) {
357 314 // 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 -
315 + load_plugin_textdomain(CJTOOLBOX_TEXT_DOMAIN, false, CJTOOLBOX_LANGUAGES);
362 316 // Always connet the access point!
363 317 return $state;
364 -
365 318 }
366 -
319 +
367 320 }// End Class
368 321
369 -// Dont run if environment (e.g PHP version) is incomaptible
370 -if ( ! CJTPlugin::isCompatibleEnvironment() )
371 -{
372 - return;
373 -}
374 -
375 322 // Initialize events!
376 -CJTPlugin::define( 'CJTPlugin', array( 'hookType' => CJTWordpressEvents::HOOK_FILTER ) );
323 +CJTPlugin::define('CJTPlugin', array('hookType' => CJTWordpressEvents::HOOK_FILTER));
377 324
378 325 // 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, '>=' ) ) {
389 - CJTPlugin::getInstance();
390 -} else {
391 - add_action( 'admin_notices', 'deprecatedPHPCheck' );
392 -}
326 +CJTPlugin::getInstance();