本文整理汇总了PHP中XenForo_CodeEvent::getEventListeners方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_CodeEvent::getEventListeners方法的具体用法?PHP XenForo_CodeEvent::getEventListeners怎么用?PHP XenForo_CodeEvent::getEventListeners使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_CodeEvent
的用法示例。
在下文中一共展示了XenForo_CodeEvent::getEventListeners方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _runOnce
protected function _runOnce()
{
$this->_checkJustInstalled();
$this->_rebuildLoadClassHintsCache();
$this->_checkCopyrightModification();
$cpdListeners = XenForo_CodeEvent::getEventListeners('controller_pre_dispatch');
if ($cpdListeners) {
$this->_getLibraryListenerFileVersion('ControllerPreDispatch');
}
self::$_runOnce = true;
}
示例2: _runOnce
protected function _runOnce()
{
$this->_checkJustInstalled();
$this->_rebuildLoadClassHintsCache();
$this->_checkCopyrightModification();
$cpdListeners = XenForo_CodeEvent::getEventListeners('controller_pre_dispatch');
if ($cpdListeners) {
$this->_getLibraryListenerFileVersion('ControllerPreDispatch');
}
$options = XenForo_Application::get('options');
$newOptions = XenForo_Application::get('config')->options;
if ($newOptions) {
foreach ($newOptions as $optionName => $optionValue) {
$options->set($optionName, $optionValue);
}
XenForo_Application::set('options', $options);
}
self::$_runOnce = true;
}
示例3: navigationTabs
public static function navigationTabs(array &$extraTabs, $selectedTabId)
{
$xenOptions = XenForo_Application::get('options');
$listeners = XenForo_CodeEvent::getEventListeners('navigation_tabs');
foreach ($listeners['_'] as $key => $callback) {
if ($callback[0] == __CLASS__) {
$listeners['_'] = array_slice($listeners['_'], $key + 1);
}
}
if (!$listeners) {
return true;
}
foreach ($listeners as $callbacks) {
foreach ($callbacks as $callback) {
if (is_callable($callback)) {
$return = call_user_func_array($callback, array(&$extraTabs, $selectedTabId));
foreach ($extraTabs as $key => $extraTab) {
if (!isset($extraTab['priority']) && isset($xenOptions->th_navigationTabs_priority[$callback[0] . '::' . $callback[1]])) {
$extraTabs[$key]['priority'] = $xenOptions->th_navigationTabs_priority[$callback[0] . '::' . $callback[1]];
}
}
if ($return === false) {
return false;
}
}
}
}
foreach ($extraTabs as $tabKey => $extraTab) {
if (isset($extraTab['nodeTab']['nat_display_order'])) {
$extraTabs[$tabKey]['priority'] = $extraTab['nodeTab']['nat_display_order'];
} elseif (!isset($extraTab['priority'])) {
$extraTabs[$tabKey]['priority'] = 10;
}
}
uasort($extraTabs, array('self', 'comparePriority'));
return false;
}
示例4: _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');
}
示例5: _checkAddOnsNeedUpgrading
/**
*
* @param array $addOns
*/
protected function _checkAddOnsNeedUpgrading(array $addOns, $checkDisabled = false)
{
if (empty($addOns)) {
return false;
}
if (XenForo_Application::$versionId < 1020000 || $checkDisabled) {
/* @var $addOnModel XenForo_Model_AddOn */
$addOnModel = XenForo_Model::create('XenForo_Model_AddOn');
$allAddOns = $addOnModel->getAllAddOns();
} else {
$allAddOns = XenForo_Application::get('addOns');
}
$lastXmlUploadDate = $this->_getLastXmlUploadDate();
foreach ($addOns as $addOnId) {
if (isset($allAddOns[$addOnId])) {
$addOn = $allAddOns[$addOnId];
try {
$addOnXML = new SimpleXMLElement(file_get_contents(XenForo_Application::getInstance()->getRootDir() . '/install/data/addon-' . $addOnId . '.xml'));
$versionId = (string) $addOnXML->attributes()->version_id;
} catch (Exception $e) {
$versionId = '';
}
if (is_array($addOn) && $versionId > $addOn['version_id'] || !is_array($addOn) && $versionId > $addOn) {
self::$_upgradeAddOns[$addOnId] = $addOn;
} else {
$xmlUploadDate = filemtime(XenForo_Application::getInstance()->getRootDir() . '/install/data/addon-' . $addOnId . '.xml');
if ($xmlUploadDate > $lastXmlUploadDate) {
$lastXmlUploadDate = $xmlUploadDate;
}
}
}
}
eval('
class Waindigo_Listener_ControllerPreDispatch_TemplatePostRender
{
public static function templatePostRender($templateName, &$content, array &$containerData, XenForo_Template_Abstract $template)
{
if ($templateName == "PAGE_CONTAINER") {
$upgradeAddOns = Waindigo_Listener_ControllerPreDispatch::getUpgradeAddOns();
if (!empty($upgradeAddOns)) {
$params = $template->getParams();
if (!$params[\'showUpgradePendingNotice\']) {
$pattern = \'#<noscript><p class="importantMessage">.*</p></noscript>#U\';
$replacement = \'<p class="importantMessage"><a href="\'.XenForo_Link::buildAdminLink(\'add-ons/upgrade-all-from-xml\').\'">\' . new XenForo_Phrase(\'upgrade_add_on\') . \'</a></p>\';
$content = preg_replace($pattern, \'${1}\' . $replacement, $content);
}
}
}
}
}');
$tprListeners = XenForo_CodeEvent::getEventListeners('template_post_render');
if (!$tprListeners || XenForo_Application::$versionId >= 1020052) {
$tprListeners = array();
}
$newListener = array('Waindigo_Listener_ControllerPreDispatch_TemplatePostRender', 'templatePostRender');
if (XenForo_Application::$versionId < 1020000) {
$tprListeners[] = $newListener;
} else {
$tprListeners['_'][] = $newListener;
}
XenForo_CodeEvent::setListeners(array('template_post_render' => $tprListeners));
if (empty(self::$_upgradeAddOns)) {
$this->_setLastXmlUploadDate($lastXmlUploadDate);
return false;
}
return true;
}
示例6: _removeUnwantedCopyrightNotice
/**
* This is to ensure copyright notices don't display on every page if all
* add-ons are newer than 15 September 2012 (unless explicitly set).
*
* This code is redundant if all add-ons are newer than 25 June 2013.
*/
protected function _removeUnwantedCopyrightNotice()
{
$thListeners = XenForo_CodeEvent::getEventListeners('template_hook');
$tprListeners = XenForo_CodeEvent::getEventListeners('template_post_render');
if (!empty($thListeners) || !empty($tprListeners)) {
$this->_getLibraryListenerFileVersion('Template');
if (!empty($thListeners)) {
$templateHookVersion = $this->_getLibraryListenerFileVersion('TemplateHook');
}
if (!empty($tprListeners)) {
$templatePostRenderVersion = $this->_getLibraryListenerFileVersion('TemplatePostRender');
}
}
$tcListeners = XenForo_CodeEvent::getEventListeners('template_create');
if (!empty($tcListeners)) {
$this->_getLibraryListenerFileVersion('TemplateCreate');
}
$lccListeners = XenForo_CodeEvent::getEventListeners('load_class_controller');
if (!empty($lccListeners)) {
$loadClassVersion = $this->_getLibraryListenerFileVersion('LoadClass', false);
}
if (defined(Waindigo_Listener_InitDependencies::COPYRIGHT_MODIFICATION_SIMPLE_CACHE_KEY) && !XenForo_Application::getSimpleCacheData(self::COPYRIGHT_MODIFICATION_SIMPLE_CACHE_KEY)) {
return;
}
if (XenForo_Application::$versionId < 1020000 && self::$_showCopyright) {
return;
}
$className = get_class(self::$_controller);
if (XenForo_Application::$versionId < 1020000 && strpos($className, 'Waindigo') === 0) {
return;
}
if (XenForo_Application::get('options')->waindigo_loadClassHints) {
$controllers = XenForo_Application::get('options')->waindigo_loadClassHints;
} else {
$controllers = array('XenForo_ControllerPublic_Misc' => array());
}
$addOns = array();
if (XenForo_Application::$versionId < 1020000 || !array_key_exists($className, $controllers)) {
if (XenForo_Application::$versionId >= 1020000) {
if (!empty($thListeners['_'])) {
$thListeners = $thListeners['_'];
} else {
$thListeners = array();
}
}
if (!empty($thListeners)) {
foreach ($thListeners as $templateHook) {
if (strlen($templateHook[0]) > strlen('Waindigo_') && substr($templateHook[0], 0, strlen('Waindigo_')) == 'Waindigo_') {
if ($templateHookVersion < '20120715') {
return;
}
$addOns[] = substr($templateHook[0], 0, strlen($templateHook[0]) - strlen('_Listener_TemplateHook'));
}
}
}
if (XenForo_Application::$versionId >= 1020000) {
if (!empty($tprListeners['_'])) {
$tprListeners = $tprListeners['_'];
} else {
$tprListeners = array();
}
}
if (!empty($tprListeners)) {
foreach ($tprListeners as $templatePostRender) {
if (strlen($templatePostRender[0]) > strlen('Waindigo_') && substr($templatePostRender[0], 0, strlen('Waindigo_')) == 'Waindigo_') {
$addOnId = substr($templatePostRender[0], 0, strlen($templatePostRender[0]) - strlen('_Listener_TemplatePostRender'));
if (in_array($addOnId, $addOns)) {
continue;
}
if ($templatePostRenderVersion < '20120715') {
return;
}
$addOns[] = $addOnId;
}
}
}
if (XenForo_Application::$versionId >= 1020000) {
if (!empty($lccListeners['_'])) {
$lccListeners = $lccListeners['_'];
} else {
$lccListeners = array();
}
}
if (!empty($lccListeners)) {
foreach ($lccListeners as $loadClassController) {
if (strlen($loadClassController[0]) > strlen('Waindigo_') && substr($loadClassController[0], 0, strlen('Waindigo_')) == 'Waindigo_') {
if (strpos($loadClassController[0], '_Listener_LoadClassController') > 0) {
$addOnId = substr($loadClassController[0], 0, strlen($loadClassController[0]) - strlen('_Listener_LoadClassController'));
} else {
$addOnId = substr($loadClassController[0], 0, strlen($loadClassController[0]) - strlen('_Listener_LoadClass'));
}
if ($loadClassVersion >= '20121018') {
$loadClassController = Waindigo_Listener_LoadClass::create($loadClassController[0]);
if (method_exists($loadClassController, 'getExtendedClass')) {
//.........这里部分代码省略.........