当前位置: 首页>>代码示例>>PHP>>正文


PHP Event::add方法代码示例

本文整理汇总了PHP中Event::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::add方法的具体用法?PHP Event::add怎么用?PHP Event::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Event的用法示例。


在下文中一共展示了Event::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 public static function register($driver, $hook)
 {
     $driverName = Telephony::getDriverName();
     if (!$driverName or $driverName == 'none') {
         return true;
     } elseif (!class_exists($driverName)) {
         Kohana::log('error', 'Telephony -> Unable to register the dialplan driver \'' . $driverName . '\'');
         return false;
     }
     $hookClass = $driverName . '_' . $driver . '_Driver';
     if (!class_exists($hookClass)) {
         Kohana::log('error', 'Telephony -> Unable to register the dialplan hook \'' . $driver . '\'(' . $hookClass . ')');
         return false;
     }
     if (empty(self::$dialplanSections)) {
         kohana::log('debug', 'Telephony -> EVAL ' . $driverName . '::getDialplanSections();');
         $sections = eval('return ' . $driverName . '::getDialplanSections();');
         if (is_array($sections)) {
             self::$dialplanSections = $sections;
         }
     }
     if (!in_array($hook, self::$dialplanSections)) {
         //Logger::ExceptionByCaller();
         throw new Exception('The hook ' . $hook . ' is not a recognized telephony global hook. (While trying to register callback ' . $driver . ')');
     }
     // Register event as _telephony.action with the callback array as the callback
     Event::add('_telephony.' . $hook, array($hookClass, $hook));
     Kohana::log('debug', 'Telephony -> Added hook for _telephony.' . $hook . ' to call ' . $hookClass . '::' . $hook);
     return TRUE;
 }
开发者ID:swk,项目名称:bluebox,代码行数:30,代码来源:dialplan.php

示例2: __construct

 /**
  * Adds the register method to load after system.ready
  */
 public function __construct()
 {
     // Hook into routing
     if (file_exists(DOCROOT . "application/config/database.php")) {
         Event::add('system.ready', array($this, 'register'));
     }
 }
开发者ID:redspider,项目名称:Ushahidi_Web,代码行数:10,代码来源:register_themes.php

示例3: add

 /**
  * Adds all the events to the main Ushahidi application
  */
 public function add()
 {
     // Add a Sub-Nav Link
     Event::add('ushahidi_action.nav_admin_reports', array($this, '_report_link'));
     // Only add the events if we are on that controller
     if (Router::$current_uri == "admin/reports") {
         plugin::add_stylesheet('analysis/views/css/buttons');
         // Add Buttons to the report List
         Event::add('ushahidi_action.report_extra_admin', array($this, '_reports_list_buttons'));
     } elseif (Router::$controller == 'analysis') {
         plugin::add_javascript('analysis/views/js/ui.dialog');
         plugin::add_javascript('analysis/views/js/ui.draggable');
         plugin::add_javascript('analysis/views/js/ui.resizable');
         plugin::add_stylesheet('analysis/views/css/main');
     } elseif (strripos(Router::$current_uri, "admin/reports/edit") !== false) {
         plugin::add_stylesheet('analysis/views/css/report');
         plugin::add_javascript('analysis/views/js/jquery.copy.min');
         Event::add('ushahidi_action.report_pre_form_admin', array($this, '_reports_list_analysis'));
         Event::add('ushahidi_action.header_scripts_admin', array($this, '_save_analysis_js'));
         Event::add('ushahidi_action.report_edit', array($this, '_save_analysis'));
     } elseif (strripos(Router::$current_uri, "reports/submit") !== false) {
         //Add dropdown fields to the submit form
         Event::add('ushahidi_action.report_form', array($this, '_submit_form'));
         //Save the contents of the dropdown
         Event::add('ushahidi_action.report_submit', array($this, '_handle_post_data'));
         Event::add('ushahidi_action.report_add', array($this, '_save_submit_form'));
     }
 }
