| @@ -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 | 27 | const PREFIXS = 'cjte-,css-javascript-toolbox-'; |
| 28 | - | |
| 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,12 +153,12 @@ | ||
| 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 | */ |
| @@ -168,20 +168,20 @@ | ||
| 168 | 168 | // Initializing! |
| 169 | 169 | $this->prefix = explode( ',', $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,9 +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 ) || | |
| 206 | + if ( ( strpos( $pluginName, $this->prefix[0] ) === 0 ) || | |
| 207 | 207 | ( strpos( $pluginName, $this->prefix[1] ) === 0 ) ) { |
| 208 | 208 | // CJT Extsnsion must has the definition XML file! |
| 209 | 209 | // First try for Edition-Specific file |
| 210 | 210 | // if not exists try the generic one. |
| @@ -240,18 +240,18 @@ | ||
| 240 | 240 | $this->extensions = $this->onload($extensions); |
| 241 | 241 | // Chaining |
| 242 | 242 | return $this->extensions; |
| 243 | 243 | } |
| 244 | - | |
| 244 | + | |
| 245 | 245 | /** |
| 246 | 246 | * put your comment there... |
| 247 | - * | |
| 247 | + * | |
| 248 | 248 | */ |
| 249 | 249 | public function load() { |
| 250 | 250 | // Initialize. |
| 251 | 251 | $frameworkVersion = new CJT_Framework_Version_Version(CJTPlugin::FW_Version); |
| 252 | 252 | // Auto load CJT extensions files when requested. |
| 253 | - spl_autoload_register($this->ontregisterautoload(array($this, '_autoload'))); | |
| 253 | + spl_autoload_register($this->ontregisterautoload(array($this, '__autoload'))); | |
| 254 | 254 | // Load all CJT extensions! |
| 255 | 255 | foreach ($this->getExtensions() as $class => $extension) { |
| 256 | 256 | // Filters! |
| 257 | 257 | extract($this->onload($extension, compact('class', 'extension'))); |
| @@ -308,9 +308,9 @@ | ||
| 308 | 308 | CJTPlugin::on((string) $event->attributes()->type, $callback); |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | - else { // If manual load specified just | |
| 312 | + else { // If manual load specified just | |
| 313 | 313 | if (class_exists($class)) { // Make sure the class is loaded! |
| 314 | 314 | $this->onloaded($class, $extension, $definitionXML, call_user_func($callback)); |
| 315 | 315 | } |
| 316 | 316 | } |
| @@ -319,12 +319,12 @@ | ||
| 319 | 319 | // Hook for processing incomaptible extensions. |
| 320 | 320 | add_action('admin_notices', array(& $this, 'processIncompatibles')); |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | - | |
| 323 | + | |
| 324 | 324 | /** |
| 325 | 325 | * put your comment there... |
| 326 | - * | |
| 326 | + * | |
| 327 | 327 | * @param mixed $pluginName |
| 328 | 328 | */ |
| 329 | 329 | public function & getDefDoc($pluginName) { |
| 330 | 330 | # Find if cached or create it |
| @@ -333,9 +333,9 @@ | ||
| 333 | 333 | $pluginXMLFile = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $pluginName . DIRECTORY_SEPARATOR . "{$pluginName}.xml"; |
| 334 | 334 | // Extension might removed while its license key still in the database |
| 335 | 335 | // Make sure the extension still exists |
| 336 | 336 | if (file_exists($pluginXMLFile)) { |
| 337 | - $this->defDocs[$pluginName] = new SimpleXMLElement(file_get_contents($pluginXMLFile)); | |
| 337 | + $this->defDocs[$pluginName] = new SimpleXMLElement(file_get_contents($pluginXMLFile)); | |
| 338 | 338 | } |
| 339 | 339 | else { |
| 340 | 340 | # Return null when extension is absent! |
| 341 | 341 | $this->defDocs[$pluginName] = null; |
| @@ -345,17 +345,17 @@ | ||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
| 348 | 348 | * put your comment there... |
| 349 | - * | |
| 349 | + * | |
| 350 | 350 | */ |
| 351 | 351 | public function & getFiles2ClassesMap() { |
| 352 | - return $this->file2Classmap; | |
| 352 | + return $this->file2Classmap; | |
| 353 | 353 | } |
| 354 | - | |
| 354 | + | |
| 355 | 355 | /** |
| 356 | 356 | * put your comment there... |
| 357 | - * | |
| 357 | + * | |
| 358 | 358 | * @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 | 359 | */ |
| 360 | 360 | public function processIncompatibles() { |
| 361 | 361 | // Proces only if in CJT page. |
| @@ -365,9 +365,9 @@ | ||
| 365 | 365 | // INitialize. |
| 366 | 366 | $message = cssJSToolbox::getText('CJT detects incompatible installed extensions, listed below with status message for every extension:'); |
| 367 | 367 | $list = ''; |
| 368 | 368 | // For every compatible extension add |
| 369 | - // an list item with details | |
| 369 | + // an list item with details | |
| 370 | 370 | // if there is an update available or provide |
| 371 | 371 | // a direct link to CJT website if no upgrade is available. |
| 372 | 372 | // Upgrade wont be available in case no license key is activated! |
| 373 | 373 | foreach ($this->incompatibilies as $class => $extension) { |