PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.17
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.17
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
← All changes | classes/models/FrmAddon.php +8 -222 6.266.17 View file →
@@ -4,82 +4,22 @@
4 4 }
5 5
6 6 /** @phpstan-consistent-constructor */
7 7 class FrmAddon {
8 -
9 - /**
10 - * @var string
11 - */
12 8 public $store_url = 'https://formidableforms.com';
13 -
14 - /**
15 - * @var int|string|null
16 - */
17 9 public $download_id;
18 -
19 - /**
20 - * @var string|null
21 - */
22 10 public $plugin_file;
23 -
24 - /**
25 - * @var string
26 - */
27 11 public $plugin_folder;
28 -
29 - /**
30 - * @var string
31 - */
32 12 public $plugin_name;
33 -
34 - /**
35 - * @var string
36 - */
37 13 public $plugin_slug;
38 -
39 - /**
40 - * @var string
41 - */
42 14 public $option_name;
43 -
44 - /**
45 - * @var string|null
46 - */
47 15 public $version;
48 -
49 - /**
50 - * @var string
51 - */
52 - public $author = 'Strategy11';
53 -
54 - /**
55 - * @var bool
56 - */
16 + public $author = 'Strategy11';
57 17 public $is_parent_licence = false;
58 -
59 - /**
60 - * @var bool
61 - */
62 - public $needs_license = true;
63 -
64 - /**
65 - * @var bool
66 - */
18 + public $needs_license = true;
67 19 private $is_expired_addon = false;
68 -
69 - /**
70 - * @var string|null
71 - */
72 20 public $license;
73 -
74 - /**
75 - * @var bool
76 - */
77 21 protected $get_beta = false;
78 -
79 - /**
80 - * @var array|null
81 - */
82 22 protected $save_status;
83 23
84 24 /**
85 25 * This is used to decide whether the license checks should continue.
@@ -112,9 +52,8 @@
112 52
113 53 if ( empty( $this->plugin_slug ) ) {
114 54 $this->plugin_slug = preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->plugin_name ) ) );
115 55 }
116 -
117 56 if ( empty( $this->option_name ) ) {
118 57 $this->option_name = 'edd_' . $this->plugin_slug . '_license_';
119 58 }
120 59
@@ -124,21 +63,13 @@
124 63 add_filter( 'frm_installed_addons', array( &$this, 'insert_installed_addon' ) );
125 64 $this->edd_plugin_updater();
126 65 }
127 66
128 - /**
129 - * @return void
130 - */
131 67 public static function load_hooks() {
132 68 add_filter( 'frm_include_addon_page', '__return_true' );
133 69 new static();
134 70 }
135 71
136 - /**
137 - * @param array $plugins
138 - *
139 - * @return array
140 - */
141 72 public function insert_installed_addon( $plugins ) {
142 73 $plugins[ $this->plugin_slug ] = $this;
143 74
144 75 return $plugins;
@@ -143,17 +74,11 @@
143 74
144 75 return $plugins;
145 76 }
146 77
147 - /**
148 - * @param string $plugin_slug
149 - *
150 - * @return false|FrmAddon
151 - */
152 78 public static function get_addon( $plugin_slug ) {
153 79 $plugins = apply_filters( 'frm_installed_addons', array() );
154 80 $plugin = false;
155 -
156 81 if ( isset( $plugins[ $plugin_slug ] ) ) {
157 82 $plugin = $plugins[ $plugin_slug ];
158 83 }
159 84
@@ -159,11 +84,8 @@
159 84
160 85 return $plugin;
161 86 }
162 87
163 - /**
164 - * @return void
165 - */
166 88 public function edd_plugin_updater() {
167 89
168 90 $this->is_license_revoked();
169 91 $license = $this->license;
@@ -198,15 +120,13 @@
198 120 }
199 121
200 122 $slug = basename( $this->plugin_file, '.php' );
201 123 $slug2 = str_replace( '/' . $slug . '.php', '', $this->plugin_folder );
202 -
203 124 if ( empty( $_args->slug ) || ( $_args->slug != $slug && $_args->slug !== $slug2 ) ) {
204 125 return $_data;
205 126 }
206 127
207 128 $item_id = $this->download_id;
208 -
209 129 if ( empty( $item_id ) ) {
210 130 $_data = array(
211 131 'name' => $this->plugin_name,
212 132 'excerpt' => '',
@@ -231,20 +151,15 @@
231 151
232 152 return (object) $_data;
233 153 }
234 154
235 - /**
236 - * @return string
237 - */
238 155 public function get_license() {
239 156 $license = $this->maybe_get_pro_license();
240 -
241 157 if ( ! empty( $license ) ) {
242 158 return $license;
243 159 }
244 160
245 161 $license = trim( get_option( $this->option_name . 'key' ) );
246 -
247 162 if ( empty( $license ) ) {
248 163 $license = $this->activate_defined_license();
249 164 }
250 165
@@ -252,10 +167,8 @@
252 167 }
253 168
254 169 /**
255 170 * @since 3.04.03
256 - *
257 - * @return false|string
258 171 */
259 172 protected function maybe_get_pro_license() {
260 173 // prevent a loop if $this is the pro plugin
261 174 $get_license = FrmAppHelper::pro_is_installed() && is_callable( 'FrmProAppHelper::get_updater' ) && $this->plugin_name != 'Formidable Pro';
@@ -266,15 +179,13 @@
266 179
267 180 $api = new FrmFormApi();
268 181 $api->get_pro_updater();
269 182 $license = $api->get_license();
270 -
271 183 if ( empty( $license ) ) {
272 184 return false;
273 185 }
274 186
275 187 $this->get_api_info( $license );
276 -
277 188 if ( ! $this->is_parent_licence ) {
278 189 $license = false;
279 190 }
280 191
@@ -284,17 +195,13 @@
284 195 /**
285 196 * Activate the license in wp-config.php
286 197 *
287 198 * @since 2.04
288 - *
289 - * @return string
290 199 */
291 200 public function activate_defined_license() {
292 201 $license = $this->get_defined_license();
293 -
294 202 if ( ! empty( $license ) && ! $this->is_active() && ! $this->checked_recently( '1 day' ) ) {
295 203 $response = $this->activate_license( $license );
296 -
297 204 if ( ! $response['success'] ) {
298 205 $license = '';
299 206 }
300 207 }
@@ -305,29 +212,19 @@
305 212 /**
306 213 * Check the wp-config.php for the license key
307 214 *
308 215 * @since 2.04
309 - *
310 - * @return false|string
311 216 */
312 217 public function get_defined_license() {
313 - $constant_name = 'FRM_' . strtoupper( $this->plugin_slug ) . '_LICENSE';
218 + $consant_name = 'FRM_' . strtoupper( $this->plugin_slug ) . '_LICENSE';
314 219
315 - return defined( $constant_name ) ? constant( $constant_name ) : false;
220 + return defined( $consant_name ) ? constant( $consant_name ) : false;
316 221 }
317 222
318 - /**
319 - * @param string $license
320 - *
321 - * @return void
322 - */
323 223 public function set_license( $license ) {
324 224 update_option( $this->option_name . 'key', $license );
325 225 }
326 226
327 - /**
328 - * @return mixed
329 - */
330 227 public function is_active() {
331 228 return get_option( $this->option_name . 'active' );
332 229 }
333 230
@@ -334,10 +231,8 @@
334 231 /**
335 232 * @since 3.04.03
336 233 *
337 234 * @param array|string $error
338 - *
339 - * @return void
340 235 */
341 236 public function maybe_clear_license( $error ) {
342 237 if ( is_array( $error ) && $error['code'] === 'disabled' && $error['license'] === $this->license ) {
343 238 $this->clear_license();
@@ -343,11 +238,8 @@
343 238 $this->clear_license();
344 239 }
345 240 }
346 241
347 - /**
348 - * @return void
349 - */
350 242 public function clear_license() {
351 243 delete_option( $this->option_name . 'active' );
352 244 delete_option( $this->option_name . 'key' );
353 245
@@ -369,9 +261,8 @@
369 261 * @return void
370 262 */
371 263 protected function maybe_set_active( $is_valid ) {
372 264 update_option( $this->option_name . 'active', $is_valid );
373 -
374 265 if ( $is_valid ) {
375 266 $this->set_active( $is_valid );
376 267 return;
377 268 }
@@ -382,13 +273,8 @@
382 273 delete_option( $this->option_name . 'key' );
383 274 $this->license = '';
384 275 }
385 276
386 - /**
387 - * @param bool $is_active
388 - *
389 - * @return void
390 - */
391 277 public function set_active( $is_active ) {
392 278 $this->delete_cache();
393 279 FrmAppHelper::save_combined_js();
394 280 $this->update_pro_capabilities();
@@ -397,10 +283,8 @@
397 283 /**
398 284 * Updates roles capabilities after pro license is active.
399 285 *
400 286 * @since 5.0
401 - *
402 - * @return void
403 287 */
404 288 protected function update_pro_capabilities() {
405 289 global $wp_roles;
406 290
@@ -410,11 +294,10 @@
410 294
411 295 $caps = FrmAppHelper::frm_capabilities( 'pro_only' );
412 296 $roles = get_editable_roles();
413 297 $settings = new FrmSettings();
414 -
415 298 foreach ( $caps as $cap => $cap_desc ) {
416 - $cap_roles = (array) ( $settings->$cap ?? 'administrator' );
299 + $cap_roles = (array) ( isset( $settings->$cap ) ? $settings->$cap : 'administrator' );
417 300
418 301 // Make sure administrators always have permissions.
419 302 if ( ! in_array( 'administrator', $cap_roles, true ) ) {
420 303 array_push( $cap_roles, 'administrator' );
@@ -431,10 +314,8 @@
431 314 }
432 315
433 316 /**
434 317 * @since 3.04.03
435 - *
436 - * @return void
437 318 */
438 319 protected function delete_cache() {
439 320 delete_transient( 'frm_api_licence' );
440 321
@@ -458,13 +339,8 @@
458 339 * The Pro version includes the show_license_message function.
459 340 * We need an extra check before we allow it to show a message.
460 341 *
461 342 * @since 3.04.03
462 - *
463 - * @param string $file File path of the plugin.
464 - * @param array $plugin Plugin data.
465 - *
466 - * @return void
467 343 */
468 344 public function maybe_show_license_message( $file, $plugin ) {
469 345 if ( $this->is_expired_addon || isset( $plugin['package'] ) ) {
470 346 // let's not show a ton of duplicate messages
@@ -473,17 +349,10 @@
473 349
474 350 $this->show_license_message( $file, $plugin );
475 351 }
476 352
477 - /**
478 - * @param string $file File path of the plugin.
479 - * @param array $plugin Plugin data.
480 - *
481 - * @return void
482 - */
483 353 public function show_license_message( $file, $plugin ) {
484 354 $message = '';
485 -
486 355 if ( empty( $this->license ) ) {
487 356 /* translators: %1$s: Plugin name, %2$s: Start link HTML, %3$s: end link HTML */
488 357 $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>' );
489 358 } else {
@@ -488,9 +357,8 @@
488 357 $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>' );
489 358 } else {
490 359 $api = new FrmFormApi( $this->license );
491 360 $errors = $api->error_for_license();
492 -
493 361 if ( ! empty( $errors ) ) {
494 362 $message = reset( $errors );
495 363 }
496 364 }
@@ -502,18 +370,13 @@
502 370 $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
503 371 $id = sanitize_title( $plugin['Name'] ) . '-next';
504 372
505 373 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>';
506 - FrmAppHelper::kses_echo( $message, 'a' );
374 + echo FrmAppHelper::kses( $message, 'a' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
507 375 echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '").previousSibling;if ( d !== null ){ d.className = d.className + " update"; }</script>';
508 376 echo '</p></div></td></tr>';
509 377 }
510 378
511 - /**
512 - * @param mixed $transient
513 - *
514 - * @return mixed
515 - */
516 379 public function clear_expired_download( $transient ) {
517 380 if ( ! is_object( $transient ) ) {
518 381 return $transient;
519 382 }
@@ -544,15 +407,12 @@
544 407 *
545 408 * @since 3.04.03
546 409 *
547 410 * @param object $transient The current plugin info saved for update.
548 - *
549 - * @return void
550 411 */
551 412 private function prepare_update_details( &$transient ) {
552 413 $version_info = $transient;
553 414 $has_beta_url = ! empty( $version_info->beta );
554 -
555 415 if ( $this->get_beta && ! $has_beta_url ) {
556 416 $version_info = (object) $this->get_api_info( $this->license );
557 417 }
558 418
@@ -557,9 +417,8 @@
557 417 }
558 418
559 419 if ( ! empty( $version_info->new_version ) ) {
560 420 $this->clear_old_plugin_version( $version_info );
561 -
562 421 if ( $version_info === false ) {
563 422 // Was cleared with timeout.
564 423 $transient = false;
565 424 } else {
@@ -575,12 +434,8 @@
575 434 /**
576 435 * Get the API info for this plugin
577 436 *
578 437 * @since 3.04.03
579 - *
580 - * @param string $license The license key.
581 - *
582 - * @return array The API info for the plugin.
583 438 */
584 439 protected function get_api_info( $license ) {
585 440 $api = new FrmFormApi( $license );
586 441 $addon = $api->get_addon_for_license( $this );
@@ -601,16 +456,11 @@
601 456 * Make sure transients don't stick around on sites that
602 457 * don't save the transient expiration
603 458 *
604 459 * @since 2.05.05
605 - *
606 - * @param object $version_info The version info for the plugin.
607 - *
608 - * @return void
609 460 */
610 461 private function clear_old_plugin_version( &$version_info ) {
611 462 $timeout = ! empty( $version_info->timeout ) ? $version_info->timeout : 0;
612 -
613 463 if ( ! empty( $timeout ) && time() > $timeout ) {
614 464 // Cache is expired.
615 465 $version_info = false;
616 466 $api = new FrmFormApi( $this->license );
@@ -622,18 +472,13 @@
622 472 * The beta url is always included if the download has a beta.
623 473 * Check if the beta should be downloaded.
624 474 *
625 475 * @since 3.04.03
626 - *
627 - * @param object $version_info The version info for the plugin.
628 - *
629 - * @return void
630 476 */
631 477 private function maybe_use_beta_url( &$version_info ) {
632 478 if ( $this->get_beta && ! empty( $version_info->beta ) ) {
633 479 $version_info->new_version = $version_info->beta['version'];
634 480 $version_info->package = $version_info->beta['package'];
635 -
636 481 if ( ! empty( $version_info->plugin ) ) {
637 482 $version_info->plugin = $version_info->beta['plugin'];
638 483 }
639 484 }
@@ -638,13 +483,8 @@
638 483 }
639 484 }
640 485 }
641 486
642 - /**
643 - * @param object $transient
644 - *
645 - * @return bool
646 - */
647 487 private function is_current_version( $transient ) {
648 488 if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) {
649 489 return false;
650 490 }
@@ -649,9 +489,8 @@
649 489 return false;
650 490 }
651 491
652 492 $response = empty( $transient->response );
653 -
654 493 if ( $response ) {
655 494 return true;
656 495 }
657 496
@@ -665,18 +504,12 @@
665 504 $last_cleared = get_option( 'frm_last_cleared' );
666 505 return $last_cleared && $last_cleared > gmdate( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) );
667 506 }
668 507
669 - /**
670 - * @return void
671 - */
672 508 private function cleared_plugins() {
673 509 update_option( 'frm_last_cleared', gmdate( 'Y-m-d H:i:s' ) );
674 510 }
675 511
676 - /**
677 - * @return void
678 - */
679 512 private function is_license_revoked() {
680 513 if ( empty( $this->license ) || empty( $this->plugin_slug ) || isset( $_POST['license'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
681 514 return;
682 515 }
@@ -691,9 +524,8 @@
691 524 return;
692 525 }
693 526
694 527 $response = $this->get_license_status();
695 -
696 528 if ( 'revoked' === $response['status'] || 'blocked' === $response['status'] || 'disabled' === $response['status'] || 'missing' === $response['status'] ) {
697 529 $this->clear_license();
698 530 }
699 531 }
@@ -708,9 +540,8 @@
708 540 */
709 541 private function checked_recently( $time, $required_status = '' ) {
710 542 $last_checked = $this->last_checked();
711 543 $is_429 = isset( $last_checked['response_code'] ) && 429 === $last_checked['response_code'];
712 -
713 544 if ( $is_429 ) {
714 545 // If the last check was a a rate limit, we'll need to check again sooner.
715 546 $time = '5 minutes';
716 547 $required_status = '';
@@ -720,9 +551,9 @@
720 551 // If the last check was invalid, we don't need to check again.
721 552 return true;
722 553 }
723 554
724 - $checked_time = $last_checked['time'] ?? false;
555 + $checked_time = isset( $last_checked['time'] ) ? $last_checked['time'] : false;
725 556 $time_ago = gmdate( 'Y-m-d H:i:s', strtotime( '-' . $time ) );
726 557 return $checked_time && $checked_time > $time_ago;
727 558 }
728 559
@@ -736,15 +567,13 @@
736 567 $last_checked = get_site_option( $this->transient_key() );
737 568 } else {
738 569 $last_checked = get_option( $this->transient_key() );
739 570 }
740 -
741 571 if ( $last_checked && ! is_array( $last_checked ) ) {
742 572 // Get string into array for existing values.
743 573 $last_checked = array( 'time' => $last_checked );
744 574 }
745 -
746 - return $last_checked ? $last_checked : array();
575 + return $last_checked ? (array) $last_checked : array();
747 576 }
748 577
749 578 /**
750 579 * @return void
@@ -750,9 +579,8 @@
750 579 * @return void
751 580 */
752 581 private function update_last_checked() {
753 582 $this->save_response['time'] = gmdate( 'Y-m-d H:i:s' );
754 -
755 583 if ( is_multisite() ) {
756 584 update_site_option( $this->transient_key(), $this->save_response );
757 585 } else {
758 586 update_option( $this->transient_key(), $this->save_response );
@@ -760,24 +588,18 @@
760 588 }
761 589
762 590 /**
763 591 * Use a new cache after the license is changed, or Formidable is updated.
764 - *
765 - * @return string
766 592 */
767 593 private function transient_key() {
768 594 return 'frm_' . md5( sanitize_key( $this->license . '_' . $this->plugin_slug ) );
769 595 }
770 596
771 - /**
772 - * @return void
773 - */
774 597 public static function activate() {
775 598 FrmAppHelper::permission_check( 'frm_change_settings' );
776 599 check_ajax_referer( 'frm_ajax', 'nonce' );
777 600
778 601 $license = stripslashes( FrmAppHelper::get_param( 'license', '', 'post', 'sanitize_text_field' ) );
779 -
780 602 if ( empty( $license ) ) {
781 603 wp_send_json(
782 604 array(
783 605 'message' => __( 'Oops! You forgot to enter your license number.', 'formidable' ),
@@ -795,13 +617,8 @@
795 617 }
796 618
797 619 /**
798 620 * @since 4.08
799 - *
800 - * @param string $license The license key.
801 - * @param string $plugin_slug The plugin slug.
802 - *
803 - * @return array The response from the license activation.
804 621 */
805 622 public static function activate_license_for_plugin( $license, $plugin_slug ) {
806 623 $this_plugin = self::get_addon( $plugin_slug );
807 624 return $this_plugin->activate_license( $license );
@@ -806,13 +623,8 @@
806 623 $this_plugin = self::get_addon( $plugin_slug );
807 624 return $this_plugin->activate_license( $license );
808 625 }
809 626
810 - /**
811 - * @param string $license The license key.
812 - *
813 - * @return array The response from the license activation.
814 - */
815 627 private function activate_license( $license ) {
816 628 $this->set_license( $license );
817 629 $this->license = $license;
818 630
@@ -825,9 +637,8 @@
825 637 if ( $response['error'] ) {
826 638 $response['message'] = $response['status'];
827 639 } else {
828 640 $messages = $this->get_messages();
829 -
830 641 if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) {
831 642 $response['message'] = $messages[ $response['status'] ];
832 643 } else {
833 644 $response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) );
@@ -833,9 +644,8 @@
833 644 $response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) );
834 645 }
835 646
836 647 $is_valid = false;
837 -
838 648 if ( 'valid' === $response['status'] ) {
839 649 $is_valid = 'valid';
840 650 $response['success'] = true;
841 651 }
@@ -865,11 +675,8 @@
865 675 )
866 676 );
867 677 }
868 678
869 - /**
870 - * @return array
871 - */
872 679 private function get_license_status() {
873 680 $this->set_running();
874 681
875 682 $response = array(
@@ -875,9 +682,8 @@
875 682 $response = array(
876 683 'status' => 'missing',
877 684 'error' => true,
878 685 );
879 -
880 686 if ( empty( $this->license ) ) {
881 687 $response['error'] = false;
882 688
883 689 return $response;
@@ -904,11 +710,8 @@
904 710 $this->done_running();
905 711 return $response;
906 712 }
907 713
908 - /**
909 - * @return array
910 - */
911 714 private function get_messages() {
912 715 return array(
913 716 'valid' => __( 'Your license has been activated. Enjoy!', 'formidable' ),
914 717 'invalid' => __( 'That license key is invalid', 'formidable' ),
@@ -921,10 +724,8 @@
921 724 }
922 725
923 726 /**
924 727 * @since 4.03
925 - *
926 - * @return void
927 728 */
928 729 public static function reset_cache() {
929 730 FrmAppHelper::permission_check( 'frm_change_settings' );
930 731 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -939,11 +740,8 @@
939 740
940 741 wp_send_json( $response );
941 742 }
942 743
943 - /**
944 - * @return void
945 - */
946 744 public static function deactivate() {
947 745 FrmAppHelper::permission_check( 'frm_change_settings' );
948 746 check_ajax_referer( 'frm_ajax', 'nonce' );
949 747
@@ -952,13 +750,11 @@
952 750 $response = array(
953 751 'success' => false,
954 752 'message' => '',
955 753 );
956 -
957 754 try {
958 755 // $license_data->license will be either "deactivated" or "failed"
959 756 $license_data = $this_plugin->send_mothership_request( 'deactivate_license' );
960 -
961 757 if ( is_array( $license_data ) && 'deactivated' === $license_data['license'] ) {
962 758 $response['success'] = true;
963 759 $response['message'] = __( 'That license was removed successfully', 'formidable' );
964 760 } else {
@@ -975,10 +771,8 @@
975 771 }
976 772
977 773 /**
978 774 * @since 4.03
979 - *
980 - * @return FrmAddon
981 775 */
982 776 private static function set_license_from_post() {
983 777 $plugin_slug = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
984 778 $this_plugin = self::get_addon( $plugin_slug );
@@ -987,10 +781,8 @@
987 781 return $this_plugin;
988 782 }
989 783
990 784 /**
991 - * @param string $action
992 - *
993 785 * @return string
994 786 */
995 787 public function send_mothership_request( $action ) {
996 788 $api_params = array(
@@ -997,9 +789,8 @@
997 789 'edd_action' => $action,
998 790 'license' => $this->license,
999 791 'url' => home_url(),
1000 792 );
1001 -
1002 793 if ( is_numeric( $this->download_id ) ) {
1003 794 $api_params['item_id'] = absint( $this->download_id );
1004 795 } else {
1005 796 $api_params['item_name'] = rawurlencode( $this->plugin_name );
@@ -1018,9 +809,8 @@
1018 809 $body = wp_remote_retrieve_body( $resp );
1019 810 $this->save_status = array( 'response_code' => wp_remote_retrieve_response_code( $resp ) );
1020 811
1021 812 $message = __( 'Your License Key was invalid', 'formidable' );
1022 -
1023 813 if ( is_wp_error( $resp ) ) {
1024 814 $link = FrmAppHelper::admin_upgrade_link( 'api', 'knowledgebase/why-cant-i-activate-formidable-pro/' );
1025 815 /* translators: %1$s: Start link HTML, %2$s: End link HTML */
1026 816 $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>' );
@@ -1028,9 +818,8 @@
1028 818 } elseif ( 'error' === $body || is_wp_error( $body ) ) {
1029 819 $message = __( 'You had an HTTP error connecting to the Formidable API', 'formidable' );
1030 820 } else {
1031 821 $json_res = json_decode( $body, true );
1032 -
1033 822 if ( null !== $json_res ) {
1034 823 if ( is_array( $json_res ) && isset( $json_res['error'] ) ) {
1035 824 $message = $json_res['error'];
1036 825 } else {
@@ -1050,11 +839,8 @@
1050 839
1051 840 return $message;
1052 841 }
1053 842
1054 - /**
1055 - * @return void
1056 - */
1057 843 public function manually_queue_update() {
1058 844 $updates = new stdClass();
1059 845 $updates->last_checked = 0;
1060 846 $updates->response = array();