当前位置: 首页>>代码示例>>PHP>>正文


PHP XenForo_CodeEvent类代码示例

本文整理汇总了PHP中XenForo_CodeEvent的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_CodeEvent类的具体用法?PHP XenForo_CodeEvent怎么用?PHP XenForo_CodeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了XenForo_CodeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setupRoutes

 /**
  * Setups all default routes for [bd] Api. Also fires the code event
  * `api_setup_routes` and let any other add-ons to setup extra
  * routes for the system.
  *
  * @param array $routes the target routes array
  */
 public static function setupRoutes(array &$routes)
 {
     self::addRoute($routes, 'index', 'bdApi_Route_PrefixApi_Index');
     self::addRoute($routes, 'oauth', 'bdApi_Route_PrefixApi_OAuth');
     self::addRoute($routes, 'categories', 'bdApi_Route_PrefixApi_Categories', 'data_only');
     self::addRoute($routes, 'conversations', 'bdApi_Route_PrefixApi_Conversations', 'data_only');
     self::addRoute($routes, 'conversation-messages', 'bdApi_Route_PrefixApi_ConversationMessages', 'data_only');
     self::addRoute($routes, 'forums', 'bdApi_Route_PrefixApi_Forums', 'data_only');
     self::addRoute($routes, 'navigation', 'bdApi_Route_PrefixApi_Navigation');
     self::addRoute($routes, 'notifications', 'bdApi_Route_PrefixApi_Notifications');
     self::addRoute($routes, 'pages', 'bdApi_Route_PrefixApi_Pages', 'data_only');
     self::addRoute($routes, 'posts', 'bdApi_Route_PrefixApi_Posts', 'data_only');
     self::addRoute($routes, 'profile-posts', 'bdApi_Route_PrefixApi_ProfilePosts', 'data_only');
     self::addRoute($routes, 'tags', 'bdApi_Route_PrefixApi_Tags');
     self::addRoute($routes, 'threads', 'bdApi_Route_PrefixApi_Threads', 'data_only');
     self::addRoute($routes, 'users', 'bdApi_Route_PrefixApi_Users', 'data_only');
     self::addRoute($routes, 'search', 'bdApi_Route_PrefixApi_Search', 'data_only');
     self::addRoute($routes, 'assets', 'bdApi_Route_PrefixApi_Assets');
     self::addRoute($routes, 'batch', 'bdApi_Route_PrefixApi_Batch');
     self::addRoute($routes, 'subscriptions', 'bdApi_Route_PrefixApi_Subscriptions');
     self::addRoute($routes, 'tools', 'bdApi_Route_PrefixApi_Tools');
     // backward compatibility
     self::addRoute($routes, 'all-threads', 'bdApi_Route_PrefixApi_Threads');
     XenForo_CodeEvent::fire('api_setup_routes', array(&$routes));
 }
开发者ID:billyprice1,项目名称:bdApi,代码行数:32,代码来源:PrefixApi.php

示例2: _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'));
 }
开发者ID:Sywooch,项目名称:forums,代码行数:14,代码来源:Index.php

示例3: __construct

 public function __construct()
 {
     $renderers = array();
     $this->_registerDefaultRenderers($renderers);
     XenForo_CodeEvent::fire('widget_framework_ready', array(&$renderers));
     foreach ($renderers as $renderer) {
         $this->_renderers[] = $renderer;
     }
 }
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:9,代码来源:Core.php

示例4: _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);
             }
         });
     }
 }
开发者ID:Hornwitser,项目名称:DiscordAuthorizer,代码行数:14,代码来源:User.php

