PluginProbe
Elementor Website Builder – more than just a page builder / 3.5.3
Elementor Website Builder – more than just a page builder v3.5.3
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
← All changes | core/utils/str.php +2 -20 4.2.0-dev23.5.3 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2 namespace Elementor\Core\Utils;
3 3
4 4 if ( ! defined( 'ABSPATH' ) ) {
5 - exit; // Exit if accessed directly.
5 + exit; // Exit if accessed directly
6 6 }
7 7
8 8 class Str {
9 9
@@ -16,26 +16,8 @@
16 16 * @return string - IDN encoded URL ( e.g. `http://é.com` will be encoded to `http://xn--9ca.com` ).
17 17 */
18 18 public static function encode_idn_url( $url ) {
19 19 return preg_replace_callback( '/(https?:\/\/)(.+)/', function ( $matches ) {
20 - // WP >= 6.2-alpha
21 - if ( class_exists( '\WpOrg\Requests\IdnaEncoder' ) ) {
22 - $class = \WpOrg\Requests\IdnaEncoder::class;
23 - } else {
24 - $class = \Requests_IDNAEncoder::class;
25 - }
26 -
27 - return $matches[1] . $class::encode( $matches[2] );
20 + return $matches[1] . \Requests_IDNAEncoder::encode( $matches[2] );
28 21 }, $url );
29 - }
30 -
31 - /**
32 - * Checks if a string ends with a given substring
33 - *
34 - * @param $haystack
35 - * @param $needle
36 - * @return bool
37 - */
38 - public static function ends_with( $haystack, $needle ) {
39 - return substr( $haystack, -strlen( $needle ) ) === $needle;
40 22 }
41 23 }