本文整理汇总了PHP中XenForo_Application::getSimpleCacheData方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::getSimpleCacheData方法的具体用法?PHP XenForo_Application::getSimpleCacheData怎么用?PHP XenForo_Application::getSimpleCacheData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::getSimpleCacheData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStatusArray
public static function getStatusArray() {
$db = XenForo_Application::get('db');
$userModel = new Xenforo_Model_User;
$options = XenForo_Application::get('options');
$numStatusShown = $options->RCBDRecentStatusNumView;
$showComments = $options->RCBDRecentStatusShowComments;
$onePerUser = $options->RCBDRecentStatusOnePerUser;
$data = XenForo_Application::getSimpleCacheData("RCBDRecentStatus_status_array");
if (!$data) {
if ($onePerUser == 1) {
$statusArray = $db->fetchAll($db->limit("SELECT * FROM (SELECT * FROM xf_profile_post WHERE message_state <> 'deleted' AND profile_user_id = user_id ORDER BY post_date DESC) t1 GROUP BY t1.user_id ORDER BY post_date DESC", $numStatusShown));
$statusArray = array_sort($statusArray, "post_date");
} else {
$statusArray = $db->fetchAll($db->limit("SELECT * FROM xf_profile_post WHERE profile_user_id = user_id AND message_state <> 'deleted' ORDER BY post_date DESC", $numStatusShown));
}
XenForo_Application::setSimpleCacheData("RCBDRecentStatus_status_array", $statusArray);
} else {
$statusArray = $data;
}
$recentStatus = array();
$postIds = array();
if (sizeof($statusArray) == 0) {
$statusArray = array(0 => array("profile_post_id" => 0, "user_id" => 1, "post_date" => time(), "message" => "No status entries yet, be the first!"));
}
foreach ($statusArray as $status) {
$postIds[] = $status['profile_post_id'];
}
$commentsArray = array();
$commentsSortedArray = array();
if ($showComments == 1) {
$matches = implode(',', $postIds);
$data = XenForo_Application::getSimpleCacheData("RCBDRecentStatus_comments_array");
if (!$data) {
$commentsArray = $db->fetchAll($db->limit("SELECT * FROM xf_profile_post_comment WHERE profile_post_id in(" . $matches . ") ORDER BY profile_post_id DESC, comment_date", $numStatusShown));
XenForo_Application::setSimpleCacheData("RCBDRecentStatus_comments_array", $commentsArray);
} else {
$commentsArray = $data;
}
$commentsUserObjs = getUserData($commentsArray);
$currentPostId = -99;
$commentGroup = array();
foreach ($commentsArray as $status) {
if ($currentPostId != $status['profile_post_id']) {
if ($currentPostId != -99) {
$commentsSortedArray[$currentPostId] = $commentGroup;
$commentGroup = array();
}
$currentPostId = $status['profile_post_id'];
}
$commentGroup[] = array("user" => $commentsUserObjs[$status['user_id']], "status" => $status['message'], "time" => $status['comment_date'], "post_id" => $status['profile_post_id']);
}
$commentsSortedArray[$currentPostId] = $commentGroup;
}
$statusUserObjs = getUserData($statusArray);
foreach ($statusArray as $status) {
$recentStatus[] = array("user" => $statusUserObjs[$status['user_id']], "status" => $status['message'], "time" => $status['post_date'], "post_id" => $status['profile_post_id']);
}
$returnArrays = array("status" => $recentStatus, "comments" => $commentsSortedArray);
return $returnArrays;
}
示例2: _bakeProtectedTags
public function _bakeProtectedTags()
{
$bbmCached = XenForo_Application::getSimpleCacheData('bbm_active');
$visitor = XenForo_Visitor::getInstance();
if (!is_array($bbmCached) || !isset($bbmCached['protected']) || !is_array($bbmCached['protected']) || empty($bbmCached['protected'])) {
return false;
}
$allProtectedTags = array();
$protectedTags = $bbmCached['protected'];
if ($this->_checkVisitorPerms == true) {
$visitorUserGroupIds = array_merge(array((string) $visitor['user_group_id']), explode(',', $visitor['secondary_group_ids']));
}
foreach ($protectedTags as $tag => $perms) {
if ($this->_checkVisitorPerms == true && array_intersect($visitorUserGroupIds, $perms)) {
continue;
}
$allProtectedTags[$tag] = array('callback' => $this->_generalTagCallback);
}
/*XenForo protected tags check*/
$xenProtectedTags = array('attach', 'email', 'img', 'media', 'url');
foreach ($xenProtectedTags as $tagName) {
$permKey = "bbm_hide_{$tagName}";
if ($visitor->hasPermission('bbm_bbcodes_grp', $permKey)) {
$allProtectedTags[$tagName] = array('callback' => $this->_generalTagCallback);
}
}
$this->_protectedTags = $allProtectedTags;
}
示例3: removeCopyrightNotice
/**
*
* @param array $matches
* @return string
*/
public static function removeCopyrightNotice(array $matches)
{
$copyrightModification = XenForo_Application::getSimpleCacheData(parent::COPYRIGHT_MODIFICATION_SIMPLE_CACHE_KEY);
if ($copyrightModification < XenForo_Application::$time) {
XenForo_Application::setSimpleCacheData(parent::COPYRIGHT_MODIFICATION_SIMPLE_CACHE_KEY, XenForo_Application::$time);
}
return $matches[0];
}
示例4: getChildNodes
public static function getChildNodes()
{
$childNodes = XenForo_Application::getSimpleCacheData(self::SIMPLE_CACHE_CHILD_NODES);
if ($childNodes === false) {
return self::rebuildChildNodesCache();
}
return $childNodes;
}
示例5: _getFromCache
protected function _getFromCache()
{
list($cachedValue, $time) = XenForo_Application::getSimpleCacheData(self::CACHE_KEY);
if (!$cachedValue) {
return array(0, 0);
} else {
return array($cachedValue, $time);
}
}
示例6: getAllCachedCollections
public function getAllCachedCollections()
{
$collections = XenForo_Application::getSimpleCacheData(self::$allCacheKey);
if (!$collections) {
$collections = $this->getCollections();
XenForo_Application::setSimpleCacheData(self::$allCacheKey, $collections);
}
return $collections;
}
示例7: getModule
public function getModule()
{
$boardTotals = $this->getModelFromCache('XenForo_Model_DataRegistry')->get('boardTotals');
if (!$boardTotals) {
$boardTotals = $this->getModelFromCache('XenForo_Model_Counters')->rebuildBoardTotalsCounter();
}
$boardTotals['most_users'] = XenForo_Application::getSimpleCacheData('EWRporta_MostUsers');
return $boardTotals;
}
示例8: getAllCachedFields
public function getAllCachedFields()
{
$fields = XenForo_Application::getSimpleCacheData(self::$allCacheKey);
if (!$fields) {
$fields = $this->getFields();
XenForo_Application::setSimpleCacheData(self::$allCacheKey, $fields);
}
return $fields;
}
示例9: rebuildUserBannerGroupCache
public function rebuildUserBannerGroupCache()
{
$userBannerGroups = $this->getUserBannerGroups();
if ($userBannerGroups) {
XenForo_Application::setSimpleCacheData('th_userBannerGroups', $userBannerGroups);
} elseif (XenForo_Application::getSimpleCacheData('th_userBannerGroups')) {
XenForo_Application::setSimpleCacheData('th_userBannerGroups', false);
}
return $userBannerGroups;
}
示例10: getAllCachedCategories
public function getAllCachedCategories()
{
$categories = XenForo_Application::getSimpleCacheData(self::$allCacheKey);
if (!$categories) {
$categories = $this->getCategories(array(), array('order' => 'lft'));
XenForo_Application::setSimpleCacheData(self::$allCacheKey, $categories);
}
$categories = $this->prepareCategories($categories);
return $categories;
}
示例11: getGroupsCached
public function getGroupsCached()
{
if (!$this->_groupCached) {
$this->_groupCached = XenForo_Application::getSimpleCacheData(TEAM_DATAREGISTRY_KEY);
if (!$this->_groupCached) {
$this->_groupCached = $this->saveGroupPermDataCache();
}
}
return $this->_groupCached;
}
示例12: template_hook
public static function template_hook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
$options = XenForo_Application::get('options');
$enableadvxenforo = $options->enableadvxenforo;
$thread_id = $hookParams['thread']['thread_id'];
if ($enableadvxenforo) {
$PermissionEnable = XenForo_Visitor::getInstance()->hasPermission('adv_xenforo', 'adv_xenforo_enable_adv') ? TRUE : FALSE;
if ($hookName == 'account_preferences_options' && $PermissionEnable) {
$ourTemplate = $template->create('adv_xenforo_account_options', $template->getparams());
$rendered = $ourTemplate->render();
$contents = $contents . $rendered;
}
$hasPermission = XenForo_Visitor::getInstance()->hasPermission('adv_xenforo', 'adv_xenforo_show') ? TRUE : FALSE;
$advs = XenForo_Application::getSimpleCacheData('adv_xenforo');
$user = XenForo_Visitor::getInstance()->toArray();
$enable_adv = $PermissionEnable === TRUE ? $user['enable_adv'] : TRUE;
$containerData = self::$containerData;
if (empty(self::$containerData)) {
$containerData = XenForo_Template_Public::getExtraContainerData();
}
if ($enable_adv) {
if ($hasPermission === TRUE && $advs["AdvsHook"]) {
$isMobile = XenForo_Visitor::isBrowsingWith('mobile');
switch (TRUE) {
case $isMobile == TRUE:
$adv_adv = 'adv_small';
break;
default:
$adv_adv = 'adv_large';
break;
}
foreach ($advs["AdvsHook"] as $_asv) {
if ($_asv['active'] && XenForo_Helper_Criteria::userMatchesCriteria($_asv['user_criteria'], TRUE, $user) && XenForo_Helper_Criteria::pageMatchesCriteria($_asv['page_criteria'], TRUE, $template->getParams(), $containerData)) {
$ourTemplate = $template->create('ads_xf_ar_xenforo', array('advanced' => $_asv[$adv_adv]));
$rendered = $ourTemplate->render();
if ($hookName == 'message_content' && Turki_Adv_Helper_Criteria::postCriteria($_asv['post_criteria'], TRUE) === FALSE) {
if ($hookParams['message']['thread_id']) {
$decode = XenForo_Helper_Criteria::prepareCriteriaForSelection($_asv['post_criteria']);
$position = $decode['active']['page'] ? $hookParams['message']['position'] % $options->messagesPerPage : $hookParams['message']['position'];
if ($position == $decode['active']['post_id'] - 1) {
$contents = $decode['active']['position'] ? Turki_Adv_Helper_Helpers::advhtml($contents, $rendered) : $contents . $rendered;
}
}
} else {
if ($hookName == $_asv['adv_hook_name'] && Turki_Adv_Helper_Criteria::postCriteria($_asv['post_criteria'], TRUE)) {
$contents = $_asv['display'] == 'top' ? $rendered . $contents : $contents . $rendered;
}
}
}
}
}
}
self::_templateHook($hookName, $contents, $hookParams, $template);
}
}
示例13: getAllNodes
public function getAllNodes()
{
if ($this->_nodes === null) {
$nodes = XenForo_Application::getSimpleCacheData(self::$nodesCacheKey);
if ($nodes === false) {
$nodes = $this->_getNodeModel()->getAllNodes();
XenForo_Application::setSimpleCacheData(self::$nodesCacheKey, $nodes);
}
$this->_nodes = $nodes;
}
return $this->_nodes;
}
示例14: actionBbCodes
public function actionBbCodes()
{
$parent = parent::actionBbCodes();
$bbmBbCodes = $this->getModelFromCache('BBM_Model_BbCodes')->getAllActiveBbCodes('strict');
$bbmBbCodesInCache = XenForo_Application::getSimpleCacheData('bbm_active');
if (!empty($bbmBbCodesInCache['nohelp'])) {
foreach ($bbmBbCodesInCache['nohelp'] as $tag) {
unset($bbmBbCodes[$tag]);
}
}
$parent->subView->params['bbmBbCodes'] = $bbmBbCodes;
return $parent;
}
示例15: _bakeAllTags
public function _bakeAllTags($parentTags)
{
$bbmCache = XenForo_Application::getSimpleCacheData('bbm_active');
$bbmTags = $bbmCache['list'];
$allTags = $parentTags;
foreach ($bbmTags as $bbmTag) {
$allTags[$bbmTag] = array();
}
foreach ($allTags as &$tag) {
foreach ($tag as $key => $config) {
unset($tag[$key]);
}
$tag['replace'] = array('', '');
}
$this->_allTags = $allTags;
}