/** * Don't bother loading if the gd library isn't active */ public function action_plugin_activation($file) { if (!function_exists('imagecreatefromjpeg')) { Session::error(_t("Habari Silo activation failed. PHP has not loaded the gd imaging library.")); Plugins::deactivate_plugin(__FILE__); } }
/** * function action_init * A function which makes sure we are good to go for plugin activation. */ public function action_init() { if (!class_exists('RenderCache')) { Session::error(_t("LaTeX activation failed. This plugin requires the RenderCache class which was not found.")); Plugins::deactivate_plugin(__FILE__); //Deactivate plugin Utils::redirect(); //Refresh page. Unfortunately, if not done so then results don't appear } }
/** * Don't bother loading if the gd library isn't active */ public function action_plugin_activation($file) { if (!function_exists('imagecreatefromjpeg')) { Session::error(_t("Habari Silo activation failed. PHP has not loaded the gd imaging library.")); Plugins::deactivate_plugin(__FILE__); } // Create required tokens ACL::create_token('create_directories', _t('Create media silo directories'), 'Administration'); ACL::create_token('delete_directories', _t('Delete media silo directories'), 'Administration'); ACL::create_token('upload_media', _t('Upload files to media silos'), 'Administration'); ACL::create_token('delete_media', _t('Delete files from media silos'), 'Administration'); }
/** * Initialize by added directory variables */ public function action_init() { $this->logs = dirname(__FILE__) . '/logs'; $this->cache = dirname(__FILE__) . '/cache'; if (!$this->confirm_dirs($error)) { Session::error("Clickheat error: {$error}"); Plugins::deactivate_plugin(__FILE__); // Deactivate plugin Utils::redirect(); //Refresh page exit; } }
/** * Do some checking and setting up. */ public function action_plugin_activation($file) { // Don't bother loading if the gd library isn't active if (!function_exists('imagecreatefromjpeg')) { Session::error(_t("Simple Gallery activation failed. PHP has not loaded the gd imaging library.")); Plugins::deactivate_plugin(__FILE__); } else { /* $this->silo = new HabariSilo(); $this->silo->action_init(); $this->silo->mkdir('simplegallery'); */ } }
/** * Handles plugin activation or deactivation. */ public function get_plugin_toggle() { $extract = $this->handler_vars->filter_keys('plugin_id', 'action'); foreach ($extract as $key => $value) { ${$key} = $value; } $plugins = Plugins::list_all(); foreach ($plugins as $file) { if (Plugins::id_from_file($file) == $plugin_id) { switch (strtolower($action)) { case 'activate': if (Plugins::activate_plugin($file)) { $plugins = Plugins::get_active(); Session::notice(_t("Activated plugin '%s'", array($plugins[Plugins::id_from_file($file)]->info->name)), $plugins[Plugins::id_from_file($file)]->plugin_id); } break; case 'deactivate': if (Plugins::deactivate_plugin($file)) { $plugins = Plugins::get_active(); Session::notice(_t("Deactivated plugin '%s'", array($plugins[Plugins::id_from_file($file)]->info->name)), $plugins[Plugins::id_from_file($file)]->plugin_id); } break; default: Plugins::act('adminhandler_get_plugin_toggle_action', $action, $file, $plugin_id, $plugins); break; } } } Utils::redirect(URL::get('admin', 'page=plugins')); }
/** * Respond to uninstalling this plugin in the plugin UI */ public function action_plugin_ui_uninstall() { // get all the posts of the types we're deleting $addons = Posts::get(array('content_type' => array('addon'), 'nolimit' => true)); foreach ($addons as $addon) { $addon->delete(); } // now that the posts are gone, delete the type - this would fail if we hadn't deleted the content first Post::delete_post_type('addon'); // remove vocabulary and terms $vocabulary = $this->vocabulary; if ($vocabulary) { $vocabulary->delete(); } // now deactivate the plugin Plugins::deactivate_plugin(__FILE__); Session::notice(_t("Uninstalled plugin '%s'", array($this->info->name), 'addon_catalog')); // redirect to the plugins page again so the page updates properly - this is what AdminHandler does after plugin deactivation Utils::redirect(URL::get('admin', 'page=plugins')); }