| @@ -637,8 +637,12 @@ | ||
| 637 | 637 | public static function has_pro() { |
| 638 | 638 | return defined( 'ELEMENTOR_PRO_VERSION' ); |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | + public static function is_license_active(): bool { | |
| 642 | + return class_exists( '\ElementorPro\License\API' ) && \ElementorPro\License\API::is_license_active(); | |
| 643 | + } | |
| 644 | + | |
| 641 | 645 | public static function is_pro_installed_and_not_active(): bool { |
| 642 | 646 | if ( ! function_exists( 'get_plugins' ) ) { |
| 643 | 647 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 644 | 648 | } |
| @@ -729,13 +733,19 @@ | ||
| 729 | 733 | if ( $id === $element['id'] ) { |
| 730 | 734 | return $element; |
| 731 | 735 | } |
| 732 | 736 | |
| 733 | - if ( ! empty( $element['elements'] ) ) { | |
| 734 | - $element = self::find_element_recursive( $element['elements'], $id ); | |
| 737 | + $inner_elements = apply_filters( | |
| 738 | + 'elementor/utils/find_element_recursive/inner_elements', | |
| 739 | + $element['elements'] ?? [], | |
| 740 | + $element | |
| 741 | + ); | |
| 735 | 742 | |
| 736 | - if ( $element ) { | |
| 737 | - return $element; | |
| 743 | + if ( ! empty( $inner_elements ) ) { | |
| 744 | + $found = self::find_element_recursive( $inner_elements, $id ); | |
| 745 | + | |
| 746 | + if ( $found ) { | |
| 747 | + return $found; | |
| 738 | 748 | } |
| 739 | 749 | } |
| 740 | 750 | } |
| 741 | 751 | |
| @@ -829,8 +839,14 @@ | ||
| 829 | 839 | |
| 830 | 840 | echo wp_kses( $text, $allowed_html ); |
| 831 | 841 | } |
| 832 | 842 | |
| 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 | + | |
| 833 | 849 | public static function is_elementor_path( $path ) { |
| 834 | 850 | $path = wp_normalize_path( $path ); |
| 835 | 851 | |
| 836 | 852 | /** |
| @@ -922,10 +938,10 @@ | ||
| 922 | 938 | return $cache; |
| 923 | 939 | } |
| 924 | 940 | |
| 925 | 941 | public static function is_sale_time(): bool { |
| 926 | - $sale_start_time = gmmktime( 12, 0, 0, 11, 25, 2025 ); | |
| 927 | - $sale_end_time = gmmktime( 3, 59, 0, 12, 3, 2025 ); | |
| 942 | + $sale_start_time = gmmktime( 10, 0, 0, 6, 15, 2026 ); | |
| 943 | + $sale_end_time = gmmktime( 3, 59, 0, 6, 17, 2026 ); | |
| 928 | 944 | |
| 929 | 945 | $now_time = gmdate( 'U' ); |
| 930 | 946 | |
| 931 | 947 | return $now_time >= $sale_start_time && $now_time <= $sale_end_time; |
| @@ -971,6 +987,19 @@ | ||
| 971 | 987 | } |
| 972 | 988 | |
| 973 | 989 | public static function encode_string( string $decoded_string ): string { |
| 974 | 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 ) ); | |
| 975 | 1004 | } |
| 976 | 1005 | } |