PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev2
Elementor Website Builder – more than just a page builder v3.28.0-dev2
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 -77 4.1.23.28.0-dev2 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,30 +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_pro_installed_and_not_active(): bool {
642 - if ( ! function_exists( 'get_plugins' ) ) {
643 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
644 - }
645 -
646 - $file_path = self::get_elementor_pro_file_path();
647 - $installed_plugins = get_plugins();
648 -
649 - return isset( $installed_plugins[ $file_path ] );
650 - }
651 -
652 - private static function get_elementor_pro_file_path(): string {
653 - return 'elementor-pro/elementor-pro.php';
654 - }
655 -
656 638 /**
657 639 * Convert HTMLEntities to UTF-8 characters
658 640 *
659 - * @param string $html_string
641 + * @param string $string
660 642 * @return string
661 643 */
662 - public static function urlencode_html_entities( $html_string ) {
644 + public static function urlencode_html_entities( $string ) {
663 645 $entities_dictionary = [
664 646 '&#145;' => "'", // Opening single quote
665 647 '&#146;' => "'", // Closing single quote
666 648 '&#147;' => '"', // Closing double quote
@@ -673,11 +655,11 @@
673 655 '&#8222;' => '"', // Double low quote
674 656 ];
675 657
676 658 // Decode decimal entities
677 - $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 );
678 660
679 - 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' ) );
680 662 }
681 663
682 664 /**
683 665 * Parse attributes that come as a string of comma-delimited key|value pairs.
@@ -729,19 +711,13 @@
729 711 if ( $id === $element['id'] ) {
730 712 return $element;
731 713 }
732 714
733 - $inner_elements = apply_filters(
734 - 'elementor/utils/find_element_recursive/inner_elements',
735 - $element['elements'] ?? [],
736 - $element
737 - );
715 + if ( ! empty( $element['elements'] ) ) {
716 + $element = self::find_element_recursive( $element['elements'], $id );
738 717
739 - if ( ! empty( $inner_elements ) ) {
740 - $found = self::find_element_recursive( $inner_elements, $id );
741 -
742 - if ( $found ) {
743 - return $found;
718 + if ( $element ) {
719 + return $element;
744 720 }
745 721 }
746 722 }
747 723
@@ -794,10 +770,10 @@
794 770
795 771 /**
796 772 * Print internal content (not user input) without escaping.
797 773 */
798 - public static function print_unescaped_internal_string( $internal_string ) {
799 - 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
800 776 }
801 777
802 778 /**
803 779 * Get recently edited posts query.
@@ -822,9 +798,9 @@
822 798
823 799 return new \WP_Query( $args );
824 800 }
825 801
826 - public static function print_wp_kses_extended( $text, array $tags ) {
802 + public static function print_wp_kses_extended( $string, array $tags ) {
827 803 $allowed_html = wp_kses_allowed_html( 'post' );
828 804
829 805 foreach ( $tags as $tag ) {
830 806 if ( isset( self::EXTENDED_ALLOWED_HTML_TAGS[ $tag ] ) ) {
@@ -832,9 +808,9 @@
832 808 $allowed_html = array_replace_recursive( $allowed_html, $extended_tags );
833 809 }
834 810 }
835 811
836 - echo wp_kses( $text, $allowed_html );
812 + echo wp_kses( $string, $allowed_html );
837 813 }
838 814
839 815 public static function is_elementor_path( $path ) {
840 816 $path = wp_normalize_path( $path );
@@ -898,21 +874,21 @@
898 874
899 875 /**
900 876 * Return specific object property value if exist from array of keys.
901 877 *
902 - * @param array $base_array
878 + * @param array $array
903 879 * @param array $keys
904 880 * @return mixed|null
905 881 */
906 - public static function get_array_value_by_keys( $base_array, $keys ) {
882 + public static function get_array_value_by_keys( $array, $keys ) {
907 883 $keys = (array) $keys;
908 884 foreach ( $keys as $key ) {
909 - if ( ! isset( $base_array[ $key ] ) ) {
885 + if ( ! isset( $array[ $key ] ) ) {
910 886 return null;
911 887 }
912 - $base_array = $base_array[ $key ];
888 + $array = $array[ $key ];
913 889 }
914 - return $base_array;
890 + return $array;
915 891 }
916 892
917 893 public static function get_cached_callback( $callback, $cache_key, $cache_time = 24 * HOUR_IN_SECONDS ) {
918 894 $cache = get_site_transient( $cache_key );
@@ -928,10 +904,10 @@
928 904 return $cache;
929 905 }
930 906
931 907 public static function is_sale_time(): bool {
932 - $sale_start_time = gmmktime( 10, 0, 0, 6, 15, 2026 );
933 - $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 );
934 910
935 911 $now_time = gmdate( 'U' );
936 912
937 913 return $now_time >= $sale_start_time && $now_time <= $sale_end_time;
@@ -961,35 +937,6 @@
961 937 $password_required = post_password_required( $post->ID )
962 938 && ! current_user_can( 'edit_post', $post->ID );
963 939
964 940 return $is_private || $not_allowed || $password_required;
965 - }
966 -
967 - public static function is_custom_kit_applied() {
968 - return (bool) Plugin::$instance->kits_manager->get_previous_id();
969 - }
970 -
971 - public static function decode_string( string $encoded_string, ?string $fallback = '' ) {
972 - try {
973 - return base64_decode( $encoded_string, true ) ?? $fallback;
974 - } catch ( \Exception $e ) {
975 - return $fallback;
976 - }
977 - }
978 -
979 - public static function encode_string( string $decoded_string ): string {
980 - return base64_encode( $decoded_string );
981 - }
982 -
983 - public static function html_to_plain_text( string $html ): string {
984 - if ( empty( $html ) ) {
985 - return '';
986 - }
987 -
988 - $text = preg_replace( '#<br\s*/?\s*>#i', ' ', $html );
989 - $text = preg_replace( '#</?[a-z][^>]*>#i', ' ', $text );
990 - $text = html_entity_decode( $text, ENT_QUOTES, 'UTF-8' );
991 - $text = str_replace( "\xE2\x80\x8B", '', $text );
992 -
993 - return trim( preg_replace( '/\s+/', ' ', $text ) );
994 941 }
995 942 }