Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/managers/hook_manager.php
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Line(s) | |||||
// any prefix, given special | // any prefix, given special | ||||
$this->_getHooks($event, $mode, rtrim('*.' . $event->Special, '.')) | $this->_getHooks($event, $mode, rtrim('*.' . $event->Special, '.')) | ||||
); | ); | ||||
if (!$hooks) { | if (!$hooks) { | ||||
return ; | return ; | ||||
} | } | ||||
$is_web_request = $this->Application->isWebRequest(); | |||||
foreach ($hooks as $hook) { | foreach ($hooks as $hook) { | ||||
Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpaceBeforeCloseBrace: Expected 1 spaces before "foreach" closing bracket; 0 found | |||||
Expected 1 spaces after "foreach" opening bracket; 0 found Lint: CodingStandard.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace: Expected 1 spaces after "foreach" opening bracket; 0 found | |||||
if ($hook['DoSpecial'] == '*') { | if ($hook['DoSpecial'] == '*') { | ||||
// use same special as master event | // use same special as master event | ||||
$hook['DoSpecial'] = $event->Special; | $hook['DoSpecial'] = $event->Special; | ||||
} | } | ||||
$prefix_special = rtrim($hook['DoPrefix'].'_'.$hook['DoSpecial'], '_'); | $prefix_special = rtrim($hook['DoPrefix'].'_'.$hook['DoSpecial'], '_'); | ||||
if ( $hook['Conditional'] && !$this->Application->GetVar($prefix_special) ) { | if ( $hook['Conditional'] && $is_web_request && !$this->Application->GetVar($prefix_special) ) { | ||||
continue; | continue; | ||||
} | } | ||||
if ( $this->Application->prefixRegistred($hook['DoPrefix']) ) { | if ( $this->Application->prefixRegistred($hook['DoPrefix']) ) { | ||||
// run hook only, when it's config is found | // run hook only, when it's config is found | ||||
$hook_event = new kEvent($hook['DoPrefix'] . '.' . $hook['DoSpecial'] . ':' . $hook['DoEvent']); | $hook_event = new kEvent($hook['DoPrefix'] . '.' . $hook['DoSpecial'] . ':' . $hook['DoEvent']); | ||||
$hook_event->MasterEvent =& $event; | $hook_event->MasterEvent =& $event; | ||||
$this->Application->HandleEvent($hook_event); | $this->Application->HandleEvent($hook_event); | ||||
Show All 18 Lines | |||||
if (!isset($hooks[strtolower($event_key.'.'.$event->Name)])) { | if (!isset($hooks[strtolower($event_key.'.'.$event->Name)])) { | ||||
$ret = Array (); | $ret = Array (); | ||||
return $ret; | return $ret; | ||||
} | } | ||||
return $hooks[ strtolower($event_key.'.'.$event->Name) ]; | return $hooks[ strtolower($event_key.'.'.$event->Name) ]; | ||||
} | } | ||||
} | } | ||||
No newline at end of file |
Expected 1 spaces before "foreach" closing bracket; 0 found