本文整理汇总了PHP中XenForo_Application::get方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::get方法的具体用法?PHP XenForo_Application::get怎么用?PHP XenForo_Application::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getXfOptions
public static function getXfOptions()
{
if (is_null(self::$xfOptions)) {
self::$xfOptions = XenForo_Application::get('options');
}
return self::$xfOptions;
}
示例2: getActiveRoutes
public function getActiveRoutes()
{
if ($this->routes != null) {
return $this->routes;
}
$routes = trim(XenForo_Application::get('options')->dark_azucloud_routes);
$routes = explode("\n", str_replace("\r", "", $routes));
$routes_extra = array();
foreach ($routes as $key => &$route) {
$route = trim($route);
if ($route == '') {
unset($routes[$key]);
continue;
}
// stick in a slash if there isn't already, otherwise remove it and keep existing either way
if (substr($route, -1) == '/') {
$routes_extra[] = substr($route, 0, strlen($route) - 1);
} else {
$routes_extra[] = $route . '/';
}
}
$routes = array_merge($routes, $routes_extra);
$this->routes = $routes;
return $routes;
}
示例3: runSyncGroups
public static function runSyncGroups()
{
$QCDB = WebSync_Database_Core::getQuartzcoreDatabase();
$options = XenForo_Application::get('options');
$userModel = XenForo_Model::create('XenForo_Model_User');
$userFieldModel = XenForo_Model::create('XenForo_Model_UserField');
if ($options->syncGroups) {
$fetchOptions = array('validOnly' => true);
$users = $userModel->getAllUsers($fetchOptions);
foreach ($users as $user) {
$hasUpdated = false;
$coreId = $userFieldModel->getUserFieldValues($user['user_id'])['CoreID'];
$secondaryGroups = $user['secondary_group_ids'];
$groups_raw = file_get_contents($options->restApiUrl . 'group.php?action=getAllGroups');
$groups = json_decode($groups_raw, true);
while ($groupId = mysqli_fetch_array($groups)) {
$group_raw = file_get_contents($options->restApiUrl . 'group.php?action=getGroup&id=' . $groupId);
$group = json_decode($group_raw);
foreach ($userGroups as $userGroup) {
if ($userGroup == $group['site_group_id']) {
$player_raw = file_get_contents($options->restApiUrl . 'player.php?action=updatePlayer&id=' . $coreId . '&primaryGroupID=' . $group['id'] . '&apikey=07af7e75676eab410d1f83937d7afb62');
$player = json_decode($player_raw, true);
$hasUpdated = $player['hasUpdated'];
}
}
}
if ($hasUpdated == false) {
$player_raw = file_get_contents($options->restApiUrl . 'player.php?action=updatePlayer&id=' . $coreId . '&primaryGroupID=2&apikey=07af7e75676eab410d1f83937d7afb62');
$player = json_decode($player_raw, true);
$hasUpdated = $player['hasUpdated'];
}
}
}
}
示例4: actionFeatured
public function actionFeatured()
{
$parent = parent::actionFeatured();
$options = XenForo_Application::get('options');
$rmEnabled = $options->dailystats_rm_enable;
$scEnabled = $options->dailystats_sc_enable;
$xfmgEnabled = $options->dailystats_xfmg_enable;
$DailyStatsModel = $this->_getDailyStatsModel();
$DS_totalUsers = XenForo_Model::create('XenForo_Model_DataRegistry')->get('DS_totalUsers');
$DS_totalPosts = XenForo_Model::create('XenForo_Model_DataRegistry')->get('DS_totalPosts');
$DS_totalThreads = XenForo_Model::create('XenForo_Model_DataRegistry')->get('DS_totalThreads');
$parent->params['DS_totalUsers'] = $DS_totalUsers;
$parent->params['DS_totalPosts'] = $DS_totalPosts;
$parent->params['DS_totalThreads'] = $DS_totalThreads;
//Check if RM option is enabled
switch ($rmEnabled) {
case '1':
$DS_totalResource = XenForo_Model::create('XenForo_Model_DataRegistry')->get('DS_totalResource');
$parent->params['DS_totalResource'] = $DS_totalResource;
break;
}
//Check if Showcase option is enabled
switch ($scEnabled) {
case '1':
$DS_totalShowcase = XenForo_Model::create('XenForo_Model_DataRegistry')->get('DS_totalShowcase');
$parent->params['DS_totalShowcase'] = $DS_totalShowcase;
break;
}
return $parent;
}
示例5: buildLink
/**
*
* @see XenForo_Route_Prefix_Forums::buildLink()
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
if (isset($data['social_forum_id'])) {
if (ThemeHouse_SocialGroups_SocialForum::hasInstance()) {
$socialForum = ThemeHouse_SocialGroups_SocialForum::getInstance()->toArray();
} else {
$socialForum = $data;
}
$class = XenForo_Application::resolveDynamicClass('ThemeHouse_SocialGroups_Route_Prefix_SocialForums', 'route_prefix');
$router = new $class();
$link = $router->buildLink('social-forums', 'social-forums', $action, $extension, $socialForum, $extraParams);
if (XenForo_Application::isRegistered('routeFiltersOut')) {
$routeFilters = XenForo_Application::get('routeFiltersOut');
if (isset($routeFilters['social-forums'])) {
foreach ($routeFilters['social-forums'] as $filter) {
if (array_key_exists('find_route', $filter) && array_key_exists('replace_route', $filter)) {
list($from, $to) = XenForo_Link::translateRouteFilterToRegex($filter['find_route'], $filter['replace_route']);
$newLink = preg_replace($from, $to, $link);
} else {
$newLink = $link;
}
if ($newLink != $link) {
$link = $newLink;
break;
}
}
}
}
return $link;
}
return parent::buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, $extraParams);
}
示例6: navigationTabs
public static function navigationTabs(&$extraTabs, $selectedTabId)
{
$options = XenForo_Application::get('options');
if (XenForo_Visitor::getInstance()->hasPermission('players', 'view') && $options->displayPlayersTab && $options->displayPlayers) {
$extraTabs['players'] = array('title' => new XenForo_Phrase('players'), 'href' => XenForo_Link::buildPublicLink('full:players'), 'position' => 'home', 'linksTemplate' => 'player_tab_links');
}
}
示例7: actionGetIndex
public function actionGetIndex()
{
$messageId = $this->_input->filterSingle('message_id', XenForo_Input::UINT);
if (!empty($messageId)) {
return $this->responseReroute(__CLASS__, 'single');
}
$conversationId = $this->_input->filterSingle('conversation_id', XenForo_Input::UINT);
if (empty($conversationId)) {
return $this->responseError(new XenForo_Phrase('bdapi_slash_conversation_messages_requires_conversation_id'), 400);
}
$conversation = $this->_getConversationOrError($conversationId);
$pageNavParams = array('conversation_id' => $conversation['conversation_id']);
$page = $this->_input->filterSingle('page', XenForo_Input::UINT);
$limit = XenForo_Application::get('options')->messagesPerPage;
$inputLimit = $this->_input->filterSingle('limit', XenForo_Input::UINT);
if (!empty($inputLimit)) {
$limit = $inputLimit;
$pageNavParams['limit'] = $inputLimit;
}
$fetchOptions = array('limit' => $limit, 'page' => $page);
$messages = $this->_getConversationModel()->getConversationMessages($conversation['conversation_id'], $this->_getConversationModel()->getFetchOptionsToPrepareApiDataForMessages($fetchOptions));
if (!$this->_isFieldExcluded('attachments')) {
$messages = $this->_getConversationModel()->getAndMergeAttachmentsIntoConversationMessages($messages);
}
$total = $conversation['reply_count'] + 1;
$data = array('messages' => $this->_filterDataMany($this->_getConversationModel()->prepareApiDataForMessages($messages, $conversation)), 'messages_total' => $total);
bdApi_Data_Helper_Core::addPageLinks($this->getInput(), $data, $limit, $total, $page, 'conversation-messages', array(), $pageNavParams);
return $this->responseData('bdApi_ViewApi_ConversationMessage_List', $data);
}
示例8: getThreadsWatchedByUser
/**
* Get the threads watched by a specific user.
*
* @param integer $userId
* @param boolean $newOnly If true, only gets unread threads.
* @param array $fetchOptions Thread fetch options (uses all valid for
* XenForo_Model_Thread).
*
* @return array Format: [thread_id] => info
*/
public function getThreadsWatchedByUser($userId, $newOnly, array $fetchOptions = array())
{
$fetchOptions['readUserId'] = $userId;
$fetchOptions['includeForumReadDate'] = true;
$joinOptions = $this->_getThreadModel()->prepareThreadFetchOptions($fetchOptions);
$limitOptions = $this->prepareLimitFetchOptions($fetchOptions);
if ($newOnly) {
$cutoff = XenForo_Application::$time - XenForo_Application::get('options')->readMarkingDataLifetime * 86400;
$newOnlyClause = '
AND thread.last_post_date > ' . $cutoff . '
AND thread.last_post_date > COALESCE(thread_read.thread_read_date, 0)
AND thread.last_post_date > COALESCE(forum_read.forum_read_date, 0)
';
} else {
$newOnlyClause = '';
}
return $this->fetchAllKeyed($this->limitQueryResults('
SELECT thread.*
' . $joinOptions['selectFields'] . '
FROM xf_forum_watch AS forum_watch
INNER JOIN xf_thread AS thread ON
(thread.node_id = forum_watch.node_id)
' . $joinOptions['joinTables'] . '
WHERE forum_watch.user_id = ?
AND thread.discussion_state = \'visible\'
' . $newOnlyClause . '
ORDER BY thread.last_post_date DESC
', $limitOptions['limit'], $limitOptions['offset']), 'thread_id', $userId);
}
示例9: renderCss
public function renderCss()
{
// re-implement XenForo_CssOutput::renderCss() so we can change how caching works
$cacheId = $this->getCacheId();
if ($cacheObject = XenForo_Application::getCache()) {
if ($cacheCss = $cacheObject->load($cacheId, true)) {
return $cacheCss . "\n/* CSS returned from cache. */";
}
}
$this->_prepareForOutput();
if (XenForo_Application::isRegistered('bbCode')) {
$bbCodeCache = XenForo_Application::get('bbCode');
} else {
$bbCodeCache = XenForo_Model::create('XenForo_Model_BbCode')->getBbCodeCache();
}
$params = array('displayStyles' => $this->_displayStyles, 'smilieSprites' => $this->_smilieSprites, 'customBbCodes' => !empty($bbCodeCache['bbCodes']) ? $bbCodeCache['bbCodes'] : array(), 'xenOptions' => XenForo_Application::get('options')->getOptions(), 'dir' => $this->_textDirection, 'pageIsRtl' => $this->_textDirection == 'RTL');
$templates = array();
foreach ($this->_cssRequested as $cssName) {
$cssName = trim($cssName);
if (!$cssName) {
continue;
}
$templateName = $cssName . '.css';
if (!isset($templates[$templateName])) {
$templates[$templateName] = new XenForo_Template_Public($templateName, $params);
}
}
$css = self::renderCssFromObjects($templates, XenForo_Application::debugMode());
$css = self::prepareCssForOutput($css, $this->_textDirection, XenForo_Application::get('options')->minifyCss && $cacheObject);
if ($cacheObject) {
$cacheObject->save($css, $cacheId, array(), 86400);
}
return $css;
}
示例10: convertEditorHtmlToBbCode
/**
* Converts WYSIWYG editor HTML back to BB code
*
* @param string $messageTextHtml HTML to convert
* @param XenForo_Input $input
* @param integer $htmlCharacterLimit Max length of HTML before processing; defaults to 4 * message length option
*
* @return string BB code input
*/
public function convertEditorHtmlToBbCode($messageTextHtml, XenForo_Input $input, $htmlCharacterLimit = -1)
{
if ($htmlCharacterLimit < 0) {
$htmlCharacterLimit = 4 * XenForo_Application::get('options')->messageMaxLength;
// quadruple the limit as HTML can be a lot more verbose
}
if ($htmlCharacterLimit && utf8_strlen($messageTextHtml) > $htmlCharacterLimit) {
throw new XenForo_Exception(new XenForo_Phrase('submitted_message_is_too_long_to_be_processed'), true);
}
$options = array();
$requestPaths = XenForo_Application::get('requestPaths');
$options['baseUrl'] = $requestPaths['fullBasePath'];
$relativeResolver = $input->filterSingle('_xfRelativeResolver', XenForo_Input::STRING);
if ($relativeResolver && isset($_SERVER['HTTP_USER_AGENT'])) {
if (preg_match('#Firefox/([0-9]+)\\.([0-9]+)\\.([0-9]+)#i', $_SERVER['HTTP_USER_AGENT'], $match)) {
// FF versions sometime before 3.6.12 have an issue with respecting the base tag of the editor,
// 3.6.8 is a known version that has problems
$useResolver = $match[1] <= 3 && $match[2] <= 6 && $match[3] <= 8;
} else {
$useResolver = false;
}
if ($useResolver) {
// take off query string and then up to the last directory
$relativeResolver = preg_replace('/\\?.*$/', '', $relativeResolver);
$relativeResolver = preg_replace('#/[^/]+$#', '', $relativeResolver);
$options['baseUrl'] = $relativeResolver;
}
}
$rendered = XenForo_Html_Renderer_BbCode::renderFromHtml($messageTextHtml, $options);
return trim(XenForo_Input::cleanString($rendered));
}
示例11: route
public static function route($class, array &$extend)
{
if (XenForo_Application::get('options')->EWRutiles_Sitemap_memberlist) {
switch ($class) {
case 'XenForo_Route_Prefix_Members':
$extend[] = 'EWRutiles_Sitemap_Route_Members';
break;
case 'XenForo_Route_Prefix_Online':
$extend[] = 'EWRutiles_Sitemap_Route_Online';
break;
case 'XenForo_Route_Prefix_ProfilePosts':
$extend[] = 'EWRutiles_Sitemap_Route_ProfilePosts';
break;
case 'XenForo_Route_Prefix_RecentActivity':
$extend[] = 'EWRutiles_Sitemap_Route_RecentActivity';
break;
case 'XenForo_Route_Prefix_SpamCleaner':
$extend[] = 'EWRutiles_Sitemap_Route_SpamCleaner';
break;
case 'XenForo_Route_Prefix_Warnings':
$extend[] = 'EWRutiles_Sitemap_Route_Warning';
break;
}
}
}
示例12: bakeBbmTags
public function bakeBbmTags()
{
$bbmTags = BBM_Helper_Bbm::getBbmBbCodes();
$activeAddons = XenForo_Application::isRegistered('addOns') ? XenForo_Application::get('addOns') : array();
$visitor = XenForo_Visitor::getInstance();
if (!is_array($bbmTags)) {
return false;
}
$allBbmTags = array();
foreach ($bbmTags as $bbm) {
if (!$bbm['active']) {
continue;
}
if (!empty($activeAddons) && !empty($bbm['bbcode_addon'])) {
if (!isset($activeAddons[$bbm['bbcode_addon']])) {
//Skip Bb Codes linked to an addon when this addon is disabled
continue;
}
}
$tagName = $bbm['tag'];
if (!empty($bbm['preParser'])) {
$this->addPreParserBbCode($tagName);
}
}
$this->_bbmTags = $allBbmTags;
/****
* XenForo Options - only need to call once the options
***/
$options = XenForo_Application::get('options');
if (!empty($options->Bbm_PreCache_XenTags)) {
foreach ($options->Bbm_PreCache_XenTags as $tagName) {
$this->addPreParserBbCode($tagName);
}
}
}
示例13: __construct
public function __construct()
{
$this->_db = XenForo_Application::get('db');
$this->_importModel = XenForo_Model::create('XenForo_Model_Import');
$this->_db->setProfiler(false);
// this causes lots of memory usage in debug mode, so stop that
}
示例14: actionIndex
public function actionIndex()
{
if (!XenForo_Visitor::getInstance()->hasPermission('form', 'viewFormsList')) {
throw $this->getErrorOrNoPermissionResponseException('do_not_have_permission');
}
$formModel = $this->_getFormModel();
$page = $this->_input->filterSingle('page', XenForo_Input::UINT);
$formsPerPage = XenForo_Application::get('options')->formsPerPage;
$visitor = XenForo_Visitor::getInstance();
$criteria = array('num_fields' => array(1, '>='), 'active' => 1, 'hide_from_list' => 0);
$fetchOptions = array('perPage' => $formsPerPage, 'page' => $page, 'numResponses' => true, 'numUserResponses' => true, 'permissionCombinationId' => $visitor['permission_combination_id']);
// sort by display order if custom
if (XenForo_Application::getOptions()->lpsfSortOrder == 'custom') {
$fetchOptions['order'] = 'display_order';
}
$forms = $formModel->getForms($criteria, $fetchOptions);
foreach ($forms as $formId => &$form) {
$form = $formModel->prepareForm($form);
if (!$formModel->canRespondToForm($form, $errorPhraseKey)) {
unset($forms[$formId]);
}
}
$viewParams = array('forms' => $forms, 'visibleForms' => count($forms), 'formsPerPage' => $formsPerPage, 'page' => $page, 'totalForms' => $formModel->countForms($criteria));
return $this->responseView('LiquidPro_SimpleForms_ViewPublic_Form_List', 'form_list', $viewParams);
}
示例15: logModeratorActionLocal
public function logModeratorActionLocal($contentType, array $content, $action, array $actionParams = array(), $parentContent = null, array $logUser = null)
{
$xenOptions = XenForo_Application::get('options');
if ($xenOptions->th_moderatorLog_splitMoveCopyPosts) {
$existingActions = array('post_copy_target_existing', 'post_move_target_existing');
$actions = array_merge($existingActions, array('post_copy_target', 'post_move_target'));
if (in_array($action, $actions)) {
$newAction = substr($action, strlen('post_'));
/* @var $postModel XenForo_Model_Post */
$postModel = $this->getModelFromCache('XenForo_Model_Post');
$posts = $postModel->getPostsByIds(explode(', ', $actionParams['ids']));
unset($actionParams['ids']);
$logId = false;
$i = 0;
foreach ($posts as $postId => $post) {
if ($i > 0 && !in_array($action, $existingActions)) {
$newAction = substr($newAction, 0, strlen('move_target'));
}
$actionParams['id'] = $postId;
$logId = $this->logModeratorActionLocal('post', $post, $newAction, $actionParams, $content, $logUser);
$i++;
}
return $logId;
}
}
return parent::logModeratorActionLocal($contentType, $content, $action, $actionParams, $parentContent, $logUser);
}