system/engine/event.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/**
* @package OpenCart
* @author Daniel Kerr
* @copyright Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/)
* @license https://opensource.org/licenses/GPL-3.0
* @link https://www.opencart.com
*/
/**
* Event class
*
* Event System Userguide
*
* https://github.com/opencart/opencart/wiki/Events-(script-notifications)-2.2.x.x
*/
class Event {
protected $registry;
protected $data = array();
/**
* Constructor
*
* @param object $route
*/
public function __construct($registry) {
$this->registry = $registry;
}
/**
*
*
* @param string $trigger
* @param object $action
* @param int $priority
*/
public function register($trigger, Action $action, $priority = 0) {
$this->data[] = array(
'trigger' => $trigger,
'action' => $action,
'priority' => $priority
);
$sort_order = array();
foreach ($this->data as $key => $value) {
$sort_order[$key] = $value['priority'];
}
array_multisort($sort_order, SORT_ASC, $this->data);
}
public function getData(){
return $this->data;
}
/**
*
*
后面还有 42 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
