PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 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 All 508 releases
← All changes | _inc/lib/core-api/class.jetpack-core-api-module-endpoints.php +7 -27 16.3-a.5 → 16.3-a.1 View file →
@@ -91,16 +91,8 @@
91 91 );
92 92 }
93 93
94 94 if ( Jetpack::activate_module( $module_slug, false, false ) ) {
95 - if ( ! Jetpack::is_module_active( $module_slug ) ) {
96 - return new WP_Error(
97 - 'module_forced',
98 - esc_html__( 'The requested Jetpack module is disabled by your host or site administrator, so it stays off.', 'jetpack' ),
99 - array( 'status' => 409 )
100 - );
101 - }
102 -
103 95 return rest_ensure_response(
104 96 array(
105 97 'code' => 'success',
106 98 'message' => esc_html__( 'The requested Jetpack module was activated.', 'jetpack' ),
@@ -160,20 +152,9 @@
160 152 array( 'status' => 409 )
161 153 );
162 154 }
163 155
164 - $deactivated = Jetpack::deactivate_module( $module_slug );
165 -
166 - // A module that was never saved as active leaves nothing to change, so check the outcome.
167 - if ( Jetpack::is_module_active( $module_slug ) ) {
168 - return new WP_Error(
169 - 'module_forced',
170 - esc_html__( 'The requested Jetpack module is enabled by your host or site administrator, so it stays on.', 'jetpack' ),
171 - array( 'status' => 409 )
172 - );
173 - }
174 -
175 - if ( $deactivated ) {
156 + if ( Jetpack::deactivate_module( $module_slug ) ) {
176 157 return rest_ensure_response(
177 158 array(
178 159 'code' => 'success',
179 160 'message' => esc_html__( 'The requested Jetpack module was deactivated.', 'jetpack' ),
@@ -281,9 +262,9 @@
281 262 $activated = array();
282 263 $failed = array();
283 264
284 265 foreach ( $request['modules'] as $module ) {
285 - if ( Jetpack::activate_module( $module, false, false ) && Jetpack::is_module_active( $module ) ) {
266 + if ( Jetpack::activate_module( $module, false, false ) ) {
286 267 $activated[] = $module;
287 268 } else {
288 269 $failed[] = $module;
289 270 }
@@ -834,15 +815,14 @@
834 815 case 'facebook':
835 816 $grouped_options_current = (array) get_option( 'verification_services_codes' );
836 817 $grouped_options = $grouped_options_current;
837 818
838 - $validated_code = jetpack_verification_validate_code( $value );
839 - if ( false === $validated_code ) {
840 - $error = esc_html__( 'The site verification code is invalid.', 'jetpack' );
841 - break;
819 + // Extracts the content attribute from the HTML meta tag if needed.
820 + if ( preg_match( '#.*<meta name="(?:[^"]+)" content="([^"]+)" />.*#i', $value, $matches ) ) {
821 + $grouped_options[ $option ] = $matches[1];
822 + } else {
823 + $grouped_options[ $option ] = $value;
842 824 }
843 -
844 - $grouped_options[ $option ] = $validated_code;
845 825
846 826 // If option value was the same, consider it done.
847 827 $updated = $grouped_options_current !== $grouped_options
848 828 ? update_option( 'verification_services_codes', $grouped_options )