示例#1
0
 /**
  * Dispatch a module view request.
  *
  * @return mixed
  */
 public function dispatch()
 {
     if (!SecurityUtil::checkPermission('Extensions::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     // Get input.
     $moduleName = $this->request->getGet()->filter('_module', null, FILTER_SANITIZE_STRING);
     $pluginName = $this->request->getGet()->filter('_plugin', null, FILTER_SANITIZE_STRING);
     $action = $this->request->getGet()->filter('_action', null, FILTER_SANITIZE_STRING);
     // Load plugins.
     if (!$moduleName) {
         $type = 'SystemPlugin';
         PluginUtil::loadAllSystemPlugins();
     } else {
         $type = 'ModulePlugin';
         PluginUtil::loadAllModulePlugins();
     }
     if ($moduleName) {
         $serviceId = PluginUtil::getServiceId("{$type}_{$moduleName}_{$pluginName}_Plugin");
     } else {
         $serviceId = PluginUtil::getServiceId("{$type}_{$pluginName}_Plugin");
     }
     $this->throwNotFoundUnless($this->serviceManager->hasService($serviceId));
     $this->plugin = $this->serviceManager->getService($serviceId);
     // Sanity checks.
     $this->throwNotFoundUnless($this->plugin->isInstalled(), __f('Plugin "%s" is not installed', $this->plugin->getMetaDisplayName()));
     $this->throwForbiddenUnless($this->plugin instanceof Zikula_Plugin_ConfigurableInterface, __f('Plugin "%s" is not configurable', $this->plugin->getMetaDisplayName()));
     $this->pluginController = $this->plugin->getConfigurationController();
     $this->throwNotFoundUnless($this->pluginController->getReflection()->hasMethod($action));
     return $this->pluginController->{$action}();
 }
示例#2
0
 function isActive()
 {
     // check for the availability of the ZFeed systemplugin that provides SimplePie
     if (PluginUtil::isAvailable(PluginUtil::getServiceId('SystemPlugin_ZFeed_Plugin'))) {
         return true;
     }
     return false;
 }
示例#3
0
    private function _setup()
    {
        $this->className = get_class($this);
        $this->serviceId = PluginUtil::getServiceId($this->className);
        $this->baseDir = dirname($this->getReflection()->getFileName());

        $this->moduleName = 'zikula';
        $this->pluginName = 'Doctrine';
        $this->pluginType = self::TYPE_SYSTEM;
        $this->domain = 'systemplugin_doctrine';

        $this->meta = $this->getMeta();
    }
示例#4
0
 /**
  * Internal setup.
  *
  * @throws \LogicException If plugin is not named correctly.
  *
  * @return void
  */
 private function _setup()
 {
     $this->className = get_class($this);
     $this->serviceId = \PluginUtil::getServiceId($this->className);
     $this->baseDir = dirname($this->getReflection()->getFileName());
     // Split class name into parts - commented in if statement below.
     $class = $this->className;
     $p = strpos($class, '_') ? explode('_', $class) : explode('\\', $class);
     if (strpos($this->serviceId, 'moduleplugin') === 0) {
         // ModulePlugin_{ModuleName}_{PluginName}_Plugin
         // $p[1] = ModuleName, $p[2] = PluginName
         $this->moduleName = $p[1];
         $this->pluginName = $p[2];
         $this->pluginType = self::TYPE_MODULE;
         $this->domain = ZLanguage::getModulePluginDomain($this->moduleName, $this->pluginName);
         ZLanguage::bindModulePluginDomain($this->moduleName, $this->pluginName);
     } elseif (strpos($this->serviceId, 'systemplugin') === 0) {
         // SystemPlugin_{PluginName}_Plugin
         // $p[1] = ModuleName
         $this->moduleName = 'zikula';
         $this->pluginName = $p[1];
         $this->pluginType = self::TYPE_SYSTEM;
         $this->domain = ZLanguage::getSystemPluginDomain($this->pluginName);
         ZLanguage::bindSystemPluginDomain($this->pluginName);
     } else {
         throw new \LogicException(sprintf('This class %s does not appear to be named correctly.  System plugins should be named {SystemPlugin}_{Name}_Plugin, module plugins should be named {ModulePlugin}_{ModuleName}_{PluginName}_Plugin.', $this->className));
     }
     $this->meta = $this->getMeta();
 }