public function __bootstrap() { Dispatcher::register('Ajde_Core_Route', 'onAfterLangSet', array($this, 'setHomepage')); Dispatcher::register('Ajde_Core_Route', 'onAfterRouteSet', array($this, 'detectNodeSlug')); Dispatcher::register('Ajde_Core_Route', 'onAfterRouteSet', array($this, 'detectShopSlug')); return true; }
protected function addTimeoutWarning() { // Add timeout warning to layout if ($this->getLoggedInUser() !== false) { Dispatcher::register('Ajde_Layout', 'beforeGetContents', 'requireTimeoutWarning'); } }
public function __construct() { /* * We add the resources before the template is included, otherwise the * layout resources never make it into the <head> section. */ Dispatcher::register('Ajde_Template', 'beforeGetContents', array($this, 'autoAddResources')); parent::__construct(); }
public static function register($controller) { // Extend Ajde_Controller if (!Dispatcher::has('Ajde_Controller', 'call', 'Ajde_Collection::extendController')) { Dispatcher::register('Ajde_Controller', 'call', 'Ajde_Collection::extendController'); } // Extend autoloader if ($controller instanceof Controller) { Autoloader::addDir(MODULE_DIR . $controller->getModule() . '/model/'); } elseif ($controller === '*') { self::registerAll(); } else { Autoloader::addDir(MODULE_DIR . $controller . '/model/'); } }
public static function registerDocumentProcessor($format, $registerOn = 'layout') { $documentProcessors = Config::get('documentProcessors'); if (is_array($documentProcessors) && isset($documentProcessors[$format])) { foreach ($documentProcessors[$format] as $processor) { $processorClass = 'Ajde_Document_Processor_' . ucfirst($format) . '_' . $processor; if (!Autoloader::exists($processorClass)) { // TODO: throw new Exception('Processor ' . $processorClass . ' not found', 90022); } if ($registerOn == 'layout') { Dispatcher::register('Ajde_Layout', 'beforeGetContents', $processorClass . '::preProcess'); Dispatcher::register('Ajde_Layout', 'afterGetContents', $processorClass . '::postProcess'); } elseif ($registerOn == 'compressor') { Dispatcher::register('Ajde_Resource_Local_Compressor', 'beforeCompress', $processorClass . '::preCompress'); Dispatcher::register('Ajde_Resource_Local_Compressor', 'afterCompress', $processorClass . '::postCompress'); } else { // TODO: throw new Exception('Document processor must be registered on either \'layout\' or \'compressor\''); } } } }