| @@ -29,9 +29,8 @@ | ||
| 29 | 29 | 'a', |
| 30 | 30 | 'article', |
| 31 | 31 | 'aside', |
| 32 | 32 | 'button', |
| 33 | - 'form', | |
| 34 | 33 | 'div', |
| 35 | 34 | 'footer', |
| 36 | 35 | 'h1', |
| 37 | 36 | 'h2', |
| @@ -199,9 +198,9 @@ | ||
| 199 | 198 | * @param string $from |
| 200 | 199 | * @param string $to |
| 201 | 200 | * |
| 202 | 201 | * @return string |
| 203 | - * @throws \Exception If URLs are missing or invalid URLs provided. | |
| 202 | + * @throws \Exception Replace URL exception. | |
| 204 | 203 | */ |
| 205 | 204 | public static function replace_urls( $from, $to ) { |
| 206 | 205 | $from = trim( $from ); |
| 207 | 206 | $to = trim( $to ); |
| @@ -513,14 +512,14 @@ | ||
| 513 | 512 | * @since 2.1.2 |
| 514 | 513 | * @access public |
| 515 | 514 | * @static |
| 516 | 515 | */ |
| 517 | - public static function array_inject( $base_array, $key, $insert ) { | |
| 518 | - $length = array_search( $key, array_keys( $base_array ), true ) + 1; | |
| 516 | + public static function array_inject( $array, $key, $insert ) { | |
| 517 | + $length = array_search( $key, array_keys( $array ), true ) + 1; | |
| 519 | 518 | |
| 520 | - return array_slice( $base_array, 0, $length, true ) + | |
| 519 | + return array_slice( $array, 0, $length, true ) + | |
| 521 | 520 | $insert + |
| 522 | - array_slice( $base_array, $length, null, true ); | |
| 521 | + array_slice( $array, $length, null, true ); | |
| 523 | 522 | } |
| 524 | 523 | |
| 525 | 524 | /** |
| 526 | 525 | * Render html attributes |
| @@ -637,30 +636,15 @@ | ||
| 637 | 636 | public static function has_pro() { |
| 638 | 637 | return defined( 'ELEMENTOR_PRO_VERSION' ); |
| 639 | 638 | } |
| 640 | 639 | |
| 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 | 640 | /** |
| 657 | 641 | * Convert HTMLEntities to UTF-8 characters |
| 658 | 642 | * |
| 659 | - * @param string $html_string | |
| 643 | + * @param string $string | |
| 660 | 644 | * @return string |
| 661 | 645 | */ |
| 662 | - public static function urlencode_html_entities( $html_string ) { | |
| 646 | + public static function urlencode_html_entities( $string ) { | |
| 663 | 647 | $entities_dictionary = [ |
| 664 | 648 | '‘' => "'", // Opening single quote |
| 665 | 649 | '’' => "'", // Closing single quote |
| 666 | 650 | '“' => '"', // Closing double quote |
| @@ -673,11 +657,11 @@ | ||
| 673 | 657 | '„' => '"', // Double low quote |
| 674 | 658 | ]; |
| 675 | 659 | |
| 676 | 660 | // Decode decimal entities |
| 677 | - $html_string = str_replace( array_keys( $entities_dictionary ), array_values( $entities_dictionary ), $html_string ); | |
| 661 | + $string = str_replace( array_keys( $entities_dictionary ), array_values( $entities_dictionary ), $string ); | |
| 678 | 662 | |
| 679 | - return rawurlencode( html_entity_decode( $html_string, ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ); | |
| 663 | + return rawurlencode( html_entity_decode( $string, ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ); | |
| 680 | 664 | } |
| 681 | 665 | |
| 682 | 666 | /** |
| 683 | 667 | * Parse attributes that come as a string of comma-delimited key|value pairs. |
| @@ -788,10 +772,10 @@ | ||
| 788 | 772 | |
| 789 | 773 | /** |
| 790 | 774 | * Print internal content (not user input) without escaping. |
| 791 | 775 | */ |
| 792 | - public static function print_unescaped_internal_string( $internal_string ) { | |
| 793 | - echo $internal_string; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 776 | + public static function print_unescaped_internal_string( $string ) { | |
| 777 | + echo $string; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 794 | 778 | } |
| 795 | 779 | |
| 796 | 780 | /** |
| 797 | 781 | * Get recently edited posts query. |
| @@ -816,9 +800,9 @@ | ||
| 816 | 800 | |
| 817 | 801 | return new \WP_Query( $args ); |
| 818 | 802 | } |
| 819 | 803 | |
| 820 | - public static function print_wp_kses_extended( $text, array $tags ) { | |
| 804 | + public static function print_wp_kses_extended( $string, array $tags ) { | |
| 821 | 805 | $allowed_html = wp_kses_allowed_html( 'post' ); |
| 822 | 806 | |
| 823 | 807 | foreach ( $tags as $tag ) { |
| 824 | 808 | if ( isset( self::EXTENDED_ALLOWED_HTML_TAGS[ $tag ] ) ) { |
| @@ -826,9 +810,9 @@ | ||
| 826 | 810 | $allowed_html = array_replace_recursive( $allowed_html, $extended_tags ); |
| 827 | 811 | } |
| 828 | 812 | } |
| 829 | 813 | |
| 830 | - echo wp_kses( $text, $allowed_html ); | |
| 814 | + echo wp_kses( $string, $allowed_html ); | |
| 831 | 815 | } |
| 832 | 816 | |
| 833 | 817 | public static function is_elementor_path( $path ) { |
| 834 | 818 | $path = wp_normalize_path( $path ); |
| @@ -892,21 +876,21 @@ | ||
| 892 | 876 | |
| 893 | 877 | /** |
| 894 | 878 | * Return specific object property value if exist from array of keys. |
| 895 | 879 | * |
| 896 | - * @param array $base_array | |
| 880 | + * @param array $array | |
| 897 | 881 | * @param array $keys |
| 898 | 882 | * @return mixed|null |
| 899 | 883 | */ |
| 900 | - public static function get_array_value_by_keys( $base_array, $keys ) { | |
| 884 | + public static function get_array_value_by_keys( $array, $keys ) { | |
| 901 | 885 | $keys = (array) $keys; |
| 902 | 886 | foreach ( $keys as $key ) { |
| 903 | - if ( ! isset( $base_array[ $key ] ) ) { | |
| 887 | + if ( ! isset( $array[ $key ] ) ) { | |
| 904 | 888 | return null; |
| 905 | 889 | } |
| 906 | - $base_array = $base_array[ $key ]; | |
| 890 | + $array = $array[ $key ]; | |
| 907 | 891 | } |
| 908 | - return $base_array; | |
| 892 | + return $array; | |
| 909 | 893 | } |
| 910 | 894 | |
| 911 | 895 | public static function get_cached_callback( $callback, $cache_key, $cache_time = 24 * HOUR_IN_SECONDS ) { |
| 912 | 896 | $cache = get_site_transient( $cache_key ); |
| @@ -922,10 +906,10 @@ | ||
| 922 | 906 | return $cache; |
| 923 | 907 | } |
| 924 | 908 | |
| 925 | 909 | 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 ); | |
| 910 | + $sale_start_time = gmmktime( 12, 0, 0, 6, 10, 2025 ); | |
| 911 | + $sale_end_time = gmmktime( 3, 59, 0, 6, 17, 2025 ); | |
| 928 | 912 | |
| 929 | 913 | $now_time = gmdate( 'U' ); |
| 930 | 914 | |
| 931 | 915 | return $now_time >= $sale_start_time && $now_time <= $sale_end_time; |
| @@ -961,29 +945,16 @@ | ||
| 961 | 945 | public static function is_custom_kit_applied() { |
| 962 | 946 | return (bool) Plugin::$instance->kits_manager->get_previous_id(); |
| 963 | 947 | } |
| 964 | 948 | |
| 965 | - public static function decode_string( string $encoded_string, ?string $fallback = '' ) { | |
| 949 | + public static function decode_string( string $string, ?string $fallback = '' ) { | |
| 966 | 950 | try { |
| 967 | - return base64_decode( $encoded_string, true ) ?? $fallback; | |
| 951 | + return base64_decode( $string, true ) ?? $fallback; | |
| 968 | 952 | } catch ( \Exception $e ) { |
| 969 | 953 | return $fallback; |
| 970 | 954 | } |
| 971 | 955 | } |
| 972 | 956 | |
| 973 | - public static function encode_string( string $decoded_string ): string { | |
| 974 | - return base64_encode( $decoded_string ); | |
| 975 | - } | |
| 976 | - | |
| 977 | - public static function html_to_plain_text( string $html ): string { | |
| 978 | - if ( empty( $html ) ) { | |
| 979 | - return ''; | |
| 980 | - } | |
| 981 | - | |
| 982 | - $text = preg_replace( '#<br\s*/?\s*>#i', ' ', $html ); | |
| 983 | - $text = preg_replace( '#</?[a-z][^>]*>#i', ' ', $text ); | |
| 984 | - $text = html_entity_decode( $text, ENT_QUOTES, 'UTF-8' ); | |
| 985 | - $text = str_replace( "\xE2\x80\x8B", '', $text ); | |
| 986 | - | |
| 987 | - return trim( preg_replace( '/\s+/', ' ', $text ) ); | |
| 957 | + public static function encode_string( string $string ): string { | |
| 958 | + return base64_encode( $string ); | |
| 988 | 959 | } |
| 989 | 960 | } |