PluginProbe
CSS & JavaScript Toolbox / 8.1
CSS & JavaScript Toolbox v8.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
css-javascript-toolbox / css-js-toolbox.php

css-js-toolbox.php in CSS & JavaScript Toolbox 8.1, at css-js-toolbox.php

324 lines 8.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: CJT Plugin for WordPress to easily add custom CSS and JavaScript to individual pages
6 Version: 8.1
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 define('CJTOOLBOX_PLUGIN_BASE', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
21
22 /** * */
23 define('CJTOOLBOX_PLUGIN_FILE', __FILE__);
24
25 /** CJT Name */
26 define('CJTOOLBOX_NAME', plugin_basename(dirname(__FILE__)));
27
28 /** CJT Text Domain used for localize texts */
29 define('CJTOOLBOX_TEXT_DOMAIN', CJTOOLBOX_NAME);
30
31 /** */
32 define('CJTOOLBOX_LANGUAGES', CJTOOLBOX_NAME . '/locals/languages/');
33
34 /** CJT Absoulte path */
35 define('CJTOOLBOX_PATH', dirname(__FILE__));
36
37 /** Dont use!! @deprecated */
38 define('CJTOOLBOX_INCLUDE_PATH', CJTOOLBOX_PATH . '/framework');
39
40 /** Access Points path */
41 define('CJTOOLBOX_ACCESS_POINTS', CJTOOLBOX_PATH . '/access.points');
42
43 /** Frmaework path */
44 define('CJTOOLBOX_FRAMEWORK', CJTOOLBOX_INCLUDE_PATH); // Alias to include path!
45
46 // Class Autoload Added @since 6.2.
47 require 'autoload.inc.php';
48
49 // Import dependencies
50 require_once CJTOOLBOX_FRAMEWORK . '/php/includes.class.php';
51 require_once CJTOOLBOX_FRAMEWORK . '/events/definition.class.php';
52 require_once CJTOOLBOX_FRAMEWORK . '/events/events.class.php';
53 require_once CJTOOLBOX_FRAMEWORK . '/events/wordpress.class.php';
54 require_once CJTOOLBOX_FRAMEWORK . '/events/hookable.interface.php';
55 require_once CJTOOLBOX_FRAMEWORK . '/events/hookable.class.php';
56
57 // Initialize events engine/system!
58 CJTWordpressEvents::__init(array('hookType' => CJTWordpressEvents::HOOK_ACTION));
59 CJTWordpressEvents::$paths['subjects']['core'] = CJTOOLBOX_FRAMEWORK . '/events/subjects';
60 CJTWordpressEvents::$paths['observers']['core'] = CJTOOLBOX_FRAMEWORK . '/events/observers';
61
62 /**
63 * CJT Plugin interface.
64 *
65 * The CJT Plugin is maximum deferred.
66 * All functionality here is just to detect if the request should be processed!
67 *
68 * The main class is located css-js-toolbox.class.php cssJSToolbox class
69 * The plugin is fully developed using Model-View-Controller design pattern.
70 *
71 * access.points directory has all the entry points that processed by the Plugin.
72 *
73 * @package CJT
74 * @author Ahmed Said
75 * @version 6
76 */
77 class CJTPlugin extends CJTHookableClass {
78
79 /**
80 *
81 */
82 const DB_VERSION = '1.6';
83
84 /**
85 *
86 */
87 const FW_Version = '4.0';
88
89 /**
90 *
91 */
92 const VERSION = '8.1' ;
93
94 /**
95 *
96 */
97 const DB_VERSION_OPTION_NAME = 'cjtoolbox_db_version';
98
99 /**
100 *
101 */
102 const PLUGIN_REQUEST_ID = 'cjtoolbox';
103
104 /**
105 * put your comment there...
106 *
107 * @var mixed
108 */
109 protected $accessPoints;
110
111 /**
112 * put your comment there...
113 *
114 * @var mixed
115 */
116 protected $extensions;
117
118 /**
119 * put your comment there...
120 *
121 * @var mixed
122 */
123 protected $installed;
124
125 /**
126 * put your comment there...
127 *
128 * @var CJTPlugin
129 */
130 protected static $instance;
131
132 /**
133 * put your comment there...
134 *
135 * @var mixed
136 */
137 protected $mainAC;
138
139 /**
140 * put your comment there...
141 *
142 * @var mixed
143 */
144 protected $onloaddbversion = array('parameters' => array('dbVersion'));
145
146 /**
147 * put your comment there...
148 *
149 * @var mixed
150 */
151 protected $onimportbasefile = array('parameters' => array('file'));
152
153 /**
154 * put your comment there...
155 *
156 * @var mixed
157 */
158 protected $onimportcontroller = array('parameters' => array('file'));
159
160 /**
161 * put your comment there...
162 *
163 * @var mixed
164 */
165 protected $onimportmodel = array('parameters' => array('file'));
166
167 /**
168 * put your comment there...
169 *
170 * @var mixed
171 */
172 protected $onload = array('parameters' => array('instance'));
173
174 /**
175 * put your comment there...
176 *
177 */
178 protected function __construct() {
179 // Hookable!
180 parent::__construct();
181 // Allow access points to utilize from CJTPlugin functionality
182 // even if the call is recursive inside getInstance/construct methods!!!
183 self::$instance = $this;
184 // Read vars!
185 $dbVersion = $this->onloaddbversion(get_option(self::DB_VERSION_OPTION_NAME));
186 $this->installed = (($dbVersion) == self::DB_VERSION);
187 // Load plugin and all installed extensions!.
188 $this->load();
189 $this->loadExtensions();
190 // Run MAIN access point!
191 $this->main();
192 }
193
194 /**
195 * put your comment there...
196 *
197 */
198 public function & extensions() {
199 return $this->extensions;
200 }
201
202 /**
203 * put your comment there...
204 *
205 */
206 public function getAccessPoint($name) {
207 return $this->accessPoints[$name];
208 }
209
210 /**
211 * put your comment there...
212 *
213 */
214 public static function getInstance() {
215 if (!self::$instance) {
216 self::$instance = new CJTPlugin();
217 }
218 return self::$instance;
219 }
220
221 /**
222 * put your comment there...
223 *
224 */
225 public function isInstalled() {
226 return $this->installed;
227 }
228
229 /**
230 * put your comment there...
231 *
232 */
233 public function listen() {
234 // For now we've only admin access points! Future versions might has something changed!
235 if (is_admin()) {
236 // Import access points core classes.
237 require_once 'framework/access-points/page.class.php';
238 require_once 'framework/access-points/directory-spider.class.php';
239 // Get access points!
240 $accessPoints = CJTAccessPointsDirectorySpider::getInstance('CJT', CJTOOLBOX_ACCESS_POINTS);
241 // For every access point create instance and LISTEN to the request!
242 foreach ($accessPoints as $name => $info) {
243 /**
244 * @var CJTAccessPoint
245 */
246 $this->accessPoints[$name] = $point = $accessPoints->point()->listen();
247 // We need to do some work with there is a connected access point.
248 $point->onconnected = array(&$this, 'onconnected');
249 }
250 }
251 // Chaining!
252 return $this;
253 }
254
255 /**
256 * put your comment there...
257 *
258 */
259 protected function load() {
260 // Bootstrap the Plugin!
261 require_once $this->onimportbasefile('css-js-toolbox.class.php');
262 cssJSToolbox::getInstance();
263 // Load MVC framework core!
264 require_once $this->onimportmodel(CJTOOLBOX_MVC_FRAMEWOK . '/model.inc.php');
265 require_once $this->onimportcontroller(CJTOOLBOX_MVC_FRAMEWOK . '/controller.inc.php');
266 // Chaining!
267 return $this;
268 }
269
270 /**
271 * put your comment there...
272 *
273 */
274 protected function loadExtensions() {
275 // Load extensions lib!
276 require_once 'framework/extensions/extensions.class.php';
277 $this->extensions = new CJTExtensions();
278 // Load all extensions!
279 $this->extensions->load();
280 // Chaining!
281 return $this;
282 }
283
284 /**
285 * Run MAIN access point!
286 *
287 * @return $this
288 */
289 protected function main() {
290 // Fire laod event
291 $this->onload($this);
292 // Access point base class is a dependency!
293 require_once 'framework/access-points/access-point.class.php';
294 // Run Main Acces Point!
295 include_once 'access.points/main.accesspoint.php';
296 $this->mainAC = new CJTMainAccessPoint();
297 $this->mainAC->listen();
298 }
299
300 /**
301 * Called When any In-Listen-State (ILS) Access point is
302 * connected (called by Wordpress hooking system).
303 *
304 * @return boolean TRUE.
305 */
306 public function onconnected($observer, $state)
307 {
308 // In all cases that we'll process the request load the localization file.
309 load_plugin_textdomain(CJTOOLBOX_TEXT_DOMAIN, false, CJTOOLBOX_LANGUAGES);
310
311 do_action( CJTPluggableHelper::ACTION_CJT_TEXT_DOMAIN_LOADED );
312
313 // Always connet the access point!
314 return $state;
315
316 }
317
318 }// End Class
319
320 // Initialize events!
321 CJTPlugin::define('CJTPlugin', array('hookType' => CJTWordpressEvents::HOOK_FILTER));
322
323 // Let's Go!
324 CJTPlugin::getInstance();