observe() статический публичный Метод

Register $callable for receiving $event s
static public observe ( $event, $callable )
Пример #1
0
 static function init($context)
 {
     self::$data = gb::data('plugins/' . gb_filenoext(basename(__FILE__)), array('notify_new_comment' => true, 'notify_pending_comment' => true, 'notify_spam_comment' => false, 'recipient' => 'author'));
     gb::observe('did-add-comment', array(__CLASS__, 'did_add_comment'));
     gb::observe('did-spam-comment', array(__CLASS__, 'did_spam_comment'));
     return true;
 }
Пример #2
0
 static function init($context)
 {
     self::$conf = gb::data('plugins/' . gb_filenoext(basename(__FILE__)), array('url' => ''));
     if (!self::$conf['url']) {
         gb::log(LOG_WARNING, 'missing "url" in configuration');
         return false;
     }
     gb::observe('will-handle-request', array(__CLASS__, 'will_handle_req'));
     return true;
 }
Пример #3
0
 static function init($context)
 {
     self::$conf = gb::data('plugins/google-analytics', array('property_id' => ''));
     if (!self::$conf['property_id']) {
         gb::log(LOG_WARNING, 'missing property_id in google-analytics configuration');
     } else {
         gb::observe('on-html-footer', array(__CLASS__, 'echo_tracking_code'));
         return true;
     }
     return false;
 }
Пример #4
0
 static function init($context)
 {
     if ($context === 'rebuild') {
         gb::observe('did-parse-object-meta', array(__CLASS__, 'check_content'));
         gb_cfilter::add('body.html', array(__CLASS__, 'escape_php'), 0);
         gb_cfilter::add('body.html', array(__CLASS__, 'unescape_php'), 9000);
         return true;
     } elseif ($context === 'request') {
         gb::add_filter('post-body', array(__CLASS__, 'eval_body'));
         return true;
     }
 }