本文整理汇总了PHP中LogUtil::getWarningMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP LogUtil::getWarningMessages方法的具体用法?PHP LogUtil::getWarningMessages怎么用?PHP LogUtil::getWarningMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogUtil
的用法示例。
在下文中一共展示了LogUtil::getWarningMessages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerPersistentEventHandlerClass
/**
* Register a Zikula_AbstractEventHandler as a persistent handler.
*
* @param string $moduleName Module name.
* @param string $className Class name (subclass of Zikula_AbstractEventHandler).
*
* @throws InvalidArgumentException If class is not available or not a subclass of Zikula_AbstractEventHandler.
*
* @return void
*
* Note: If the exact same handler is already registered, this function does nothing.
*/
public static function registerPersistentEventHandlerClass($moduleName, $className)
{
if (!class_exists($className)) {
throw new InvalidArgumentException(sprintf('Class %s does not exist or cannot be found', $className));
}
$reflection = new ReflectionClass($className);
if (!$reflection->isSubclassOf('Zikula_AbstractEventHandler')) {
throw new InvalidArgumentException(sprintf('%s is not a subclass of Zikula_AbstractEventHandler', $className));
}
$handlers = ModUtil::getVar(self::HANDLERS, $moduleName, array());
$newHandler = array('classname' => $className);
foreach ($handlers as $handler) {
if ($handler == $newHandler) {
// The exact same handler exists already. Do nothing but display a warning.
if (System::isDevelopmentMode()) {
LogUtil::registerWarning(__f('The eventhandler class "%1$s" for "%2$s" could not be registered because it is registered already.', array($className, $moduleName)));
} else {
$warns = LogUtil::getWarningMessages(false);
$msg = __f('The eventhandlers for "%1$s" could not be registered because they are registered already.', array($moduleName));
if (!in_array(DataUtil::formatForDisplayHTML($msg), $warns)) {
LogUtil::registerWarning($msg);
}
}
return;
}
}
$handlers[] = $newHandler;
ModUtil::setVar(self::HANDLERS, $moduleName, $handlers);
}