예제 #1
0
파일: Cms.php 프로젝트: nabble/ajde-core
 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;
 }
예제 #2
0
 protected function addTimeoutWarning()
 {
     // Add timeout warning to layout
     if ($this->getLoggedInUser() !== false) {
         Dispatcher::register('Ajde_Layout', 'beforeGetContents', 'requireTimeoutWarning');
     }
 }
예제 #3
0
파일: Html.php 프로젝트: nabble/ajde-core
 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();
 }
예제 #4
0
 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/');
     }
 }
예제 #5
0
 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\'');
             }
         }
     }
 }