PluginProbe
Elementor Website Builder – more than just a page builder / 3.4.2
Elementor Website Builder – more than just a page builder v3.4.2
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 +63 -308 4.2.23.4.2 View file →
@@ -1,10 +1,7 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 -use Elementor\Core\Files\Fonts\Google_Font;
5 -use Elementor\Core\Utils\Collection;
6 -
7 4 if ( ! defined( 'ABSPATH' ) ) {
8 5 exit; // Exit if accessed directly.
9 6 }
10 7
@@ -22,16 +19,14 @@
22 19
23 20 const EDITOR_BREAK_LINES_OPTION_KEY = 'elementor_editor_break_lines';
24 21
25 22 /**
26 - * A list of safe tags for `validate_html_tag` method.
23 + * A list of safe tage for `validate_html_tag` method.
27 24 */
28 25 const ALLOWED_HTML_WRAPPER_TAGS = [
29 26 'a',
30 27 'article',
31 28 'aside',
32 - 'button',
33 - 'form',
34 29 'div',
35 30 'footer',
36 31 'h1',
37 32 'h2',
@@ -83,36 +78,31 @@
83 78 'd' => true,
84 79 'fill' => true,
85 80 ],
86 81 ],
87 - 'image' => [
88 - 'img' => [
89 - 'srcset' => true,
90 - 'sizes' => true,
91 - ],
92 - ],
93 82 ];
94 83
95 84 /**
96 - * Variables for free to pro upsale modal promotions
85 + * Is ajax.
86 + *
87 + * Whether the current request is a WordPress ajax request.
88 + *
89 + * @since 1.0.0
90 + * @deprecated 2.6.0 Use `wp_doing_ajax()` instead.
91 + * @access public
92 + * @static
93 + *
94 + * @return bool True if it's a WordPress ajax request, false otherwise.
97 95 */
96 + public static function is_ajax() {
97 + _deprecated_function( __METHOD__, '2.6.0', 'wp_doing_ajax()' );
98 98
99 - const ANIMATED_HEADLINE = 'animated_headline';
99 + return wp_doing_ajax();
100 + }
100 101
101 - const CTA = 'cta';
102 -
103 - const VIDEO_PLAYLIST = 'video_playlist';
104 -
105 - const TESTIMONIAL_WIDGET = 'testimonial_widget';
106 -
107 - const IMAGE_CAROUSEL = 'image_carousel';
108 -
109 102 /**
110 - * Whether WordPress CLI mode is enabled or not.
103 + * Is WP CLI.
111 104 *
112 - * @access public
113 - * @static
114 - *
115 105 * @return bool
116 106 */
117 107 public static function is_wp_cli() {
118 108 return defined( 'WP_CLI' ) && WP_CLI;
@@ -118,8 +108,10 @@
118 108 return defined( 'WP_CLI' ) && WP_CLI;
119 109 }
120 110
121 111 /**
112 + * Is script debug.
113 + *
122 114 * Whether script debug is enabled or not.
123 115 *
124 116 * @since 1.0.0
125 117 * @access public
@@ -124,9 +116,9 @@
124 116 * @since 1.0.0
125 117 * @access public
126 118 * @static
127 119 *
128 - * @return bool
120 + * @return bool True if it's a script debug is active, false otherwise.
129 121 */
130 122 public static function is_script_debug() {
131 123 return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
132 124 }
@@ -131,32 +123,8 @@
131 123 return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
132 124 }
133 125
134 126 /**
135 - * Whether Elementor debug is enabled or not.
136 - *
137 - * @access public
138 - * @static
139 - *
140 - * @return bool
141 - */
142 - public static function is_elementor_debug() {
143 - return defined( 'ELEMENTOR_DEBUG' ) && ELEMENTOR_DEBUG;
144 - }
145 -
146 - /**
147 - * Whether Elementor test mode is enabled or not.
148 - *
149 - * @access public
150 - * @static
151 - *
152 - * @return bool
153 - */
154 - public static function is_elementor_tests() {
155 - return defined( 'ELEMENTOR_TESTS' ) && ELEMENTOR_TESTS;
156 - }
157 -
158 - /**
159 127 * Get pro link.
160 128 *
161 129 * Retrieve the link to Elementor Pro.
162 130 *
@@ -195,54 +163,38 @@
195 163 * @since 2.1.0
196 164 * @static
197 165 * @access public
198 166 *
199 - * @param string $from
200 - * @param string $to
167 + * @param $from
168 + * @param $to
201 169 *
202 170 * @return string
203 - * @throws \Exception If URLs are missing or invalid URLs provided.
171 + * @throws \Exception
204 172 */
205 173 public static function replace_urls( $from, $to ) {
206 174 $from = trim( $from );
207 175 $to = trim( $to );
208 176
209 - if ( empty( $from ) ) {
210 - throw new \Exception( 'Couldn’t replace your address because the old URL was not provided. Try again by entering the old URL.' );
211 - }
212 -
213 - if ( empty( $to ) ) {
214 - throw new \Exception( 'Couldn’t replace your address because the new URL was not provided. Try again by entering the new URL.' );
215 - }
216 -
217 177 if ( $from === $to ) {
218 - throw new \Exception( 'Couldn’t replace your address because both of the URLs provided are identical. Try again by entering different URLs.' );
178 + throw new \Exception( esc_html__( 'The `from` and `to` URL\'s must be different', 'elementor' ) );
219 179 }
220 180
221 181 $is_valid_urls = ( filter_var( $from, FILTER_VALIDATE_URL ) && filter_var( $to, FILTER_VALIDATE_URL ) );
222 -
223 182 if ( ! $is_valid_urls ) {
224 - throw new \Exception( 'Couldn’t replace your address because at least one of the URLs provided are invalid. Try again by entering valid URLs.' );
183 + throw new \Exception( esc_html__( 'The `from` and `to` URL\'s must be valid URL\'s', 'elementor' ) );
225 184 }
226 185
227 186 global $wpdb;
228 - $escaped_from = str_replace( '/', '\\/', $from );
229 - $escaped_to = str_replace( '/', '\\/', $to );
230 - $meta_value_like = '[%'; // meta_value LIKE '[%' are json formatted
231 187
188 + // @codingStandardsIgnoreStart cannot use `$wpdb->prepare` because it remove's the backslashes
232 189 $rows_affected = $wpdb->query(
233 - $wpdb->prepare(
234 - "UPDATE {$wpdb->postmeta} " .
235 - 'SET `meta_value` = REPLACE(`meta_value`, %s, %s) ' .
236 - "WHERE `meta_key` = '_elementor_data' AND `meta_value` LIKE %s;",
237 - $escaped_from,
238 - $escaped_to,
239 - $meta_value_like
240 - )
241 - );
190 + "UPDATE {$wpdb->postmeta} " .
191 + "SET `meta_value` = REPLACE(`meta_value`, '" . str_replace( '/', '\\\/', $from ) . "', '" . str_replace( '/', '\\\/', $to ) . "') " .
192 + "WHERE `meta_key` = '_elementor_data' AND `meta_value` LIKE '[%' ;" ); // meta_value LIKE '[%' are json formatted
193 + // @codingStandardsIgnoreEnd
242 194
243 195 if ( false === $rows_affected ) {
244 - throw new \Exception( 'An error occurred while replacing URL\'s.' );
196 + throw new \Exception( esc_html__( 'An error occurred', 'elementor' ) );
245 197 }
246 198
247 199 // Allow externals to replace-urls, when they have to.
248 200 $rows_affected += (int) apply_filters( 'elementor/tools/replace-urls', 0, $from, $to );
@@ -247,13 +199,12 @@
247 199 // Allow externals to replace-urls, when they have to.
248 200 $rows_affected += (int) apply_filters( 'elementor/tools/replace-urls', 0, $from, $to );
249 201
250 202 Plugin::$instance->files_manager->clear_cache();
251 - Google_Font::clear_cache();
252 203
253 204 return sprintf(
254 - /* translators: %d: Number of rows. */
255 - _n( '%d database row affected.', '%d database rows affected.', $rows_affected, 'elementor' ),
205 + /* translators: %d: Number of rows */
206 + _n( '%d row affected.', '%d rows affected.', $rows_affected, 'elementor' ),
256 207 $rows_affected
257 208 );
258 209 }
259 210
@@ -280,9 +231,9 @@
280 231 *
281 232 * Filters whether the post type supports editing with Elementor.
282 233 *
283 234 * @since 1.0.0
284 - * @deprecated 2.2.0 Use `elementor/utils/is_post_support` hook Instead.
235 + * @deprecated 2.2.0 Use `elementor/utils/is_post_support` Instead
285 236 *
286 237 * @param bool $is_supported Whether the post type supports editing with Elementor.
287 238 * @param int $post_id Post ID.
288 239 * @param string $post_type Post type.
@@ -399,10 +350,10 @@
399 350 if ( ! defined( 'DONOTCDN' ) ) {
400 351 define( 'DONOTCDN', true );
401 352 }
402 353
403 - if ( ! defined( 'DONOTCACHEOBJECT' ) ) {
404 - define( 'DONOTCACHEOBJECT', true );
354 + if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
355 + define( 'DONOTCACHCEOBJECT', true );
405 356 }
406 357
407 358 // Set the headers to prevent caching for the different browsers.
408 359 nocache_headers();
@@ -441,12 +392,11 @@
441 392 * Retrieve a custom URL for creating a new post/page using Elementor.
442 393 *
443 394 * @since 1.9.0
444 395 * @access public
445 - * @deprecated 3.3.0 Use `Plugin::$instance->documents->get_create_new_post_url()` instead.
446 396 * @static
447 397 *
448 - * @param string $post_type Optional. Post type slug. Default is 'page'.
398 + * @param string $post_type Optional. Post type slug. Default is 'page'.
449 399 * @param string|null $template_type Optional. Query arg 'template_type'. Default is null.
450 400 *
451 401 * @return string A URL for creating new post using Elementor.
452 402 */
@@ -513,14 +463,14 @@
513 463 * @since 2.1.2
514 464 * @access public
515 465 * @static
516 466 */
517 - public static function array_inject( $base_array, $key, $insert ) {
518 - $length = array_search( $key, array_keys( $base_array ), true ) + 1;
467 + public static function array_inject( $array, $key, $insert ) {
468 + $length = array_search( $key, array_keys( $array ), true ) + 1;
519 469
520 - return array_slice( $base_array, 0, $length, true ) +
470 + return array_slice( $array, 0, $length, true ) +
521 471 $insert +
522 - array_slice( $base_array, $length, null, true );
472 + array_slice( $array, $length, null, true );
523 473 }
524 474
525 475 /**
526 476 * Render html attributes
@@ -558,25 +508,18 @@
558 508 }
559 509
560 510 public static function get_meta_viewport( $context = '' ) {
561 511 $meta_tag = '<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />';
562 -
563 512 /**
564 513 * Viewport meta tag.
565 514 *
566 - * Filters the meta tag containing the viewport information.
515 + * Filters the Elementor preview URL.
567 516 *
568 - * This hook can be used to change the initial viewport meta tag set by Elementor
569 - * and replace it with a different viewport tag.
570 - *
571 517 * @since 2.5.0
572 518 *
573 519 * @param string $meta_tag Viewport meta tag.
574 - * @param string $context Page context.
575 520 */
576 - $meta_tag = apply_filters( 'elementor/template/viewport_tag', $meta_tag, $context );
577 -
578 - return $meta_tag;
521 + return apply_filters( 'elementor/template/viewport_tag', $meta_tag, $context );
579 522 }
580 523
581 524 /**
582 525 * Add Elementor Config js vars to the relevant script handle,
@@ -581,12 +524,11 @@
581 524 /**
582 525 * Add Elementor Config js vars to the relevant script handle,
583 526 * WP will wrap it with <script> tag.
584 527 * To make sure this script runs thru the `script_loader_tag` hook, use a known handle value.
585 - *
586 528 * @param string $handle
587 529 * @param string $js_var
588 - * @param mixed $config
530 + * @param mixed $config
589 531 */
590 532 public static function print_js_config( $handle, $js_var, $config ) {
591 533 $config = wp_json_encode( $config );
592 534
@@ -616,9 +558,9 @@
616 558
617 559 /**
618 560 * Checks a control value for being empty, including a string of '0' not covered by PHP's empty().
619 561 *
620 - * @param mixed $source
562 + * @param mixed $source
621 563 * @param bool|string $key
622 564 *
623 565 * @return bool
624 566 */
@@ -637,34 +579,15 @@
637 579 public static function has_pro() {
638 580 return defined( 'ELEMENTOR_PRO_VERSION' );
639 581 }
640 582
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 583 /**
661 584 * Convert HTMLEntities to UTF-8 characters
662 585 *
663 - * @param string $html_string
586 + * @param $string
664 587 * @return string
665 588 */
666 - public static function urlencode_html_entities( $html_string ) {
589 + public static function urlencode_html_entities( $string ) {
667 590 $entities_dictionary = [
668 591 '&#145;' => "'", // Opening single quote
669 592 '&#146;' => "'", // Closing single quote
670 593 '&#147;' => '"', // Closing double quote
@@ -677,11 +600,11 @@
677 600 '&#8222;' => '"', // Double low quote
678 601 ];
679 602
680 603 // Decode decimal entities
681 - $html_string = str_replace( array_keys( $entities_dictionary ), array_values( $entities_dictionary ), $html_string );
604 + $string = str_replace( array_keys( $entities_dictionary ), array_values( $entities_dictionary ), $string );
682 605
683 - return rawurlencode( html_entity_decode( $html_string, ENT_QUOTES | ENT_HTML5, 'UTF-8' ) );
606 + return rawurlencode( html_entity_decode( $string, ENT_QUOTES | ENT_HTML5, 'UTF-8' ) );
684 607 }
685 608
686 609 /**
687 610 * Parse attributes that come as a string of comma-delimited key|value pairs.
@@ -733,19 +656,13 @@
733 656 if ( $id === $element['id'] ) {
734 657 return $element;
735 658 }
736 659
737 - $inner_elements = apply_filters(
738 - 'elementor/utils/find_element_recursive/inner_elements',
739 - $element['elements'] ?? [],
740 - $element
741 - );
660 + if ( ! empty( $element['elements'] ) ) {
661 + $element = self::find_element_recursive( $element['elements'], $id );
742 662
743 - if ( ! empty( $inner_elements ) ) {
744 - $found = self::find_element_recursive( $inner_elements, $id );
745 -
746 - if ( $found ) {
747 - return $found;
663 + if ( $element ) {
664 + return $element;
748 665 }
749 666 }
750 667 }
751 668
@@ -760,10 +677,10 @@
760 677 * Fired by `admin_menu` action.
761 678 *
762 679 * @since 3.1.0
763 680 *
764 - * @param string $menu_slug
765 - * @param string $new_label
681 + * @param $menu_slug
682 + * @param $new_label
766 683 * @access public
767 684 */
768 685 public static function change_submenu_first_item_label( $menu_slug, $new_label ) {
769 686 global $submenu;
@@ -782,9 +699,9 @@
782 699 *
783 700 * @return string
784 701 */
785 702 public static function validate_html_tag( $tag ) {
786 - return $tag && in_array( strtolower( $tag ), self::ALLOWED_HTML_WRAPPER_TAGS ) ? $tag : 'div';
703 + return in_array( strtolower( $tag ), self::ALLOWED_HTML_WRAPPER_TAGS ) ? $tag : 'div';
787 704 }
788 705
789 706 /**
790 707 * Safe print a validated HTML tag.
@@ -798,10 +715,10 @@
798 715
799 716 /**
800 717 * Print internal content (not user input) without escaping.
801 718 */
802 - public static function print_unescaped_internal_string( $internal_string ) {
803 - echo $internal_string; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
719 + public static function print_unescaped_internal_string( $string ) {
720 + echo $string; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
804 721 }
805 722
806 723 /**
807 724 * Get recently edited posts query.
@@ -814,9 +731,8 @@
814 731 * @return \WP_Query
815 732 */
816 733 public static function get_recently_edited_posts_query( $args = [] ) {
817 734 $args = wp_parse_args( $args, [
818 - 'no_found_rows' => true,
819 735 'post_type' => 'any',
820 736 'post_status' => [ 'publish', 'draft' ],
821 737 'posts_per_page' => '3',
822 738 'meta_key' => '_elementor_edit_mode',
@@ -826,180 +742,19 @@
826 742
827 743 return new \WP_Query( $args );
828 744 }
829 745
830 - public static function print_wp_kses_extended( $text, array $tags ) {
746 + public static function print_wp_kses_extended( string $string, array $tags ) {
831 747 $allowed_html = wp_kses_allowed_html( 'post' );
748 + // Since PHP 5.6 cannot use isset() on the result of an expression.
749 + $extended_allowed_html_tags = self::EXTENDED_ALLOWED_HTML_TAGS;
832 750
833 751 foreach ( $tags as $tag ) {
834 - if ( isset( self::EXTENDED_ALLOWED_HTML_TAGS[ $tag ] ) ) {
752 + if ( isset( $extended_allowed_html_tags[ $tag ] ) ) {
835 753 $extended_tags = apply_filters( "elementor/extended_allowed_html_tags/{$tag}", self::EXTENDED_ALLOWED_HTML_TAGS[ $tag ] );
836 - $allowed_html = array_replace_recursive( $allowed_html, $extended_tags );
754 + $allowed_html = array_merge( $allowed_html, $extended_tags );
837 755 }
838 756 }
839 757
840 - echo wp_kses( $text, $allowed_html );
841 - }
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 -
849 - public static function is_elementor_path( $path ) {
850 - $path = wp_normalize_path( $path );
851 -
852 - /**
853 - * Elementor related paths.
854 - *
855 - * Filters Elementor related paths.
856 - *
857 - * @param string[] $available_paths
858 - */
859 - $available_paths = apply_filters( 'elementor/utils/elementor_related_paths', [ ELEMENTOR_PATH ] );
860 -
861 - return (bool) ( new Collection( $available_paths ) )
862 - ->map( function ( $p ) {
863 - // `untrailingslashit` in order to include other plugins prefixed with elementor.
864 - return untrailingslashit( wp_normalize_path( $p ) );
865 - } )
866 - ->find(function ( $p ) use ( $path ) {
867 - return false !== strpos( $path, $p );
868 - } );
869 - }
870 -
871 - /**
872 - * @param string $file
873 - * @param mixed ...$args
874 - * @return false|string
875 - */
876 - public static function file_get_contents( $file, ...$args ) {
877 - if ( ! is_file( $file ) || ! is_readable( $file ) ) {
878 - return false;
879 - }
880 - return file_get_contents( $file, ...$args );
881 - }
882 -
883 - public static function get_super_global_value( $super_global, $key ) {
884 - if ( ! isset( $super_global[ $key ] ) ) {
885 - return null;
886 - }
887 -
888 - if ( $_FILES === $super_global ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
889 - return isset( $super_global[ $key ]['name'] ) ?
890 - self::sanitize_file_name( $super_global[ $key ] ) :
891 - self::sanitize_multi_upload( $super_global[ $key ] );
892 - }
893 -
894 - return wp_kses_post_deep( wp_unslash( $super_global[ $key ] ) );
895 - }
896 -
897 - private static function sanitize_multi_upload( $fields ) {
898 - return array_map( function( $field ) {
899 - return array_map( 'self::sanitize_file_name', $field );
900 - }, $fields );
901 - }
902 -
903 - private static function sanitize_file_name( $file ) {
904 - $file['name'] = sanitize_file_name( $file['name'] );
905 -
906 - return $file;
907 - }
908 -
909 - /**
910 - * Return specific object property value if exist from array of keys.
911 - *
912 - * @param array $base_array
913 - * @param array $keys
914 - * @return mixed|null
915 - */
916 - public static function get_array_value_by_keys( $base_array, $keys ) {
917 - $keys = (array) $keys;
918 - foreach ( $keys as $key ) {
919 - if ( ! isset( $base_array[ $key ] ) ) {
920 - return null;
921 - }
922 - $base_array = $base_array[ $key ];
923 - }
924 - return $base_array;
925 - }
926 -
927 - public static function get_cached_callback( $callback, $cache_key, $cache_time = 24 * HOUR_IN_SECONDS ) {
928 - $cache = get_site_transient( $cache_key );
929 -
930 - if ( ! $cache ) {
931 - $cache = call_user_func( $callback );
932 -
933 - if ( ! is_wp_error( $cache ) ) {
934 - set_site_transient( $cache_key, $cache, $cache_time );
935 - }
936 - }
937 -
938 - return $cache;
939 - }
940 -
941 - 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 );
944 -
945 - $now_time = gmdate( 'U' );
946 -
947 - return $now_time >= $sale_start_time && $now_time <= $sale_end_time;
948 - }
949 -
950 - public static function safe_throw( string $message ) {
951 - if ( ! static::is_elementor_debug() ) {
952 - return;
953 - }
954 -
955 - throw new \Exception( esc_html( $message ) );
956 - }
957 -
958 - public static function has_invalid_post_permissions( $post ): bool {
959 - $is_image_attachment = 'attachment' === $post->post_type && strpos( $post->post_mime_type, 'image/' ) === 0;
960 -
961 - if ( $is_image_attachment ) {
962 - return false;
963 - }
964 -
965 - $is_private = 'private' === $post->post_status
966 - && ! current_user_can( 'read_private_posts', $post->ID );
967 -
968 - $not_allowed = 'publish' !== $post->post_status
969 - && ! current_user_can( 'edit_post', $post->ID );
970 -
971 - $password_required = post_password_required( $post->ID )
972 - && ! current_user_can( 'edit_post', $post->ID );
973 -
974 - 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 ) );
758 + echo wp_kses( $string, $allowed_html );
1004 759 }
1005 760 }