/**
  * put your comment there...
  * 
  */
 protected function enableAction()
 {
     // Initializing!
     $model = $this->model;
     $cjtWebServer = cssJSToolbox::getCJTWebSiteURL();
     $extensions =& CJTPlugin::getInstance()->extensions();
     // Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate
     // license key!
     $activeLicenses = $model->getStatedLicenses();
     // Activate Automatic upgrade for all activated licenses/components!
     foreach ($activeLicenses as $name => $state) {
         // Get extension def doc.
         // Act only if extension has XMl DOC! This might happened i fthe extension
         // removed while its key still in the database
         if ($extDef = $extensions->getDefDoc(dirname($state['component']['pluginBase']))) {
             // Check CJT Server only if updateSrc points to Wordpress Repository
             $updateSrcServer = (string) $extDef->license->attributes()->updateSrc;
             if (!$updateSrcServer || $updateSrcServer == 'CJT') {
                 // Initializingn vars for a single state/component!
                 $pluginFile = ABSPATH . PLUGINDIR . '/' . $state['component']['pluginBase'];
                 $license =& $state['license'];
                 // Set EDD Automatic Updater!
                 try {
                     CJTStoreUpdate::autoUpgrade($name, $license['key'], $pluginFile);
                 } catch (CJTServicesAPICallException $exception) {
                     die('CJT AUTO-UPGRADE EXCAPTION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
                 }
             }
         }
     }
 }
Esempio n. 2
0
 /**
  * put your comment there...
  * 
  */
 protected function enableAction()
 {
     // Initializing!
     $model = $this->model;
     $cjtWebServer = cssJSToolbox::getCJTWebSiteURL();
     $extensions =& CJTPlugin::getInstance()->extensions();
     // Get all CJT-Plugins (Include CJT Plugin itself + all its extensions) that has activate
     // license key!
     $activeLicenses = $model->getStatedLicenses();
     // Import EDD updater Class!
     cssJSToolbox::import('framework:third-party:easy-digital-download:auto-upgrade.class.php');
     // Activate Automatic upgrade for all activated licenses/components!
     foreach ($activeLicenses as $name => $state) {
         // Get extension def doc.
         // Act only if extension has XMl DOC! This might happened i fthe extension
         // removed while its key still in the database
         if ($extDef = $extensions->getDefDoc(dirname($state['component']['pluginBase']))) {
             // Check CJT Server only if updateSrc points to Wordpress Repository
             $updateSrcServer = (string) $extDef->license->attributes()->updateSrc;
             if (!$updateSrcServer || $updateSrcServer == 'CJT') {
                 // Initializingn vars for a single state/component!
                 $pluginFile = ABSPATH . PLUGINDIR . '/' . $state['component']['pluginBase'];
                 // Stop using Cached Data as it causes issue, always
                 // get fresh plugin data.
                 $plugin = get_plugin_data($pluginFile);
                 $license =& $state['license'];
                 // Edd API parameter to be send along with he check!
                 $requestParams = array('version' => $plugin['Version'], 'author' => $plugin['AuthorName'], 'license' => $license['key'], 'item_name' => $name);
                 // Set EDD Automatic Updater!
                 $updated = new CJT_EDD_SL_Plugin_Updater($cjtWebServer, $pluginFile, $requestParams);
             }
         }
     }
 }
 /**
  * put your comment there...
  * 
  */
 public function route($loadView = null, $request = null)
 {
     // Initializing!
     $controller = false;
     // Controllers allowed to be Loaded if not installed
     $notInstalledAllowedControllers = array('installer', 'setup');
     // Veil access point unless CJT installed or the controller is installer (to allow instalaltion throught AJAX)!
     if (CJTPlugin::getInstance()->isInstalled() || in_array($this->controllerName, $notInstalledAllowedControllers)) {
         // Connected!
         $this->connected();
         // IF Module-Prefix passed THEN Point to correct Controller path
         if (isset($_REQUEST['cjtajaxmodule'])) {
             # try to get module associated to passed module
             $accessPointClassLoader = CJT_Framework_Autoload_Loader::autoLoad($_REQUEST['cjtajaxmodule']);
             if ($accessPointClassLoader) {
                 $this->overrideControllersPath = $accessPointClassLoader->getPath() . DIRECTORY_SEPARATOR . 'controllers';
                 $this->overrideControllersPrefix = $accessPointClassLoader->getPrefix();
             }
         }
         // Instantiate controller.
         $controller = parent::route($loadView, $request);
         // Dispatch the call as its originally requested from ajax action!
         $action = "wp_ajax_{$this->pageId}_{$_REQUEST['CJTAjaxAction']}";
         // Fire Ajax action.
         do_action($action);
     }
     return $controller;
 }
 /**
  * put your comment there...
  * 
  */
 protected function doListen()
 {
     // If not installed and not in manage page display admin notice!
     if (!CJTPlugin::getInstance()->isInstalled() && $this->hasAccess()) {
         add_action('admin_notices', array(&$this, 'notInstalledAdminNotice'));
     }
 }
Esempio n. 5
0
 /**
  * put your comment there...
  * 
  */
 protected function doListen()
 {
     // Only if installed!
     if (CJTPlugin::getInstance()->isInstalled()) {
         // Don't bother doing this stuff if the current user lacks permissions
         if ((current_user_can('edit_posts') || current_user_can('edit_pages')) && get_user_option('rich_editing') == 'true') {
             add_filter('mce_external_plugins', array($this, 'registerButton'));
         }
     }
 }
 /**
  * put your comment there...
  * 
  */
 public function main()
 {
     // Run the coupling only if installed!
     if (CJTPlugin::getInstance()->isInstalled()) {
         $this->controllerName = 'blocks-coupling';
         $this->route(false);
     }
     // Run all the aother access points!
     CJTPlugin::getInstance()->listen();
 }
Esempio n. 7
0
 /**
  * put your comment there...
  * 
  */
 public function getPage()
 {
     // If not installed always run the installer.
     if (!CJTPlugin::getInstance()->isInstalled()) {
         $installedAccessPoint = CJTPlugin::getInstance()->getAccessPoint('installer');
         // Redirect menu call back to the installer access point!
         $this->controller = $installedAccessPoint->installationPage();
         // Stop not installed admin notice!
         $installedAccessPoint->stopNotices();
     } else {
         // If installed work like a pages proxy!
         // Set as the connected object!
         $this->connected();
         // Process the request!
         $this->route();
     }
 }
 /**
  * put your comment there...
  * 
  * @param mixed $postType
  * @param mixed $post
  */
 public function postsMetabox($postType, $post)
 {
     // Initialize.
     $controller = false;
     // Veil access point unless CJT installed!
     if (CJTPlugin::getInstance()->isInstalled()) {
         // Only if permitted!
         if ($this->hasAccess()) {
             // Set as connected object!
             $this->connected();
             // Load metabox controller!
             $this->controllerName = 'metabox';
             // Standarize calling the controller with Ajax requests!
             // Ajax uses 'post' parameter as postId!
             $post = $post->ID;
             // Dispatch controller!
             $controller = $this->route(null, compact('postType', 'post'));
         }
     }
     return $controller;
 }
 /**
  * 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'));
     }
 }
Esempio n. 10
0
 /**
  * put your comment there...
  * 
  * @param mixed $tpl
  */
 public function display($tpl = null)
 {
     // Get model object!
     $model = $this->getModel('extensions');
     // Some time we work as aspecific extensions page or geneal Wordpress plugins page!
     $this->securityToken = cssJSToolbox::getSecurityToken();
     $this->listTypeName = $model->getListTypeName();
     $this->extensions = CJTPlugin::getInstance()->extensions();
     if ($this->listTypeName == 'extensions') {
         // Select Extensions menu item instead of Wordpress Plugins item!
         add_filter('parent_file', array(&$this, 'activateExtensionsMenuItem'));
     }
     // Output internal HTML used by JS!
     add_action('admin_footer', array(&$this, 'outputCommonMarkups'));
     // Add SETUP Link inside the Plugins (only CJT extensions) row!
     add_filter('plugin_action_links', array(&$this, 'addExtensionActions'), 10, 2);
 }
Esempio n. 11
0
 /**
  * put your comment there...
  * 
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new CJTPlugin();
     }
     return self::$instance;
 }
 /**
  * put your comment there...
  * 
  */
 public function createMetabox()
 {
     if (CJTPlugin::getInstance()->isInstalled()) {
         wp_add_dashboard_widget('cjt-statistics', cssJSToolbox::getText('CSS & Javascript Toolbox'), array($this, 'route'));
     }
 }
Esempio n. 13
0
 /**
  * put your comment there...
  * 
  */
 public function getInvolved()
 {
     # Check installation state
     if (CJTPlugin::getInstance()->isInstalled()) {
         # INitialize
         $extensionClass = $this->extensionClass;
         $extension =& $this->extension;
         $extensionFile = ABSPATH . PLUGINDIR . DIRECTORY_SEPARATOR . $extension['dir'] . DIRECTORY_SEPARATOR . $extension['file'];
         # Load/install extensions packages hook
         add_action('init', array($this, '_checkInstallationState'));
         # Deactivation hooks
         register_deactivation_hook($extensionFile, array($this, '_extensionDeactivated'));
     }
 }