| @@ -1,8 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * @package Polylang | |
| 4 | - */ | |
| 5 | 2 | |
| 6 | 3 | /** |
| 7 | 4 | * Links model for use when using one domain per language |
| 8 | 5 | * for example mysite.com/sth and mysite.fr/qqch |
| @@ -40,9 +37,9 @@ | ||
| 40 | 37 | * @return string modified url |
| 41 | 38 | */ |
| 42 | 39 | public function add_language_to_link( $url, $lang ) { |
| 43 | 40 | if ( ! empty( $lang ) && ! empty( $this->hosts[ $lang->slug ] ) ) { |
| 44 | - $url = preg_replace( '#://(' . wp_parse_url( $this->home, PHP_URL_HOST ) . ')($|/.*)#', '://' . $this->hosts[ $lang->slug ] . '$2', $url ); | |
| 41 | + $url = preg_replace( '#:\/\/(' . wp_parse_url( $this->home, PHP_URL_HOST ) . ')($|\/.*)#', '://' . $this->hosts[ $lang->slug ] . '$2', $url ); | |
| 45 | 42 | } |
| 46 | 43 | return $url; |
| 47 | 44 | } |
| 48 | 45 | |
| @@ -56,9 +53,9 @@ | ||
| 56 | 53 | * @return string modified url |
| 57 | 54 | */ |
| 58 | 55 | public function remove_language_from_link( $url ) { |
| 59 | 56 | if ( ! empty( $this->hosts ) ) { |
| 60 | - $url = preg_replace( '#://(' . implode( '|', $this->hosts ) . ')($|/.*)#', '://' . wp_parse_url( $this->home, PHP_URL_HOST ) . '$2', $url ); | |
| 57 | + $url = preg_replace( '#:\/\/(' . implode( '|', $this->hosts ) . ')($|\/.*)#', '://' . wp_parse_url( $this->home, PHP_URL_HOST ) . '$2', $url ); | |
| 61 | 58 | } |
| 62 | 59 | return $url; |
| 63 | 60 | } |
| 64 | 61 | |