本文整理汇总了PHP中DevblocksPlatform::getEventRegistry方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::getEventRegistry方法的具体用法?PHP DevblocksPlatform::getEventRegistry怎么用?PHP DevblocksPlatform::getEventRegistry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::getEventRegistry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trigger
function trigger(Model_DevblocksEvent $event)
{
/*
* [TODO] Look at the hash and spawn our listeners for this particular point
*/
$events = DevblocksPlatform::getEventRegistry();
if (null == ($listeners = @$events[$event->id])) {
$listeners = array();
}
// [TODO] Make sure we can't get a double listener
if (isset($events['*']) && is_array($events['*'])) {
foreach ($events['*'] as $evt) {
$listeners[] = $evt;
}
}
if (is_array($listeners) && !empty($listeners)) {
foreach ($listeners as $listener) {
/* @var $listener DevblocksExtensionManifest */
// Extensions can be invoked on these plugins even by workers who cannot see them
if (null != ($manifest = DevblocksPlatform::getExtension($listener, false, true))) {
if (method_exists($manifest, 'createInstance')) {
$inst = $manifest->createInstance();
/* @var $inst DevblocksEventListenerExtension */
if ($inst instanceof DevblocksEventListenerExtension) {
$inst->handleEvent($event);
}
}
}
}
}
}
示例2: trigger
function trigger(Model_DevblocksEvent $event)
{
/*
* [TODO] Look at the hash and spawn our listeners for this particular point
*/
$events = DevblocksPlatform::getEventRegistry();
if (null == ($listeners = @$events[$event->id])) {
$listeners = array();
}
// [TODO] Make sure we can't get a double listener
if (is_array($events['*'])) {
foreach ($events['*'] as $evt) {
$listeners[] = $evt;
}
}
if (is_array($listeners) && !empty($listeners)) {
foreach ($listeners as $listener) {
/* @var $listener DevblocksExtensionManifest */
$manifest = DevblocksPlatform::getExtension($listener);
$inst = $manifest->createInstance();
/* @var $inst DevblocksEventListenerExtension */
$inst->handleEvent($event);
}
}
}