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


PHP Events::getInstance方法代码示例

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


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

示例1: __construct

 public function __construct(Request $request, array $member_id)
 {
     self::$_request = $request;
     self::$config = (include ST_DIR . '/config.php');
     self::$_routing = (include ST_DIR . '/routing.php');
     self::$_user = (object) $member_id;
     $this->_tpl = $tpl;
     if (empty($this->_user->user_id)) {
         self::$_user->user_id = 0;
         self::$_user->user_group = 5;
     }
     self::$_user->ip_address = $_SERVER['REMOTE_ADDR'];
     $this->eventManager = Events::getInstance();
     $this->addToBreadcrumbs($GLOBALS['config']['home_title'], $GLOBALS['config']['http_home_url']);
     $this->configure();
 }
开发者ID:dautushenka,项目名称:DLE-Statement,代码行数:16,代码来源:ControllerAbstract.php

示例2: sortByPriority

	/**
	 * Sorts registered events by priority
	 * @return void
	 */
	protected static function sortByPriority() {
		$ce = Events::getInstance();
		foreach(array_keys($ce->registeredEvents) as $event) {
			usort($ce->registeredEvents[$event],'Events::comparePriority');
		}
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:10,代码来源:events.php

示例3: fire

 /** 
  * An internal function used by Concrete to "fire" a system-wide event. Any time this happens, events that 
  * a developer has hooked into will be run.
  * @param string $event
  * @return void
  */
 public static function fire($event)
 {
     if (!defined('ENABLE_APPLICATION_EVENTS') || ENABLE_APPLICATION_EVENTS == false) {
         return;
     }
     // any additional arguments passed to the fire function will get passed FIRST to the method, with the method's own registered
     // params coming at the end. e.g. if I fire Events::fire('on_login', $userObject) it will come in with user object first
     $args = func_get_args();
     if (count($args) > 1) {
         array_shift($args);
     } else {
         $args = false;
     }
     $ce = Events::getInstance();
     $events = $ce->registeredEvents[$event];
     $eventReturn = false;
     if (is_array($events)) {
         foreach ($events as $ev) {
             $type = $ev[0];
             $proceed = true;
             if ($type == Events::EVENT_TYPE_PAGETYPE) {
                 // then the first argument in the event fire() method will be the page
                 // that this applies to. We check to see if the page type is the right type
                 $proceed = false;
                 if (is_object($args[0]) && $args[0] instanceof Page && $args[0]->getCollectionTypeID() > 0) {
                     if ($ev[3] == Loader::pageTypeControllerPath($args[0]->getCollectionTypeHandle())) {
                         $proceed = true;
                     }
                 }
             }
             if ($proceed) {
                 if ($ev[3] != false) {
                     // HACK - second part is for windows and its paths
                     if (substr($ev[3], 0, 1) == '/' || substr($ev[3], 1, 1) == ':') {
                         // then this means that our path is a full one
                         require_once $ev[3];
                     } else {
                         require_once DIR_BASE . '/' . $ev[3];
                     }
                 }
                 $params = is_array($ev[4]) ? $ev[4] : array();
                 // now if args has any values we put them FIRST
                 $params = array_merge($args, $params);
                 if (method_exists($ev[1], $ev[2])) {
                     // Note: DO NOT DO RETURN HERE BECAUSE THEN MULTIPLE EVENTS WON'T WORK
                     $eventReturn = call_user_func_array(array($ev[1], $ev[2]), $params);
                 }
             }
         }
     }
     return $eventReturn;
 }
开发者ID:homer6,项目名称:concrete5-mirror,代码行数:58,代码来源:events.php

示例4: testGetInstance

 /**
  * Test to see if getInstance returns a Events class instance
  */
 public function testGetInstance()
 {
     $events = Events::getInstance();
     $this->assertInstanceOf('Concrete5_Library_Events', $events);
 }
开发者ID:masteramuk,项目名称:concrete5,代码行数:8,代码来源:EventsTest.php


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