當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cache::getCacheWebsiteAttributes方法代碼示例

本文整理匯總了PHP中Piwik\Tracker\Cache::getCacheWebsiteAttributes方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cache::getCacheWebsiteAttributes方法的具體用法?PHP Cache::getCacheWebsiteAttributes怎麽用?PHP Cache::getCacheWebsiteAttributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\Tracker\Cache的用法示例。


在下文中一共展示了Cache::getCacheWebsiteAttributes方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getGoalDefinitions

 public static function getGoalDefinitions($idSite)
 {
     $websiteAttributes = Cache::getCacheWebsiteAttributes($idSite);
     if (isset($websiteAttributes['goals'])) {
         return $websiteAttributes['goals'];
     }
     return array();
 }
開發者ID:josl,項目名稱:CGE-File-Sharing,代碼行數:8,代碼來源:GoalManager.php

示例2: getSiteCreatedTime

 private function getSiteCreatedTime($idSite)
 {
     $attributes = Cache::getCacheWebsiteAttributes($idSite);
     if (!isset($attributes['ts_created'])) {
         return null;
     }
     return Date::factory($attributes['ts_created']);
 }
開發者ID:dorelljames,項目名稱:piwik,代碼行數:8,代碼來源:SitesManagerRequestProcessor.php

示例3: detectReferrerDirectEntry

 /**
  * We have previously tried to detect the campaign variables in the URL
  * so at this stage, if the referrer host is the current host,
  * or if the referrer host is any of the registered URL for this website,
  * it is considered a direct entry
  * @return bool
  */
 protected function detectReferrerDirectEntry()
 {
     if (empty($this->referrerHost)) {
         return false;
     }
     $urlsByHost = $this->getCachedUrlsByHostAndIdSite();
     $directEntry = new SiteUrls();
     $matchingSites = $directEntry->getIdSitesMatchingUrl($this->referrerUrlParse, $urlsByHost);
     if (isset($matchingSites) && is_array($matchingSites) && in_array($this->idsite, $matchingSites)) {
         $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
         return true;
     } elseif (isset($matchingSites)) {
         return false;
     }
     $site = Cache::getCacheWebsiteAttributes($this->idsite);
     $excludeUnknowns = $site['exclude_unknown_urls'];
     // fallback logic if the referrer domain is not known to any site to not break BC
     if (!$excludeUnknowns && isset($this->currentUrlParse['host'])) {
         // this might be actually buggy if first thing tracked is eg an outlink and referrer is from that site
         $currentHost = Common::mb_strtolower($this->currentUrlParse['host']);
         if ($currentHost == Common::mb_strtolower($this->referrerHost)) {
             $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
             return true;
         }
     }
     return false;
 }
開發者ID:diosmosis,項目名稱:piwik,代碼行數:34,代碼來源:Base.php

