本文整理汇总了PHP中EventUtil::notify方法的典型用法代码示例。如果您正苦于以下问题:PHP EventUtil::notify方法的具体用法?PHP EventUtil::notify怎么用?PHP EventUtil::notify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventUtil
的用法示例。
在下文中一共展示了EventUtil::notify方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stopQuery
public function stopQuery()
{
$query = $this->currentQuery;
$query['time'] = microtime(true) - $this->start;
$zevent = new Zikula_Event('log.sql', null, $query);
EventUtil::notify($zevent);
}
示例2: getRegisteredWidgets
/**
* Gets all registered widgets
*
* @return array Collection of Dashboard_AbstractWidget
*/
public function getRegisteredWidgets($uid)
{
$dbWidgets = $this->em->getRepository('Dashboard_Entity_Widget')->findAll();
$widgets = array();
/* @var Dashboard_Entity_Widget $dbWidget */
foreach ($dbWidgets as $dbWidget) {
if (!SecurityUtil::checkPermission('Dashboard::', "{$dbWidget->getId()}:{$dbWidget->getModule()}:{$uid}", ACCESS_READ)) {
continue;
// error
}
$event = new Zikula_Event(new Zikula_Event(Dashboard_Events::FILTER_WIDGET_CLASS, null, array(), $dbWidget->getClass()));
$class = EventUtil::notify($event)->getData();
if (!class_exists($class)) {
continue;
}
/* @var Dashboard_AbstractWidget $widget */
$widget = new $class();
$widget->setId($dbWidget->getId());
$widgets[] = $widget;
}
return $widgets;
}
示例3: postStmtExecute
/**
* Executed following a Doctrine statement exec query.
*
* @param Doctrine_Event $event The Doctrine event instance.
*
* @return void
*/
public function postStmtExecute(Doctrine_Event $event)
{
$event->end();
$zevent = new Zikula_Event('log.sql', null, array('time' => $event->getElapsedSecs(), 'query' => $event->getQuery()));
EventUtil::notify($zevent);
}
示例4: exec
/**
* Run a module function.
*
* @param string $modname The name of the module.
* @param string $type The type of function to run.
* @param string $func The specific function to run.
* @param array $args The arguments to pass to the function.
* @param boolean $api Whether or not to execute an API (or regular) function.
* @param string $instanceof Perform instanceof checking of target class.
*
* @throws Zikula_Exception_NotFound If method was not found.
* @throws InvalidArgumentException If the controller is not an instance of the class specified in $instanceof.
*
* @return mixed.
*/
public static function exec($modname, $type = 'user', $func = 'main', $args = array(), $api = false, $instanceof = null)
{
// define input, all numbers and booleans to strings
$modname = isset($modname) ? (string) $modname : '';
$ftype = $api ? 'api' : '';
$loadfunc = $api ? 'ModUtil::loadApi' : 'ModUtil::load';
// validate
if (!System::varValidate($modname, 'mod')) {
return null;
}
// Remove from 1.4
if (System::isLegacyMode() && $modname == 'Modules') {
LogUtil::log(__('Warning! "Modules" module has been renamed to "Extensions". Please update your ModUtil::func() and ModUtil::apiFunc() calls.'));
$modname = 'Extensions';
}
$modinfo = self::getInfo(self::getIDFromName($modname));
$path = $modinfo['type'] == self::TYPE_SYSTEM ? 'system' : 'modules';
$controller = null;
$modfunc = null;
$loaded = call_user_func_array($loadfunc, array($modname, $type));
if (self::isOO($modname)) {
$result = self::getCallable($modname, $type, $func, $api);
if ($result) {
$modfunc = $result['callable'];
$controller = $modfunc[0];
if (!is_null($instanceof)) {
if (!$controller instanceof $instanceof) {
throw new InvalidArgumentException(__f('%1$s must be an instance of $2$s', array(get_class($controller), $instanceof)));
}
}
}
}
$modfunc = $modfunc ? $modfunc : "{$modname}_{$type}{$ftype}_{$func}";
$eventManager = EventUtil::getManager();
if ($loaded) {
$preExecuteEvent = new Zikula_Event('module_dispatch.preexecute', $controller, array('modname' => $modname, 'modfunc' => $modfunc, 'args' => $args, 'modinfo' => $modinfo, 'type' => $type, 'api' => $api));
$postExecuteEvent = new Zikula_Event('module_dispatch.postexecute', $controller, array('modname' => $modname, 'modfunc' => $modfunc, 'args' => $args, 'modinfo' => $modinfo, 'type' => $type, 'api' => $api));
if (is_callable($modfunc)) {
$eventManager->notify($preExecuteEvent);
// Check $modfunc is an object instance (OO) or a function (old)
if (is_array($modfunc)) {
if ($modfunc[0] instanceof Zikula_AbstractController) {
$reflection = call_user_func(array($modfunc[0], 'getReflection'));
$subclassOfReflection = new ReflectionClass($reflection->getParentClass());
if ($subclassOfReflection->hasMethod($modfunc[1])) {
// Don't allow front controller to access any public methods inside the controller's parents
throw new Zikula_Exception_NotFound();
}
$modfunc[0]->preDispatch();
}
$postExecuteEvent->setData(call_user_func($modfunc, $args));
if ($modfunc[0] instanceof Zikula_AbstractController) {
$modfunc[0]->postDispatch();
}
} else {
$postExecuteEvent->setData($modfunc($args));
}
return $eventManager->notify($postExecuteEvent)->getData();
}
// get the theme
if (ServiceUtil::getManager()->getService('zikula')->getStage() & Zikula_Core::STAGE_THEME) {
$theme = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));
if (file_exists($file = 'themes/' . $theme['directory'] . '/functions/' . $modname . "/{$type}{$ftype}/{$func}.php") || file_exists($file = 'themes/' . $theme['directory'] . '/functions/' . $modname . "/pn{$type}{$ftype}/{$func}.php")) {
include_once $file;
if (function_exists($modfunc)) {
EventUtil::notify($preExecuteEvent);
$postExecuteEvent->setData($modfunc($args));
return EventUtil::notify($postExecuteEvent)->getData();
}
}
}
if (file_exists($file = "config/functions/{$modname}/{$type}{$ftype}/{$func}.php") || file_exists($file = "config/functions/{$modname}/pn{$type}{$ftype}/{$func}.php")) {
include_once $file;
if (is_callable($modfunc)) {
$eventManager->notify($preExecuteEvent);
$postExecuteEvent->setData($modfunc($args));
return $eventManager->notify($postExecuteEvent)->getData();
}
}
if (file_exists($file = "{$path}/{$modname}/{$type}{$ftype}/{$func}.php") || file_exists($file = "{$path}/{$modname}/pn{$type}{$ftype}/{$func}.php")) {
include_once $file;
if (is_callable($modfunc)) {
$eventManager->notify($preExecuteEvent);
$postExecuteEvent->setData($modfunc($args));
return $eventManager->notify($postExecuteEvent)->getData();
//.........这里部分代码省略.........
示例5: moduleservices
public static function moduleservices(Zikula_Event $event)
{
// check if this is for this handler
$subject = $event->getSubject();
if (!($event['method'] == 'moduleservices' && strrpos(get_class($subject), '_Controller_Admin'))) {
return;
}
$moduleName = $subject->getName();
if (!SecurityUtil::checkPermission($moduleName.'::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
$view = Zikula_View::getInstance('Extensions', false);
$view->assign('currentmodule', $moduleName);
// notify EVENT here to gather any system service links
$localevent = new Zikula_Event('module_dispatch.service_links', $subject, array('modname' => $moduleName));
EventUtil::notify($localevent);
$sublinks = $localevent->getData();
$view->assign('sublinks', $sublinks);
$event->setData($view->fetch('extensions_hookui_moduleservices.tpl'));
$event->stop();
}
示例6: _getThemeFilterEvent
/**
* Filter results for a given getTheme() type.
*
* @param string $themeName Theme name.
* @param string $type Event type.
*
* @return string Theme name
*/
private static function _getThemeFilterEvent($themeName, $type)
{
$event = new Zikula_Event('user.gettheme', null, array('type' => $type), $themeName);
return EventUtil::notify($event)->getData();
}
示例7: validatePostProcess
/**
* Post-Process the basic object validation with class specific logic.
*
* Subclasses can define appropriate implementations.
*
* @param string $type Controller type.
* @param array $data Data to be used for validation.
*
* @return boolean
*/
public function validatePostProcess($type = 'user', $data = null)
{
// empty function, should be implemented by child classes.
EventUtil::notify(new Zikula_Event('dbobjectarray.validatepostprocess', $this));
return true;
}