/** * Checking the existence of a plugin and its connection. * * @param array $plugins */ public static function load(array $plugins) { $paths = App::path('Plugin'); foreach ($plugins as $plugin) { $isPlugin = false; if (CakePlugin::loaded($plugin)) { break; } foreach ($paths as $path) { $pluginPath = $path . $plugin . DS; if (is_dir($pluginPath)) { $isPlugin = $pluginPath; break; } } if ($pluginPath = $isPlugin) { $plgConfig = ['autoload' => true]; // Plugin config files. $plgBootstrap = $pluginPath . 'config' . DS . self::$_pluginsSrc['bootstrap']; $plgRoutes = $pluginPath . 'config' . DS . self::$_pluginsSrc['routes']; $plgEvents = $pluginPath . 'config' . DS . self::$_pluginsSrc['events']; if (file_exists($plgBootstrap)) { $plgConfig['bootstrap'] = true; } if (file_exists($plgRoutes)) { $plgConfig['routes'] = true; } CakePlugin::load($plugin, $plgConfig); if (CakePlugin::loaded($plugin)) { Union::mergeConfig('App.paths.locales', [$pluginPath . 'src' . DS . 'Locale' . DS]); if (file_exists($plgEvents)) { Configure::load($plugin . '.events'); } } } else { throw new MissingPluginException(['plugin' => $plugin]); } } }
/** * Email constructor. * * @param Entity $entity */ public function __construct(Entity $entity) { $config = PluginConfig::getInstance()->getGroup('union_core'); $this->_entity = $entity; $this->config = $config->params(); $this->_entityId = $entity->get('id'); $this->_arrayData = $entity->toArray(); $this->_serverName = Union::serverName(); $this->mailer = $this->config->get('mailer', 'mail'); $this->fromName = $this->config->get('mailfrom', 'Union CMS'); $this->fromEmail = $this->config->get('mailname', '*****@*****.**'); }
/** * On admin link chooser. * * @param Event $event */ public function onAdminLinkChooser(Event $event) { Union::mergeConfig('Link.choosers', [__d('menus', 'Links') => ['type' => 'url', 'order' => 100, 'links' => [__d('menus', 'Outer link') => ['url' => 'http://']]]]); }
/** * On admin link chooser. * * @param Event $event */ public function onAdminLinkChooser(Event $event) { Union::mergeConfig('Link.choosers', $this->_chooserLinks()); }
/** * Setup module locale. * * @return void */ protected function _setLocale() { $localePath = $this->getPath() . DS . 'locale' . DS; Union::mergeConfig('App.paths.locales', [$localePath]); }