/** * Trigger Seotoaster plugins hooks * * @param $method string Method to trigger */ private function _callPlugins($method) { $enabledPlugins = Tools_Plugins_Tools::getEnabledPlugins(); if (is_array($enabledPlugins) && !empty($enabledPlugins)) { array_walk($enabledPlugins, function ($plugin, $key, $data) { try { $name = ucfirst($plugin->getName()); Tools_Factory_PluginFactory::validate($name); $reflection = new Zend_Reflection_Class($name); if ($reflection->hasMethod($data['method'])) { $pluginInstance = Tools_Factory_PluginFactory::createPlugin($plugin->getName(), array(), array('websiteUrl' => $data['websiteUrl'])); $pluginInstance->{$data}['method'](); } } catch (Exceptions_SeotoasterException $se) { error_log($se->getMessage()); error_log($se->getTraceAsString()); } }, array('method' => $method, 'websiteUrl' => Zend_Controller_Action_HelperBroker::getStaticHelper('Website')->getUrl())); } }
protected function _load() { $pluginName = strtolower(array_shift($this->_options)); if (!$pluginName) { return $this->_translator->translate('Plugin name not specified.'); } $plugin = Application_Model_Mappers_PluginMapper::getInstance()->findByName($pluginName); if ($plugin !== null) { if ($plugin->getStatus() != Application_Model_Models_Plugin::ENABLED) { return $this->_translator->translate('You need install the ') . $plugin->getName() . $this->_translator->translate(' plug-in to view and use this great feature.') . ' <a href="http://www.seotoaster.com/website-plugins-marketplace.html" target="_blank">' . $this->_translator->translate('Download plug-ins here') . ' ' . '</a>' . $this->_translator->translate('and watch a short video to learn how to install plug-ins on your website') . ' <a href="http://www.seotoaster.com/how-to-add-a-plugin.html" target="_blank">' . $this->_translator->translate('here') . '</a>.'; } try { $toasterPlugin = Tools_Factory_PluginFactory::createPlugin($plugin->getName(), $this->_options, $this->_toasterOptions); return $toasterPlugin->run(); } catch (Exceptions_SeotoasterPluginException $spe) { if (Tools_System_Tools::debugMode()) { error_log($spe->getMessage() . "\n" . $spe->getTraceAsString()); } if (Tools_Security_Acl::isAllowed(Tools_Security_Acl::RESOURCE_ADMINPANEL)) { return $spe->getMessage(); } } catch (Exceptions_SeotoasterException $se) { if (Tools_System_Tools::debugMode()) { error_log($se->getMessage() . "\n" . $se->getTraceAsString()); } if (Tools_Security_Acl::isAllowed(Tools_Security_Acl::RESOURCE_ADMINPANEL)) { return $se->getMessage(); } } catch (Exception $e) { if (Tools_System_Tools::debugMode()) { error_log($e->getMessage() . "\n" . $e->getTraceAsString()); } //return $e->getMessage(); } } if (Tools_Security_Acl::isAllowed(Tools_Security_Acl::RESOURCE_ADMINPANEL)) { return $this->_translator->translate('You need the') . ' ' . $pluginName . ' ' . $this->_translator->translate('plug-in to view and use this great feature.') . ' <a href="http://www.seotoaster.com/website-plugins-marketplace.html" target="_blank">' . $this->_translator->translate('Download plug-ins here') . ' ' . '</a>' . $this->_translator->translate('and watch a short video to learn how to install plug-ins on your website') . ' <a href="http://www.seotoaster.com/how-to-add-a-plugin.html" target="_blank">' . $this->_translator->translate('here') . '</a>.'; } return ''; }
public function fireactionAction() { $this->_helper->viewRenderer->setNoRender(true); $pluginName = $this->getRequest()->getParam('name'); //we will fire the action in the case when plugin is enabled $toasterPlugin = Application_Model_Mappers_PluginMapper::getInstance()->findByName($pluginName); if ($toasterPlugin instanceof Application_Model_Models_Plugin && $toasterPlugin->getStatus() == Application_Model_Models_Plugin::ENABLED) { $pageData = array('websiteUrl' => $this->_helper->website->getUrl()); try { $plugin = Tools_Factory_PluginFactory::createPlugin($pluginName, array(), $pageData); $plugin->run($this->getRequest()->getParams()); } catch (Exception $e) { die($e->getMessage()); } } }
/** * Fetch list of plugin email observers * @param $pluginName * @return mixed|null */ private function _getPluginObserversList($pluginName) { try { $pluginReflection = new Zend_Reflection_Class(Tools_Factory_PluginFactory::createPlugin($pluginName)); } catch (Exceptions_SeotoasterPluginException $spe) { return null; } if ($pluginReflection->hasProperty(Tools_Mail_Watchdog::OBSERVER_LIST_PROP)) { return $pluginReflection->getStaticPropertyValue(Tools_Mail_Watchdog::OBSERVER_LIST_PROP); } return null; }