PluginProbe
Polylang / 2.5
Polylang v2.5
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | include/links-domain.php +3 -6 2.72.5 View file →
@@ -37,9 +37,9 @@
37 37 * @return string modified url
38 38 */
39 39 public function add_language_to_link( $url, $lang ) {
40 40 if ( ! empty( $lang ) && ! empty( $this->hosts[ $lang->slug ] ) ) {
41 - $url = preg_replace( '#://(' . wp_parse_url( $this->home, PHP_URL_HOST ) . ')($|/.*)#', '://' . $this->hosts[ $lang->slug ] . '$2', $url );
41 + $url = preg_replace( '#:\/\/(' . parse_url( $this->home, PHP_URL_HOST ) . ')($|\/.*)#', '://' . $this->hosts[ $lang->slug ] . '$2', $url );
42 42 }
43 43 return $url;
44 44 }
45 45
@@ -53,9 +53,9 @@
53 53 * @return string modified url
54 54 */
55 55 public function remove_language_from_link( $url ) {
56 56 if ( ! empty( $this->hosts ) ) {
57 - $url = preg_replace( '#://(' . implode( '|', $this->hosts ) . ')($|/.*)#', '://' . wp_parse_url( $this->home, PHP_URL_HOST ) . '$2', $url );
57 + $url = preg_replace( '#:\/\/(' . implode( '|', $this->hosts ) . ')($|\/.*)#', '://' . parse_url( $this->home, PHP_URL_HOST ) . '$2', $url );
58 58 }
59 59 return $url;
60 60 }
61 61
@@ -81,12 +81,9 @@
81 81 */
82 82 public function get_hosts() {
83 83 $hosts = array();
84 84 foreach ( $this->options['domains'] as $lang => $domain ) {
85 - $host = wp_parse_url( $domain, PHP_URL_HOST );
86 - // The use of the constant is mandatory in PHP 7.2 and PHP 7.3 to avoid a deprecated notice.
87 - $hosts[ $lang ] = defined( 'INTL_IDNA_VARIANT_UTS46' ) ? idn_to_ascii( $host, 0, INTL_IDNA_VARIANT_UTS46 ) : idn_to_ascii( $host );
85 + $hosts[ $lang ] = parse_url( $domain, PHP_URL_HOST );
88 86 }
89 -
90 87 return $hosts;
91 88 }
92 89 }