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