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


PHP XenForo_Application::getCache方法代码示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $attachmentId = $this->_input->filterSingle('attachment_id', XenForo_Input::UINT);
     $cache = XenForo_Application::getCache();
     $imageTypes = array('gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'png' => 'image/png');
     if ($cache) {
         $attachment = unserialize($cache->load('attachment_cache_' . md5($attachmentId)));
         if (!$attachment) {
             $attachment = $this->_getAttachmentOrError($attachmentId);
             $extension = XenForo_Helper_File::getFileExtension($attachment['filename']);
             if (isset($imageTypes[$extension])) {
                 $cache->save(serialize($attachment), 'attachment_cache_' . md5($attachmentId), array(), 3600);
             }
         }
     } else {
         $attachment = $this->_getAttachmentOrError($attachmentId);
     }
     $extension = XenForo_Helper_File::getFileExtension($attachment['filename']);
     if (!in_array($extension, array_keys($imageTypes))) {
         return parent::actionIndex();
     }
     $attachmentModel = $this->_getAttachmentModel();
     $filePath = $attachmentModel->getAttachmentDataFilePath($attachment);
     if (!file_exists($filePath) || !is_readable($filePath)) {
         return $this->responseError(new XenForo_Phrase('attachment_cannot_be_shown_at_this_time'));
     }
     $this->canonicalizeRequestUrl(XenForo_Link::buildPublicLink('attachments', $attachment));
     $eTag = $this->_request->getServer('HTTP_IF_NONE_MATCH');
     $this->_routeMatch->setResponseType('raw');
     if ($eTag && $eTag == $attachment['attach_date']) {
         return $this->responseView('XenForo_ViewPublic_Attachment_View304');
     }
     $viewParams = array('attachment' => $attachment, 'attachmentFile' => $filePath);
     return $this->responseView('XenForo_ViewPublic_Attachment_View', '', $viewParams);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:35,代码来源:Attachment.php

示例2: 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;
 }
开发者ID:jackton,项目名称:XenForo-RedisCache,代码行数:34,代码来源:CssOutput.php

