PluginProbe
Elementor Website Builder – more than just a page builder / 3.6.0-dev1
Elementor Website Builder – more than just a page builder v3.6.0-dev1
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / trunk / core / utils / str.php

str.php in Elementor Website Builder – more than just a page builder 3.6.0-dev1, at trunk/core/utils/str.php

24 lines 579 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\Utils;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly
6 }
7
8 class Str {
9
10 /**
11 * Convert a non-latin URL to an IDN one.
12 * Note: Max length is 64 chars.
13 *
14 * @param string $url - A URL to encode.
15 *
16 * @return string - IDN encoded URL ( e.g. `http://é.com` will be encoded to `http://xn--9ca.com` ).
17 */
18 public static function encode_idn_url( $url ) {
19 return preg_replace_callback( '/(https?:\/\/)(.+)/', function ( $matches ) {
20 return $matches[1] . \Requests_IDNAEncoder::encode( $matches[2] );
21 }, $url );
22 }
23 }
24