fix domainlist for multi domain using

This commit is contained in:
Daniel Seifert 2014-11-25 08:52:46 +00:00
parent c44f66609a
commit f509aa7110

View File

@ -142,10 +142,12 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
$aLanguages = oxRegistry::getLang()->getLanguageArray(null, true, true); $aLanguages = oxRegistry::getLang()->getLanguageArray(null, true, true);
reset($aLanguages); reset($aLanguages);
foreach ($aLanguages as $oVal) { foreach ($aLanguages as $oVal) {
$aUrls = $this->_d3AddLanguageUrlsToList($aLanguageUrls, $oVal, $aSslLanguageUrls, $aUrls); $this->_d3AddLanguageUrlsToList($aLanguageUrls, $oVal, $aSslLanguageUrls, $aUrls);
} }
} }
$this->_d3UnsetCurrentUrl($aUrls);
return $aUrls; return $aUrls;
} }
@ -157,23 +159,45 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
* *
* @return array * @return array
*/ */
protected function _d3AddLanguageUrlsToList($aLanguageUrls, $oVal, $aSslLanguageUrls, $aUrls) protected function _d3AddLanguageUrlsToList($aLanguageUrls, $oVal, $aSslLanguageUrls, &$aUrls)
{ {
$blIsSsl = oxRegistry::getConfig()->isSsl(); $blIsSsl = oxRegistry::getConfig()->isSsl();
if ($this->_d3CheckLanguageUrlsToList($aLanguageUrls, $oVal, $blIsSsl)) { if ($this->_d3CheckLanguageUrlsToList($aLanguageUrls, $oVal, $blIsSsl)) {
$sUrl = str_replace('http://', '', $aLanguageUrls[$oVal->id]); $sUrl = $this->_d3GANormalizeUrl($aLanguageUrls[$oVal->id]);
$aUrls[] = "'" . $sUrl . "'"; $aUrls[md5($sUrl)] = "'" . $sUrl . "'";
} }
if ($this->_d3CheckLanguageUrlsToList($aSslLanguageUrls, $oVal, !$blIsSsl)) { if ($this->_d3CheckLanguageUrlsToList($aSslLanguageUrls, $oVal, !$blIsSsl)) {
$sSslUrl = str_replace('https://', '', $aSslLanguageUrls[$oVal->id]); $sSslUrl = $this->_d3GANormalizeUrl($aLanguageUrls[$oVal->id]);
$aUrls[] = "'" . $sSslUrl . "'"; $aUrls[md5($sSslUrl)] = "'" . $sSslUrl . "'";
} }
return $aUrls; return $aUrls;
} }
/**
* @param $sUrl
*
* @return string
*/
protected function _d3GANormalizeUrl($sUrl)
{
$sPattern = "^http(s?)://";
/** @var d3str $oD3Str */
$oD3Str = oxNew('d3str');
return preg_replace('@'.$sPattern.'@', '', $oD3Str->untrailingslashit($sUrl));
}
/**
* @param $aUrls
*/
protected function _d3UnsetCurrentUrl(&$aUrls)
{
unset($aUrls[md5($this->_d3GANormalizeUrl(oxRegistry::getConfig()->getCurrentShopUrl()))]);
}
/** /**
* @param $aLanguageUrls * @param $aLanguageUrls
* @param $oVal * @param $oVal