PluginProbe ʕ •ᴥ•ʔ
Contact Form 7 / 6.1
Contact Form 7 v6.1
6.1.6 5.0.2 5.0.3 5.0.4 5.0.5 5.1 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.2 5.2.1 5.2.2 5.3 5.3.1 5.3.2 5.4 5.4.1 5.4.2 5.5 5.5.1 5.5.2 5.5.3 5.5.4 5.5.5 5.5.6 5.5.6.1 5.6 5.6.1 5.6.2 5.6.3 5.6.4 5.7 5.7.1 5.7.2 5.7.3 5.7.4 5.7.5 5.7.5.1 5.7.6 5.7.7 5.8 5.8.1 5.8.2 5.8.3 5.8.4 5.8.5 5.8.6 5.8.7 5.9 5.9.2 5.9.3 5.9.4 5.9.5 5.9.6 5.9.7 5.9.8 6.0 6.0.1 6.0.2 6.0.3 6.0.4 6.0.5 6.0.6 6.1 6.1.1 6.1.2 6.1.3 6.1.4 6.1.5 trunk 1.1 1.10 1.10.0.1 1.10.1 1.2 1.3 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.5 1.6 1.6.1 1.7 1.7.1 1.7.2 1.7.4 1.7.5 1.7.6 1.7.6.1 1.7.7 1.7.7.1 1.7.8 1.8 1.8.0.1 1.8.0.2 1.8.0.3 1.8.0.4 1.8.1 1.8.1.1 1.9 1.9.1 1.9.2 1.9.2.1 1.9.2.2 1.9.3 1.9.4 1.9.5 1.9.5.1 2.0 2.0-beta 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1 2.1.1 2.1.2 2.2 2.2.1 2.3 2.3.1 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 3.0 3.0-beta 3.0.1 3.0.2 3.0.2.1 3.1 3.1.1 3.1.2 3.2 3.2.1 3.3 3.3.1 3.3.2 3.3.3 3.4 3.4.1 3.4.2 3.5 3.5.1 3.5.2 3.5.3 3.5.4 3.6 3.7 3.7.1 3.7.2 3.8 3.8.1 3.9 3.9-beta 3.9.1 3.9.2 3.9.3 4.0 4.0.1 4.0.2 4.0.3 4.1 4.1-beta 4.1.1 4.1.2 4.2 4.2-beta 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6 4.6.1 4.7 4.8 4.8.1 4.9 4.9.1 4.9.2 5.0 5.0.1
contact-form-7 / includes / functions.php
contact-form-7 / includes Last commit date
block-editor 1 year ago config-validator 11 months ago css 11 months ago js 1 year ago swv 11 months ago capabilities.php 7 years ago contact-form-functions.php 11 months ago contact-form-template.php 11 months ago contact-form.php 11 months ago controller.php 11 months ago file.php 11 months ago filesystem.php 11 months ago form-tag.php 11 months ago form-tags-manager.php 11 months ago formatting.php 11 months ago functions.php 11 months ago html-formatter.php 11 months ago integration.php 11 months ago l10n.php 11 months ago mail-tag.php 11 months ago mail.php 11 months ago pipe.php 11 months ago pocket-holder.php 3 years ago rest-api.php 11 months ago shortcodes.php 11 months ago special-mail-tags.php 1 year ago submission.php 11 months ago upgrade.php 11 months ago validation-functions.php 11 months ago validation.php 11 months ago
functions.php
749 lines
1 <?php
2
3 /**
4 * Returns path to a plugin file.
5 *
6 * @param string $path File path relative to the plugin root directory.
7 * @return string Absolute file path.
8 */
9 function wpcf7_plugin_path( $path = '' ) {
10 return path_join( WPCF7_PLUGIN_DIR, trim( $path, '/' ) );
11 }
12
13
14 /**
15 * Returns the URL to a plugin file.
16 *
17 * @param string $path File path relative to the plugin root directory.
18 * @return string URL.
19 */
20 function wpcf7_plugin_url( $path = '' ) {
21 $url = plugins_url( $path, WPCF7_PLUGIN );
22
23 if ( is_ssl() and 'http:' === substr( $url, 0, 5 ) ) {
24 $url = 'https:' . substr( $url, 5 );
25 }
26
27 return $url;
28 }
29
30
31 /**
32 * Include a file under WPCF7_PLUGIN_MODULES_DIR.
33 *
34 * @param string $path File path relative to the module dir.
35 * @return bool True on success, false on failure.
36 */
37 function wpcf7_include_module_file( $path ) {
38 $dir = WPCF7_PLUGIN_MODULES_DIR;
39
40 if ( empty( $dir ) or ! is_dir( $dir ) ) {
41 return false;
42 }
43
44 $path = path_join( $dir, ltrim( $path, '/' ) );
45
46 if ( file_exists( $path ) ) {
47 include_once $path;
48 return true;
49 }
50
51 return false;
52 }
53
54
55 /**
56 * Retrieves uploads directory information.
57 *
58 * @param string|bool $type Optional. Type of output. Default false.
59 * @return array|string Information about the upload directory.
60 */
61 function wpcf7_upload_dir( $type = false ) {
62 $uploads = wp_get_upload_dir();
63
64 $uploads = apply_filters( 'wpcf7_upload_dir', array(
65 'dir' => $uploads['basedir'],
66 'url' => $uploads['baseurl'],
67 ) );
68
69 if ( 'dir' === $type ) {
70 return $uploads['dir'];
71 } if ( 'url' === $type ) {
72 return $uploads['url'];
73 }
74
75 return $uploads;
76 }
77
78
79 /**
80 * Verifies that a correct security nonce was used with time limit.
81 *
82 * @param string $nonce Nonce value that was used for verification.
83 * @param string $action Optional. Context to what is taking place.
84 * Default 'wp_rest'.
85 * @return int|bool 1 if the nonce is generated between 0-12 hours ago,
86 * 2 if the nonce is generated between 12-24 hours ago.
87 * False if the nonce is invalid.
88 */
89 function wpcf7_verify_nonce( $nonce, $action = 'wp_rest' ) {
90 return wp_verify_nonce( $nonce, $action );
91 }
92
93
94 /**
95 * Creates a cryptographic token tied to a specific action, user, user session,
96 * and window of time.
97 *
98 * @param string $action Optional. Context to what is taking place.
99 * Default 'wp_rest'.
100 * @return string The token.
101 */
102 function wpcf7_create_nonce( $action = 'wp_rest' ) {
103 return wp_create_nonce( $action );
104 }
105
106
107 /**
108 * Converts multi-dimensional array to a flat array.
109 *
110 * @param mixed $input Array or item of array.
111 * @return array Flatten array.
112 */
113 function wpcf7_array_flatten( $input ) {
114 if ( ! is_array( $input ) ) {
115 return array( $input );
116 }
117
118 $output = array();
119
120 foreach ( $input as $value ) {
121 $output = array_merge( $output, wpcf7_array_flatten( $value ) );
122 }
123
124 return $output;
125 }
126
127
128 /**
129 * Excludes unset or blank text values from the given array.
130 *
131 * @param array $input The array.
132 * @return array Array without blank text values.
133 */
134 function wpcf7_exclude_blank( $input ) {
135 $output = array_filter( $input,
136 static function ( $i ) {
137 return isset( $i ) && '' !== $i;
138 }
139 );
140
141 return array_values( $output );
142 }
143
144
145 /**
146 * Creates a comma-separated list from a multi-dimensional array.
147 *
148 * @param mixed $input Array or item of array.
149 * @param string|array $options Optional. Output options.
150 * @return string Comma-separated list.
151 */
152 function wpcf7_flat_join( $input, $options = '' ) {
153 $options = wp_parse_args( $options, array(
154 'separator' => ', ',
155 ) );
156
157 $input = wpcf7_array_flatten( $input );
158 $output = array();
159
160 foreach ( $input as $value ) {
161 if ( is_scalar( $value ) ) {
162 $output[] = trim( (string) $value );
163 }
164 }
165
166 return implode( $options['separator'], $output );
167 }
168
169
170 /**
171 * Returns true if HTML5 is supported.
172 */
173 function wpcf7_support_html5() {
174 return (bool) wpcf7_apply_filters_deprecated(
175 'wpcf7_support_html5',
176 array( true ),
177 '5.6',
178 ''
179 );
180 }
181
182
183 /**
184 * Returns true if HTML5 fallback is active.
185 */
186 function wpcf7_support_html5_fallback() {
187 return (bool) apply_filters( 'wpcf7_support_html5_fallback', false );
188 }
189
190
191 /**
192 * Returns true if the Really Simple CAPTCHA plugin is used for contact forms.
193 */
194 function wpcf7_use_really_simple_captcha() {
195 return apply_filters( 'wpcf7_use_really_simple_captcha',
196 WPCF7_USE_REALLY_SIMPLE_CAPTCHA
197 );
198 }
199
200
201 /**
202 * Returns true if config validation is active.
203 */
204 function wpcf7_validate_configuration() {
205 return apply_filters( 'wpcf7_validate_configuration',
206 WPCF7_VALIDATE_CONFIGURATION
207 );
208 }
209
210
211 /**
212 * Returns true if wpcf7_autop() is applied.
213 */
214 function wpcf7_autop_or_not( $options = '' ) {
215 $options = wp_parse_args( $options, array(
216 'for' => 'form',
217 ) );
218
219 return (bool) apply_filters( 'wpcf7_autop_or_not', WPCF7_AUTOP, $options );
220 }
221
222
223 /**
224 * Returns true if JavaScript for this plugin is loaded.
225 */
226 function wpcf7_load_js() {
227 return apply_filters( 'wpcf7_load_js', WPCF7_LOAD_JS );
228 }
229
230
231 /**
232 * Returns true if CSS for this plugin is loaded.
233 */
234 function wpcf7_load_css() {
235 return apply_filters( 'wpcf7_load_css', WPCF7_LOAD_CSS );
236 }
237
238
239 /**
240 * Builds an HTML anchor element.
241 *
242 * @param string $url Link URL.
243 * @param string $anchor_text Anchor label text.
244 * @param string|array $atts Optional. HTML attributes.
245 * @return string Formatted anchor element.
246 */
247 function wpcf7_link( $url, $anchor_text, $atts = '' ) {
248 $atts = wp_parse_args( $atts, array(
249 'id' => null,
250 'class' => null,
251 ) );
252
253 $atts = array_merge( $atts, array(
254 'href' => esc_url( $url ),
255 ) );
256
257 return sprintf(
258 '<a %1$s>%2$s</a>',
259 wpcf7_format_atts( $atts ),
260 esc_html( $anchor_text )
261 );
262 }
263
264
265 /**
266 * Returns the current request URL.
267 */
268 function wpcf7_get_request_uri() {
269 static $request_uri = '';
270
271 if ( empty( $request_uri ) ) {
272 $request_uri = add_query_arg( array() );
273 $request_uri = '/' . ltrim( $request_uri, '/' );
274 }
275
276 return sanitize_url( $request_uri );
277 }
278
279
280 /**
281 * Registers post types used for this plugin.
282 */
283 function wpcf7_register_post_types() {
284 if ( class_exists( 'WPCF7_ContactForm' ) ) {
285 WPCF7_ContactForm::register_post_type();
286 return true;
287 } else {
288 return false;
289 }
290 }
291
292
293 /**
294 * Returns the version string of this plugin.
295 *
296 * @param string|array $options Optional. Output options.
297 * @return string Version string.
298 */
299 function wpcf7_version( $options = '' ) {
300 $options = wp_parse_args( $options, array(
301 'limit' => -1,
302 'only_major' => false,
303 ) );
304
305 if ( $options['only_major'] ) {
306 $options['limit'] = 2;
307 }
308
309 $options['limit'] = (int) $options['limit'];
310
311 $ver = WPCF7_VERSION;
312 $ver = strtr( $ver, '_-+', '...' );
313 $ver = preg_replace( '/[^0-9.]+/', ".$0.", $ver );
314 $ver = preg_replace( '/[.]+/', ".", $ver );
315 $ver = trim( $ver, '.' );
316 $ver = explode( '.', $ver );
317
318 if ( -1 < $options['limit'] ) {
319 $ver = array_slice( $ver, 0, $options['limit'] );
320 }
321
322 $ver = implode( '.', $ver );
323
324 return $ver;
325 }
326
327
328 /**
329 * Returns array entries that match the given version.
330 *
331 * @param string $version The version to search for.
332 * @param array $input Search target array.
333 * @return array|bool Array of matched entries. False on failure.
334 */
335 function wpcf7_version_grep( $version, array $input ) {
336 $pattern = '/^' . preg_quote( (string) $version, '/' ) . '(?:\.|$)/';
337
338 return preg_grep( $pattern, $input );
339 }
340
341
342 /**
343 * Returns an enctype attribute value.
344 *
345 * @param string $enctype Enctype value.
346 * @return string Enctype value. Empty if not a valid enctype.
347 */
348 function wpcf7_enctype_value( $enctype ) {
349 $enctype = trim( $enctype );
350
351 if ( empty( $enctype ) ) {
352 return '';
353 }
354
355 $valid_enctypes = array(
356 'application/x-www-form-urlencoded',
357 'multipart/form-data',
358 'text/plain',
359 );
360
361 if ( in_array( $enctype, $valid_enctypes, true ) ) {
362 return $enctype;
363 }
364
365 $pattern = '%^enctype="(' . implode( '|', $valid_enctypes ) . ')"$%';
366
367 if ( preg_match( $pattern, $enctype, $matches ) ) {
368 return $matches[1]; // for back-compat
369 }
370
371 return '';
372 }
373
374
375 /**
376 * Removes directory recursively.
377 *
378 * @param string $dir Directory path.
379 * @return bool True on success, false on failure.
380 */
381 function wpcf7_rmdir_p( $dir ) {
382 $filesystem = WPCF7_Filesystem::get_instance();
383
384 return $filesystem->delete( $dir, true );
385 }
386
387
388 /**
389 * Builds a URL-encoded query string.
390 *
391 * @link https://developer.wordpress.org/reference/functions/_http_build_query/
392 *
393 * @param array $data URL query parameters.
394 * @param string $key Optional. If specified, used to prefix key name.
395 * @return string Query string.
396 */
397 function wpcf7_build_query( $data, $key = '' ) {
398 $sep = '&';
399 $ret = array();
400
401 foreach ( (array) $data as $k => $v ) {
402 $k = urlencode( $k );
403
404 if ( ! empty( $key ) ) {
405 $k = $key . '%5B' . $k . '%5D';
406 }
407
408 if ( null === $v ) {
409 continue;
410 } elseif ( false === $v ) {
411 $v = '0';
412 }
413
414 if ( is_array( $v ) or is_object( $v ) ) {
415 array_push( $ret, wpcf7_build_query( $v, $k ) );
416 } else {
417 array_push( $ret, $k . '=' . urlencode( $v ) );
418 }
419 }
420
421 return implode( $sep, $ret );
422 }
423
424
425 /**
426 * Returns the number of code units in a string.
427 *
428 * @link http://www.w3.org/TR/html5/infrastructure.html#code-unit-length
429 *
430 * @param string $text Input string.
431 * @return int|bool The number of code units, or false if
432 * mb_convert_encoding is not available.
433 */
434 function wpcf7_count_code_units( $text ) {
435 static $use_mb = null;
436
437 if ( is_null( $use_mb ) ) {
438 $use_mb = function_exists( 'mb_convert_encoding' );
439 }
440
441 if ( ! $use_mb ) {
442 return false;
443 }
444
445 $text = (string) $text;
446 $text = str_replace( "\r\n", "\n", $text );
447
448 $encoding = mb_detect_encoding( $text, mb_detect_order(), true );
449
450 if ( $encoding ) {
451 $text = mb_convert_encoding( $text, 'UTF-16', $encoding );
452 } else {
453 $text = mb_convert_encoding( $text, 'UTF-16', 'UTF-8' );
454 }
455
456 $byte_count = mb_strlen( $text, '8bit' );
457
458 return floor( $byte_count / 2 );
459 }
460
461
462 /**
463 * Returns true if WordPress is running on the localhost.
464 */
465 function wpcf7_is_localhost() {
466 $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST );
467
468 return in_array(
469 strtolower( $sitename ),
470 array( 'localhost', '127.0.0.1' ),
471 true
472 );
473 }
474
475
476 /**
477 * Marks a function as deprecated and informs when it has been used.
478 *
479 * @param string $function_name The function that was called.
480 * @param string $version The version of Contact Form 7 that deprecated
481 * the function.
482 * @param string $replacement The function that should have been called.
483 */
484 function wpcf7_deprecated_function( $function_name, $version, $replacement ) {
485
486 if ( ! WP_DEBUG ) {
487 return;
488 }
489
490 if ( function_exists( '__' ) ) {
491 /* translators: 1: PHP function name, 2: version number, 3: alternative function name */
492 $message = __( 'Function %1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s! Use %3$s instead.', 'contact-form-7' );
493 } else {
494 $message = 'Function %1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s! Use %3$s instead.';
495 }
496
497 $message = sprintf( $message, $function_name, $version, $replacement );
498
499 wp_trigger_error( '', $message, E_USER_DEPRECATED );
500 }
501
502
503 /**
504 * Fires functions attached to a deprecated filter hook.
505 *
506 * @param string $hook_name The name of the filter hook.
507 * @param array $args Array of additional function arguments to be
508 * passed to apply_filters().
509 * @param string $version The version of Contact Form 7 that deprecated
510 * the hook.
511 * @param string $replacement The hook that should have been used.
512 */
513 function wpcf7_apply_filters_deprecated( $hook_name, $args, $version, $replacement = '' ) {
514 if ( ! has_filter( $hook_name ) ) {
515 return $args[0];
516 }
517
518 if ( WP_DEBUG and apply_filters( 'deprecated_hook_trigger_error', true ) ) {
519 if ( $replacement ) {
520 wp_trigger_error(
521 '',
522 sprintf(
523 /* translators: 1: WordPress hook name, 2: version number, 3: alternative hook name */
524 __( 'Hook %1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s! Use %3$s instead.', 'contact-form-7' ),
525 $hook_name,
526 $version,
527 $replacement
528 ),
529 E_USER_DEPRECATED
530 );
531 } else {
532 wp_trigger_error(
533 '',
534 sprintf(
535 /* translators: 1: WordPress hook name, 2: version number */
536 __( 'Hook %1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s with no alternative available.', 'contact-form-7' ),
537 $hook_name,
538 $version
539 ),
540 E_USER_DEPRECATED
541 );
542 }
543 }
544
545 return apply_filters_ref_array( $hook_name, $args );
546 }
547
548
549 /**
550 * Marks something as being incorrectly called.
551 *
552 * @param string $function_name The function that was called.
553 * @param string $message A message explaining what has been done incorrectly.
554 * @param string $version The version of Contact Form 7 where the message
555 * was added.
556 */
557 function wpcf7_doing_it_wrong( $function_name, $message, $version ) {
558
559 if ( ! WP_DEBUG ) {
560 return;
561 }
562
563 if ( function_exists( '__' ) ) {
564 if ( $version ) {
565 $version = sprintf(
566 /* translators: %s: Contact Form 7 version number. */
567 __( '(This message was added in Contact Form 7 version %s.)', 'contact-form-7' ),
568 $version
569 );
570 }
571
572 wp_trigger_error(
573 '',
574 sprintf(
575 /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: Contact Form 7 version number. */
576 __( 'Function %1$s was called incorrectly. %2$s %3$s', 'contact-form-7' ),
577 $function_name,
578 $message,
579 $version
580 ),
581 E_USER_NOTICE
582 );
583 } else {
584 if ( $version ) {
585 $version = sprintf(
586 '(This message was added in Contact Form 7 version %s.)',
587 $version
588 );
589 }
590
591 wp_trigger_error(
592 '',
593 sprintf(
594 'Function %1$s was called incorrectly. %2$s %3$s',
595 $function_name,
596 $message,
597 $version
598 ),
599 E_USER_NOTICE
600 );
601 }
602 }
603
604
605 /**
606 * Triggers an error about a remote HTTP request and response.
607 *
608 * @param string $url The resource URL.
609 * @param array $request Request arguments.
610 * @param array|WP_Error $response The response or WP_Error on failure.
611 */
612 function wpcf7_log_remote_request( $url, $request, $response ) {
613
614 if ( ! WP_DEBUG ) {
615 return;
616 }
617
618 $log = sprintf(
619 /* translators: 1: response code, 2: message, 3: body, 4: URL */
620 __( 'HTTP Response: %1$s %2$s %3$s from %4$s', 'contact-form-7' ),
621 (int) wp_remote_retrieve_response_code( $response ),
622 wp_remote_retrieve_response_message( $response ),
623 wp_remote_retrieve_body( $response ),
624 $url
625 );
626
627 $log = apply_filters( 'wpcf7_log_remote_request',
628 $log, $url, $request, $response
629 );
630
631 if ( $log ) {
632 wp_trigger_error( '', $log, E_USER_NOTICE );
633 }
634 }
635
636
637 /**
638 * Anonymizes an IP address by masking local part.
639 *
640 * @param string $ip_addr The original IP address.
641 * @return string|bool Anonymized IP address, or false on failure.
642 */
643 function wpcf7_anonymize_ip_addr( $ip_addr ) {
644 if (
645 ! function_exists( 'inet_ntop' ) or
646 ! function_exists( 'inet_pton' )
647 ) {
648 return $ip_addr;
649 }
650
651 $packed = inet_pton( $ip_addr );
652
653 if ( false === $packed ) {
654 return $ip_addr;
655 }
656
657 if ( 4 === strlen( $packed ) ) { // IPv4
658 $mask = '255.255.255.0';
659 } elseif ( 16 === strlen( $packed ) ) { // IPv6
660 $mask = 'ffff:ffff:ffff:0000:0000:0000:0000:0000';
661 } else {
662 return $ip_addr;
663 }
664
665 return inet_ntop( $packed & inet_pton( $mask ) );
666 }
667
668
669 /**
670 * Retrieves a sanitized value from the $_GET superglobal.
671 *
672 * @param string $key Array key.
673 * @param mixed $default The default value returned when
674 * the specified superglobal is not set.
675 * @return mixed Sanitized value.
676 */
677 function wpcf7_superglobal_get( $key, $default = '' ) {
678 return wpcf7_superglobal( 'get', $key ) ?? $default;
679 }
680
681
682 /**
683 * Retrieves a sanitized value from the $_POST superglobal.
684 *
685 * @param string $key Array key.
686 * @param mixed $default The default value returned when
687 * the specified superglobal is not set.
688 * @return mixed Sanitized value.
689 */
690 function wpcf7_superglobal_post( $key, $default = '' ) {
691 return wpcf7_superglobal( 'post', $key ) ?? $default;
692 }
693
694
695 /**
696 * Retrieves a sanitized value from the $_REQUEST superglobal.
697 *
698 * @param string $key Array key.
699 * @param mixed $default The default value returned when
700 * the specified superglobal is not set.
701 * @return mixed Sanitized value.
702 */
703 function wpcf7_superglobal_request( $key, $default = '' ) {
704 return wpcf7_superglobal( 'request', $key ) ?? $default;
705 }
706
707
708 /**
709 * Retrieves a sanitized value from the $_SERVER superglobal.
710 *
711 * @param string $key Array key.
712 * @param mixed $default The default value returned when
713 * the specified superglobal is not set.
714 * @return mixed Sanitized value.
715 */
716 function wpcf7_superglobal_server( $key, $default = '' ) {
717 return wpcf7_superglobal( 'server', $key ) ?? $default;
718 }
719
720
721 /**
722 * Retrieves a sanitized value from the specified superglobal.
723 *
724 * @param string $superglobal A superglobal type.
725 * @param string $key Array key.
726 * @return string|array|null Sanitized value.
727 */
728 function wpcf7_superglobal( $superglobal, $key ) {
729 $superglobals = array(
730 'get' => $_GET,
731 'post' => $_POST,
732 'request' => $_REQUEST,
733 'server' => $_SERVER,
734 );
735
736 if ( isset( $superglobals[$superglobal][$key] ) ) {
737 return map_deep(
738 $superglobals[$superglobal][$key],
739 static function ( $val ) {
740 $val = wp_unslash( $val );
741 $val = wp_check_invalid_utf8( $val );
742 $val = wp_kses_no_null( $val );
743 $val = wpcf7_strip_whitespaces( $val );
744 return $val;
745 }
746 );
747 }
748 }
749