47 $aAddUrlParams = array();
49 return $aAddUrlParams;
59 if ( $this->_aAddUrlParams === null ) {
63 if ( ( $iCur = $this->
getConfig()->getShopCurrency() ) ) {
64 $this->_aAddUrlParams[
'cur'] = $iCur;
84 $sUrl = $oStr->preg_replace(
'/(\?|&(amp;)?)(force_)?(admin_)?sid=[a-z0-9\._]+&?(amp;)?/i',
'\1', $sUrl);
85 $sUrl = $oStr->preg_replace(
'/(&|\?)$/',
'', $sUrl );
91 if ($qpos = $oStr->strpos($sUrl,
'?')) {
92 if ($qpos == $oStr->strlen($sUrl)-1) {
101 if ( !$oStr->preg_match(
'/[&?](amp;)?lang=[0-9]+/i', $sUrl)) {
102 $sUrl .=
"{$sSep}lang=".oxRegistry::getLang()->getBaseLanguage();
107 if ( !$oStr->preg_match(
'/[&?](amp;)?cur=[0-9]+/i', $sUrl)) {
108 $iCur = (int) $oConfig->getShopCurrency();
110 $sUrl .=
"{$sSep}cur=".$iCur;
132 $sUrl = $oStr->preg_replace(
'/(\?|&(amp;)?)(force_)?(admin_)?sid=[a-z0-9\._]+&?(amp;)?/i',
'\1', $sUrl);
133 $sUrl = $oStr->preg_replace(
'/(&|\?)$/',
'', $sUrl );
134 $sSep = ( $oStr->strpos( $sUrl,
'?' ) === false ) ?
'?' :
'&';
140 if ( !$oStr->preg_match(
'/[&?](amp;)?lang=[0-9]+/i', $sUrl ) && $iLang != $oConfig->getConfigParam(
'sDefaultLang' ) ) {
141 $sUrl .=
"{$sSep}lang=".$iLang;
157 public function appendUrl($sUrl, $aAddParams, $blFinalUrl =
false)
163 if (is_array($aAddParams)) {
164 foreach ( $aAddParams as $sName => $sValue ) {
165 if ( isset( $sValue ) && !$oStr->preg_match(
"/\?(.*&(amp;)?)?".preg_quote( $sName ).
"=/", $sUrl ) ) {
166 $sUrl .= $sSeparator . $sName .
"=" . $sValue;
167 $sSeparator =
'&';
172 if ($sUrl && !$blFinalUrl) {
173 $sUrl .= $sSeparator;
190 if ( is_array( $aParams ) ) {
191 foreach ( $aParams as $sParam ) {
192 $sUrl = $oStr->preg_replace(
'/(\?|&(amp;)?)'.preg_quote( $sParam ).
'=[a-z0-9\.]+&?(amp;)?/i',
'\1', $sUrl );
195 $sUrl = $oStr->preg_replace(
'/(\?|&(amp;)?).+/i',
'\1', $sUrl );
198 return trim( $sUrl,
"?" );
211 if (!preg_match(
"#^https?://#i", $sUrl)) {
212 $sShopUrl = $this->
getConfig()->getSslShopUrl();
213 $sUrl = $sShopUrl . $sUrl;
229 public function processUrl($sUrl, $blFinalUrl =
true, $aParams = null, $iLang = null)
231 $sUrl = $this->
appendUrl($sUrl, $aParams, $blFinalUrl);
253 $sUrl = $this->
appendUrl($sUrl, $aAddParams, $blFinalUrl);
258 $sUrl =
getStr()->preg_replace(
'/(\?|&(amp;)?)$/',
'', $sUrl);
274 $sUrlHost = @parse_url($sUrl, PHP_URL_HOST);
276 if (is_null($sUrlHost)) {
280 if (empty($aHosts)) {
284 foreach ( $aHosts as $sHost ) {
285 if ( $sHost === $sUrlHost ) {
310 return getStr()->preg_replace(
'/(\?|&(amp;)?)$/',
'', $sUrl );
323 $aUrlParts = explode(
'?', $sUrl);
326 if ( !is_array($aUrlParts) || count($aUrlParts) != 2) {
330 $sUrl = $aUrlParts[0];
331 $sUrlParams = $aUrlParts[1];
334 $sUrlParams = $oStrUtils->preg_replace(
335 array(
'@(\&(amp;){1,})@ix',
'@\&{1,}@',
'@\?&@x'),
336 array(
'&',
'&',
'?'),
341 parse_str($sUrlParams, $aUrlParams);
342 $sUrl .=
'?'.http_build_query($aUrlParams,
'', $sConnector);
364 if ( $oStr->preg_match(
'/(\?|&(amp;)?)$/i', $sUrl ) ) {
368 if ( $oStr->strpos($sUrl,
'?') === false ) {
371 return $sUrl.
'&';
383 $aServerParams[
"HTTPS"] = $oUtilsServer->getServerVar(
"HTTPS" );
384 $aServerParams[
"HTTP_X_FORWARDED_PROTO"] = $oUtilsServer->getServerVar(
"HTTP_X_FORWARDED_PROTO" );
385 $aServerParams[
"HTTP_HOST"] = $oUtilsServer->getServerVar(
"HTTP_HOST" );
386 $aServerParams[
"REQUEST_URI"] = $oUtilsServer->getServerVar(
"REQUEST_URI" );
388 $sProtocol =
"http://";
390 if ( isset($aServerParams[
'HTTPS']) && (($aServerParams[
'HTTPS'] ==
'on' || $aServerParams[
'HTTPS'] == 1))
391 || (isset($aServerParams[
'HTTP_X_FORWARDED_PROTO']) && $aServerParams[
'HTTP_X_FORWARDED_PROTO'] ==
'https')
393 $sProtocol =
'https://';
396 $sUrl = $sProtocol . $aServerParams[
'HTTP_HOST'] . $aServerParams[
'REQUEST_URI'];
414 $sValue = str_replace(
"&",
"&", $sValue );
415 $aNavParams = explode(
"&", $sValue );
416 $aNavParams = array_filter( $aNavParams );
418 foreach ( $aNavParams as $sValue ) {
419 $exp = explode(
"=", $sValue );
420 $aParams[$exp[0]] = $exp[1];
434 if ($sUrl && ($sHost = @parse_url($sUrl, PHP_URL_HOST))) {
435 if (!in_array($sHost, $aHosts)) {
451 if (isset($aLanguageUrls[$iLanguageId])) {
452 $this->
_addHost($aLanguageUrls[$iLanguageId], $aHosts);
463 if ($this->_aHosts === null) {
464 $this->_aHosts = array();
507 if ($oStr->strpos($sUrl,
'?') ===
false) {
510 if ($sSeparator ===
'' && !$oStr->preg_match(
"/(\?|&(amp;)?)$/", $sUrl)) {
511 $sSeparator =
'&';
525 return @parse_url($this->
getConfig()->getShopUrl(), PHP_URL_HOST);