开发者ID:rjmackay,项目名称:ushahidi-analysis,代码行数:31,代码来源:analysis.php

示例4: __construct

 /**
  * On first session instance creation, sets up the driver and creates session.
  *
  * @param string Force a specific session_id
  */
 protected function __construct($session_id = NULL)
 {
     $this->input = Input::instance();
     // This part only needs to be run once
     if (Session::$instance === NULL) {
         // Load config
         Session::$config = Kohana::config('session');
         // Makes a mirrored array, eg: foo=foo
         Session::$protect = array_combine(Session::$protect, Session::$protect);
         // Configure garbage collection
         ini_set('session.gc_probability', (int) Session::$config['gc_probability']);
         ini_set('session.gc_divisor', 100);
         ini_set('session.gc_maxlifetime', Session::$config['expiration'] == 0 ? 86400 : Session::$config['expiration']);
         // Create a new session
         $this->create(NULL, $session_id);
         if (Session::$config['regenerate'] > 0 and $_SESSION['total_hits'] % Session::$config['regenerate'] === 0) {
             // Regenerate session id and update session cookie
             $this->regenerate();
         } else {
             // Always update session cookie to keep the session alive
             cookie::set(Session::$config['name'], $_SESSION['session_id'], Session::$config['expiration']);
         }
         // Close the session on system shutdown (run before sending the headers), so that
         // the session cookie(s) can be written.
         Event::add('system.shutdown', array($this, 'write_close'));
         // Singleton instance
         Session::$instance = $this;
     }
     Kohana_Log::add('debug', 'Session Library initialized');
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:35,代码来源:Session.php

示例5: __construct

 /**
  * Constructs a new challenge.
  *
  * @return  void
  */
 public function __construct()
 {
     // Generate a new challenge
     $this->response = $this->generate_challenge();
     // Store the correct Captcha response in a session
     Event::add('system.post_controller', array($this, 'update_response_session'));
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:12,代码来源:Captcha.php

示例6: __construct

 /**
  * Registers the main event add method
  */
 public function __construct()
 {
     // Hook into routing
     Event::add('system.pre_controller', array($this, 'add'));
     $this->post_data = null;
     //initialize this for later use
 }
开发者ID:kclarisse,项目名称:Ushahidi-Plugins,代码行数:10,代码来源:locationhighlightlite.php

示例7: __construct

 /**
  * Template loading and setup routine.
  */
 public function __construct()
 {
     parent::__construct();
     // checke request is ajax
     $this->ajax_request = request::is_ajax();
     // Load the template
     $this->template = new View($this->template);
     if ($this->auto_render == TRUE) {
         Event::add('system.post_controller', array($this, '_render'));
     }
     /**
      * 判断用户登录情况
      */
     if (isset($_REQUEST['session_id'])) {
         $session = Session::instance($_REQUEST['session_id']);
         $manager = role::get_manager($_REQUEST['session_id']);
     } else {
         $session = Session::instance();
         $manager = role::get_manager();
     }
     /* 当前请求的URL */
     $current_url = urlencode(url::current(TRUE));
     //当前用户管理的站点的ID
     $this->site_id = site::id();
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:28,代码来源:kc_template.php

示例8: add

 /**
  * Adds all the events to the main Ushahidi application
  */
 public function add()
 {
     if (strripos(Router::$current_uri, "admin") !== false) {
         Event::add('ushahidi_action.header_nav', array($this, '_add_offline_tab_header'));
         //adds the mobile tab
     }
 }
开发者ID:rjmackay,项目名称:Ushahidi-plugin-offline,代码行数:10,代码来源:offline.php

示例9: add

 /**
  * Adds all the events to the main Ushahidi application
  */
 public function add()
 {
     // Only add the events if we are on that controller
     if (Router::$controller == 'reports' and Router::$method == 'view') {
         Event::add('ushahidi_filter.report_description', array($this, '_embed_youtube'));
     }
 }
开发者ID:nanangsyaifudin,项目名称:HAC-2012,代码行数:10,代码来源:youtube.php

示例10: add

 /**
  * Adds all the events to the main Ushahidi application
  */
 public function add()
 {
     // Only add the events if we are on that controller
     if (Router::$controller == 'reports') {
         switch (Router::$method) {
             // Hook into the Report Add/Edit Form in Admin
             case 'edit':
                 // Hook into the form itself
                 Event::add('ushahidi_action.report_form_admin', array($this, '_report_form'));
                 // Hook into the report_submit_admin (post_POST) event right before saving
                 // Event::add('ushahidi_action.report_submit_admin', array($this, '_report_validate'));
                 // Hook into the report_edit (post_SAVE) event
                 Event::add('ushahidi_action.report_edit', array($this, '_report_form_submit'));
                 break;
                 // Hook into the Report view (front end)
             // Hook into the Report view (front end)
             case 'view':
                 plugin::add_stylesheet('actionable/views/css/actionable');
                 Event::add('ushahidi_action.report_meta', array($this, '_report_view'));
                 break;
         }
     } elseif (Router::$controller == 'feed') {
         // Add Actionable Tag to RSS Feed
         Event::add('ushahidi_action.feed_rss_item', array($this, '_feed_rss'));
     }
 }
开发者ID:redspider,项目名称:ushahidi-plugins-actionable,代码行数:29,代码来源:actionable.php

示例11: add

 /**
  * overload steam add function with different add listener
  *
  * @return void
  * @author Andy Bennett
  */
 public function add()
 {
     Event::clear('steamform_' . $this->setup['name'] . '_add.complete');
     Event::add('steamform_' . $this->setup['name'] . '_add.complete', array('Galleries_Controller', 'event_add_complete'));
     // We can't use parent here, as that wipes out the event we've set!
     Steam_Core::add();
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:13,代码来源:galleries.php

示例12: __construct

 /**
  * Template loading and setup routine.
  */
 public function __construct($initSession = TRUE)
 {
     self::$msgNotice[0] = _('Access Denied');
     self::$msgNotice[1] = _('Login First Please');
     parent::__construct();
     $this->autoMinifiy = Lemon::config('core.output_minify');
     // checke request is ajax
     $this->ajaxRequest = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
     $this->logon = Logon::getInstance();
     $this->cookieLogon();
     // do init session
     if ($initSession == TRUE) {
         $PHPSESSIONID = $this->input->get('PHPSESSIONID');
         if (!empty($PHPSESSIONID)) {
             $this->sessionInstance = Session::instance($PHPSESSIONID);
         } else {
             $this->sessionInstance = Session::instance();
         }
         $getLogonInfo = $this->logon->getLogonInfo();
         if ($getLogonInfo['userId'] == 0 || $this->check_mgr && $getLogonInfo['mgrRole'] == Logon::$MGR_ROLE_LABEL_GUEST) {
             // 未登录用户才尝试去session里尝试获取一下用户信息。
             $this->setLogonInfoBySession();
         }
     }
     $this->userRoleLabel = $this->logon->getLogonInfoValueByKey('userRoleLabel', Logon::$USER_ROLE_LABEL_GUEST);
     $this->mgrRole = $this->logon->getLogonInfoValueByKey('mgrRole', Logon::$MGR_ROLE_LABEL_GUEST);
     // Load the app
     $this->template = new View($this->template);
     if ($this->autoRender == TRUE) {
         // Render the app immediately after the controller method
         Event::add('system.post_controller', array($this, '_render'));
     }
 }
开发者ID:BGCX261,项目名称:zr4u-svn-to-git,代码行数:36,代码来源:app.php

示例13: send

 /**
  * Send the contents of a file or a data string with the proper MIME type and exit.
  *
  * @uses exit()
  * @uses Kohana::close_buffers()
  *
  * @param   string  a file path or file name
  * @param   string  optional data to send
  * @return  void
  */
 public static function send($filename, $data = NULL)
 {
     if ($data === NULL) {
         $filepath = realpath($filename);
         $filename = basename($filepath);
         $filesize = filesize($filepath);
     } else {
         $filename = basename($filename);
         $filesize = strlen($data);
     }
     // Retrieve MIME type by extension
     $mime = Kohana::config('mimes.' . strtolower(substr(strrchr($filename, '.'), 1)));
     $mime = empty($mime) ? 'application/octet-stream' : $mime[0];
     // Close output buffers
     Kohana::close_buffers(FALSE);
     // Clear any output
     Event::add('system.display', create_function('', 'Kohana::$output = "";'));
     // Send headers
     header("Content-Type: {$mime}");
     header('Content-Length: ' . sprintf('%d', $filesize));
     header('Content-Transfer-Encoding: binary');
     // Send data
     if ($data === NULL) {
         $handle = fopen($filepath, 'rb');
         fpassthru($handle);
         fclose($handle);
     } else {
         echo $data;
     }
     exit;
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:41,代码来源:download.php

示例14: __construct

 /**
  * Template loading and setup routine.
  */
 public function __construct()
 {
     parent::__construct();
     $this->obj_session = Session::instance();
     $this->obj_user_lib = User::instance();
     // checke request is ajax
     $this->ajax_request = request::is_ajax();
     if ($this->auto_render == TRUE) {
         Event::add('system.post_controller', array($this, '_render'));
     }
     //$session = Session::instance();
     $user = array();
     $user = $this->obj_session->get('USER');
     //var_dump($_SESSION);
     if (!empty($user)) {
         $this->_user = $this->obj_user_lib->get_user_by_uid($user['id']);
     }
     unset($user);
     $data = array();
     $data['site_config'] = Kohana::config('site_config.site');
     $host = $_SERVER['HTTP_HOST'];
     $dis_site_config = Kohana::config('distribution_site_config');
     if (array_key_exists($host, $dis_site_config) == true && isset($dis_site_config[$host])) {
         $data['site_config']['site_title'] = $dis_site_config[$host]['site_name'];
         $data['site_config']['keywords'] = $dis_site_config[$host]['keywords'];
         $data['site_config']['description'] = $dis_site_config[$host]['description'];
     }
     $this->_site_config = $data;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:32,代码来源:template.php

示例15: add

 /**
  * @see EventInterface::add()
  */
 public function add($fd, $flag, $func, $args = array())
 {
     switch ($flag) {
         case self::EV_SIGNAL:
             $fd_key = (int) $fd;
             $event = \Event::signal($this->_eventBase, $fd, $func);
             if (!$event || !$event->add()) {
                 return false;
             }
             $this->_eventSignal[$fd_key] = $event;
             return true;
         case self::EV_TIMER:
         case self::EV_TIMER_ONCE:
             $param = array($func, (array) $args, $flag, $fd, self::$_timerId);
             $event = new \Event($this->_eventBase, -1, \Event::TIMEOUT | \Event::PERSIST, array($this, "timerCallback"), $param);
             if (!$event || !$event->addTimer($fd)) {
                 return false;
             }
             $this->_eventTimer[self::$_timerId] = $event;
             return self::$_timerId++;
         default:
             $fd_key = (int) $fd;
             $real_flag = $flag === self::EV_READ ? \Event::READ | \Event::PERSIST : \Event::WRITE | \Event::PERSIST;
             $event = new \Event($this->_eventBase, $fd, $real_flag, $func, $fd);
             if (!$event || !$event->add()) {
                 return false;
             }
             $this->_allEvents[$fd_key][$flag] = $event;
             return true;
     }
 }
开发者ID:sukui,项目名称:Workerman,代码行数:34,代码来源:Event.php


注:本文中的Event::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。