diff --git a/core/toxidcurl.php b/core/toxidcurl.php index 91037b1..938965a 100644 --- a/core/toxidcurl.php +++ b/core/toxidcurl.php @@ -368,12 +368,7 @@ protected function _getRemoteContent($sUrl) $aResult = array(); $curl_handle = curl_init(); - $params = http_build_query($this->additionalUrlParams); - if (false === strpos($sUrl, '?')) { - $sUrl .= "?{$params}"; - } else { - $sUrl = rtrim($sUrl, '&') . "&{$params}"; - } + $sUrl = $this->_appendAdditionalUrlParams($sUrl); curl_setopt($curl_handle, CURLOPT_URL, $sUrl); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); @@ -394,6 +389,30 @@ protected function _getRemoteContent($sUrl) return $aResult; } + + /** + * Returns the given $sUrl with the appended parameters, if any. + * + * @param $sUrl + * + * @return string + */ + protected function _appendAdditionalUrlParams($sUrl) + { + if (!$this->additionalUrlParams) { + return $sUrl; + } + + $params = http_build_query($this->additionalUrlParams); + + if (false === strpos($sUrl, '?')) { + $sUrl .= "?{$params}"; + } else { + $sUrl = rtrim($sUrl, '&') . "&{$params}"; + } + + return $sUrl; + } /** * rewrites given string URL's, which belongs to typo3 and configured in aToxidCurlSource @@ -506,8 +525,12 @@ protected function _getToxidLangUrlParam($iLangId = null, $blReset = false) if ($iLangId === null) { $iLangId = oxRegistry::getLang()->getBaseLanguage(); } + + if ($param = $this->_aToxidLangUrlParam[$iLangId]) { + return '?' . ltrim($param, '?'); + } - return '?' . ltrim($this->_aToxidLangUrlParam[$iLangId], '?'); + return ''; } /**