本文整理汇总了PHP中Hook::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::getName方法的具体用法?PHP Hook::getName怎么用?PHP Hook::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hook
的用法示例。
在下文中一共展示了Hook::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RegisterHook
/**
* Register a hook object with the global HookHandler object.
*
* Allows for abstract calling of the hook.
*
* @param Hook $hook
*
* @return void
*/
public static function RegisterHook(Hook $hook) {
$name = $hook->getName();
Core\Utilities\Logger\write_debug('Registering new hook [' . $name . ']');
if(isset(HookHandler::$RegisteredHooks[$name]) && FULL_DEBUG){
trigger_error('Registering hook that is already registered [' . $name . ']', E_USER_NOTICE);
}
HookHandler::$RegisteredHooks[$name] = $hook;
//var_dump(self::$EarlyRegisteredHooks);
// Attach any bindings that may have existed.
if (isset(self::$EarlyRegisteredHooks[$name])) {
foreach (self::$EarlyRegisteredHooks[$name] as $b) {
$hook->attach($b['call']);
}
unset(self::$EarlyRegisteredHooks[$name]);
}
}
示例2: isHookRegistered
/**
* Check if any hook is registered on given name
* @param Hook $hook
* @return boolean
*/
public static function isHookRegistered(Hook $hookToCheck)
{
if (isset(static::$hooks[$hookToCheck->getName()]) and !empty(static::$hooks[$hookToCheck->getName()])) {
foreach (static::$hooks[$hookToCheck->getName()] as $hook) {
if ($hookToCheck === $hook) {
return true;
}
}
}
return false;
}