本文整理汇总了PHP中XenForo_CodeEvent::addListener方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_CodeEvent::addListener方法的具体用法?PHP XenForo_CodeEvent::addListener怎么用?PHP XenForo_CodeEvent::addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_CodeEvent
的用法示例。
在下文中一共展示了XenForo_CodeEvent::addListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setCustomRoutePrefixes
/**
* Internal method for doing the actual swapping/shifting of route prefixes.
*
* @param string $defaultRoutePrefix
* @param array $routesPublic
*/
protected static function _setCustomRoutePrefixes($defaultRoutePrefix, array $routesPublic)
{
$routesPublic['index'] = array('build_link' => 'all', 'route_class' => 'WidgetPortal_Route_PrefixPublic_Index');
$routesPublic['forum'] = array('build_link' => 'none', 'route_class' => 'WidgetPortal_Route_PrefixPublic_Forum');
$routesPublic[$defaultRoutePrefix]['build_link'] = 'all';
XenForo_Link::setHandlerInfoForGroup('public', $routesPublic);
XenForo_CodeEvent::addListener('load_class_route_prefix', array(__CLASS__, 'loadClassRoutePrefix'));
}
示例2: _postDelete
protected function _postDelete()
{
parent::_postDelete();
$discordId = $this->getExisting('da_discord_id');
if ($discordId !== null) {
XenForo_CodeEvent::addListener('controller_post_dispatch', function ($c, $r, $n, $a) use($discordId) {
try {
self::refreshDiscordId($discordId);
} catch (Exception $e) {
XenForo_Error::logException($e, false);
}
});
}
}
示例3: _fetchDisabledInstallerWaindigoListeners
/**
*
* @param string $hint
*/
protected static function _fetchDisabledInstallerWaindigoListeners($hint = '')
{
/* @var $codeEventModel XenForo_Model_CodeEvent */
$codeEventModel = XenForo_Model::create('XenForo_Model_CodeEvent');
$listeners = $codeEventModel->getAllEventListeners();
$installerWaindigoListeners = XenForo_CodeEvent::getEventListeners('load_class_installer_waindigo');
if (XenForo_Application::$versionId > 1020000) {
if (isset($installerWaindigoListeners['_'])) {
$installerWaindigoListeners = $installerWaindigoListeners['_'];
} else {
$installerWaindigoListeners = array();
}
if ($hint) {
if (isset($installerWaindigoListeners[$hint])) {
$installerWaindigoListeners = array_merge($installerWaindigoListeners, $installerWaindigoListeners[$hint]);
}
}
}
foreach ($listeners as $listener) {
if ($listener['event_id'] == 'load_class_installer_waindigo') {
if ($installerWaindigoListeners) {
foreach ($installerWaindigoListeners as $installerWaindigoListener) {
list($callbackClass, $callbackMethod) = $installerWaindigoListener;
if ($listener['callback_class'] == $callbackClass && $listener['callback_method'] == $callbackMethod) {
continue 2;
}
}
}
if ($listener['active']) {
XenForo_CodeEvent::addListener('load_class_installer_waindigo', array($listener['callback_class'], $listener['callback_method']), $hint);
}
}
}
$installerWaindigoListeners = XenForo_CodeEvent::getEventListeners('load_class_installer_waindigo');
}
示例4: _rebuildLoadClassHintsCache
protected function _rebuildLoadClassHintsCache()
{
if (XenForo_Application::$versionId < 1020000) {
return;
}
$newLoadClassHints = array('XenForo_ControllerPublic_Misc' => array());
XenForo_Application::get('options')->set('waindigo_loadClassHints', $newLoadClassHints);
XenForo_CodeEvent::addListener('load_class', 'Waindigo_Listener_LoadClass', 'XenForo_ControllerPublic_Misc');
}
示例5: __construct
public function __construct($directory)
{
static::$instance = $this;
$this->loadConfig($directory);
\XenForo_CodeEvent::addListener('load_class_datawriter', 'Robbo\\XfSync\\Listener::extendClass');
}
示例6: bootstrap
/**
* Bootstraps the Updater.
* This routine cannot be executed at `init_dependencies` due to version resolving,
* it will run at `front_controller_pre_route` instead. This method should only be called once
* for each <code>$config.apiUrl</code.
*
* @param array $config
*
* @internal
*/
public static function bootstrap(array $config)
{
if (isset($GLOBALS[self::KEY]['setupMethod'][$config['apiUrl']])) {
if (XenForo_Application::debugMode()) {
die(sprintf('Updater for %s has been setup by %s already!', $config['apiUrl'], $GLOBALS[self::KEY]['setupMethod'][$config['apiUrl']]));
}
return;
}
$GLOBALS[self::KEY]['setupMethod'][$config['apiUrl']] = __METHOD__;
if (self::$_config !== null) {
if (XenForo_Application::debugMode()) {
die(sprintf('%s has been setup to run with %s already!', __METHOD__, self::$_config['apiUrl']));
}
return;
}
self::$_config = $config;
// from this point, we no longer need to care about other implementations of Updater
// all checks have been passed and indicated that the current one is the latest version
XenForo_CodeEvent::addListener('front_controller_pre_view', array(__CLASS__, 'front_controller_pre_view'));
}
示例7: _rebuildLoadClassHintsCache
protected function _rebuildLoadClassHintsCache()
{
if (XenForo_Application::$versionId < 1020000) {
return;
}
$addOns = XenForo_Application::get('addOns');
if (!$addOns) {
$addOns = array();
}
$loadClassHints = XenForo_Application::getSimpleCacheData(self::CONTROLLERS_SIMPLE_CACHE_KEY);
if (!$loadClassHints) {
$loadClassHints = array();
}
$addOnIds = array_keys($addOns);
$newLoadClassHints = array('XenForo_ControllerPublic_Misc' => array());
foreach ($addOnIds as $addOnId) {
foreach ($loadClassHints as $hint => $addOnIds) {
if (in_array($addOnId, $addOnIds)) {
$newLoadClassHints[$hint][] = $addOnId;
}
}
}
XenForo_Application::getOptions()->set('waindigo_loadClassHints', $newLoadClassHints);
XenForo_CodeEvent::addListener('load_class', 'Waindigo_Listener_LoadClass', 'XenForo_ControllerPublic_Misc');
}