public function execute() { require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Translate/Adapter/Array.php'; require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Locale.php'; try { // check if the WP locale is valid otherwise set it to default $locale = IfwPsn_Wp_Proxy_Blog::getLanguage(); if (!in_array($locale, $this->_supportedLanguages)) { $locale = 'en_US'; } $translator = new IfwPsn_Vendor_Zend_Translate('IfwPsn_Vendor_Zend_Translate_Adapter_Array', $this->_adapter->getPluginManager()->getPathinfo()->getRootLib() . 'IfwPsn/Zend/Form/resources/languages', $locale, array('scan' => IfwPsn_Vendor_Zend_Translate::LOCALE_DIRECTORY)); // set the validation translator IfwPsn_Vendor_Zend_Validate_Abstract::setDefaultTranslator($translator); } catch (Exception $e) { // do nothing. if something failed, we just have no translation for Zend_Validate } }
/** * Fires at the end of the update message container in each row of the plugins list table. * * @param array $plugin_data An array of plugin data. * @param $meta_data */ public function onPluginUpdateMessage($plugin_data, $meta_data) { $plugin_slug = $this->_pm->getPathinfo()->getDirname(); $request = new IfwPsn_Wp_Plugin_Update_Request($this->_pm); $request->setAction('plugin_update_message')->addData('slug', $plugin_slug)->addData('version', $plugin_data['Version'])->addData('lang', IfwPsn_Wp_Proxy_Blog::getLanguage()); if ($this->_pm->isPremium()) { $license = $this->_pm->getOptionsManager()->getOption('license_code'); $request->addData('license', $license); } $response = $request->send(); if ($response->isSuccess()) { if ($this->_pm->isPremium() && empty($license)) { printf('<div style="padding: 5px 10px; border: 1px dashed red; margin-top: 10px;">%s</div>', sprintf(__('You have to enter your plugin <b>license code</b> in the <a href="%s">plugin options</a> to be able to download this update!', 'ifw'), $this->_pm->getConfig()->plugin->optionsPage)); } echo $response->getBody(); } }