示例3: runOften

 public static function runOften()
 {
     $feeds = XenForo_Model::create('DigitalPointSocialBar_Model_SocialBar')->getSlugsFromOptions();
     shuffle($feeds);
     // randomize order in case someone has absurd number of lists attached to forums (would need to be more than 180 unique) to work around Twitter API limits
     $cacheObject = XenForo_Application::getCache();
     $twitter = DigitalPointSocialBar_Helper_Twitter::getService(XenForo_Application::getOptions()->dpTwitterAccessToken, XenForo_Application::getOptions()->dpTwitterAccessTokenSecret, XenForo_Application::getOptions()->dpTwitterUsername);
     // forum specific feeds
     if ($feeds) {
         foreach ($feeds as $slug) {
             $tweets_array = array();
             $results = $twitter->listsStatuses(array('slug' => $slug, 'owner_screen_name' => XenForo_Application::getOptions()->dpTwitterUsername, 'count' => 250, 'include_rts' => 1, 'include_entities' => 1));
             if (count($results)) {
                 try {
                     for ($i = 0; $i < count($results); $i++) {
                         $tweet = $results[$i];
                         if (is_object($tweet->user)) {
                             $screen_name = $tweet->user->screen_name;
                             if (!@isset($tweets_array[$screen_name])) {
                                 $tweets_array[$screen_name] = DigitalPointSocialBar_Helper_Twitter::parseTweet($tweet);
                             }
                         }
                     }
                     $cacheObject->save(json_encode(array_values($tweets_array)), 'social_bar_' . str_replace('-', '_', $slug), array(), 604800);
                     // 7 day cache
                 } catch (Exception $e) {
                 }
             }
         }
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:31,代码来源:SocialBar.php

示例4: getInstance

 public static function getInstance()
 {
     $object = new self();
     if (!$object->_cache) {
         $object->_cache = XenForo_Application::getCache();
     }
     return $object;
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:8,代码来源:Cache.php

示例5: __construct

 public function __construct()
 {
     $this->options = XenForo_Application::get('options');
     $this->cache = XenForo_Application::getCache();
     if ($this->cache && $this->options->sonnb_LiveThread_Cache) {
         $this->enable = true;
     }
     $this->duration = $this->options->sonnb_LiveThread_CacheDuration;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:9,代码来源:Cache.php

示例6: installCode

 public static function installCode()
 {
     if (XenForo_Application::$versionId < 1030070) {
         throw new XenForo_Exception('Digital Point Social Bar requires XenForo 1.3.0 or newer.', true);
     }
     if (!XenForo_Application::getCache()) {
         throw new XenForo_Exception('Digital Point Social Bar requires a valid caching mechanism defined within your XenForo config.php.', true);
     }
     $db = XenForo_Application::getDb();
     try {
         $db->query("\n\t\t\t\tALTER TABLE xf_forum\n\t\t\t\t\tADD dp_twitter_slug\n\t\t\t\t\t\tVARCHAR(25)\n\t\t\t\t\t\tCHARACTER SET utf8\n\t\t\t\t\t\tCOLLATE utf8_general_ci\n\t\t\t\t\t\tNOT NULL\n\t\t\t\t\t\tDEFAULT ''\n\t\t\t");
     } catch (Zend_Db_Exception $e) {
         return false;
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:15,代码来源:Install.php

示例7: actionTweets

 public function actionTweets()
 {
     if (!($slug = $this->_input->filterSingle('slug', XenForo_Input::STRING))) {
         $slug = XenForo_Application::getOptions()->dpTwitterDefaultList;
     }
     $tweets = json_decode(XenForo_Application::getCache()->load('social_bar_' . str_replace('-', '_', preg_replace('#[^a-z0-9\\_\\-]#', '', $slug)), true), true);
     if (!$tweets) {
         $tweets = array('d' => XenForo_Application::$time, 'n' => 'Error', 'u' => '', 'i' => '', 's' => '', 't' => 'Twitter List not found for "' . $slug . '".');
     }
     header('Content-Type: application/json; charset=UTF-8', true);
     header('Cache-Control: max-age=600', true);
     header('Last-Modified : ' . gmdate('D, d M Y H:i:s' . XenForo_Application::$time) . ' GMT', true);
     echo XenForo_ViewRenderer_Json::jsonEncodeForOutput(array('tweets' => $tweets));
     exit;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:15,代码来源:SocialBar.php

示例8: actionTestSetup

 public function actionTestSetup()
 {
     $checks['hasCache'] = XenForo_Application::getCache() ? true : false;
     if (DigitalPointBetterAnalytics_Helper_Reporting::checkAccessToken(false)) {
         $checks['profiles'] = DigitalPointBetterAnalytics_Helper_Reporting::getProfiles();
         $checks['matchingProfile'] = DigitalPointBetterAnalytics_Helper_Reporting::getProfileByPropertyId(XenForo_Application::getOptions()->googleAnalyticsWebPropertyId);
         $checks['siteSearchSetup'] = @$checks['matchingProfile']['siteSearchQueryParameters'] == 'q';
         $checks['ecommerceTracking'] = @$checks['matchingProfile']['eCommerceTracking'];
         $checks['enhancedEcommerceTracking'] = @$checks['matchingProfile']['enhancedECommerceTracking'];
         $property = DigitalPointBetterAnalytics_Helper_Reporting::getPropertyByPropertyId(@$checks['matchingProfile']['accountId'], XenForo_Application::getOptions()->googleAnalyticsWebPropertyId);
         $checks['level'] = @$property['level'];
         $checks['industryVertical'] = @$property['industryVertical'];
         $checks['dimensions'] = DigitalPointBetterAnalytics_Helper_Reporting::getDimensionsByPropertyId(@$checks['matchingProfile']['accountId'], XenForo_Application::getOptions()->googleAnalyticsWebPropertyId, array('User', 'Forum'));
     }
     $checks['licensed'] = DigitalPointBetterAnalytics_Helper_Api::check(true);
     $checks['user_dimension_set'] = XenForo_Application::getOptions()->dpBetterAnalyticsDimensionIndexUser > 0 && @$checks['dimensions']['User']['index'] == XenForo_Application::getOptions()->dpBetterAnalyticsDimensionIndexUser;
     $checks['forum_dimension_set'] = XenForo_Application::getOptions()->dpBetterAnalyticsDimentionIndex > 0 && @$checks['dimensions']['Forum']['index'] == XenForo_Application::getOptions()->dpBetterAnalyticsDimentionIndex;
     $checks['hasCurl'] = function_exists('curl_multi_init');
     return $this->responseView('DigitalPointBetterAnalytics_ViewAdmin_Tools_CheckAnalytics', 'tools_test_analytics', array('checks' => $checks));
 }
开发者ID:Sywooch,项目名称:forums,代码行数:20,代码来源:Analytics.php

示例9: renderTagAttach

 public function renderTagAttach(array $tag, array $rendererStates)
 {
     $imageTypes = array('gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'png' => 'image/png');
     if (empty($rendererStates['viewAttachments'])) {
         $rendererStates['viewAttachments'] = true;
     }
     $attachmentId = intval($this->stringifyTree($tag['children']));
     if (!empty($rendererStates['attachments'][$attachmentId])) {
         $extension = XenForo_Helper_File::getFileExtension($rendererStates['attachments'][$attachmentId]['filename']);
         if (!empty($rendererStates['attachments'][$attachmentId]['temp_hash'])) {
             $rendererStates['attachments'][$attachmentId]['temp_hash'] = '';
         }
         if (in_array($extension, array_keys($imageTypes))) {
             $rendererStates['viewAttachments'] = true;
         }
     } else {
         if ($tag['option'] == 'full' && $tag['children'] && $rendererStates['viewAttachments'] && $rendererStates['lightBox'] && $attachmentId) {
             $cache = XenForo_Application::getCache();
             if ($cache) {
                 $attachment_check = unserialize($cache->load('attachment_cache_' . md5($attachmentId)));
                 if (!$attachment_check) {
                     $attachment_check = $this->_getAttachmentModel()->getAttachmentById($attachmentId);
                     $cache->save(serialize($attachment_check), 'attachment_cache_' . md5($attachmentId), array(), 3600);
                 }
             } else {
                 $attachment_check = $this->_getAttachmentModel()->getAttachmentById($attachmentId);
             }
             if ($attachment_check && in_array(XenForo_Helper_File::getFileExtension($attachment_check['filename']), array_keys($imageTypes))) {
                 $attachment = $this->_getAttachmentModel()->prepareAttachment($attachment_check);
                 if (!empty($attachment['temp_hash'])) {
                     $attachment['temp_hash'] = '';
                 }
                 $rendererStates['canView'] = true;
                 $rendererStates['validAttachment'] = true;
                 $rendererStates['viewAttachments'] = true;
                 $rendererStates['attachments'][$attachment['attachment_id']] = $attachment;
             }
         }
     }
     return parent::renderTagAttach($tag, $rendererStates);
 }
开发者ID:Sywooch,项目名称:forums,代码行数:41,代码来源:Base.php

示例10: renderHtml

 public function renderHtml()
 {
     parent::renderHtml();
     if (isset($this->_params['editorTemplate']) && $this->_params['editorTemplate']->getParam('showWysiwyg')) {
         $attachPattern = '/\\[ATTACH(.*?)\\](.*?)\\[\\/ATTACH\\]/si';
         $count = @preg_match_all($attachPattern, $this->_params['post']['message'], $matches);
         if ($count) {
             $cache = XenForo_Application::getCache();
             $imageTypes = array('gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'png' => 'image/png');
             foreach ($matches[0] as $position => $match) {
                 if ($match && intval($matches[2][$position]) > 0) {
                     $attachmentId = intval($matches[2][$position]);
                     if ($cache) {
                         $attachment = unserialize($cache->load('attachment_cache_' . md5($attachmentId)));
                         if (!$attachment) {
                             $attachment = $this->_getAttachment($attachmentId);
                             $extension = XenForo_Helper_File::getFileExtension($attachment['filename']);
                             if (isset($imageTypes[$extension])) {
                                 $cache->save(serialize($attachment), 'attachment_cache_' . md5($attachmentId), array(), 3600);
                             }
                         }
                     } else {
                         $attachment = $this->_getAttachment($attachmentId);
                     }
                     if ($attachment && $attachment['thumbnail_width']) {
                         $attachment = $this->_getAttachmentModel()->prepareAttachment($attachment);
                         if ($matches[1][$position]) {
                             $replace = '<img class="attachFull bbCodeImage" src="' . XenForo_Link::buildPublicLink('attachments', array('attachment_id' => $attachment['attachment_id'])) . '" alt="attachFull' . $attachment['attachment_id'] . '" data-mce-src="' . XenForo_Link::buildPublicLink('attachments', array('attachment_id' => $attachment['attachment_id'])) . '" />';
                         } else {
                             $replace = '<img class="attachThumb bbCodeImage" src="' . $attachment['thumbnailUrl'] . '" alt="attachThumb' . $attachment['attachment_id'] . '" data-mce-src="' . $attachment['thumbnailUrl'] . '" />';
                         }
                     }
                     if (!empty($replace)) {
                         $htmlMessage = str_replace($match, $replace, $this->_params['editorTemplate']->getParam('messageHtml'));
                         $this->_params['editorTemplate']->setParam('messageHtml', $htmlMessage);
                     }
                 }
             }
         }
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:41,代码来源:Edit.php

示例11: getSlugsFromList

 public function getSlugsFromList()
 {
     $cache = XenForo_Application::getCache();
     if ($cache) {
         $cacheKey = 'social_ownership_list_slugs';
         if ($slugs = @unserialize($cache->load($cacheKey, true))) {
             return $slugs;
         }
     }
     $twitter = self::getTwitterService();
     $results = $twitter->listsOwnerships(array('count' => 100, 'screen_name' => XenForo_Application::getOptions()->dpTwitterUsername));
     $slugs = array();
     if (@$results->lists) {
         foreach ($results->lists as $list) {
             $slugs[$list->slug] = $list->name;
         }
     }
     if ($cache) {
         $cache->save(serialize($slugs), $cacheKey, array(), 90);
         // 90 second cache
     }
     return $slugs;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:23,代码来源:SocialBar.php

示例12: getShareCounts

 public static function getShareCounts()
 {
     // XenForo options
     $o = XenForo_Application::get('options');
     // Debug options
     self::$dCacheHit = $o->EHSS_CacheHitDebug;
     // XenForo variables
     $cache = XenForo_Application::getCache();
     $req = XenForo_Application::get('requestPaths');
     // Main options
     $cacheIdPrefix = $o->EHSS_CacheIdPrefix;
     $cacheTime = $o->EHSS_CacheTime;
     self::$mSiteUrl = $req['fullUri'];
     self::$mCacheId = ($cacheIdPrefix ?: '') . md5(self::$mSiteUrl);
     // Local variables
     $counts = array();
     $prevCache = false;
     if ($cacheTime === 0) {
         self::logExceptionByType('EHSS_DEBUG: Caching was effectively disabled because cache time was set to 0 (Session: ' . self::$mCacheId . ')', 1);
     }
     if ($cache && $cacheTime > 0) {
         $prevCache = $cache->load(self::$mCacheId);
         if ($prevCache) {
             $counts = json_decode($prevCache, true);
             foreach ($counts as $v) {
                 if ($v !== -1) {
                     self::logExceptionByType('EHSS_DEBUG: Share counters were loaded from cache and the data was valid (Session: ' . self::$mCacheId . ')', 1);
                     // Return counts if at least one count was valid
                     return json_encode($counts);
                 }
             }
         }
     }
     /** WILL ONLY GET TO THIS POINT IF THERE WAS NO CACHE **/
     // More debug options
     self::$dFetching = $o->EHSS_FetchingDebug;
     // More main options
     self::$mTimeout = $o->EHSS_Timeout;
     self::$mCurlSecure = $o->EHSS_CurlSecure;
     self::$mCurlLocalCert = $o->EHSS_CurlLocalCert;
     $oDisableCurl = $o->EHSS_DisableCurl;
     $oZeroFallback = $o->EHSS_ZeroFallback;
     // Define self::$mCurlUsable, self::$mCurlMilliSeconds and self::$mCurlSecurePeer
     if ($oDisableCurl || !function_exists('curl_version')) {
         self::$mCurlUsable = false;
         self::logExceptionByType('EHSS_DEBUG: Did not use cURL because either it was disabled or the module did not exist (Session: ' . self::$mCacheId . ')', 2);
     } else {
         $t = curl_version();
         self::$mCurlMilliSeconds = version_compare($t['version'], '7.16.2', '>=');
         if (!self::$mCurlMilliSeconds) {
             self::logExceptionByType('EHSS_DEBUG: Did not use milliseconds as timeout value because cURL version was older than version 7.16.2 (Your version: ' . $t['version'] . ', Session: ' . self::$mCacheId . ')', 2);
         }
         self::$mCurlSecurePeer = version_compare($t['version'], '7.10', '>=');
         if (!self::$mCurlSecurePeer) {
             self::logExceptionByType('EHSS_DEBUG: Did not use cURL option \'CURLOPT_SSL_VERIFYPEER\' because cURL version was older than version 7.10 (Your version: ' . $t['version'] . ', Session: ' . self::$mCacheId . ')', 2);
         }
         if (!self::$mCurlSecure) {
             self::logExceptionByType('EHSS_DEBUG: Did not use secure connection for cURL as instructed (Your version: ' . $t['version'] . ', Session: ' . self::$mCacheId . ')', 2);
         }
     }
     // More local variables
     $counters = $o->EHSS_ShareCounter;
     $services = array("facebook", "twitter", "googleplus", "linkedin", "pinterest", "vk");
     $tryAgain = $o->EHSS_TryAgain;
     // Temporarily mark the current session as 'total failure'
     $tFailure = true;
     // Get count for enabled services
     foreach ($services as $s) {
         if (!$counters[$s]) {
             continue;
         }
         $ts = $s;
         // Facebook v2 patch (use newer Graph API with access token if available)
         if ($s === 'facebook') {
             self::$mFacebookAppId = $o->facebookAppId;
             self::$mFacebookAppSecret = $o->facebookAppSecret;
             if (strlen(self::$mFacebookAppId) && strlen(self::$mFacebookAppSecret)) {
                 $ts = 'facebook_v2';
                 self::logExceptionByType('EHSS_DEBUG: Used an alternative API for Facebook since Facebook App ID and Secret were available in XenForo options.', 2);
             }
         }
         $counts[$s] = self::getCount($ts);
         self::logExceptionByType('EHSS_DEBUG: ' . $ts . ' service returned ' . $counts[$s] . ' (Session: ' . self::$mCacheId . ')', 2);
         // Disable the temporary 'total failure' mark if at least one site were fetched properly
         if ($counts[$s] >= 0) {
             $tFailure = false;
         } elseif ($oZeroFallback) {
             $counts[$s] = 0;
         }
     }
     $jsonCounts = json_encode($counts);
     if ($tFailure && $tryAgain) {
         self::logExceptionByType('EHSS_DEBUG: Did not save share counters because none were successfully fetched (Session: ' . self::$mCacheId . ')', 1);
     } elseif ($cache && $cacheTime > 0) {
         $cache->save($jsonCounts, self::$mCacheId, array(), $cacheTime);
         self::logExceptionByType('EHSS_DEBUG: Share counters were stored to cache (Session: ' . self::$mCacheId . ')', 1);
     } else {
         self::logExceptionByType('EHSS_DEBUG: Did not save share counters because of missing cache object or caching was disabled (Session: ' . self::$mCacheId . ')', 1);
     }
     return $jsonCounts;
//.........这里部分代码省略.........
开发者ID:BobbyWibowo,项目名称:EH_SocialShare,代码行数:101,代码来源:Listener2.php

示例13: getShareCounts

 public static function getShareCounts()
 {
     // Load XenForo options - debug
     self::$debugCacheHit = XenForo_Application::get('options')->EHSS_CacheHitDebug;
     self::$debugCurl = XenForo_Application::get('options')->EHSS_CurlDebug;
     $services = array("facebook", "twitter", "googleplus", "linkedin", "pinterest", "vk");
     $counts = array();
     $tmp = XenForo_Application::get('requestPaths');
     $siteUrl = $tmp['fullUri'];
     $cacheIdSuffix = XenForo_Application::get('options')->EHSS_CacheIdSuffix;
     $cacheId = "ehss_" . sprintf('%u', crc32($siteUrl)) . ($cacheIdSuffix ? '_' . $cacheIdSuffix : '');
     // CRC32 hash of the page's URL (fastest built-in hash for non-crypto use) with 'ehss_' prefix and custom suffix if available
     $cacheObject = XenForo_Application::getCache();
     $cacheTime = XenForo_Application::get('options')->EHSS_CacheTime;
     $previousCache = false;
     if ($cacheObject) {
         $previousCache = $cacheObject->load($cacheId);
         if ($previousCache) {
             $counts = json_decode($previousCache, true);
             foreach ($counts as $value) {
                 if ($value !== -1) {
                     self::logExceptionByType('DEBUG: Share counters were loaded from cache and the data was valid (' . $cacheId . ')', 1);
                     return json_encode($counts);
                     // Immediately return counts if at least one count was valid
                 }
             }
         }
     }
     // Load XenForo options - etc.
     $keepTrying = XenForo_Application::get('options')->EHSS_KeepTrying;
     $completeFailure = true;
     // Mark current session as completely failed
     $curlTimeout = XenForo_Application::get('options')->EHSS_CurlTimeout;
     $curlDisabled = XenForo_Application::get('options')->EHSS_DisableCurl;
     $curlExist = function_exists('curl_version');
     $curlVerPassMS = false;
     $curlSslVerify = XenForo_Application::get('options')->EHSS_CurlSslVerify;
     $curlVerPassPeer = false;
     $curlCertInfo = XenForo_Application::get('options')->EHSS_CurlCertInfo;
     // Fetch share counts if there was no previous cache or the previous cache held no valid counts
     if ($curlExist) {
         $curlVerPassMS = self::doesComplyWithMinCurlVersion('7.16.2');
         $curlVerPassPeer = self::doesComplyWithMinCurlVersion('7.10');
         $tmp = curl_version();
         if (!$curlVerPassMS) {
             self::logExceptionByType('DEBUG: Did not use milliseconds as cURL timeout because cURL version was older than 7.16.2 (version: ' . $tmp['version'] . ')', 2);
         }
         if (!$curlVerPassPeer) {
             self::logExceptionByType('DEBUG: Did not use cURL option \'CURLOPT_SSL_VERIFYPEER\' because cURL version was older than 7.10 (version: ' . $tmp['version'] . ')', 2);
         }
     }
     foreach ($services as $service) {
         $extraInfo = array();
         $tmpService = $service;
         $counts[$service] = -1;
         // Facebook v2 patch (use newer Graph API with access token when available)
         if ($tmpService === 'facebook') {
             $facebookAppId = XenForo_Application::get('options')->facebookAppId;
             $facebookAppSecret = XenForo_Application::get('options')->facebookAppSecret;
             if (strlen($facebookAppId) && strlen($facebookAppSecret)) {
                 self::logExceptionByType('DEBUG: Facebook App ID and Secret were available on XenForo options, thus the add-on would use an alternative of the Facebook API', 2);
                 $tmpService = 'facebook_v2';
                 $extraInfo['facebookAppId'] = $facebookAppId;
                 $extraInfo['facebookAppSecret'] = $facebookAppSecret;
             }
         }
         $tmp = XenForo_Application::get('options')->EHSS_ShareCounter;
         if ($tmp[$service]) {
             $counts[$service] = self::getCount($tmpService, $siteUrl, $curlTimeout, !$curlDisabled && $curlExist ? true : false, $curlVerPassMS, $curlSslVerify, $curlVerPassPeer, $curlCertInfo, $extraInfo);
         }
         if ($counts[$service] !== -1) {
             $completeFailure = false;
             // If at least one service was fetched properly, mark current session as not completely failed, then store to cache
         }
     }
     if ($completeFailure && $keepTrying) {
         self::logExceptionByType('DEBUG: Did not save share counters because none were successfully fetched (' . $cacheId . ')', 1);
     } else {
         if ($cacheObject) {
             $cacheObject->save(json_encode($counts), $cacheId, array(), $cacheTime);
             self::logExceptionByType('DEBUG: Share counters were stored on cache (' . $cacheId . ')', 1);
         } else {
             self::logExceptionByType('DEBUG: Did not save share counters because of missing cache object (' . $cacheId . ')', 1);
         }
     }
     return json_encode($counts);
 }
开发者ID:BobbyWibowo,项目名称:EH_SocialShare,代码行数:87,代码来源:Listener.php

示例14: _getCache

 /**
  * Helper method to get the cache object.
  *
  * @return Zend_Cache_Core|Zend_Cache_Frontend|false
  */
 protected function _getCache()
 {
     if ($this->_cache === null) {
         $this->_cache = XenForo_Application::getCache();
     }
     return $this->_cache;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:12,代码来源:DataWriter.php

示例15: _cacheDelete

 public static function _cacheDelete($cacheKey)
 {
     if ($cache = XenForo_Application::getCache()) {
         $cache->remove($cacheKey);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:6,代码来源:Reporting.php


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