/** * put your comment there... * */ public function load() { // Initialize. $frameworkVersion = new CJT_Framework_Version_Version(CJTPlugin::FW_Version); // Auto load CJT extensions files when requested. spl_autoload_register($this->ontregisterautoload(array($this, '__autoload'))); // Load all CJT extensions! foreach ($this->getExtensions() as $class => $extension) { // Filters! extract($this->onload($extension, compact('class', 'extension'))); // Build Extension plugin path $pluginPath = ABSPATH . PLUGINDIR . "/{$extension['name']}"; // Set runtime variables. $this->extensions[$class]['runtime']['classFile'] = "{$pluginPath}/{$extension['name']}.class.php"; // Load definition. $definitionXML = $extension['defDoc']; // Extensions below version 1.0 use static classes // while version 1.0 and up use objects if ((string) $definitionXML->attributes()->version == '1.0') { // Instantiate extension object $extensionObject = new $class($extension); // Hold extension object $extension['exObject'] = $extensionObject; // Obejct callback $callback = array($extensionObject, $this->loadMethod); } else { # Static callback $callback = array($class, $this->loadMethod); } // Callback filter $callback = $this->onloadcallback($callback); // If auto load is speicifd then import class file and bind events. if ($extension['definition']['primary']['loadMethod'] == 'auto') { // If frameworkVersion is not provided assume its 0 (Older version) // before frameworkversion chech even supported. // otherwise compare it with current frameworkversion // If the version MAJOR is different current // then its incompatible. $extensionVer = new CJT_Framework_Version_Version((int) (string) $definitionXML->attributes()->requireFrameworkVersion); if ($frameworkVersion->getMajor() < $extensionVer->getMajor()) { // Detects which requird updates CJT or the Extension itself. $extension['incompatibleMessage']['msg'] = cssJSToolbox::getText('Extension is required CJT Framework Version higher than currently installed, CJT need to get updated!!!'); $extension['incompatibleMessage']['flag'] = cssJSToolbox::getText('Aborted'); // Add to incomaptibility list. $this->incompatibilies[$pluginPath] = $extension; } else { # Detect extensions required old Framework if ($frameworkVersion->getMajor() > $extensionVer->getMajor()) { $extension['incompatibleMessage']['msg'] = cssJSToolbox::getText('Extension is required old CJT Framework Version than the installed. This extension might need to get update. Please check if this extension is currently behaving correctly!!!'); $extension['incompatibleMessage']['flag'] = cssJSToolbox::getText('Ignored'); // Add to incomaptibility list. $this->incompatibilies[$pluginPath] = $extension; } // Bind events for compatible extensions. foreach ($definitionXML->getInvolved->event as $event) { // filter! extract($this->onbindevent(compact('event', 'callback'))); // Bind! CJTPlugin::on((string) $event->attributes()->type, $callback); } } } else { // If manual load specified just if (class_exists($class)) { // Make sure the class is loaded! $this->onloaded($class, $extension, $definitionXML, call_user_func($callback)); } } } if (!empty($this->incompatibilies)) { // Hook for processing incomaptible extensions. add_action('admin_notices', array(&$this, 'processIncompatibles')); } }