PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 7.2.2
Jetpack – WP Security, Backup, Speed, & Growth v7.2.2
16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 All 502 releases
jetpack / modules / verification-tools / verification-tools-utils.php

verification-tools-utils.php in Jetpack – WP Security, Backup, Speed, & Growth 7.2.2, at modules/verification-tools/verification-tools-utils.php

46 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * Helper functions that are called from API even when module is inactive should be added here.
5 * This file will be included in module-extras.php.
6 */
7
8 function jetpack_verification_validate( $verification_services_codes ) {
9 foreach ( $verification_services_codes as $key => $code ) {
10 // Parse html meta tag if it does not look like a valid code
11 if ( ! preg_match( '/^[a-z0-9_-]+$/i', $code ) ) {
12 $code = jetpack_verification_get_code( $code );
13 }
14
15 $code = esc_attr( trim( $code ) );
16
17 // limit length to 100 chars.
18 $code = substr( $code, 0, 100 );
19
20 /**
21 * Fire after each Verification code was validated.
22 *
23 * @module verification-tools
24 *
25 * @since 3.0.0
26 *
27 * @param string $key Verification service name.
28 * @param string $code Verification service code provided in field in the Tools menu.
29 */
30 do_action( 'jetpack_site_verification_validate', $key, $code );
31
32 $verification_services_codes[ $key ] = $code;
33 }
34 return $verification_services_codes;
35 }
36
37 function jetpack_verification_get_code( $code ) {
38 $pattern = '/content=["\']?([^"\' ]*)["\' ]/is';
39 preg_match( $pattern, $code, $match );
40 if ( $match ) {
41 return urldecode( $match[1] );
42 } else {
43 return false;
44 }
45 }
46