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


PHP PageUrl::cleanupUrl方法代码示例

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


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

示例1: getReferrerInformation

 /**
  * Returns an array containing the following information:
  * - referer_type
  *        - direct            -- absence of referrer URL OR referrer URL has the same host
  *        - site                -- based on the referrer URL
  *        - search_engine        -- based on the referrer URL
  *        - campaign            -- based on campaign URL parameter
  *
  * - referer_name
  *         - ()
  *         - piwik.net            -- site host name
  *         - google.fr            -- search engine host name
  *         - adwords-search    -- campaign name
  *
  * - referer_keyword
  *         - ()
  *         - ()
  *         - my keyword
  *         - my paid keyword
  *         - ()
  *         - ()
  *
  * - referer_url : the same for all the referrer types
  *
  * @param string $referrerUrl must be URL Encoded
  * @param string $currentUrl
  * @param int $idSite
  * @return array
  */
 public function getReferrerInformation($referrerUrl, $currentUrl, $idSite)
 {
     $this->idsite = $idSite;
     // default values for the referer_* fields
     $referrerUrl = Common::unsanitizeInputValue($referrerUrl);
     if (!empty($referrerUrl) && !UrlHelper::isLookLikeUrl($referrerUrl)) {
         $referrerUrl = '';
     }
     $currentUrl = PageUrl::cleanupUrl($currentUrl);
     $this->referrerUrl = $referrerUrl;
     $this->referrerUrlParse = @parse_url($this->referrerUrl);
     $this->currentUrlParse = @parse_url($currentUrl);
     $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
     $this->nameReferrerAnalyzed = '';
     $this->keywordReferrerAnalyzed = '';
     $this->referrerHost = '';
     if (isset($this->referrerUrlParse['host'])) {
         $this->referrerHost = $this->referrerUrlParse['host'];
     }
     $referrerDetected = $this->detectReferrerCampaign();
     if (!$referrerDetected) {
         if ($this->detectReferrerDirectEntry() || $this->detectReferrerSearchEngine()) {
             $referrerDetected = true;
         }
     }
     if (!empty($this->referrerHost) && !$referrerDetected) {
         $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_WEBSITE;
         $this->nameReferrerAnalyzed = Common::mb_strtolower($this->referrerHost);
     }
     $referrerInformation = array('referer_type' => $this->typeReferrerAnalyzed, 'referer_name' => $this->nameReferrerAnalyzed, 'referer_keyword' => $this->keywordReferrerAnalyzed, 'referer_url' => $this->referrerUrl);
     return $referrerInformation;
 }
开发者ID:kreynen,项目名称:elmsln,代码行数:61,代码来源:Referrer.php

示例2: getCampaignInformation

 /**
  * Returns the extracted utm details from the url
  * @param  string  $currentUrl 
  * @param  int     $idSite     
  * @param  Request $request    
  * @return array            
  */
 private function getCampaignInformation($currentUrl, $idSite, Request $request)
 {
     $cacheKey = $currentUrl . $idSite;
     if (isset(self::$cachedReferrer[$cacheKey])) {
         return self::$cachedReferrer[$cacheKey];
     }
     $currentUrl = PageUrl::cleanupUrl($currentUrl);
     $this->currentUrlParse = @parse_url($currentUrl);
     $utmInformation = $this->extractUtmDetailsFromUrl();
     self::$cachedReferrer[$cacheKey] = $utmInformation;
     return $utmInformation;
 }
开发者ID:adevait,项目名称:CampaignDetailed,代码行数:19,代码来源:Base.php

示例3: getReferrerInformation

 /**
  * Returns an array containing the following information:
  * - referer_type
  *        - direct            -- absence of referrer URL OR referrer URL has the same host
  *        - site                -- based on the referrer URL
  *        - search_engine        -- based on the referrer URL
  *        - campaign            -- based on campaign URL parameter
  *
  * - referer_name
  *         - ()
  *         - piwik.net            -- site host name
  *         - google.fr            -- search engine host name
  *         - adwords-search    -- campaign name
  *
  * - referer_keyword
  *         - ()
  *         - ()
  *         - my keyword
  *         - my paid keyword
  *         - ()
  *         - ()
  *
  * - referer_url : the same for all the referrer types
  *
  * @param string $referrerUrl must be URL Encoded
  * @param string $currentUrl
  * @param int $idSite
  * @return array
  */
 protected function getReferrerInformation($referrerUrl, $currentUrl, $idSite, Request $request)
 {
     $cacheKey = $referrerUrl . $currentUrl . $idSite;
     if (isset(self::$cachedReferrer[$cacheKey])) {
         return self::$cachedReferrer[$cacheKey];
     }
     $this->idsite = $idSite;
     // default values for the referer_* fields
     $referrerUrl = Common::unsanitizeInputValue($referrerUrl);
     if (!empty($referrerUrl) && !UrlHelper::isLookLikeUrl($referrerUrl)) {
         $referrerUrl = '';
     }
     $currentUrl = PageUrl::cleanupUrl($currentUrl);
     $this->referrerUrl = $referrerUrl;
     $this->referrerUrlParse = @parse_url($this->referrerUrl);
     $this->currentUrlParse = @parse_url($currentUrl);
     $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
     $this->nameReferrerAnalyzed = '';
     $this->keywordReferrerAnalyzed = '';
     $this->referrerHost = '';
     if (isset($this->referrerUrlParse['host'])) {
         $this->referrerHost = $this->referrerUrlParse['host'];
     }
     $referrerDetected = $this->detectReferrerCampaign($request);
     if (!$referrerDetected) {
         if ($this->detectReferrerDirectEntry() || $this->detectReferrerSearchEngine()) {
             $referrerDetected = true;
         }
     }
     if (!$referrerDetected && !empty($this->referrerHost)) {
         $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_WEBSITE;
         $this->nameReferrerAnalyzed = Common::mb_strtolower($this->referrerHost);
         $urlsByHost = $this->getCachedUrlsByHostAndIdSite();
         $directEntry = new SiteUrls();
         $path = $directEntry->getPathMatchingUrl($this->referrerUrlParse, $urlsByHost);
         if (!empty($path) && $path !== '/') {
             $this->nameReferrerAnalyzed .= rtrim($path, '/');
         }
     }
     $referrerInformation = array('referer_type' => $this->typeReferrerAnalyzed, 'referer_name' => $this->nameReferrerAnalyzed, 'referer_keyword' => $this->keywordReferrerAnalyzed, 'referer_url' => $this->referrerUrl);
     self::$cachedReferrer[$cacheKey] = $referrerInformation;
     return $referrerInformation;
 }
开发者ID:dev-bobsong,项目名称:piwik,代码行数:72,代码来源:Base.php

示例4: 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


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