PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.1
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / models / FrmAddon.php

FrmAddon.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 5.1, at classes/models/FrmAddon.php

709 lines 21.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 class FrmAddon {
7 public $store_url = 'https://formidableforms.com';
8 public $download_id;
9 public $plugin_file;
10 public $plugin_folder;
11 public $plugin_name;
12 public $plugin_slug;
13 public $option_name;
14 public $version;
15 public $author = 'Strategy11';
16 public $is_parent_licence = false;
17 public $needs_license = true;
18 private $is_expired_addon = false;
19 public $license;
20 protected $get_beta = false;
21
22 public function __construct() {
23
24 if ( empty( $this->plugin_slug ) ) {
25 $this->plugin_slug = preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->plugin_name ) ) );
26 }
27 if ( empty( $this->option_name ) ) {
28 $this->option_name = 'edd_' . $this->plugin_slug . '_license_';
29 }
30
31 $this->plugin_folder = plugin_basename( $this->plugin_file );
32 $this->license = $this->get_license();
33
34 add_filter( 'frm_installed_addons', array( &$this, 'insert_installed_addon' ) );
35 $this->edd_plugin_updater();
36 }
37
38 public static function load_hooks() {
39 add_filter( 'frm_include_addon_page', '__return_true' );
40 //new static();
41 }
42
43 public function insert_installed_addon( $plugins ) {
44 $plugins[ $this->plugin_slug ] = $this;
45
46 return $plugins;
47 }
48
49 public static function get_addon( $plugin_slug ) {
50 $plugins = apply_filters( 'frm_installed_addons', array() );
51 $plugin = false;
52 if ( isset( $plugins[ $plugin_slug ] ) ) {
53 $plugin = $plugins[ $plugin_slug ];
54 }
55
56 return $plugin;
57 }
58
59 public function edd_plugin_updater() {
60
61 $this->is_license_revoked();
62 $license = $this->license;
63
64 add_action( 'after_plugin_row_' . plugin_basename( $this->plugin_file ), array( $this, 'maybe_show_license_message' ), 10, 2 );
65
66 if ( ! empty( $license ) ) {
67
68 if ( 'formidable/formidable.php' !== $this->plugin_folder ) {
69 add_filter( 'plugins_api', array( &$this, 'plugins_api_filter' ), 10, 3 );
70 }
71
72 add_filter( 'site_transient_update_plugins', array( &$this, 'clear_expired_download' ) );
73 }
74 }
75
76 /**
77 * Updates information on the "View version x.x details" page with custom data.
78 *
79 * @uses api_request()
80 *
81 * @param mixed $_data
82 * @param string $_action
83 * @param object $_args
84 *
85 * @return object $_data
86 */
87 public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
88
89 if ( $_action != 'plugin_information' ) {
90 return $_data;
91 }
92
93 $slug = basename( $this->plugin_file, '.php' );
94 $slug2 = str_replace( '/' . $slug . '.php', '', $this->plugin_folder );
95 if ( empty( $_args->slug ) || ( $_args->slug != $slug && $_args->slug !== $slug2 ) ) {
96 return $_data;
97 }
98
99 $item_id = $this->download_id;
100 if ( empty( $item_id ) ) {
101 $_data = array(
102 'name' => $this->plugin_name,
103 'excerpt' => '',
104 'changelog' => 'See the full changelog at <a href="' . esc_url( $this->store_url . '/changelog/' ) . '"></a>',
105 'banners' => array(
106 'high' => '',
107 'low' => 'https://ps.w.org/formidable/assets/banner-1544x500.png',
108 ),
109 );
110 } else {
111 $api = new FrmFormApi( $this->license );
112 $plugins = $api->get_api_info();
113 $_data = $plugins[ $item_id ];
114 }
115
116 $_data['sections'] = array(
117 'description' => $_data['excerpt'],
118 'changelog' => $_data['changelog'],
119 );
120 $_data['author'] = '<a href="' . esc_url( $this->store_url ) . '">' . esc_html( $this->author ) . '</a>';
121 $_data['homepage'] = $this->store_url;
122
123 return (object) $_data;
124 }
125
126 public function get_license() {
127 $license = $this->maybe_get_pro_license();
128 if ( ! empty( $license ) ) {
129 return $license;
130 }
131
132 $license = trim( get_option( $this->option_name . 'key' ) );
133 if ( empty( $license ) ) {
134 $license = $this->activate_defined_license();
135 }
136
137 return $license;
138 }
139
140 /**
141 * @since 3.04.03
142 */
143 protected function maybe_get_pro_license() {
144 // prevent a loop if $this is the pro plugin
145 $get_license = FrmAppHelper::pro_is_installed() && is_callable( 'FrmProAppHelper::get_updater' ) && $this->plugin_name != 'Formidable Pro';
146
147 if ( ! $get_license ) {
148 return false;
149 }
150
151 $api = new FrmFormApi();
152 $api->get_pro_updater();
153 $license = $api->get_license();
154 if ( empty( $license ) ) {
155 return false;
156 }
157
158 $this->get_api_info( $license );
159 if ( ! $this->is_parent_licence ) {
160 $license = false;
161 }
162
163 return $license;
164 }
165
166 /**
167 * Activate the license in wp-config.php
168 *
169 * @since 2.04
170 */
171 public function activate_defined_license() {
172 $license = $this->get_defined_license();
173 if ( ! empty( $license ) && ! $this->is_active() && $this->is_time_to_auto_activate() ) {
174 $response = $this->activate_license( $license );
175 $this->set_auto_activate_time();
176 if ( ! $response['success'] ) {
177 $license = '';
178 }
179 }
180
181 return $license;
182 }
183
184 /**
185 * Check the wp-config.php for the license key
186 *
187 * @since 2.04
188 */
189 public function get_defined_license() {
190 $consant_name = 'FRM_' . strtoupper( $this->plugin_slug ) . '_LICENSE';
191
192 return defined( $consant_name ) ? constant( $consant_name ) : false;
193 }
194
195 public function set_license( $license ) {
196 update_option( $this->option_name . 'key', $license );
197 }
198
199 /**
200 * If the license is in the config, limit the frequency of checks.
201 * The license may be entered incorrectly, so we don't want to check on every page load.
202 *
203 * @since 2.04
204 */
205 private function is_time_to_auto_activate() {
206 $last_try = get_option( $this->option_name . 'last_activate' );
207
208 return ( ! $last_try || $last_try < strtotime( '-1 day' ) );
209 }
210
211 private function set_auto_activate_time() {
212 update_option( $this->option_name . 'last_activate', time() );
213 }
214
215 public function is_active() {
216 return get_option( $this->option_name . 'active' );
217 }
218
219 /**
220 * @since 3.04.03
221 *
222 * @param array error
223 */
224 public function maybe_clear_license( $error ) {
225 if ( $error['code'] === 'disabled' && $error['license'] === $this->license ) {
226 $this->clear_license();
227 }
228 }
229
230 public function clear_license() {
231 delete_option( $this->option_name . 'active' );
232 delete_option( $this->option_name . 'key' );
233 delete_site_option( $this->transient_key() );
234 delete_option( $this->transient_key() );
235 $this->delete_cache();
236 }
237
238 public function set_active( $is_active ) {
239 update_option( $this->option_name . 'active', $is_active );
240 $this->delete_cache();
241 FrmAppHelper::save_combined_js();
242 $this->update_pro_capabilities();
243 }
244
245 /**
246 * Updates roles capabilities after pro license is active.
247 *
248 * @since 5.0
249 */
250 protected function update_pro_capabilities() {
251 global $wp_roles;
252
253 $caps = FrmAppHelper::frm_capabilities( 'pro_only' );
254 $roles = get_editable_roles();
255 $settings = new FrmSettings();
256 foreach ( $caps as $cap => $cap_desc ) {
257 $cap_roles = (array) ( isset( $settings->$cap ) ? $settings->$cap : 'administrator' );
258
259 // Make sure administrators always have permissions.
260 if ( ! in_array( 'administrator', $cap_roles ) ) {
261 array_push( $cap_roles, 'administrator' );
262 }
263
264 foreach ( $roles as $role => $details ) {
265 if ( in_array( $role, $cap_roles ) ) {
266 $wp_roles->add_cap( $role, $cap );
267 } else {
268 $wp_roles->remove_cap( $role, $cap );
269 }
270 }
271 }
272 }
273
274 /**
275 * @since 3.04.03
276 */
277 protected function delete_cache() {
278 delete_transient( 'frm_api_licence' );
279
280 $api = new FrmFormApi( $this->license );
281 $api->reset_cached();
282
283 $api = new FrmFormTemplateApi( $this->license );
284 $api->reset_cached();
285 }
286
287 /**
288 * The Pro version includes the show_license_message function.
289 * We need an extra check before we allow it to show a message.
290 *
291 * @since 3.04.03
292 */
293 public function maybe_show_license_message( $file, $plugin ) {
294 if ( $this->is_expired_addon || isset( $plugin['package'] ) ) {
295 // let's not show a ton of duplicate messages
296 return;
297 }
298
299 $this->show_license_message( $file, $plugin );
300 }
301
302 public function show_license_message( $file, $plugin ) {
303 $message = '';
304 if ( empty( $this->license ) ) {
305 /* translators: %1$s: Plugin name, %2$s: Start link HTML, %3$s: end link HTML */
306 $message = sprintf( esc_html__( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), esc_html( $this->plugin_name ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">', '</a>' );
307 } else {
308 $api = new FrmFormApi( $this->license );
309 $errors = $api->error_for_license();
310 if ( ! empty( $errors ) ) {
311 $message = reset( $errors );
312 }
313 }
314
315 if ( empty( $message ) ) {
316 return;
317 }
318
319 $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
320 $id = sanitize_title( $plugin['Name'] ) . '-next';
321
322 echo '<tr class="plugin-update-tr active" id="' . esc_attr( $id ) . '"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message notice error inline notice-error notice-alt"><p>';
323 echo FrmAppHelper::kses( $message, 'a' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
324 echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '").previousSibling;if ( d !== null ){ d.className = d.className + " update"; }</script>';
325 echo '</p></div></td></tr>';
326 }
327
328 public function clear_expired_download( $transient ) {
329 if ( ! is_object( $transient ) ) {
330 return $transient;
331 }
332
333 if ( $this->is_current_version( $transient ) ) {
334 //make sure it doesn't show there is an update if plugin is up-to-date
335 if ( isset( $transient->response[ $this->plugin_folder ] ) ) {
336 unset( $transient->response[ $this->plugin_folder ] );
337 }
338 } elseif ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) {
339 $this->prepare_update_details( $transient->response[ $this->plugin_folder ] );
340
341 // if the transient has expired, clear the update and trigger it again
342 if ( $transient->response[ $this->plugin_folder ] === false ) {
343 if ( ! $this->has_been_cleared() ) {
344 $this->cleared_plugins();
345 $this->manually_queue_update();
346 }
347 unset( $transient->response[ $this->plugin_folder ] );
348 }
349 }
350
351 return $transient;
352 }
353
354 /**
355 * Check if the plugin information is correct to allow an update
356 *
357 * @since 3.04.03
358 *
359 * @param object $transient - the current plugin info saved for update
360 */
361 private function prepare_update_details( &$transient ) {
362 $version_info = $transient;
363 $has_beta_url = isset( $version_info->beta ) && ! empty( $version_info->beta );
364 if ( $this->get_beta && ! $has_beta_url ) {
365 $version_info = (object) $this->get_api_info( $this->license );
366 }
367
368 if ( isset( $version_info->new_version ) && ! empty( $version_info->new_version ) ) {
369 $this->clear_old_plugin_version( $version_info );
370 if ( $version_info === false ) { // was cleared with timeout
371 $transient = false;
372 } else {
373 $this->maybe_use_beta_url( $version_info );
374
375 if ( version_compare( $version_info->new_version, $this->version, '>' ) ) {
376 $transient = $version_info;
377 }
378 }
379 }
380 }
381
382 /**
383 * Get the API info for this plugin
384 *
385 * @since 3.04.03
386 */
387 protected function get_api_info( $license ) {
388 $api = new FrmFormApi( $license );
389 $addon = $api->get_addon_for_license( $this );
390
391 // if there is no download url, this license does not apply to the addon
392 if ( isset( $addon['package'] ) ) {
393 $this->is_parent_licence = true;
394 } elseif ( isset( $addon['error'] ) ) {
395 // if the license is expired, we must assume all add-ons were packaged
396 $this->is_parent_licence = true;
397 $this->is_expired_addon = true;
398 }
399
400 return $addon;
401 }
402
403 /**
404 * Make sure transients don't stick around on sites that
405 * don't save the transient expiration
406 *
407 * @since 2.05.05
408 */
409 private function clear_old_plugin_version( &$version_info ) {
410 $timeout = ( isset( $version_info->timeout ) && ! empty( $version_info->timeout ) ) ? $version_info->timeout : 0;
411 if ( ! empty( $timeout ) && time() > $timeout ) {
412 $version_info = false; // Cache is expired
413 $api = new FrmFormApi( $this->license );
414 $api->reset_cached();
415 }
416 }
417
418 /**
419 * The beta url is always included if the download has a beta.
420 * Check if the beta should be downloaded.
421 *
422 * @since 3.04.03
423 */
424 private function maybe_use_beta_url( &$version_info ) {
425 if ( $this->get_beta && isset( $version_info->beta ) && ! empty( $version_info->beta ) ) {
426 $version_info->new_version = $version_info->beta['version'];
427 $version_info->package = $version_info->beta['package'];
428 if ( isset( $version_info->plugin ) && ! empty( $version_info->plugin ) ) {
429 $version_info->plugin = $version_info->beta['plugin'];
430 }
431 }
432 }
433
434 private function is_current_version( $transient ) {
435 if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) {
436 return false;
437 }
438
439 $response = ! isset( $transient->response ) || empty( $transient->response );
440 if ( $response ) {
441 return true;
442 }
443
444 return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] === $transient->response[ $this->plugin_folder ]->new_version;
445 }
446
447 private function has_been_cleared() {
448 $last_cleared = get_option( 'frm_last_cleared' );
449
450 return ( $last_cleared && $last_cleared > gmdate( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ) );
451 }
452
453 private function cleared_plugins() {
454 update_option( 'frm_last_cleared', gmdate( 'Y-m-d H:i:s' ) );
455 }
456
457 private function is_license_revoked() {
458 if ( empty( $this->license ) || empty( $this->plugin_slug ) || isset( $_POST['license'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
459 return;
460 }
461
462 if ( is_multisite() ) {
463 $last_checked = get_site_option( $this->transient_key() );
464 } else {
465 $last_checked = get_option( $this->transient_key() );
466 }
467
468 $seven_days_ago = gmdate( 'Y-m-d H:i:s', strtotime( '-7 days' ) );
469
470 if ( ! $last_checked || $last_checked < $seven_days_ago ) {
471 // check weekly
472 if ( is_multisite() ) {
473 update_site_option( $this->transient_key(), gmdate( 'Y-m-d H:i:s' ) );
474 } else {
475 update_option( $this->transient_key(), gmdate( 'Y-m-d H:i:s' ) );
476 }
477
478 $response = $this->get_license_status();
479 if ( 'revoked' === $response['status'] || 'blocked' === $response['status'] || 'disabled' === $response['status'] ) {
480 $this->clear_license();
481 }
482 }
483 }
484
485 /**
486 * Use a new cache after the license is changed, or Formidable is updated.
487 */
488 private function transient_key() {
489 return 'frm_' . md5( sanitize_key( $this->license . '_' . $this->plugin_slug ) );
490 }
491
492 public static function activate() {
493 FrmAppHelper::permission_check( 'frm_change_settings' );
494 check_ajax_referer( 'frm_ajax', 'nonce' );
495
496 $license = stripslashes( FrmAppHelper::get_param( 'license', '', 'post', 'sanitize_text_field' ) );
497 if ( empty( $license ) ) {
498 wp_die(
499 json_encode(
500 array(
501 'message' => __( 'Oops! You forgot to enter your license number.', 'formidable' ),
502 'success' => false,
503 )
504 )
505 );
506 }
507
508 $plugin_slug = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
509 $response = self::activate_license_for_plugin( $license, $plugin_slug );
510
511 echo json_encode( $response );
512 wp_die();
513 }
514
515 /**
516 * @since 4.08
517 */
518 public static function activate_license_for_plugin( $license, $plugin_slug ) {
519 $this_plugin = self::get_addon( $plugin_slug );
520 return $this_plugin->activate_license( $license );
521 }
522
523 private function activate_license( $license ) {
524 $this->set_license( $license );
525 $this->license = $license;
526
527 $response = $this->get_license_status();
528 $response['message'] = '';
529 $response['success'] = false;
530
531 if ( $response['error'] ) {
532 $response['message'] = $response['status'];
533 } else {
534 $messages = $this->get_messages();
535 if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) {
536 $response['message'] = $messages[ $response['status'] ];
537 } else {
538 $response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) );
539 }
540
541 $is_valid = false;
542 if ( 'valid' === $response['status'] ) {
543 $is_valid = 'valid';
544 $response['success'] = true;
545 }
546 $this->set_active( $is_valid );
547 }
548
549 return $response;
550 }
551
552 private function get_license_status() {
553 $response = array(
554 'status' => 'missing',
555 'error' => true,
556 );
557 if ( empty( $this->license ) ) {
558 $response['error'] = false;
559
560 return $response;
561 }
562
563 try {
564 $response['error'] = false;
565 $license_data = $this->send_mothership_request( 'activate_license' );
566
567 // $license_data->license will be either "valid" or "invalid"
568 if ( is_array( $license_data ) ) {
569 if ( in_array( $license_data['license'], array( 'valid', 'invalid' ), true ) ) {
570 $response['status'] = $license_data['license'];
571 }
572 } else {
573 $response['status'] = $license_data;
574 }
575 } catch ( Exception $e ) {
576 $response['status'] = $e->getMessage();
577 }
578
579 return $response;
580 }
581
582 private function get_messages() {
583 return array(
584 'valid' => __( 'Your license has been activated. Enjoy!', 'formidable' ),
585 'invalid' => __( 'That license key is invalid', 'formidable' ),
586 'expired' => __( 'That license is expired', 'formidable' ),
587 'revoked' => __( 'That license has been refunded', 'formidable' ),
588 'no_activations_left' => __( 'That license has been used on too many sites', 'formidable' ),
589 'invalid_item_id' => __( 'Oops! That is the wrong license key for this plugin.', 'formidable' ),
590 'missing' => __( 'That license key is invalid', 'formidable' ),
591 );
592 }
593
594 /**
595 * @since 4.03
596 */
597 public static function reset_cache() {
598 FrmAppHelper::permission_check( 'frm_change_settings' );
599 check_ajax_referer( 'frm_ajax', 'nonce' );
600
601 $this_plugin = self::set_license_from_post();
602 $this_plugin->delete_cache();
603
604 $response = array(
605 'success' => true,
606 'message' => __( 'Cache cleared', 'formidable' ),
607 );
608
609 echo json_encode( $response );
610 wp_die();
611 }
612
613 public static function deactivate() {
614 FrmAppHelper::permission_check( 'frm_change_settings' );
615 check_ajax_referer( 'frm_ajax', 'nonce' );
616
617 $this_plugin = self::set_license_from_post();
618
619 $response = array(
620 'success' => false,
621 'message' => '',
622 );
623 try {
624 // $license_data->license will be either "deactivated" or "failed"
625 $license_data = $this_plugin->send_mothership_request( 'deactivate_license' );
626 if ( is_array( $license_data ) && 'deactivated' === $license_data['license'] ) {
627 $response['success'] = true;
628 $response['message'] = __( 'That license was removed successfully', 'formidable' );
629 } else {
630 $response['message'] = __( 'There was an error deactivating your license.', 'formidable' );
631 }
632 } catch ( Exception $e ) {
633 $response['message'] = $e->getMessage();
634 }
635
636 $this_plugin->clear_license();
637
638 echo json_encode( $response );
639 wp_die();
640 }
641
642 /**
643 * @since 4.03
644 */
645 private static function set_license_from_post() {
646 $plugin_slug = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
647 $this_plugin = self::get_addon( $plugin_slug );
648 $license = $this_plugin->get_license();
649 $this_plugin->license = $license;
650 return $this_plugin;
651 }
652
653 public function send_mothership_request( $action ) {
654 $api_params = array(
655 'edd_action' => $action,
656 'license' => $this->license,
657 'url' => home_url(),
658 );
659 if ( is_numeric( $this->download_id ) ) {
660 $api_params['item_id'] = absint( $this->download_id );
661 } else {
662 $api_params['item_name'] = rawurlencode( $this->plugin_name );
663 }
664
665 $arg_array = array(
666 'body' => $api_params,
667 'timeout' => 25,
668 'user-agent' => $this->plugin_slug . '/' . $this->version . '; ' . get_bloginfo( 'url' ),
669 );
670
671 $resp = wp_remote_post( $this->store_url, $arg_array );
672 $body = wp_remote_retrieve_body( $resp );
673
674 $message = __( 'Your License Key was invalid', 'formidable' );
675 if ( is_wp_error( $resp ) ) {
676 $link = FrmAppHelper::admin_upgrade_link( 'api', 'knowledgebase/why-cant-i-activate-formidable-pro/' );
677 /* translators: %1$s: Start link HTML, %2$s: End link HTML */
678 $message = sprintf( __( 'You had an error communicating with the Formidable API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="' . esc_url( $link ) . '" target="_blank">', '</a>' );
679 $message .= ' ' . $resp->get_error_message();
680 } elseif ( 'error' === $body || is_wp_error( $body ) ) {
681 $message = __( 'You had an HTTP error connecting to the Formidable API', 'formidable' );
682 } else {
683 $json_res = json_decode( $body, true );
684 if ( null !== $json_res ) {
685 if ( is_array( $json_res ) && isset( $json_res['error'] ) ) {
686 $message = $json_res['error'];
687 } else {
688 $message = $json_res;
689 }
690 } elseif ( isset( $resp['response'] ) && isset( $resp['response']['code'] ) ) {
691 /* translators: %1$s: Error code, %2$s: Error message */
692 $message = sprintf( __( 'There was a %1$s error: %2$s', 'formidable' ), $resp['response']['code'], $resp['response']['message'] . ' ' . $resp['body'] );
693 }
694 }
695
696 return $message;
697 }
698
699 public function manually_queue_update() {
700 $updates = new stdClass();
701 $updates->last_checked = 0;
702 $updates->response = array();
703 $updates->translations = array();
704 $updates->no_update = array();
705 $updates->checked = array();
706 set_site_transient( 'update_plugins', $updates );
707 }
708 }
709