本文整理汇总了PHP中XenForo_CodeEvent类 的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_CodeEvent类的具体用法?PHP XenForo_CodeEvent怎么用?PHP XenForo_CodeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XenForo_CodeEvent类 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: run
/**
* Runs the request, handling from routing straight through to response output.
* Primary method to be used by the external API.
*
* @return string|null Returns a string if {@link $_sendResponse} is false
*/
public function run()
{
ob_start();
XenForo_Application::set('fc', $this);
$this->setup();
$this->setRequestPaths();
$showDebugOutput = $this->showDebugOutput();
$this->_dependencies->preLoadData();
XenForo_CodeEvent::fire('front_controller_pre_route', array($this));
$routeMatch = $this->route();
XenForo_CodeEvent::fire('front_controller_pre_dispatch', array($this, &$routeMatch));
$controllerResponse = $this->dispatch($routeMatch);
if (!$controllerResponse) {
XenForo_Error::noControllerResponse($routeMatch, $this->_request);
exit;
}
$viewRenderer = $this->_getViewRenderer($routeMatch->getResponseType());
if (!$viewRenderer) {
// note: should only happen if there's an error getting the default renderer, which should never happen :)
XenForo_Error::noViewRenderer($this->_request);
exit;
}
$containerParams = array('majorSection' => $routeMatch->getMajorSection(), 'minorSection' => $routeMatch->getMinorSection());
XenForo_CodeEvent::fire('front_controller_pre_view', array($this, &$controllerResponse, &$viewRenderer, &$containerParams));
$content = $this->renderView($controllerResponse, $viewRenderer, $containerParams);
if ($showDebugOutput) {
$content = $this->renderDebugOutput($content);
}
$bufferedContents = ob_get_contents();
ob_end_clean();
if ($bufferedContents !== '' && is_string($content)) {
if (preg_match('#<body[^>]*>#sU', $content, $match)) {
$content = str_replace($match[0], $match[0] . $bufferedContents, $content);
} else {
$content = $bufferedContents . $content;
}
}
XenForo_CodeEvent::fire('front_controller_post_view', array($this, &$content));
if ($this->_sendResponse) {
$headers = $this->_response->getHeaders();
$isText = false;
foreach ($headers as $header) {
if ($header['name'] == 'Content-Type') {
if (strpos($header['value'], 'text/') === 0) {
$isText = true;
}
break;
}
}
if ($isText && is_string($content) && $content) {
$extraHeaders = XenForo_Application::gzipContentIfSupported($content);
foreach ($extraHeaders as $extraHeader) {
$this->_response->setHeader($extraHeader[0], $extraHeader[1], $extraHeader[2]);
}
}
if (is_string($content) && $content && !ob_get_level() && XenForo_Application::get('config')->enableContentLength) {
if ($this->_response->getHttpResponseCode() >= 400 && strpos($this->_request->getServer('HTTP_USER_AGENT', ''), 'IEMobile') !== false) {
// Windows mobile bug - 400+ errors cause the standard browser error
// to be output if a content length is sent. ...Err, what?
} else {
$this->_response->setHeader('Content-Length', strlen($content), true);
}
}
$this->_response->sendHeaders();
if ($content instanceof XenForo_FileOutput) {
$content->output();
} else {
echo $content;
}
} else {
return $content;
}
}
开发者ID:VoDongMy, 项目名称:xenforo-laravel5.1, 代码行数:79, 代码来源:FrontController.php
示例17: preLoadData
/**
* Pre-loads globally required data for the system.
*/
public function preLoadData()
{
$required = array_merge(array('options', 'languages', 'contentTypes', 'codeEventListeners', 'deferredRun', 'simpleCache', 'addOns', 'defaultStyleProperties', 'routeFiltersIn', 'routeFiltersOut'), $this->_dataPreLoadFromRegistry);
$dr = new XenForo_Model_DataRegistry();
// this is a slight hack to prevent the class from being cached
$data = $dr->getMulti($required);
if (XenForo_Application::get('config')->enableListeners) {
if (!is_array($data['codeEventListeners'])) {
$data['codeEventListeners'] = XenForo_Model::create('XenForo_Model_CodeEvent')->rebuildEventListenerCache();
}
XenForo_CodeEvent::setListeners($data['codeEventListeners']);
}
if (!is_array($data['options'])) {
$data['options'] = XenForo_Model::create('XenForo_Model_Option')->rebuildOptionCache();
}
$options = new XenForo_Options($data['options']);
XenForo_Application::setDefaultsFromOptions($options);
XenForo_Application::set('options', $options);
if (!is_array($data['languages'])) {
$data['languages'] = XenForo_Model::create('XenForo_Model_Language')->rebuildLanguageCache();
}
XenForo_Application::set('languages', $data['languages']);
if (!is_array($data['defaultStyleProperties'])) {
$data['defaultStyleProperties'] = XenForo_Model::create('XenForo_Model_StyleProperty')->rebuildPropertyCacheInStyleAndChildren(0, true);
}
XenForo_Application::set('defaultStyleProperties', $data['defaultStyleProperties']);
if (!is_array($data['contentTypes'])) {
$data['contentTypes'] = XenForo_Model::create('XenForo_Model_ContentType')->rebuildContentTypeCache();
}
XenForo_Application::set('contentTypes', $data['contentTypes']);
if (!is_int($data['deferredRun'])) {
$data['deferredRun'] = XenForo_Model::create('XenForo_Model_Deferred')->updateNextDeferredTime();
}
XenForo_Application::set('deferredRun', $data['deferredRun']);
if (!is_array($data['addOns'])) {
$data['addOns'] = XenForo_Model::create('XenForo_Model_AddOn')->rebuildActiveAddOnCache();
}
XenForo_Application::set('addOns', $data['addOns']);
if (!is_array($data['simpleCache'])) {
$data['simpleCache'] = array();
XenForo_Model::create('XenForo_Model_DataRegistry')->set('simpleCache', $data['simpleCache']);
}
XenForo_Application::set('simpleCache', $data['simpleCache']);
if (!is_array($data['routeFiltersIn']) || !is_array($data['routeFiltersOut'])) {
$filterCache = XenForo_Model::create('XenForo_Model_RouteFilter')->rebuildRouteFilterCache();
$data['routeFiltersIn'] = $filterCache['in'];
$data['routeFiltersOut'] = $filterCache['out'];
}
XenForo_Application::set('routeFiltersIn', $data['routeFiltersIn']);
XenForo_Application::set('routeFiltersOut', $data['routeFiltersOut']);
XenForo_Link::setRouteFiltersOut($data['routeFiltersOut']);
$this->_handleCustomPreloadedData($data);
XenForo_CodeEvent::fire('init_dependencies', array($this, $data));
}
开发者ID:VoDongMy, 项目名称:xenforo-laravel5.1, 代码行数:57, 代码来源:Abstract.php
示例18: _disableListeners
protected function _disableListeners()
{
if (isset($this->_data['addon_id'])) {
$this->_db->query('
UPDATE xf_addon SET active = 0
WHERE addon_id = ?
', $this->_data['addon_id']);
$cache = $this->getModelFromCache('XenForo_Model_CodeEvent')->rebuildEventListenerCache();
XenForo_CodeEvent::setListeners($cache, false);
}
}
开发者ID:Sywooch, 项目名称:forums, 代码行数:11, 代码来源:20150107.php
示例19: 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 (!$class) {
return 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', array($class, &$extend), $class);
if ($type) {
XenForo_CodeEvent::fire('load_class_' . $type, array($class, &$extend), $class);
}
if ($fakeNeeded) {
if (!$extend) {
return false;
}
eval('class ' . $class . ' extends ' . $fakeBase . ' {}');
}
if ($extend) {
try {
foreach ($extend as $dynamicClass) {
if (preg_match('/[;,$\\/#"\'\\.()]/', $dynamicClass)) {
continue;
}
// XenForo Class Proxy, in case you're wondering
$proxyClass = 'XFCP_' . $dynamicClass;
$namespaceEval = '';
$nsSplit = strrpos($dynamicClass, '\\');
if ($nsSplit !== false && ($ns = substr($dynamicClass, 0, $nsSplit))) {
$namespaceEval = "namespace {$ns}; ";
$proxyClass = 'XFCP_' . substr($dynamicClass, $nsSplit + 1);
$createClass = '\\' . $createClass;
}
eval($namespaceEval . '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:VoDongMy, 项目名称:xenforo-laravel5.1, 代码行数:73, 代码来源:Application.php
示例20: _fetchDisabledInstallerWaindigoListeners
dphi-official/Machine_Learning_Bootcamp
阅读:1364| 2022-08-18
juven/maven-bash-completion: Maven Bash Auto Completion
阅读:823| 2022-08-16
win7系统电脑使用过程中有不少朋友表示遇到过win7系统注册表编辑器打开的状况,当出现
阅读:764| 2022-11-06
Use After Free in GitHub repository vim/vim prior to 9.0.0046.
阅读:597| 2022-07-29
route101/mastoinker: Quick image view assistant for Mastodon client
阅读:926| 2022-08-18
rootnroll/library: Playgrounds library
阅读:616| 2022-08-15
0e0w · GitHub
阅读:430| 2022-08-15
tgreyuk/typedoc-plugin-markdown: A plugin for TypeDoc that enables TypeScript AP
阅读:765| 2022-08-18
台湾人的方言是“台湾话”,官方是“国语”,和普通话一样。小编一直觉得,大连话和台
阅读:315| 2022-11-06
juankysoriano/MaterialLife: A Material Design styled Game of Life for Android
阅读:341| 2022-08-17
请发表评论