PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev3
Elementor Website Builder – more than just a page builder v3.28.0-dev3
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 | includes/utils.php +24 -87 4.2.43.28.0-dev3 View file →
@@ -1,8 +1,7 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 -use Elementor\Core\Files\Fonts\Google_Font;
5 4 use Elementor\Core\Utils\Collection;
6 5
7 6 if ( ! defined( 'ABSPATH' ) ) {
8 7 exit; // Exit if accessed directly.
@@ -29,9 +28,8 @@
29 28 'a',
30 29 'article',
31 30 'aside',
32 31 'button',
33 - 'form',
34 32 'div',
35 33 'footer',
36 34 'h1',
37 35 'h2',
@@ -199,9 +197,9 @@
199 197 * @param string $from
200 198 * @param string $to
201 199 *
202 200 * @return string
203 - * @throws \Exception If URLs are missing or invalid URLs provided.
201 + * @throws \Exception Replace URL exception.
204 202 */
205 203 public static function replace_urls( $from, $to ) {
206 204 $from = trim( $from );
207 205 $to = trim( $to );
@@ -247,9 +245,8 @@
247 245 // Allow externals to replace-urls, when they have to.
248 246 $rows_affected += (int) apply_filters( 'elementor/tools/replace-urls', 0, $from, $to );
249 247
250 248 Plugin::$instance->files_manager->clear_cache();
251 - Google_Font::clear_cache();
252 249
253 250 return sprintf(
254 251 /* translators: %d: Number of rows. */
255 252 _n( '%d database row affected.', '%d database rows affected.', $rows_affected, 'elementor' ),
@@ -513,14 +510,14 @@
513 510 * @since 2.1.2
514 511 * @access public
515 512 * @static
516 513 */
517 - public static function array_inject( $base_array, $key, $insert ) {
518 - $length = array_search( $key, array_keys( $base_array ), true ) + 1;
514 + public static function array_inject( $array, $key, $insert ) {
515 + $length = array_search( $key, array_keys( $array ), true ) + 1;
519 516
520 - return array_slice( $base_array, 0, $length, true ) +
517 + return array_slice( $array, 0, $length, true ) +
521 518 $insert +
522 - array_slice( $base_array, $length, null, true );
519 + array_slice( $array, $length, null, true );
523 520 }
524 521
525 522 /**
526 523 * Render html attributes
@@ -637,34 +634,15 @@
637 634 public static function has_pro() {
638 635 return defined( 'ELEMENTOR_PRO_VERSION' );
639 636 }
640 637
641 - public static function is_license_active(): bool {
642 - return class_exists( '\ElementorPro\License\API' ) && \ElementorPro\License\API::is_license_active();
643 - }
644 -
645 - public static function is_pro_installed_and_not_active(): bool {
646 - if ( ! function_exists( 'get_plugins' ) ) {
647 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
648 - }
649 -
650 - $file_path = self::get_elementor_pro_file_path();
651 - $installed_plugins = get_plugins();
652 -
653 - return isset( $installed_plugins[ $file_path ] );
654 - }
655 -
656 - private static function get_elementor_pro_file_path(): string {
657 - return 'elementor-pro/elementor-pro.php';
658 - }
659 -
660 638 /**
661 639 * Convert HTMLEntities to UTF-8 characters
662 640 *
663 - * @param string $html_string
641 + * @param string $string
664 642 * @return string
665 643 */
666 - public static function urlencode_html_entities( $html_string ) {
644 + public static function urlencode_html_entities( $string ) {
667 645 $entities_dictionary = [
668 646 '&#145;' => "'", // Opening single quote
669 647 '&#146;' => "'", // Closing single quote
670 648 '&#147;' => '"', // Closing double quote
@@ -677,11 +655,11 @@
677 655 '&#8222;' => '"', // Double low quote
678 656 ];
679 657
680 658 // Decode decimal entities
681 - $html_string = str_replace( array_keys( $entities_dictionary ), array_values( $entities_dictionary ), $html_string );
659 + $string = str_replace( array_keys( $entities_dictionary ), array_values( $entities_dictionary ), $string );
682 660
683 - return rawurlencode( html_entity_decode( $html_string, ENT_QUOTES | ENT_HTML5, 'UTF-8' ) );
661 + return rawurlencode( html_entity_decode( $string, ENT_QUOTES | ENT_HTML5, 'UTF-8' ) );
684 662 }
685 663
686 664 /**
687 665 * Parse attributes that come as a string of comma-delimited key|value pairs.
@@ -733,19 +711,13 @@
733 711 if ( $id === $element['id'] ) {
734 712 return $element;
735 713 }
736 714
737 - $inner_elements = apply_filters(
738 - 'elementor/utils/find_element_recursive/inner_elements',
739 - $element['elements'] ?? [],
740 - $element
741 - );
715 + if ( ! empty( $element['elements'] ) ) {
716 + $element = self::find_element_recursive( $element['elements'], $id );
742 717
743 - if ( ! empty( $inner_elements ) ) {
744 - $found = self::find_element_recursive( $inner_elements, $id );
745 -
746 - if ( $found ) {
747 - return $found;
718 + if ( $element ) {
719 + return $element;
748 720 }
749 721 }
750 722 }
751 723
@@ -798,10 +770,10 @@
798 770
799 771 /**
800 772 * Print internal content (not user input) without escaping.
801 773 */
802 - public static function print_unescaped_internal_string( $internal_string ) {
803 - echo $internal_string; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
774 + public static function print_unescaped_internal_string( $string ) {
775 + echo $string; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
804 776 }
805 777
806 778 /**
807 779 * Get recently edited posts query.
@@ -826,9 +798,9 @@
826 798
827 799 return new \WP_Query( $args );
828 800 }
829 801
830 - public static function print_wp_kses_extended( $text, array $tags ) {
802 + public static function print_wp_kses_extended( $string, array $tags ) {
831 803 $allowed_html = wp_kses_allowed_html( 'post' );
832 804
833 805 foreach ( $tags as $tag ) {
834 806 if ( isset( self::EXTENDED_ALLOWED_HTML_TAGS[ $tag ] ) ) {
@@ -836,17 +808,11 @@
836 808 $allowed_html = array_replace_recursive( $allowed_html, $extended_tags );
837 809 }
838 810 }
839 811
840 - echo wp_kses( $text, $allowed_html );
812 + echo wp_kses( $string, $allowed_html );
841 813 }
842 814
843 - public static function kses_post_deep( $data ) {
844 - return map_deep( $data, function ( $value ) {
845 - return is_string( $value ) ? wp_kses_post( $value ) : $value;
846 - } );
847 - }
848 -
849 815 public static function is_elementor_path( $path ) {
850 816 $path = wp_normalize_path( $path );
851 817
852 818 /**
@@ -908,21 +874,21 @@
908 874
909 875 /**
910 876 * Return specific object property value if exist from array of keys.
911 877 *
912 - * @param array $base_array
878 + * @param array $array
913 879 * @param array $keys
914 880 * @return mixed|null
915 881 */
916 - public static function get_array_value_by_keys( $base_array, $keys ) {
882 + public static function get_array_value_by_keys( $array, $keys ) {
917 883 $keys = (array) $keys;
918 884 foreach ( $keys as $key ) {
919 - if ( ! isset( $base_array[ $key ] ) ) {
885 + if ( ! isset( $array[ $key ] ) ) {
920 886 return null;
921 887 }
922 - $base_array = $base_array[ $key ];
888 + $array = $array[ $key ];
923 889 }
924 - return $base_array;
890 + return $array;
925 891 }
926 892
927 893 public static function get_cached_callback( $callback, $cache_key, $cache_time = 24 * HOUR_IN_SECONDS ) {
928 894 $cache = get_site_transient( $cache_key );
@@ -938,10 +904,10 @@
938 904 return $cache;
939 905 }
940 906
941 907 public static function is_sale_time(): bool {
942 - $sale_start_time = gmmktime( 10, 0, 0, 6, 15, 2026 );
943 - $sale_end_time = gmmktime( 3, 59, 0, 6, 17, 2026 );
908 + $sale_start_time = gmmktime( 13, 0, 0, 11, 26, 2024 );
909 + $sale_end_time = gmmktime( 9, 59, 0, 12, 4, 2024 );
944 910
945 911 $now_time = gmdate( 'U' );
946 912
947 913 return $now_time >= $sale_start_time && $now_time <= $sale_end_time;
@@ -971,35 +937,6 @@
971 937 $password_required = post_password_required( $post->ID )
972 938 && ! current_user_can( 'edit_post', $post->ID );
973 939
974 940 return $is_private || $not_allowed || $password_required;
975 - }
976 -
977 - public static function is_custom_kit_applied() {
978 - return (bool) Plugin::$instance->kits_manager->get_previous_id();
979 - }
980 -
981 - public static function decode_string( string $encoded_string, ?string $fallback = '' ) {
982 - try {
983 - return base64_decode( $encoded_string, true ) ?? $fallback;
984 - } catch ( \Exception $e ) {
985 - return $fallback;
986 - }
987 - }
988 -
989 - public static function encode_string( string $decoded_string ): string {
990 - return base64_encode( $decoded_string );
991 - }
992 -
993 - public static function html_to_plain_text( string $html ): string {
994 - if ( empty( $html ) ) {
995 - return '';
996 - }
997 -
998 - $text = preg_replace( '#<br\s*/?\s*>#i', ' ', $html );
999 - $text = preg_replace( '#</?[a-z][^>]*>#i', ' ', $text );
1000 - $text = html_entity_decode( $text, ENT_QUOTES, 'UTF-8' );
1001 - $text = str_replace( "\xE2\x80\x8B", '', $text );
1002 -
1003 - return trim( preg_replace( '/\s+/', ' ', $text ) );
1004 941 }
1005 942 }