示例#1
0
文件: Event.php 项目: rodacom/jelix
 /**
  * return the list of all listener corresponding to an event
  * @param string $eventName the event name we wants the listeners for.
  * @return array of objects
  */
 protected static function loadListenersFor($eventName)
 {
     if (!self::$listenersConfig) {
         self::$compilerData[3] = App::config()->urlengine['urlScriptId'] . '.' . self::$compilerData[3];
         self::$listenersConfig = Includer::incAll(self::$compilerData);
     }
     $inf =& self::$listenersConfig;
     self::$hashListened[$eventName] = array();
     if (isset($inf[$eventName])) {
         $modules =& App::config()->_modulesPathList;
         foreach ($inf[$eventName] as $listener) {
             list($module, $listenerName) = $listener;
             if (!isset($modules[$module])) {
                 // some modules could be unused
                 continue;
             }
             if (!isset(self::$listenersSingleton[$module][$listenerName])) {
                 require_once $modules[$module] . 'classes/' . $listenerName . '.listener.php';
                 $className = $listenerName . 'Listener';
                 self::$listenersSingleton[$module][$listenerName] = new $className();
             }
             self::$hashListened[$eventName][] = self::$listenersSingleton[$module][$listenerName];
         }
     }
 }
示例#2
0
 public static function incAll($aType)
 {
     return \Jelix\Core\Includer::incAll($aType);
 }