/** * 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')); }
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); } }); } }
/** * * @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'); }
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'); }
public function __construct($directory) { static::$instance = $this; $this->loadConfig($directory); \XenForo_CodeEvent::addListener('load_class_datawriter', 'Robbo\\XfSync\\Listener::extendClass'); }
/** * 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')); }
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'); }