示例5: init_dependencies

 public static function init_dependencies(XenForo_Dependencies_Abstract $dependencies, array $data)
 {
     if ($dependencies instanceof XenForo_Dependencies_Public and ChipXF_MobileSwitcher_Detecter::isMobile()) {
         foreach ($data['codeEventListeners'] as $event => &$callbackList) {
             foreach ($callbackList as $key => $callback) {
                 if (in_array($callback[0], XenForo_Application::get('options')->ChipXF_MS_AddonsDisabled)) {
                     unset($data['codeEventListeners'][$event][$key]);
                 }
             }
         }
         XenForo_CodeEvent::removeListeners();
         XenForo_CodeEvent::setListeners($data['codeEventListeners']);
         ChipXF_MobileSwitcher_Detecter::$isMobile = true;
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:15,代码来源:Listener.php

示例6: renderTree

 public function renderTree(array $tree, array $extraStates = array())
 {
     if (XenForo_Application::get('options')->get('Bbm_PreCache_Enable')) {
         if (!empty($extraStates['bbmPreCacheInit']) && !$this->_bbmPreCacheDone) {
             parent::renderTree($tree, $extraStates);
             unset($extraStates['bbmPreCacheInit']);
             XenForo_CodeEvent::fire('bbm_callback_precache', array(&$this->_bbmPreCache, &$extraStates, 'wysiwyg'));
             XenForo_Application::set('bbm_preCache_wysiwyg', array($this->_bbmPreCache, $extraStates));
             $this->_bbmPreCacheDone = true;
             return '';
         }
         if (XenForo_Application::isRegistered('bbm_preCache_wysiwyg')) {
             list($_bbmPreCache, $_extraStates) = XenForo_Application::get('bbm_preCache_wysiwyg');
             $this->_bbmPreCache = $_bbmPreCache;
             $extraStates['bbmPreCacheComplete'] = true;
             $extraStates += $_extraStates;
         }
     }
     return parent::renderTree($tree, $extraStates);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:20,代码来源:PreCacheWysiwyg.php

示例7: 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;
 }
开发者ID:ThemeHouse-XF,项目名称:NavigationTabs,代码行数:37,代码来源:NavigationTabs.php

示例8: controllerPostDispatch

 /**
  * Get the data and determine if we need to change the response code to 410.
  *
  * @param XenForo_Controller                        $controller
  * @param XenForo_ControllerResponse_Abstract|false $controllerResponse
  * @param string                                    $controllerName
  * @param string                                    $action
  *
  * @throws XenForo_Exception
  */
 public static final function controllerPostDispatch(XenForo_Controller $controller, $controllerResponse, $controllerName, $action)
 {
     if ($controller instanceof XenForo_ControllerPublic_Abstract && $controllerResponse instanceof XenForo_ControllerResponse_Error && $controllerResponse->responseCode == 404) {
         $data = array();
         XenForo_CodeEvent::fire('410_gone_data', array(&$data, $controller, $controllerName, $action));
         $table = $field = '';
         foreach ($data as $_controllerName => $info) {
             if ($_controllerName == $controllerName) {
                 list($table, $field) = $info;
                 break;
             }
         }
         if (($id = $controller->getInput()->filterSingle($field, XenForo_Input::UINT)) && $table && $field) {
             $db = XenForo_Application::getDb();
             try {
                 if (!$db->fetchOne("SELECT {$field} FROM {$table} WHERE {$field} = ?", $id) && $db->fetchOne("SELECT COUNT(*) FROM {$table} WHERE {$field} > ?", $id) > 0) {
                     $controllerResponse->responseCode = 410;
                 }
             } catch (Throwable $e) {
                 XenForo_Error::logException($e, false, "410 Query Failed (Field: {$field}, Table: {$table}): ");
             }
         }
     }
 }
开发者ID:liamwli,项目名称:410Gone,代码行数:34,代码来源:Listener.php

示例9: mediaMatchesCriteria

 /**
  * Determines if the given media matches the criteria.
  *
  * @param array|string $criteria List of criteria, format: [] with keys rule
  * and data; may be serialized
  * @param boolean $matchOnEmpty If true and there's no criteria, true is
  * returned; otherwise, false
  * @param array $media
  *
  * @return boolean
  */
 public static function mediaMatchesCriteria($criteria, $matchOnEmpty = false, array $media)
 {
     if (!($criteria = XenForo_Helper_Criteria::unserializeCriteria($criteria))) {
         return (bool) $matchOnEmpty;
     }
     foreach ($criteria as $criterion) {
         $data = $criterion['data'];
         switch ($criterion['rule']) {
             case 'categories':
                 if (!isset($media['category_id'])) {
                     return false;
                 }
                 if (empty($data['category_ids'])) {
                     return false;
                 }
                 if (!in_array($media['category_id'], $data['category_ids'])) {
                     return false;
                 }
                 break;
             default:
                 $eventReturnValue = false;
                 XenForo_CodeEvent::fire('criteria_xengallery_media', array($criterion['rule'], $data, $media, &$eventReturnValue));
                 if ($eventReturnValue === false) {
                     return false;
                 }
         }
     }
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:40,代码来源:Criteria.php

示例10: _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');
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:9,代码来源:20150212.php

示例11: setup

 /**
  * Setup the visitor singleton.
  *
  * @param integer $userId User ID to setup as
  * @param array $options
  *
  * @return XenForo_Visitor
  */
 public static function setup($userId, array $options = array())
 {
     $userId = intval($userId);
     $options = array_merge(array('languageId' => 0, 'permissionUserId' => 0), $options);
     /* @var $userModel XenForo_Model_User */
     $userModel = XenForo_Model::create('XenForo_Model_User');
     $class = XenForo_Application::resolveDynamicClass('XenForo_Visitor');
     $object = new $class();
     if ($userId && ($user = $userModel->getVisitingUserById($userId))) {
         if ($user['is_admin']) {
             if ($options['permissionUserId']) {
                 // force permissions for testing
                 $user = $userModel->setPermissionsFromUserId($user, $options['permissionUserId']);
             }
             if ($options['languageId']) {
                 $user['admin_language_id'] = $user['language_id'] = $options['languageId'];
             }
         }
         $object->_user = $user;
     } else {
         $object->_user = $userModel->getVisitingGuestUser();
         if ($options['languageId']) {
             $object->_user['language_id'] = $options['languageId'];
         }
     }
     $object->_user = $userModel->prepareUser($object->_user);
     $object->_user['referer'] = !empty($options['referer']) ? $options['referer'] : null;
     $object->_user['from_search'] = !empty($options['fromSearch']);
     if (!empty($object->_user['ignored'])) {
         $ignored = XenForo_Helper_Php::safeUnserialize($object->_user['ignored']);
         $object->_user['ignoredUsers'] = $ignored;
     } else {
         $object->_user['ignoredUsers'] = array();
     }
     if (!$object->_user['global_permission_cache']) {
         // force a rebuild if we don't have the perm cache
         $perms = XenForo_Model::create('XenForo_Model_Permission')->rebuildPermissionCombinationById($object->_user['permission_combination_id']);
         $object->_user['permissions'] = $perms ? $perms : array();
     } else {
         $object->_user['permissions'] = XenForo_Permission::unserializePermissions($object->_user['global_permission_cache']);
     }
     $object->setVisitorLanguage($object->_user['language_id']);
     XenForo_Locale::setDefaultTimeZone($object->_user['timezone']);
     self::$_instance = $object;
     self::$_setupOptions = $options;
     XenForo_CodeEvent::fire('visitor_setup', array(&self::$_instance));
     return self::$_instance;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:56,代码来源:Visitor.php

示例12: _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')) {
//.........这里部分代码省略.........
开发者ID:Sywooch,项目名称:forums,代码行数:101,代码来源:20140326.php

示例13: export

 public function export($overwrite = false)
 {
     if (!$this->_addOnId) {
         throw new XenForo_Exception('Please specify an add-on id.');
     }
     $filename = str_replace('_', '/', $this->_className) . '.php';
     $existingContents = '';
     $fullFilename = XenForo_Autoloader::getInstance()->getRootDir() . '/' . $filename;
     if (file_exists($fullFilename)) {
         $existingContents = file_get_contents($fullFilename);
         $existingContentsArray = preg_split('/(\\r\\n|\\n|\\r)/', $existingContents);
         foreach ($existingContentsArray as $key => $value) {
             if (rtrim($value) != $value) {
                 $existingContentsArray[$key] = rtrim($value);
             }
         }
         $existingContents = implode("\n", $existingContentsArray);
         $existingContents = str_replace("\t", '	', $existingContents);
         file_put_contents($fullFilename, $existingContents);
         $existingPhpFile = self::createFromContents($this->_className, $existingContents);
     } else {
         if (!file_exists(dirname($fullFilename))) {
             XenForo_Helper_File::createDirectory(dirname($fullFilename));
         }
         $existingPhpFile = self::createFromContents($this->_className);
     }
     $contents = $this->getHeader();
     $this->mergeConstants($existingPhpFile->getConstants());
     if (isset($this->_constants) && !empty($this->_constants)) {
         foreach ($this->_constants as $constantName => $constant) {
             $contents .= $constant->getPhpDocAsString();
             $contents .= "\n\t";
             $contents .= 'const ' . $constant->getConstantName() . ' = ' . $constant->getValue() . ';' . "\n";
         }
     }
     $this->mergeVariables($existingPhpFile->getVariables());
     if (isset($this->_variables) && !empty($this->_variables)) {
         /* @var $variable ThemeHouse_PhpFile_Variable */
         foreach ($this->_variables as $variableName => $variable) {
             $contents .= $variable->getPhpDocAsString();
             $contents .= "\n\t";
             $contents .= $variable->getFullSignatureAsString() . ' = ' . $variable->getValue() . ';' . "\n";
         }
     }
     $this->mergeFunctions($existingPhpFile->getFunctions());
     if (isset($this->_functions) && !empty($this->_functions)) {
         /* @var $function ThemeHouse_PhpFile_Function */
         foreach ($this->_functions as $functionName => $function) {
             $contents .= $function->getPhpDocAsString();
             $contents .= "\n\t";
             $contents .= $function->getFullSignatureAsString();
             $contents .= "\n\t{";
             $contents .= $function->getBodyAsString();
             $contents .= "\n\t}\n";
         }
     }
     $contents .= "}";
     $export = XenForo_CodeEvent::fire('phpfile_export_th', array(&$filename, &$contents, $existingContents, $overwrite, $this->_addOnId));
     if ($export) {
         if (!file_exists(dirname(XenForo_AutoLoader::getInstance()->getRootDir() . '/' . $filename))) {
             mkdir(dirname(XenForo_AutoLoader::getInstance()->getRootDir() . '/' . $filename), 0, true);
         }
         file_put_contents(XenForo_AutoLoader::getInstance()->getRootDir() . '/' . $filename, $contents);
     }
 }
开发者ID:ThemeHouse-XF,项目名称:Reflection,代码行数:65,代码来源:20150123.php

示例14: resolveDynamicClass

 /**
  * Resolves dynamic, run time inheritance for the specified class.
  * The classes to be loaded for this base class are grabbed via the event.
  * These classes must inherit from from XFCP_x, which is a non-existant
  * class that is dynamically created, inheriting from the correct class
  * as needed.
  *
  * If a fake base is needed when the base class doesn't exist, and there
  * are no classes extending it, false will still be returned! This prevents
  * an unnecessary eval.
  *
  * @param string $class Name of class
  * @param string $type Type of class (for determining event to fire)
  * @param string|false $fakeBase If the specified class doesn't exist, an alternative base can be specified
  *
  * @return false|string False or name of class to instantiate
  */
 public static function resolveDynamicClass($class, $type, $fakeBase = false)
 {
     if (!XenForo_Application::autoload($class)) {
         if ($fakeBase) {
             $fakeNeeded = true;
         } else {
             return false;
         }
     } else {
         $fakeNeeded = false;
     }
     if (!empty(self::$_classCache[$class])) {
         return self::$_classCache[$class];
     }
     $createClass = $class;
     $extend = array();
     XenForo_CodeEvent::fire('load_class_' . $type, array($class, &$extend));
     if ($fakeNeeded) {
         if (!$extend) {
             return false;
         }
         eval('class ' . $class . ' extends ' . $fakeBase . ' {}');
     }
     if ($extend) {
         try {
             foreach ($extend as $dynamicClass) {
                 // XenForo Class Proxy, in case you're wondering
                 $proxyClass = 'XFCP_' . $dynamicClass;
                 eval('class ' . $proxyClass . ' extends ' . $createClass . ' {}');
                 XenForo_Application::autoload($dynamicClass);
                 $createClass = $dynamicClass;
             }
         } catch (Exception $e) {
             self::$_classCache[$class] = $class;
             throw $e;
         }
     }
     self::$_classCache[$class] = $createClass;
     return $createClass;
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:57,代码来源:Application.php

示例15: _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;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:71,代码来源:20150212.php


注:本文中的XenForo_CodeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。