PluginProbe
CSS & JavaScript Toolbox / 8.0.3
CSS & JavaScript Toolbox v8.0.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 | framework/extensions/extensions.class.php +66 -67 10.18.0.3 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 -*
3 +*
4 4 */
5 5
6 6 // Disallow direct access.
7 7 defined('ABSPATH') or die("Access denied");
@@ -6,128 +6,128 @@
6 6 // Disallow direct access.
7 7 defined('ABSPATH') or die("Access denied");
8 8
9 9 /**
10 -*
10 +*
11 11 */
12 12 class CJTExtensions extends CJTHookableClass {
13 -
13 +
14 14 /**
15 - *
15 + *
16 16 */
17 17 const CACHE_OPTION_NAME = 'cjt_extensions';
18 -
18 +
19 19 /**
20 - *
20 + *
21 21 */
22 22 const LOAD_METHOD = 'getInvolved';
23 -
23 +
24 24 /**
25 - *
25 + *
26 26 */
27 - const PREFIXS = 'cjte-,css-javascript-toolbox-';
28 -
27 + const PREFIX = 'cjte-';
28 +
29 29 /**
30 30 * put your comment there...
31 - *
31 + *
32 32 * @var mixed
33 33 */
34 34 protected $defDocs;
35 -
35 +
36 36 /**
37 37 * put your comment there...
38 - *
38 + *
39 39 * @var mixed
40 40 */
41 41 protected $extensions;
42 -
42 +
43 43 /**
44 44 * put your comment there...
45 - *
45 + *
46 46 * @var mixed
47 47 */
48 48 protected $file2Classmap;
49 -
49 +
50 50 /**
51 51 * put your comment there...
52 - *
52 + *
53 53 * @var mixed
54 54 */
55 55 protected $incompatibilies;
56 -
56 +
57 57 /**
58 58 * put your comment there...
59 - *
59 + *
60 60 * @var mixed
61 61 */
62 62 protected $loadMethod;
63 -
63 +
64 64 /**
65 65 * put your comment there...
66 - *
66 + *
67 67 * @var mixed
68 68 */
69 69 protected $onautoload = array('parameters' => array('file', 'class'));
70 -
70 +
71 71 /**
72 72 * put your comment there...
73 - *
73 + *
74 74 * @var mixed
75 75 */
76 76 protected $onbindevent = array('parameters' => array('event', 'callback'));
77 -
77 +
78 78 /**
79 79 * put your comment there...
80 - *
80 + *
81 81 * @var mixed
82 82 */
83 83 protected $ondetectextension = array('parameters' => array('extension'));
84 -
84 +
85 85 /**
86 86 * put your comment there...
87 - *
87 + *
88 88 * @var mixed
89 89 */
90 90 protected $ongetactiveplugins = array('parameters' => array('plugins'));
91 -
91 +
92 92 /**
93 93 * put your comment there...
94 - *
94 + *
95 95 * @var mixed
96 96 */
97 97 protected $onload = array('parameters' => array('params'));
98 -
98 +
99 99 /**
100 100 * put your comment there...
101 - *
101 + *
102 102 * @var mixed
103 103 */
104 104 protected $onloadcallback = array('parameters' => array('callback'));
105 -
105 +
106 106 /**
107 107 * put your comment there...
108 - *
108 + *
109 109 * @var mixed
110 110 */
111 111 protected $onloaddefinition = array('parameters' => array('definition'));
112 -
112 +
113 113 /***
114 114 * put your comment there...
115 - *
115 + *
116 116 * @var mixed
117 117 */
118 118 protected $ontregisterautoload = array('parameters' => array('callback'));
119 -
119 +
120 120 /**
121 121 * put your comment there...
122 - *
122 + *
123 123 * @var mixed
124 124 */
125 125 protected $onreloadcacheparameters = array('parameters' => array('params'));
126 -
126 +
127 127 /**
128 128 * put your comment there...
129 - *
129 + *
130 130 * @var mixed
131 131 */
132 132 protected $onloaded = array(
133 133 'hookType' => CJTWordpressEvents::HOOK_ACTION,
@@ -132,22 +132,22 @@
132 132 protected $onloaded = array(
133 133 'hookType' => CJTWordpressEvents::HOOK_ACTION,
134 134 'parameters' => array('class', 'extension', 'definition', 'result')
135 135 );
136 -
136 +
137 137 /**
138 138 * put your comment there...
139 - *
139 + *
140 140 * @var mixed
141 141 */
142 142 protected $prefix;
143 -
143 +
144 144 /**
145 145 * put your comment there...
146 - *
146 + *
147 147 * @param mixed $className
148 148 */
149 - public function _autoload($className) {
149 + public function __autoload($className) {
150 150 // Load only classed defined on the list!
151 151 if (isset($this->extensions[$className])) {
152 152 $classFile = $this->onautoload($this->extensions[$className]['runtime']['classFile'], $className);
153 153 // Import class file!
@@ -153,35 +153,35 @@
153 153 // Import class file!
154 154 require_once $classFile;
155 155 }
156 156 }
157 -
157 +
158 158 /**
159 159 * put your comment there...
160 - *
160 + *
161 161 * @param mixed $prefix
162 162 * @param mixed $loadMethod
163 163 * @return CJTExtensions
164 164 */
165 - public function __construct($prefix = self::PREFIXS, $loadMethod = self::LOAD_METHOD) {
165 + public function __construct($prefix = self::PREFIX, $loadMethod = self::LOAD_METHOD) {
166 166 // Hookable!
167 167 parent::__construct();
168 168 // Initializing!
169 - $this->prefix = explode( ',', $prefix );
169 + $this->prefix = $prefix;
170 170 $this->loadMethod = $loadMethod;
171 171 }
172 -
172 +
173 173 /**
174 174 * put your comment there...
175 - *
175 + *
176 176 */
177 177 public function __destruct() {
178 - spl_autoload_unregister(array($this, '_autoload'));
178 + spl_autoload_unregister(array($this, '__autoload'));
179 179 }
180 -
180 +
181 181 /**
182 182 * put your comment there...
183 - *
183 + *
184 184 * @param mixed $reload
185 185 * @return CJTExtensions
186 186 */
187 187 public function & getExtensions($reload = false) {
@@ -202,10 +202,9 @@
202 202 foreach ($activePlugins as $file) {
203 203 $pluginDir = dirname($file);
204 204 $pluginName = basename($pluginDir);
205 205 // Any plugin with our prefix is a CJT extension!
206 - if ( ( strpos( $pluginName, $this->prefix[0] ) === 0 ) ||
207 - ( strpos( $pluginName, $this->prefix[1] ) === 0 ) ) {
206 + if (strpos($pluginName, $this->prefix) === 0) {
208 207 // CJT Extsnsion must has the definition XML file!
209 208 // First try for Edition-Specific file
210 209 // if not exists try the generic one.
211 210 $xmlFile = "{$pluginDir}/{$pluginName}.xml";
@@ -240,18 +239,18 @@
240 239 $this->extensions = $this->onload($extensions);
241 240 // Chaining
242 241 return $this->extensions;
243 242 }
244 -
243 +
245 244 /**
246 245 * put your comment there...
247 - *
246 + *
248 247 */
249 248 public function load() {
250 249 // Initialize.
251 250 $frameworkVersion = new CJT_Framework_Version_Version(CJTPlugin::FW_Version);
252 251 // Auto load CJT extensions files when requested.
253 - spl_autoload_register($this->ontregisterautoload(array($this, '_autoload')));
252 + spl_autoload_register($this->ontregisterautoload(array($this, '__autoload')));
254 253 // Load all CJT extensions!
255 254 foreach ($this->getExtensions() as $class => $extension) {
256 255 // Filters!
257 256 extract($this->onload($extension, compact('class', 'extension')));
@@ -308,9 +307,9 @@
308 307 CJTPlugin::on((string) $event->attributes()->type, $callback);
309 308 }
310 309 }
311 310 }
312 - else { // If manual load specified just
311 + else { // If manual load specified just
313 312 if (class_exists($class)) { // Make sure the class is loaded!
314 313 $this->onloaded($class, $extension, $definitionXML, call_user_func($callback));
315 314 }
316 315 }
@@ -319,12 +318,12 @@
319 318 // Hook for processing incomaptible extensions.
320 319 add_action('admin_notices', array(& $this, 'processIncompatibles'));
321 320 }
322 321 }
323 -
322 +
324 323 /**
325 324 * put your comment there...
326 - *
325 + *
327 326 * @param mixed $pluginName
328 327 */
329 328 public function & getDefDoc($pluginName) {
330 329 # Find if cached or create it
@@ -333,9 +332,9 @@
333 332 $pluginXMLFile = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $pluginName . DIRECTORY_SEPARATOR . "{$pluginName}.xml";
334 333 // Extension might removed while its license key still in the database
335 334 // Make sure the extension still exists
336 335 if (file_exists($pluginXMLFile)) {
337 - $this->defDocs[$pluginName] = new SimpleXMLElement(file_get_contents($pluginXMLFile));
336 + $this->defDocs[$pluginName] = new SimpleXMLElement(file_get_contents($pluginXMLFile));
338 337 }
339 338 else {
340 339 # Return null when extension is absent!
341 340 $this->defDocs[$pluginName] = null;
@@ -345,17 +344,17 @@
345 344 }
346 345
347 346 /**
348 347 * put your comment there...
349 - *
348 + *
350 349 */
351 350 public function & getFiles2ClassesMap() {
352 - return $this->file2Classmap;
351 + return $this->file2Classmap;
353 352 }
354 -
353 +
355 354 /**
356 355 * put your comment there...
357 - *
356 + *
358 357 * @TODO: REMOVE HTML-MARKUP. CJT PLUGIN NEVER WRITE MARKUP IMIXED WITH HTML. ITS VERY BAD PROGRAMMING PRACTICE. THIS WILL BE REMOVED NEXT TIME AS WE IN RUSH!!!
359 358 */
360 359 public function processIncompatibles() {
361 360 // Proces only if in CJT page.
@@ -365,9 +364,9 @@
365 364 // INitialize.
366 365 $message = cssJSToolbox::getText('CJT detects incompatible installed extensions, listed below with status message for every extension:');
367 366 $list = '';
368 367 // For every compatible extension add
369 - // an list item with details
368 + // an list item with details
370 369 // if there is an update available or provide
371 370 // a direct link to CJT website if no upgrade is available.
372 371 // Upgrade wont be available in case no license key is activated!
373 372 foreach ($this->incompatibilies as $class => $extension) {