/** * Try to disable plugin. This method should be only invoked by any other core * * @throws RM_Exception * @param RM_Plugin_Row $plugin * @return bool */ public function disable(RM_Plugin_Row $plugin) { $model = new RM_Plugins(); $moduleObject = $model->get($plugin->name); //Try/catch just for visualisation and better code understanding, //we don't want to handle this exception here and just throw it to higher level try { $moduleObject->disable(); } catch (RM_Exception $e) { throw $e; } $paymentSystem = RM_Environment::getInstance()->getPaymentSystem(); //isRestricted throw RM_Exception instead of returning 'false', cause we need an error text message to understand //what is going wrong on the higher level if ($paymentSystem->isRestricted($plugin)) { return false; } $model->disable($plugin); return true; }
/** * Returns data for the info grid (grid with language files) on the language page. * * This method returns the list data in JSON format. This is implicated in * lists.js * * @param request iso * @return json the json data for the list. */ public function infogridJsonAction() { $iso = $this->_getParam('iso'); $files = RM_Language_Manager::$files; $jsonFiles = array(); foreach ($files as $file) { $jsonFiles[] = array($file, RM_Language_Manager::TYPE_MAIN . ',' . RM_Language_Manager::TYPE_MAIN, $iso . ',' . $file . ',' . RM_Language_Manager::TYPE_MAIN . ',' . RM_Language_Manager::TYPE_MAIN); } $extensionFiles = RM_Language_Manager::$extensionFiles; $moduleModel = new RM_Modules(); $modules = $moduleModel->fetchAll(); foreach ($modules as $module) { foreach ($extensionFiles as $file) { $jsonFiles[] = array($file, RM_Language_Manager::TYPE_MODULE . ',' . $moduleModel->get($module->name)->getName(), $iso . ',' . $file . ',' . RM_Language_Manager::TYPE_MODULE . ',' . $module->name); } } $pluginModel = new RM_Plugins(); $plugins = $pluginModel->fetchAll(); foreach ($plugins as $plugin) { foreach ($extensionFiles as $file) { $jsonFiles[] = array($file, RM_Language_Manager::TYPE_PLUGIN . ',' . $pluginModel->get($plugin->name)->getName(), $iso . ',' . $file . ',' . RM_Language_Manager::TYPE_PLUGIN . ',' . $plugin->name); } } $json = new stdClass(); $json->total = count($jsonFiles); $json->data = $jsonFiles; return array('data' => $jsonFiles); }