示例#1
0
文件: NodeModel.php 项目: nabble/ajde
 public function registerEvents()
 {
     if (!Ajde_Event::has($this, 'afterCrudSave', 'postCrudSave')) {
         Ajde_Event::register($this, 'beforeCrudSave', 'preCrudSave');
         Ajde_Event::register($this, 'afterCrudSave', 'postCrudSave');
     }
 }
示例#2
0
 protected function addTimeoutWarning()
 {
     // Add timeout warning to layout
     if ($this->getLoggedInUser() !== false) {
         Ajde_Event::register('Ajde_Layout', 'beforeGetContents', 'requireTimeoutWarning');
     }
 }
示例#3
0
文件: MetaModel.php 项目: nabble/ajde
 public function registerEvents()
 {
     if (!Ajde_Event::has($this, 'afterCrudLoaded', 'parseForCrud')) {
         Ajde_Event::register($this, 'afterCrudLoaded', 'parseForCrud');
         Ajde_Event::register($this, 'beforeCrudSave', 'prepareCrudSave');
     }
 }
示例#4
0
文件: Cms.php 项目: nabble/ajde
 public function __bootstrap()
 {
     Ajde_Event::register('Ajde_Core_Route', 'onAfterLangSet', [$this, 'setHomepage']);
     Ajde_Event::register('Ajde_Core_Route', 'onAfterRouteSet', [$this, 'detectNodeSlug']);
     Ajde_Event::register('Ajde_Core_Route', 'onAfterRouteSet', [$this, 'detectShopSlug']);
     return true;
 }
示例#5
0
 public function __construct()
 {
     /*
      * We add the resources before the template is included, otherwise the
      * layout resources never make it into the <head> section.
      */
     Ajde_Event::register('Ajde_Template', 'beforeGetContents', array($this, 'autoAddResources'));
     parent::__construct();
 }
示例#6
0
文件: Html.php 项目: nabble/ajde
 public function __construct()
 {
     /*
      * We add the resources before the template is included, otherwise the
      * layout resources never make it into the <head> section.
      */
     Ajde_Event::register('Ajde_Template', 'beforeGetContents', [$this, 'autoAddResources']);
     Ajde_Event::register('Ajde_Application', 'onAfterDocumentRendered', [$this, 'setupExternalPageCache']);
     parent::__construct();
 }
示例#7
0
文件: App.php 项目: nabble/ajde
 public function __bootstrap()
 {
     \Nabble\SemaltBlocker\Blocker::protect();
     Ajde_Event::register('TransactionModel', 'onPaid', [$this, 'onTransactionPaid']);
     Ajde_Event::register('TransactionModel', 'onCreate', [$this, 'onTransactionCreated']);
     if (UserModel::isTester() || UserModel::isAdmin()) {
         $providers = config('shop.transaction.providers');
         $providers[] = 'test';
         Config::set('shop.transaction.providers', $providers);
     }
     return true;
 }
示例#8
0
 public static function register($controller)
 {
     // Extend Ajde_Controller
     if (!Ajde_Event::has('Ajde_Controller', 'call', 'Ajde_Collection::extendController')) {
         Ajde_Event::register('Ajde_Controller', 'call', 'Ajde_Collection::extendController');
     }
     // Extend autoloader
     if ($controller instanceof Ajde_Controller) {
         Ajde_Core_Autoloader::addDir(MODULE_DIR . $controller->getModule() . '/model/');
     } elseif ($controller === '*') {
         self::registerAll();
     } else {
         Ajde_Core_Autoloader::addDir(MODULE_DIR . $controller . '/model/');
     }
 }
示例#9
0
 public function __construct()
 {
     Ajde_Event::register($this, 'afterCrudLoaded', [$this, 'parseForCrud']);
     parent::__construct();
 }
示例#10
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 (!Ajde_Core_Autoloader::exists($processorClass)) {
                 // TODO:
                 throw new Ajde_Exception('Processor ' . $processorClass . ' not found', 90022);
             }
             if ($registerOn == 'layout') {
                 Ajde_Event::register('Ajde_Layout', 'beforeGetContents', $processorClass . '::preProcess');
                 Ajde_Event::register('Ajde_Layout', 'afterGetContents', $processorClass . '::postProcess');
             } elseif ($registerOn == 'compressor') {
                 Ajde_Event::register('Ajde_Resource_Local_Compressor', 'beforeCompress', $processorClass . '::preCompress');
                 Ajde_Event::register('Ajde_Resource_Local_Compressor', 'afterCompress', $processorClass . '::postCompress');
             } else {
                 // TODO:
                 throw new Ajde_Exception('Document processor must be registered on either \'layout\' or \'compressor\'');
             }
         }
     }
 }