diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-10-07 08:29:24 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-10-07 08:29:26 +0400 |
commit | a27771ee5a807eccbed9c9bc62262e79f59fe065 (patch) | |
tree | 4a15c24a9a4d7b4d79134a985c11c4e68168261e /core | |
parent | 6aa7ab6538cdd84af0b89b6e2d2d9524600ac5f2 (diff) |
Refs #4125 Renaming plugin from Referers to Referrers
* updating all variables/methods containing Referers
* RENAMING custom segments definition, and custom scheduled reports definition, so that when they load "Referers" segment/report it still works as expected
* RENAMING old archived data so that archived blobs are called Referrers
* Reverting part of 0deb2bbb8d5598200f7adfbc77b190516f919e48
* Update integration tests generating PDF+HTML with images on my dev box (GD 2.1 and PHP 5.5)
Diffstat (limited to 'core')
-rw-r--r-- | core/API/Proxy.php | 4 | ||||
-rw-r--r-- | core/Archive.php | 14 | ||||
-rw-r--r-- | core/ArchiveProcessor.php | 4 | ||||
-rw-r--r-- | core/Common.php | 2 | ||||
-rw-r--r-- | core/Controller.php | 4 | ||||
-rw-r--r-- | core/DataAccess/LogAggregator.php | 4 | ||||
-rw-r--r-- | core/DataFiles/SearchEngines.php | 4 | ||||
-rw-r--r-- | core/DataTable.php | 2 | ||||
-rw-r--r-- | core/Nonce.php | 6 | ||||
-rw-r--r-- | core/Tracker/Action.php | 24 | ||||
-rw-r--r-- | core/Tracker/GoalManager.php | 26 | ||||
-rw-r--r-- | core/Tracker/Referrer.php | 146 | ||||
-rw-r--r-- | core/Tracker/Request.php | 2 | ||||
-rw-r--r-- | core/Tracker/Visit.php | 28 | ||||
-rw-r--r-- | core/Url.php | 6 | ||||
-rw-r--r-- | core/UrlHelper.php | 72 | ||||
-rw-r--r-- | core/Version.php | 2 | ||||
-rw-r--r-- | core/ViewDataTable.php | 2 | ||||
-rw-r--r-- | core/ViewDataTable/Properties.php | 2 |
19 files changed, 175 insertions, 179 deletions
diff --git a/core/API/Proxy.php b/core/API/Proxy.php index cfad9b418d..1f9dc2a6b7 100644 --- a/core/API/Proxy.php +++ b/core/API/Proxy.php @@ -82,7 +82,7 @@ class Proxy * The module to be registered must be * - a singleton (providing a getInstance() method) * - the API file must be located in plugins/ModuleName/API.php - * for example plugins/Referers/API.php + * for example plugins/Referrers/API.php * * The method will introspect the methods, their parameters, etc. * @@ -228,7 +228,7 @@ class Proxy * Returns the 'moduleName' part of 'Piwik_moduleName_API' classname * * @param string $className "API" - * @return string "Referers" + * @return string "Referrers" */ public function getModuleNameFromClassName($className) { diff --git a/core/Archive.php b/core/Archive.php index 543840ec02..694cf55e05 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -61,7 +61,7 @@ class Archive * Archive IDs are indexed by done flag and period, ie: * * array( - * 'done.Referers' => array( + * 'done.Referrers' => array( * '2010-01-01' => 1, * '2010-01-02' => 2, * ), @@ -170,7 +170,7 @@ class Archive * Returns the value of the element $name from the current archive * The value to be returned is a numeric value and is stored in the archive_numeric_* tables * - * @param string|array $names One or more archive names, eg, 'nb_visits', 'Referers_distinctKeywords', + * @param string|array $names One or more archive names, eg, 'nb_visits', 'Referrers_distinctKeywords', * etc. * @return mixed False if no value with the given name, numeric if only one site * and date and we're not forcing an index, and array if multiple @@ -201,7 +201,7 @@ class Archive * * It can return anything from strings, to serialized PHP arrays or PHP objects, etc. * - * @param string|array $names One or more archive names, eg, 'Referers_keywordBySearchEngine'. + * @param string|array $names One or more archive names, eg, 'Referrers_keywordBySearchEngine'. * @param null $idSubtable * @return string|array|bool False if no value with the given name, numeric if only one site * and date and we're not forcing an index, and array if multiple @@ -218,7 +218,7 @@ class Archive * * Note: Every DataTable instance returned will have at most one row in it. * - * @param string|array $names One or more archive names, eg, 'nb_visits', 'Referers_distinctKeywords', + * @param string|array $names One or more archive names, eg, 'nb_visits', 'Referrers_distinctKeywords', * etc. * @return DataTable|DataTable\Map|bool False if no value with the given names. Based on the number * of sites/periods, the result can be a DataTable\Map, which @@ -233,7 +233,7 @@ class Archive /** * This method will build a dataTable from the blob value $name in the current archive. * - * For example $name = 'Referers_searchEngineByKeyword' will return a + * For example $name = 'Referrers_searchEngineByKeyword' will return a * DataTable containing all the keywords. If a $idSubtable is given, the method * will return the subTable of $name. If 'all' is supplied for $idSubtable every subtable * will be returned. @@ -644,10 +644,6 @@ class Archive } $plugin = substr($report, 0, strpos($report, '_')); - if ($plugin == 'Referrers') { // TODO: remove when Referers plugin name is changed - $plugin = 'Referers'; - } - if (empty($plugin) || !\Piwik\PluginsManager::getInstance()->isPluginActivated($plugin) ) { diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php index f73f74cbbf..70d8e3fe3a 100644 --- a/core/ArchiveProcessor.php +++ b/core/ArchiveProcessor.php @@ -405,8 +405,8 @@ abstract class ArchiveProcessor $clean = array(); foreach ($values as $id => $value) { // for the parent Table we keep the name - // for example for the Table of searchEngines we keep the name 'referer_search_engine' - // but for the child table of 'Google' which has the ID = 9 the name would be 'referer_search_engine_9' + // for example for the Table of searchEngines we keep the name 'referrer_search_engine' + // but for the child table of 'Google' which has the ID = 9 the name would be 'referrer_search_engine_9' $newName = $name; if ($id != 0) { //FIXMEA: refactor diff --git a/core/Common.php b/core/Common.php index 806278b2a7..4955cb75fd 100644 --- a/core/Common.php +++ b/core/Common.php @@ -27,7 +27,7 @@ use Piwik\Tracker\Cache; class Common { /** - * Const used to map the referer type to an integer in the log_visit table + * Const used to map the referrer type to an integer in the log_visit table */ const REFERRER_TYPE_DIRECT_ENTRY = 1; const REFERRER_TYPE_SEARCH_ENGINE = 2; diff --git a/core/Controller.php b/core/Controller.php index d3c17ae8a1..6f46eb1d72 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -34,7 +34,7 @@ use Piwik\ViewDataTable; abstract class Controller { /** - * Plugin name, eg. Referers + * Plugin name, eg. Referrers * @var string */ protected $pluginName; @@ -291,7 +291,7 @@ abstract class Controller * Returns a numeric value from the API. * Works only for API methods that originally returns numeric values (there is no cast here) * - * @param string $methodToCall Name of method to call, eg. Referers.getNumberOfDistinctSearchEngines + * @param string $methodToCall Name of method to call, eg. Referrers.getNumberOfDistinctSearchEngines * @param bool|string $date A custom date to use when getting the value. If false, the 'date' query * parameter is used. * diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php index d2aa52f014..34a9dd831c 100644 --- a/core/DataAccess/LogAggregator.php +++ b/core/DataAccess/LogAggregator.php @@ -128,9 +128,9 @@ class LogAggregator /** * Query visits logs by dimension, and return the aggregate data. * - * @param array|string $dimensions Can be a string, eg. "referer_name", will be aliased as 'label' in the returned rows + * @param array|string $dimensions Can be a string, eg. "referrer_name", will be aliased as 'label' in the returned rows * Can also be an array of strings, when the dimension spans multiple fields, - * eg. array("referer_name", "referer_keyword") + * eg. array("referrer_name", "referrer_keyword") * @param bool|string $where Additional condition for WHERE clause * @param array $additionalSelects Additional SELECT clause * @param bool|array $metrics Set this if you want to limit the columns that are returned. diff --git a/core/DataFiles/SearchEngines.php b/core/DataFiles/SearchEngines.php index f7bda380d3..e82b55469c 100644 --- a/core/DataFiles/SearchEngines.php +++ b/core/DataFiles/SearchEngines.php @@ -40,7 +40,7 @@ * Reference: http://www.php.net/manual/en/mbstring.encodings.php * * You can add new search engines icons by adding the icon in the - * plugins/Referers/images/searchEngines directory using the format + * plugins/Referrers/images/searchEngines directory using the format * 'mainSearchEngineUrl.png'. Example: www.google.com.png * * To help Piwik link directly the search engine result page for the keyword, @@ -822,7 +822,7 @@ if (!isset($GLOBALS['Piwik_SearchEngines'])) { // Teoma 'www.teoma.com' => array('Teoma', 'q', 'web?q={k}'), - // Terra -- referer does not contain search phrase (keywords) + // Terra -- referrer does not contain search phrase (keywords) 'buscador.terra.es' => array('Terra', 'query', 'Default.aspx?source=Search&query={k}'), 'buscador.terra.cl' => array('Terra'), 'buscador.terra.com.br' => array('Terra'), diff --git a/core/DataTable.php b/core/DataTable.php index d6c71b9459..5760483c95 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -62,7 +62,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; * 'visits' => 1550, * 'visits_length' => 514214, * 'returning_visits' => 77) - * - metadata = array( 'logo' => '/plugins/Referers/images/searchEngines/google.com.png', + * - metadata = array( 'logo' => '/plugins/Referrers/images/searchEngines/google.com.png', * 'url' => 'http://google.com') * - DataTable = DataTable containing several DataTable\Row containing the keywords information for this search engine * Example of one DataTable\Row diff --git a/core/Nonce.php b/core/Nonce.php index ddd586ce24..35b611d800 100644 --- a/core/Nonce.php +++ b/core/Nonce.php @@ -70,9 +70,9 @@ class Nonce return false; } - // validate referer - $referer = Url::getReferer(); - if (!empty($referer) && !Url::isLocalUrl($referer)) { + // validate referrer + $referrer = Url::getReferrer(); + if (!empty($referrer) && !Url::isLocalUrl($referrer)) { return false; } diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index 409696e7f0..1017798312 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -577,12 +577,12 @@ class Action implements ActionInterface * * @param int $idVisit is the ID of the current visit in the DB table log_visit * @param $visitorIdCookie - * @param int $idRefererActionUrl is the ID of the last action done by the current visit. - * @param $idRefererActionName - * @param int $timeSpentRefererAction is the number of seconds since the last action was done. - * It is directly related to idRefererActionUrl. + * @param int $idReferrerActionUrl is the ID of the last action done by the current visit. + * @param $idReferrerActionName + * @param int $timeSpentReferrerAction is the number of seconds since the last action was done. + * It is directly related to idReferrerActionUrl. */ - public function record($idVisit, $visitorIdCookie, $idRefererActionUrl, $idRefererActionName, $timeSpentRefererAction) + public function record($idVisit, $visitorIdCookie, $idReferrerActionUrl, $idReferrerActionName, $timeSpentReferrerAction) { $this->loadIdActionNameAndUrl(); @@ -599,9 +599,9 @@ class Action implements ActionInterface 'server_time' => Tracker::getDatetimeFromTimestamp($this->request->getCurrentTimestamp()), 'idaction_url' => $this->getIdActionUrl(), 'idaction_name' => $idActionName, - 'idaction_url_ref' => $idRefererActionUrl, - 'idaction_name_ref' => $idRefererActionName, - 'time_spent_ref_action' => $timeSpentRefererAction + 'idaction_url_ref' => $idReferrerActionUrl, + 'idaction_name_ref' => $idReferrerActionName, + 'time_spent_ref_action' => $timeSpentReferrerAction ); if (!empty($this->timeGeneration)) { @@ -633,9 +633,9 @@ class Action implements ActionInterface 'idSite' => $this->request->getIdSite(), 'idLinkVisitAction' => $this->idLinkVisitAction, 'idVisit' => $idVisit, - 'idRefererActionUrl' => $idRefererActionUrl, - 'idRefererActionName' => $idRefererActionName, - 'timeSpentRefererAction' => $timeSpentRefererAction, + 'idReferrerActionUrl' => $idReferrerActionUrl, + 'idReferrerActionName' => $idReferrerActionName, + 'timeSpentReferrerAction' => $timeSpentReferrerAction, ); Common::printDebug($insertWithoutNulls); @@ -1019,7 +1019,7 @@ interface ActionInterface public function getActionType(); - public function record($idVisit, $visitorIdCookie, $idRefererActionUrl, $idRefererActionName, $timeSpentRefererAction); + public function record($idVisit, $visitorIdCookie, $idReferrerActionUrl, $idReferrerActionName, $timeSpentReferrerAction); public function getIdActionUrl(); diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php index cca7e90887..25fb11a6cb 100644 --- a/core/Tracker/GoalManager.php +++ b/core/Tracker/GoalManager.php @@ -232,10 +232,10 @@ class GoalManager */ public function recordGoals($idSite, $visitorInformation, $visitCustomVariables, $action) { - $refererTimestamp = $this->request->getParam('_refts'); - $refererUrl = $this->request->getParam('_ref'); - $refererCampaignName = trim(urldecode($this->request->getParam('_rcn'))); - $refererCampaignKeyword = trim(urldecode($this->request->getParam('_rck'))); + $referrerTimestamp = $this->request->getParam('_refts'); + $referrerUrl = $this->request->getParam('_ref'); + $referrerCampaignName = trim(urldecode($this->request->getParam('_rcn'))); + $referrerCampaignKeyword = trim(urldecode($this->request->getParam('_rck'))); $browserLanguage = $this->request->getBrowserLanguage(); $location_country = isset($visitorInformation['location_country']) @@ -296,28 +296,28 @@ class GoalManager // 0) In some (unknown!?) cases the campaign is not found in the attribution cookie, but the URL ref was found. // In this case we look up if the current visit is credited to a campaign and will credit this campaign rather than the URL ref (since campaigns have higher priority) - if (empty($refererCampaignName) + if (empty($referrerCampaignName) && $type == Common::REFERRER_TYPE_CAMPAIGN && !empty($name) ) { // Use default values per above } // 1) Campaigns from 1st party cookie - elseif (!empty($refererCampaignName)) { + elseif (!empty($referrerCampaignName)) { $type = Common::REFERRER_TYPE_CAMPAIGN; - $name = $refererCampaignName; - $keyword = $refererCampaignKeyword; - $time = $refererTimestamp; + $name = $referrerCampaignName; + $keyword = $referrerCampaignKeyword; + $time = $referrerTimestamp; } // 2) Referrer URL parsing - elseif (!empty($refererUrl)) { + elseif (!empty($referrerUrl)) { $referrer = new Referrer(); - $referrer = $referrer->getRefererInformation($refererUrl, $currentUrl = '', $idSite); + $referrer = $referrer->getReferrerInformation($referrerUrl, $currentUrl = '', $idSite); - // if the parsed referer is interesting enough, ie. website or search engine + // if the parsed referrer is interesting enough, ie. website or search engine if (in_array($referrer['referer_type'], array(Common::REFERRER_TYPE_SEARCH_ENGINE, Common::REFERRER_TYPE_WEBSITE))) { $type = $referrer['referer_type']; $name = $referrer['referer_name']; $keyword = $referrer['referer_keyword']; - $time = $refererTimestamp; + $time = $referrerTimestamp; } } $goal += array( diff --git a/core/Tracker/Referrer.php b/core/Tracker/Referrer.php index 0490a3e74e..d4088d99c9 100644 --- a/core/Tracker/Referrer.php +++ b/core/Tracker/Referrer.php @@ -19,25 +19,25 @@ use Piwik\UrlHelper; */ class Referrer { - // @see detect*() referer methods - protected $typeRefererAnalyzed; - protected $nameRefererAnalyzed; - protected $keywordRefererAnalyzed; - protected $refererHost; - protected $refererUrl; - protected $refererUrlParse; + // @see detect*() referrer methods + protected $typeReferrerAnalyzed; + protected $nameReferrerAnalyzed; + protected $keywordReferrerAnalyzed; + protected $referrerHost; + protected $referrerUrl; + protected $referrerUrlParse; protected $currentUrlParse; protected $idsite; - // Used to prefix when a adsense referer is detected + // Used to prefix when a adsense referrer is detected const LABEL_PREFIX_ADSENSE_KEYWORD = '(adsense) '; /** * Returns an array containing the following information: * - referer_type - * - direct -- absence of referer URL OR referer URL has the same host - * - site -- based on the referer URL - * - search_engine -- based on the referer URL + * - 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 @@ -54,86 +54,86 @@ class Referrer * - () * - () * - * - referer_url : the same for all the referer types + * - referer_url : the same for all the referrer types * - * @param string $refererUrl must be URL Encoded + * @param string $referrerUrl must be URL Encoded * @param string $currentUrl * @param int $idSite * @return array */ - public function getRefererInformation($refererUrl, $currentUrl, $idSite) + public function getReferrerInformation($referrerUrl, $currentUrl, $idSite) { $this->idsite = $idSite; // default values for the referer_* fields - $refererUrl = Common::unsanitizeInputValue($refererUrl); - if (!empty($refererUrl) - && !UrlHelper::isLookLikeUrl($refererUrl) + $referrerUrl = Common::unsanitizeInputValue($referrerUrl); + if (!empty($referrerUrl) + && !UrlHelper::isLookLikeUrl($referrerUrl) ) { - $refererUrl = ''; + $referrerUrl = ''; } $currentUrl = Action::cleanupUrl($currentUrl); - $this->refererUrl = $refererUrl; - $this->refererUrlParse = @parse_url($this->refererUrl); + $this->referrerUrl = $referrerUrl; + $this->referrerUrlParse = @parse_url($this->referrerUrl); $this->currentUrlParse = @parse_url($currentUrl); - $this->typeRefererAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY; - $this->nameRefererAnalyzed = ''; - $this->keywordRefererAnalyzed = ''; - $this->refererHost = ''; + $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY; + $this->nameReferrerAnalyzed = ''; + $this->keywordReferrerAnalyzed = ''; + $this->referrerHost = ''; - if (isset($this->refererUrlParse['host'])) { - $this->refererHost = $this->refererUrlParse['host']; + if (isset($this->referrerUrlParse['host'])) { + $this->referrerHost = $this->referrerUrlParse['host']; } - $refererDetected = false; + $referrerDetected = false; if (!empty($this->currentUrlParse['host']) - && $this->detectRefererCampaign() + && $this->detectReferrerCampaign() ) { - $refererDetected = true; + $referrerDetected = true; } - if (!$refererDetected) { - if ($this->detectRefererDirectEntry() - || $this->detectRefererSearchEngine() + if (!$referrerDetected) { + if ($this->detectReferrerDirectEntry() + || $this->detectReferrerSearchEngine() ) { - $refererDetected = true; + $referrerDetected = true; } } - if (!empty($this->refererHost) - && !$refererDetected + if (!empty($this->referrerHost) + && !$referrerDetected ) { - $this->typeRefererAnalyzed = Common::REFERRER_TYPE_WEBSITE; - $this->nameRefererAnalyzed = mb_strtolower($this->refererHost, 'UTF-8'); + $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_WEBSITE; + $this->nameReferrerAnalyzed = mb_strtolower($this->referrerHost, 'UTF-8'); } - $refererInformation = array( - 'referer_type' => $this->typeRefererAnalyzed, - 'referer_name' => $this->nameRefererAnalyzed, - 'referer_keyword' => $this->keywordRefererAnalyzed, - 'referer_url' => $this->refererUrl, + $referrerInformation = array( + 'referer_type' => $this->typeReferrerAnalyzed, + 'referer_name' => $this->nameReferrerAnalyzed, + 'referer_keyword' => $this->keywordReferrerAnalyzed, + 'referer_url' => $this->referrerUrl, ); - return $refererInformation; + return $referrerInformation; } /** * Search engine detection * @return bool */ - protected function detectRefererSearchEngine() + protected function detectReferrerSearchEngine() { - $searchEngineInformation = UrlHelper::extractSearchEngineInformationFromUrl($this->refererUrl); - Piwik_PostEvent('Tracker.detectRefererSearchEngine', array(&$searchEngineInformation, $this->refererUrl)); + $searchEngineInformation = UrlHelper::extractSearchEngineInformationFromUrl($this->referrerUrl); + Piwik_PostEvent('Tracker.detectReferrerSearchEngine', array(&$searchEngineInformation, $this->referrerUrl)); if ($searchEngineInformation === false) { return false; } - $this->typeRefererAnalyzed = Common::REFERRER_TYPE_SEARCH_ENGINE; - $this->nameRefererAnalyzed = $searchEngineInformation['name']; - $this->keywordRefererAnalyzed = $searchEngineInformation['keywords']; + $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_SEARCH_ENGINE; + $this->nameReferrerAnalyzed = $searchEngineInformation['name']; + $this->keywordReferrerAnalyzed = $searchEngineInformation['keywords']; return true; } @@ -151,45 +151,45 @@ class Referrer } if (!empty($campaignName)) { - $this->typeRefererAnalyzed = Common::REFERRER_TYPE_CAMPAIGN; - $this->nameRefererAnalyzed = $campaignName; + $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_CAMPAIGN; + $this->nameReferrerAnalyzed = $campaignName; foreach ($this->campaignKeywords as $campaignKeywordParameter) { $campaignKeyword = UrlHelper::getParameterFromQueryString($string, $campaignKeywordParameter); if (!empty($campaignKeyword)) { - $this->keywordRefererAnalyzed = trim(urldecode($campaignKeyword)); + $this->keywordReferrerAnalyzed = trim(urldecode($campaignKeyword)); break; } } // if the campaign keyword is empty, try to get a keyword from the referrer URL - if (empty($this->keywordRefererAnalyzed)) { + if (empty($this->keywordReferrerAnalyzed)) { // Set the Campaign keyword to the keyword found in the Referrer URL if any - $referrerUrlInfo = UrlHelper::extractSearchEngineInformationFromUrl($this->refererUrl); + $referrerUrlInfo = UrlHelper::extractSearchEngineInformationFromUrl($this->referrerUrl); if (!empty($referrerUrlInfo['keywords'])) { - $this->keywordRefererAnalyzed = $referrerUrlInfo['keywords']; + $this->keywordReferrerAnalyzed = $referrerUrlInfo['keywords']; } // Set the keyword, to the hostname found, in a Adsense Referrer URL '&url=' parameter - if (empty($this->keywordRefererAnalyzed) - && !empty($this->refererUrlParse['query']) - && !empty($this->refererHost) - && (strpos($this->refererHost, 'google') !== false || strpos($this->refererHost, 'doubleclick') !== false) + if (empty($this->keywordReferrerAnalyzed) + && !empty($this->referrerUrlParse['query']) + && !empty($this->referrerHost) + && (strpos($this->referrerHost, 'google') !== false || strpos($this->referrerHost, 'doubleclick') !== false) ) { // This parameter sometimes is found & contains the page with the adsense ad bringing visitor to our site $adsenseReferrerParameter = 'url'; - $value = trim(urldecode(UrlHelper::getParameterFromQueryString($this->refererUrlParse['query'], $adsenseReferrerParameter))); + $value = trim(urldecode(UrlHelper::getParameterFromQueryString($this->referrerUrlParse['query'], $adsenseReferrerParameter))); if (!empty($value)) { $parsedAdsenseReferrerUrl = parse_url($value); if (!empty($parsedAdsenseReferrerUrl['host'])) { - $this->keywordRefererAnalyzed = self::LABEL_PREFIX_ADSENSE_KEYWORD . $parsedAdsenseReferrerUrl['host']; + $this->keywordReferrerAnalyzed = self::LABEL_PREFIX_ADSENSE_KEYWORD . $parsedAdsenseReferrerUrl['host']; } } } // or we default to the referrer hostname otherwise - if (empty($this->keywordRefererAnalyzed)) { - $this->keywordRefererAnalyzed = $this->refererHost; + if (empty($this->keywordReferrerAnalyzed)) { + $this->keywordReferrerAnalyzed = $this->referrerHost; } } @@ -202,7 +202,7 @@ class Referrer * Campaign analysis * @return bool */ - protected function detectRefererCampaign() + protected function detectReferrerCampaign() { if (!isset($this->currentUrlParse['query']) && !isset($this->currentUrlParse['fragment']) @@ -231,24 +231,24 @@ class Referrer /** * We have previously tried to detect the campaign variables in the URL - * so at this stage, if the referer host is the current host, - * or if the referer host is any of the registered URL for this website, + * 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 detectRefererDirectEntry() + protected function detectReferrerDirectEntry() { - if (!empty($this->refererHost)) { - // is the referer host the current host? + if (!empty($this->referrerHost)) { + // is the referrer host the current host? if (isset($this->currentUrlParse['host'])) { $currentHost = mb_strtolower($this->currentUrlParse['host'], 'UTF-8'); - if ($currentHost == mb_strtolower($this->refererHost, 'UTF-8')) { - $this->typeRefererAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY; + if ($currentHost == mb_strtolower($this->referrerHost, 'UTF-8')) { + $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY; return true; } } - if (Visit::isHostKnownAliasHost($this->refererHost, $this->idsite)) { - $this->typeRefererAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY; + if (Visit::isHostKnownAliasHost($this->referrerHost, $this->idsite)) { + $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY; return true; } } diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php index 0d6288406b..9365b706bd 100644 --- a/core/Tracker/Request.php +++ b/core/Tracker/Request.php @@ -45,7 +45,7 @@ class Request $this->timestamp = time(); $this->enforcedIp = false; - // When the 'url' and referer url parameter are not given, we might be in the 'Simple Image Tracker' mode. + // When the 'url' and referrer url parameter are not given, we might be in the 'Simple Image Tracker' mode. // The URL can default to the Referrer, which will be in this case // the URL of the page containing the Simple Image beacon if (empty($this->params['urlref']) diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index 50bcb8c1d3..7df96eb24a 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -27,7 +27,7 @@ use UserAgentParser; /** * Class used to handle a Visit. * A visit is either NEW or KNOWN. - * - If a visit is NEW then we process the visitor information (settings, referers, etc.) and save + * - If a visit is NEW then we process the visitor information (settings, referrers, etc.) and save * a new line in the log_visit table. * - If a visit is KNOWN then we update the visit row in the log_visit table, updating the number of pages * views, time spent, etc. @@ -173,15 +173,15 @@ class Visit implements VisitInterface if ($this->isVisitorKnown() && $isLastActionInTheSameVisit ) { - $idRefererActionUrl = $this->visitorInfo['visit_exit_idaction_url']; - $idRefererActionName = $this->visitorInfo['visit_exit_idaction_name']; + $idReferrerActionUrl = $this->visitorInfo['visit_exit_idaction_url']; + $idReferrerActionName = $this->visitorInfo['visit_exit_idaction_name']; try { $this->handleKnownVisit($idActionUrl, $idActionName, $actionType, $visitIsConverted); if (!is_null($action)) { $action->record($this->visitorInfo['idvisit'], $this->visitorInfo['idvisitor'], - $idRefererActionUrl, - $idRefererActionName, + $idReferrerActionUrl, + $idReferrerActionName, $this->visitorInfo['time_spent_ref_action'] ); } @@ -310,7 +310,7 @@ class Visit implements VisitInterface // trigger event before update Piwik_PostEvent('Tracker.knownVisitorUpdate', array(&$valuesToUpdate)); - $this->visitorInfo['time_spent_ref_action'] = $this->getTimeSpentRefererAction(); + $this->visitorInfo['time_spent_ref_action'] = $this->getTimeSpentReferrerAction(); // update visitorInfo foreach ($valuesToUpdate AS $name => $value) { @@ -355,7 +355,7 @@ class Visit implements VisitInterface /** * @return int Time in seconds */ - protected function getTimeSpentRefererAction() + protected function getTimeSpentReferrerAction() { $timeSpent = $this->request->getCurrentTimestamp() - $this->visitorInfo['visit_last_action_time']; if ($timeSpent < 0 @@ -397,9 +397,9 @@ class Visit implements VisitInterface // Referrer data $referrer = new Referrer(); - $refererUrl = $this->request->getParam('urlref'); + $referrerUrl = $this->request->getParam('urlref'); $currentUrl = $this->request->getParam('url'); - $refererInfo = $referrer->getRefererInformation($refererUrl, $currentUrl, $this->request->getIdSite()); + $referrerInfo = $referrer->getReferrerInformation($referrerUrl, $currentUrl, $this->request->getIdSite()); $visitorReturning = $isReturningCustomer ? 2 /* Returning customer */ @@ -436,10 +436,10 @@ class Visit implements VisitInterface 'visit_total_time' => self::cleanupVisitTotalTime($defaultTimeOnePageVisit), 'visit_goal_converted' => $visitIsConverted ? 1 : 0, 'visit_goal_buyer' => $this->goalManager->getBuyerType(), - 'referer_type' => $refererInfo['referer_type'], - 'referer_name' => $refererInfo['referer_name'], - 'referer_url' => $refererInfo['referer_url'], - 'referer_keyword' => $refererInfo['referer_keyword'], + 'referer_type' => $referrerInfo['referer_type'], + 'referer_name' => $referrerInfo['referer_name'], + 'referer_url' => $referrerInfo['referer_url'], + 'referer_keyword' => $referrerInfo['referer_keyword'], 'config_id' => $userInfo['config_id'], 'config_os' => $userInfo['config_os'], 'config_browser_name' => $userInfo['config_browser_name'], @@ -954,7 +954,7 @@ class Visit implements VisitInterface return Common::generateUniqId(); } - // is the referer host any of the registered URLs for this website? + // is the referrer host any of the registered URLs for this website? static public function isHostKnownAliasHost($urlHost, $idSite) { $websiteData = Cache::getCacheWebsiteAttributes($idSite); diff --git a/core/Url.php b/core/Url.php index 3a03492f22..3f597e5386 100644 --- a/core/Url.php +++ b/core/Url.php @@ -384,9 +384,9 @@ class Url * Redirects the user to the referrer if found. * If the user doesn't have a referrer set, it redirects to the current URL without query string. */ - static public function redirectToReferer() + static public function redirectToReferrer() { - $referrer = self::getReferer(); + $referrer = self::getReferrer(); if ($referrer !== false) { self::redirectToUrl($referrer); } @@ -415,7 +415,7 @@ class Url * * @return string|bool */ - static public function getReferer() + static public function getReferrer() { if (!empty($_SERVER['HTTP_REFERER'])) { return $_SERVER['HTTP_REFERER']; diff --git a/core/UrlHelper.php b/core/UrlHelper.php index b411c6c6d1..3c6eda5b0d 100644 --- a/core/UrlHelper.php +++ b/core/UrlHelper.php @@ -153,9 +153,9 @@ class UrlHelper $urlQuery = $separator . $urlQuery; // $urlQuery = str_replace(array('%20'), ' ', $urlQuery); - $refererQuery = trim($urlQuery); + $referrerQuery = trim($urlQuery); - $values = explode($separator, $refererQuery); + $values = explode($separator, $referrerQuery); $nameToValue = array(); @@ -245,7 +245,7 @@ class UrlHelper * as the google keyword parameter couldn't be found. * * @see unit tests in /tests/core/Common.test.php - * @param string $referrerUrl URL referer URL, eg. $_SERVER['HTTP_REFERER'] + * @param string $referrerUrl URL referrer URL, eg. $_SERVER['HTTP_REFERER'] * @return array|bool false if a keyword couldn't be extracted, * or array( * 'name' => 'Google', @@ -253,62 +253,62 @@ class UrlHelper */ public static function extractSearchEngineInformationFromUrl($referrerUrl) { - $refererParsed = @parse_url($referrerUrl); - $refererHost = ''; - if (isset($refererParsed['host'])) { - $refererHost = $refererParsed['host']; + $referrerParsed = @parse_url($referrerUrl); + $referrerHost = ''; + if (isset($referrerParsed['host'])) { + $referrerHost = $referrerParsed['host']; } - if (empty($refererHost)) { + if (empty($referrerHost)) { return false; } // some search engines (eg. Bing Images) use the same domain // as an existing search engine (eg. Bing), we must also use the url path - $refererPath = ''; - if (isset($refererParsed['path'])) { - $refererPath = $refererParsed['path']; + $referrerPath = ''; + if (isset($referrerParsed['path'])) { + $referrerPath = $referrerParsed['path']; } // no search query - if (!isset($refererParsed['query'])) { - $refererParsed['query'] = ''; + if (!isset($referrerParsed['query'])) { + $referrerParsed['query'] = ''; } - $query = $refererParsed['query']; + $query = $referrerParsed['query']; // Google Referrers URLs sometimes have the fragment which contains the keyword - if (!empty($refererParsed['fragment'])) { - $query .= '&' . $refererParsed['fragment']; + if (!empty($referrerParsed['fragment'])) { + $query .= '&' . $referrerParsed['fragment']; } $searchEngines = Common::getSearchEngineUrls(); - $hostPattern = self::getLossyUrl($refererHost); - if (array_key_exists($refererHost . $refererPath, $searchEngines)) { - $refererHost = $refererHost . $refererPath; - } elseif (array_key_exists($hostPattern . $refererPath, $searchEngines)) { - $refererHost = $hostPattern . $refererPath; + $hostPattern = self::getLossyUrl($referrerHost); + if (array_key_exists($referrerHost . $referrerPath, $searchEngines)) { + $referrerHost = $referrerHost . $referrerPath; + } elseif (array_key_exists($hostPattern . $referrerPath, $searchEngines)) { + $referrerHost = $hostPattern . $referrerPath; } elseif (array_key_exists($hostPattern, $searchEngines)) { - $refererHost = $hostPattern; - } elseif (!array_key_exists($refererHost, $searchEngines)) { + $referrerHost = $hostPattern; + } elseif (!array_key_exists($referrerHost, $searchEngines)) { if (!strncmp($query, 'cx=partner-pub-', 15)) { // Google custom search engine - $refererHost = 'google.com/cse'; - } elseif (!strncmp($refererPath, '/pemonitorhosted/ws/results/', 28)) { + $referrerHost = 'google.com/cse'; + } elseif (!strncmp($referrerPath, '/pemonitorhosted/ws/results/', 28)) { // private-label search powered by InfoSpace Metasearch - $refererHost = 'wsdsold.infospace.com'; - } elseif (strpos($refererHost, '.images.search.yahoo.com') != false) { + $referrerHost = 'wsdsold.infospace.com'; + } elseif (strpos($referrerHost, '.images.search.yahoo.com') != false) { // Yahoo! Images - $refererHost = 'images.search.yahoo.com'; - } elseif (strpos($refererHost, '.search.yahoo.com') != false) { + $referrerHost = 'images.search.yahoo.com'; + } elseif (strpos($referrerHost, '.search.yahoo.com') != false) { // Yahoo! - $refererHost = 'search.yahoo.com'; + $referrerHost = 'search.yahoo.com'; } else { return false; } } - $searchEngineName = $searchEngines[$refererHost][0]; + $searchEngineName = $searchEngines[$referrerHost][0]; $variableNames = null; - if (isset($searchEngines[$refererHost][1])) { - $variableNames = $searchEngines[$refererHost][1]; + if (isset($searchEngines[$referrerHost][1])) { + $variableNames = $searchEngines[$referrerHost][1]; } if (!$variableNames) { $searchEngineNames = Common::getSearchEngineNames(); @@ -391,7 +391,7 @@ class UrlHelper strpos($query, '&q=') !== false || strpos($query, '?q=') !== false // then they started sending the full host only (no path/query string) - || (empty($query) && (empty($refererPath) || $refererPath == '/') && empty($refererParsed['fragment'])) + || (empty($query) && (empty($referrerPath) || $referrerPath == '/') && empty($referrerParsed['fragment'])) ) ) // search engines with no keyword @@ -418,10 +418,10 @@ class UrlHelper if (!empty($key)) { if (function_exists('iconv') - && isset($searchEngines[$refererHost][3]) + && isset($searchEngines[$referrerHost][3]) ) { // accepts string, array, or comma-separated list string in preferred order - $charsets = $searchEngines[$refererHost][3]; + $charsets = $searchEngines[$referrerHost][3]; if (!is_array($charsets)) { $charsets = explode(',', $charsets); } diff --git a/core/Version.php b/core/Version.php index 73b0025f92..7ff7df98d2 100644 --- a/core/Version.php +++ b/core/Version.php @@ -24,5 +24,5 @@ final class Version * Current Piwik version * @var string */ - const VERSION = '2.0-a12'; + const VERSION = '2.0-a13'; } diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index d345922cdf..f3b6ee92c7 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -739,7 +739,7 @@ class ViewDataTable } /** - * @return string URL to call the API, eg. "method=Referers.getKeywords&period=day&date=yesterday"... + * @return string URL to call the API, eg. "method=Referrers.getKeywords&period=day&date=yesterday"... */ public function getRequestArray() { diff --git a/core/ViewDataTable/Properties.php b/core/ViewDataTable/Properties.php index a4a5866f75..81eabc0234 100644 --- a/core/ViewDataTable/Properties.php +++ b/core/ViewDataTable/Properties.php @@ -266,7 +266,7 @@ class Properties * Array property containing custom data to be saved in JSON in the data-params HTML attribute * of a data table div. This data can be used by JavaScript DataTable classes. * - * e.g. array('typeReferer' => ...) + * e.g. array('typeReferrer' => ...) * * Default value: array() */ |