public function testGetPlugins() { $_allPlugins = InfinitasPlugin::listPlugins('all'); $allPlugins = array() + array('' => 'None'); foreach ($_allPlugins as $k => $v) { $allPlugins[Inflector::underscore($v)] = $v; } // need to see how to do this //$this->assertEqual(count($this->Infinitas->getPlugins($this->AppModel, true)), count($allPlugins)); }
public static function themes($type = 'installed') { switch ($type) { case 'installed': return ClassRegistry::init('Themes.Theme')->installed(); break; case 'notInstalled': return array_intersect(self::themes('all'), self::themes('installed')); break; default: case 'all': $return = array(); foreach (InfinitasPlugin::listPlugins('loaded') as $plugin) { foreach (InstallerLib::findThemes($plugin) as $theme) { $return[$plugin . '.' . $theme] = Inflector::humanize(Inflector::underscore($plugin . Inflector::camelize($theme))); } } foreach (InstallerLib::findThemes() as $theme) { $return[$theme] = Inflector::humanize(Inflector::underscore($theme)); } return $return; break; } }
/** * @brief get a list of themes that are not yet installed * * @access public * * @return array list of themes that are not installed */ public function notInstalled() { App::uses('InstallerLib', 'Installer.Lib'); $installed = $this->installed(); $notInstalled = array(); foreach (InfinitasPlugin::listPlugins('loaded') as $plugin) { foreach (InstallerLib::findThemes($plugin) as $theme) { if (!array_key_exists($theme, $installed)) { $notInstalled[$plugin . '.' . $theme] = Inflector::humanize(Inflector::underscore($plugin . Inflector::camelize($theme))); } } } foreach (InstallerLib::findThemes() as $theme) { if (!linkinfo(InstallerLib::themePath(null, $theme)) && !array_key_exists($theme, $installed)) { $notInstalled[$theme] = Inflector::humanize(Inflector::underscore($theme)); } } return $notInstalled; }
private function __getPlugins() { $plugins = InfinitasPlugin::listPlugins('loaded'); natcasesort($plugins); foreach ($plugins as &$plugin) { $plugin = InfinitasPlugin::path($plugin) . 'webroot' . DS . 'img' . DS; } $plugins[] = APP . DS . 'webroot' . DS . 'img' . DS; return $plugins; }
/** * Dispatch Event * * @param string $eventName * @param array $data (optional) * @return array * */ protected static function _dispatchEvent(&$HandlerObject, $scope, $eventName, $data = array()) { $_this = EventCore::getInstance(); $eventHandlerMethod = $_this->_handlerMethodName($eventName); $return = array(); if (isset($_this->_eventHandlerCache[$eventName])) { foreach ($_this->_eventHandlerCache[$eventName] as $eventClass) { $pluginName = EventCore::_extractPluginName($eventClass); $pluginType = 'loaded'; if (isset($_this->__pluginsMap[$eventName])) { $pluginType = $_this->__pluginsMap[$eventName]; } if (!in_array(Inflector::camelize($pluginName), (array) InfinitasPlugin::listPlugins($pluginType))) { continue; } if ($scope == 'Global' || $scope == $pluginName) { EventCore::_loadEventClass($eventClass); $Event = new Event($eventName, $HandlerObject, $pluginName); $return[$pluginName] = call_user_func_array(array($_this->_eventClasses[$eventClass], $eventHandlerMethod), array($Event, $data)); } } } return $return; }