示例4: isUserAgentExcluded

 /**
  * Returns true if the specified user agent should be excluded for the current site or not.
  *
  * Visits whose user agent string contains one of the excluded_user_agents strings for the
  * site being tracked (or one of the global strings) will be excluded.
  *
  * @internal param string $this ->userAgent The user agent string.
  * @return bool
  */
 protected function isUserAgentExcluded()
 {
     $websiteAttributes = Cache::getCacheWebsiteAttributes($this->idSite);
     if (!empty($websiteAttributes['excluded_user_agents'])) {
         foreach ($websiteAttributes['excluded_user_agents'] as $excludedUserAgent) {
             // if the excluded user agent string part is in this visit's user agent, this visit should be excluded
             if (stripos($this->userAgent, $excludedUserAgent) !== false) {
                 return true;
             }
         }
     }
     return false;
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:22,代碼來源:VisitExcluded.php

示例5: authenticateSuperUserOrAdmin

 public static function authenticateSuperUserOrAdmin($tokenAuth, $idSite)
 {
     if (empty($tokenAuth)) {
         return false;
     }
     $superUserLogin = Config::getInstance()->superuser['login'];
     $superUserPassword = Config::getInstance()->superuser['password'];
     if (md5($superUserLogin . $superUserPassword) === $tokenAuth) {
         return true;
     }
     // Now checking the list of admin token_auth cached in the Tracker config file
     if (!empty($idSite) && $idSite > 0) {
         $website = Cache::getCacheWebsiteAttributes($idSite);
         if (array_key_exists('admin_token_auth', $website) && in_array($tokenAuth, $website['admin_token_auth'])) {
             return true;
         }
     }
     Common::printDebug("WARNING! token_auth = {$tokenAuth} is not valid, Super User / Admin was NOT authenticated");
     return false;
 }
開發者ID:KiwiJuicer,項目名稱:handball-dachau,代碼行數:20,代碼來源:Request.php

示例6: getTimezoneForSite

 private function getTimezoneForSite($idSite)
 {
     try {
         $site = Cache::getCacheWebsiteAttributes($idSite);
     } catch (UnexpectedWebsiteFoundException $e) {
         return null;
     }
     if (!empty($site['timezone'])) {
         return $site['timezone'];
     }
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:11,代碼來源:Visit.php

示例7: authenticateSuperUserOrAdmin

 public static function authenticateSuperUserOrAdmin($tokenAuth, $idSite)
 {
     if (empty($tokenAuth)) {
         return false;
     }
     Piwik::postEvent('Request.initAuthenticationObject');
     /** @var \Piwik\Auth $auth */
     $auth = StaticContainer::get('Piwik\\Auth');
     $auth->setTokenAuth($tokenAuth);
     $auth->setLogin(null);
     $auth->setPassword(null);
     $auth->setPasswordHash(null);
     $access = $auth->authenticate();
     if (!empty($access) && $access->hasSuperUserAccess()) {
         return true;
     }
     // Now checking the list of admin token_auth cached in the Tracker config file
     if (!empty($idSite) && $idSite > 0) {
         $website = Cache::getCacheWebsiteAttributes($idSite);
         if (array_key_exists('admin_token_auth', $website) && in_array((string) $tokenAuth, $website['admin_token_auth'])) {
             return true;
         }
     }
     Common::printDebug("WARNING! token_auth = {$tokenAuth} is not valid, Super User / Admin was NOT authenticated");
     return false;
 }
開發者ID:normimuc,項目名稱:piwik,代碼行數:26,代碼來源:Request.php

示例8: shouldRemoveURLFragmentFor

 /**
  * Returns true if URL fragments should be removed for a specific site,
  * false if otherwise.
  *
  * This function uses the Tracker cache and not the MySQL database.
  *
  * @param $idSite int The ID of the site to check for.
  * @return bool
  */
 public static function shouldRemoveURLFragmentFor($idSite)
 {
     $websiteAttributes = Cache::getCacheWebsiteAttributes($idSite);
     return empty($websiteAttributes['keep_url_fragment']);
 }
開發者ID:bossrabbit,項目名稱:piwik,代碼行數:14,代碼來源:PageUrl.php

示例9: detectSiteSearch

 protected function detectSiteSearch($originalUrl)
 {
     $website = Cache::getCacheWebsiteAttributes($this->request->getIdSite());
     if (empty($website['sitesearch'])) {
         Common::printDebug("Internal 'Site Search' tracking is not enabled for this site. ");
         return false;
     }
     $actionName = $url = $categoryName = $count = false;
     $originalUrl = PageUrl::cleanupUrl($originalUrl);
     // Detect Site search from Tracking API parameters rather than URL
     $searchKwd = $this->request->getParam('search');
     if (!empty($searchKwd)) {
         $actionName = $searchKwd;
         $isCategoryName = $this->request->getParam('search_cat');
         if (!empty($isCategoryName)) {
             $categoryName = $isCategoryName;
         }
         $isCount = $this->request->getParam('search_count');
         if ($this->isValidSearchCount($isCount)) {
             $count = $isCount;
         }
     }
     if (empty($actionName)) {
         $parsedUrl = @parse_url($originalUrl);
         // Detect Site Search from URL query parameters
         if (!empty($parsedUrl['query']) || !empty($parsedUrl['fragment'])) {
             // array($url, $actionName, $categoryName, $count);
             $searchInfo = $this->detectSiteSearchFromUrl($website, $parsedUrl);
             if (!empty($searchInfo)) {
                 list($url, $actionName, $categoryName, $count) = $searchInfo;
             }
         }
     }
     $actionName = trim($actionName);
     $categoryName = trim($categoryName);
     if (empty($actionName)) {
         Common::printDebug("(this is not a Site Search request)");
         return false;
     }
     Common::printDebug("Detected Site Search keyword '{$actionName}'. ");
     if (!empty($categoryName)) {
         Common::printDebug("- Detected Site Search Category '{$categoryName}'. ");
     }
     if ($count !== false) {
         Common::printDebug("- Search Results Count was '{$count}'. ");
     }
     if ($url != $originalUrl) {
         Common::printDebug("NOTE: The Page URL was changed / removed, during the Site Search detection, was '{$originalUrl}', now is '{$url}'");
     }
     return array($actionName, $url, $categoryName, $count);
 }
開發者ID:carriercomm,項目名稱:piwik,代碼行數:51,代碼來源:ActionSiteSearch.php

示例10: isHostKnownAliasHost

 public static function isHostKnownAliasHost($urlHost, $idSite)
 {
     $websiteData = Cache::getCacheWebsiteAttributes($idSite);
     if (isset($websiteData['hosts'])) {
         $canonicalHosts = array();
         foreach ($websiteData['hosts'] as $host) {
             $canonicalHosts[] = self::toCanonicalHost($host);
         }
         $canonicalHost = self::toCanonicalHost($urlHost);
         if (in_array($canonicalHost, $canonicalHosts)) {
             return true;
         }
     }
     return false;
 }
開發者ID:TensorWrenchOSS,項目名稱:piwik,代碼行數:15,代碼來源:Visit.php

示例11: isHostKnownAliasHost

 public static function isHostKnownAliasHost($urlHost, $idSite)
 {
     $websiteData = Cache::getCacheWebsiteAttributes($idSite);
     if (isset($websiteData['hosts'])) {
         $canonicalHosts = array();
         foreach ($websiteData['hosts'] as $host) {
             $canonicalHosts[] = str_replace('www.', '', mb_strtolower($host, 'UTF-8'));
         }
         $canonicalHost = str_replace('www.', '', mb_strtolower($urlHost, 'UTF-8'));
         if (in_array($canonicalHost, $canonicalHosts)) {
             return true;
         }
     }
     return false;
 }
開發者ID:carriercomm,項目名稱:piwik,代碼行數:15,代碼來源:Visit.php

示例12: test_shouldCacheDimensinsViaWebsiteAttributes_ButOnlyActiveOnes

 public function test_shouldCacheDimensinsViaWebsiteAttributes_ButOnlyActiveOnes()
 {
     $this->configureSomeDimensions();
     $cache = Cache::getCacheWebsiteAttributes($idSite = 1);
     $this->assertCount(4, $cache['custom_dimensions']);
     foreach ($cache['custom_dimensions'] as $dimension) {
         $this->assertTrue($dimension['active']);
     }
     $cache = Cache::getCacheWebsiteAttributes($idSite = 2);
     $this->assertCount(1, $cache['custom_dimensions']);
     foreach ($cache['custom_dimensions'] as $dimension) {
         $this->assertTrue($dimension['active']);
     }
 }
開發者ID:ep123,項目名稱:plugin-CustomDimensions,代碼行數:14,代碼來源:CustomDimensionsTest.php

示例13: getCachedCustomDimensions

 /**
  * Get Cached Custom Dimensions during tracking. Returns only active custom dimensions.
  *
  * @param Request $request
  * @return array
  * @throws \Piwik\Exception\UnexpectedWebsiteFoundException
  */
 public static function getCachedCustomDimensions(Request $request)
 {
     $idSite = $request->getIdSite();
     $cache = Cache::getCacheWebsiteAttributes($idSite);
     if (empty($cache['custom_dimensions'])) {
         // no custom dimensions set
         return array();
     }
     return $cache['custom_dimensions'];
 }
開發者ID:ep123,項目名稱:plugin-CustomDimensions,代碼行數:17,代碼來源:CustomDimensionsRequestProcessor.php


注:本文中的Piwik\Tracker\Cache::getCacheWebsiteAttributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。