/** * 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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); } } } } }
/** * 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')); } }
/** * 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(); }
/** * 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... * * @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); }
protected function main() { // Fire laod event $this->onload($this); // Access point base class is a dependency! require_once 'framework/access-points/access-point.class.php'; // Run Main Acces Point! include_once 'access.points/main.accesspoint.php'; $this->mainAC = new CJTMainAccessPoint(); $this->mainAC->listen(); } /** * Called When any In-Listen-State (ILS) Access point is * connected (called by Wordpress hooking system). * * @return boolean TRUE. */ public function onconnected($observer, $state) { // In all cases that we'll process the request load the localization file. load_plugin_textdomain(CJTOOLBOX_TEXT_DOMAIN, false, CJTOOLBOX_LANGUAGES); // Always connet the access point! return $state; } } // End Class // Initialize events! CJTPlugin::define('CJTPlugin', array('hookType' => CJTWordpressEvents::HOOK_FILTER)); // Let's Go! CJTPlugin::getInstance();
/** * 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')); } }
/** * 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')); } }