PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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 +382 -47 6.28 → trunk View file →
@@ -107,14 +107,41 @@
107 107 * @var bool
108 108 */
109 109 protected $should_clear_cache = true;
110 110
111 + /**
112 + * Cached for the request, since every add-on asks for the same values.
113 + *
114 + * @since 6.35
115 + *
116 + * @var array<string,string>|null
117 + */
118 + private static $lite_requirements;
119 +
120 + /**
121 + * Add-ons that require more than Lite does, keyed by plugin slug.
122 + *
123 + * Nearly every add-on is plain PHP with no dependency of its own, so it runs anywhere Lite
124 + * runs and Lite's own requirements describe it. The exceptions bundle a third party
125 + * library, which sets a floor of its own. PDFs bundles Dompdf, which needs PHP 7.1.
126 + *
127 + * Values here are floors, never ceilings, so raising Lite's minimum still raises every
128 + * add-on's. Keys match the names WordPress uses, requires and requires_php.
129 + *
130 + * @since 6.35
131 + *
132 + * @var array<string,array<string,string>>
133 + */
134 + private static $addon_requirements = array(
135 + 'pdfs' => array( 'requires_php' => '7.1' ),
136 + );
137 +
111 138 public function __construct() {
112 - if ( empty( $this->plugin_slug ) ) {
139 + if ( ! $this->plugin_slug ) {
113 140 $this->plugin_slug = preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->plugin_name ) ) );
114 141 }
115 142
116 - if ( empty( $this->option_name ) ) {
143 + if ( ! $this->option_name ) {
117 144 $this->option_name = 'edd_' . $this->plugin_slug . '_license_';
118 145 }
119 146
120 147 $this->plugin_folder = plugin_basename( $this->plugin_file );
@@ -160,13 +187,23 @@
160 187 $license = $this->license;
161 188
162 189 add_action( 'after_plugin_row_' . plugin_basename( $this->plugin_file ), array( $this, 'maybe_show_license_message' ), 10, 2 );
163 190
191 + $is_addon = 'formidable/formidable.php' !== $this->plugin_folder;
192 +
193 + if ( $is_addon ) {
194 + // Lite gets its tested and required versions from wordpress.org, add-ons have no
195 + // such source. Added before the license check, since a site without a license
196 + // still needs to know what its add-ons support.
197 + add_filter( 'site_transient_update_plugins', array( $this, 'add_version_requirements' ), 20 );
198 + add_filter( 'plugins_api', array( $this, 'add_requirements_to_plugin_info' ), 20, 3 );
199 + }
200 +
164 201 if ( ! $license ) {
165 202 return;
166 203 }
167 204
168 - if ( 'formidable/formidable.php' !== $this->plugin_folder ) {
205 + if ( $is_addon ) {
169 206 add_filter( 'plugins_api', array( &$this, 'plugins_api_filter' ), 10, 3 );
170 207 }
171 208
172 209 add_filter( 'site_transient_update_plugins', array( &$this, 'clear_expired_download' ) );
@@ -187,12 +224,9 @@
187 224 if ( $_action !== 'plugin_information' ) {
188 225 return $_data;
189 226 }
190 227
191 - $slug = basename( $this->plugin_file, '.php' );
192 - $slug2 = str_replace( '/' . $slug . '.php', '', $this->plugin_folder );
193 -
194 - if ( empty( $_args->slug ) || ( $_args->slug !== $slug && $_args->slug !== $slug2 ) ) {
228 + if ( empty( $_args->slug ) || ! $this->is_plugin_slug( $_args->slug ) ) {
195 229 return $_data;
196 230 }
197 231
198 232 $item_id = $this->download_id;
@@ -233,10 +267,274 @@
233 267 return (object) $_data;
234 268 }
235 269
236 270 /**
271 + * Checks if a requested plugin_information slug refers to this plugin.
272 + *
273 + * Either the plugin file name or the plugin folder may be used as an add-on's slug.
274 + *
275 + * @since 6.35
276 + *
277 + * @param string $slug The requested slug.
278 + *
279 + * @return bool
280 + */
281 + private function is_plugin_slug( $slug ) {
282 + $file_slug = basename( $this->plugin_file, '.php' );
283 + $folder_slug = str_replace( '/' . $file_slug . '.php', '', $this->plugin_folder );
284 +
285 + return $slug === $file_slug || $slug === $folder_slug;
286 + }
287 +
288 + /**
289 + * Adds the versions this add-on supports to its update data.
290 + *
291 + * The API reports no tested or required versions, so anything reading the update transient
292 + * has no way to tell whether an add-on has been tried with the WordPress release in use, or
293 + * whether the site meets what the add-on needs.
294 + *
295 + * @since 6.35
296 + *
297 + * @param mixed $transient The update_plugins site transient.
298 + *
299 + * @return mixed
300 + */
301 + public function add_version_requirements( $transient ) {
302 + if ( ! is_object( $transient ) ) {
303 + return $transient;
304 + }
305 +
306 + $requirements = $this->get_version_requirements();
307 +
308 + if ( ! $requirements ) {
309 + return $transient;
310 + }
311 +
312 + foreach ( array( 'response', 'no_update' ) as $group ) {
313 + $plugins = $transient->$group ?? false;
314 +
315 + if ( ! is_array( $plugins ) || empty( $plugins[ $this->plugin_folder ] ) ) {
316 + continue;
317 + }
318 +
319 + // The entries are objects, so this updates the transient in place.
320 + $plugin = $plugins[ $this->plugin_folder ];
321 +
322 + if ( ! is_object( $plugin ) ) {
323 + continue;
324 + }
325 +
326 + foreach ( $requirements as $key => $value ) {
327 + if ( empty( $plugin->$key ) ) {
328 + $plugin->$key = $value;
329 + }
330 + }
331 + }
332 +
333 + return $transient;
334 + }
335 +
336 + /**
337 + * Adds the versions this add-on supports to its plugin information.
338 + *
339 + * This is where WordPress itself reads the values, for the "Compatible up to" and
340 + * "Requires PHP" lines and the compatibility warnings in the plugin details modal. It is
341 + * separate from plugins_api_filter because that filter is only added when a license is set.
342 + *
343 + * @since 6.35
344 + *
345 + * @param mixed $data Plugin information from an earlier filter, or false if none.
346 + * @param string $action The requested action.
347 + * @param object|null $args Arguments for the request, including the slug.
348 + *
349 + * @return mixed
350 + */
351 + public function add_requirements_to_plugin_info( $data, $action = '', $args = null ) {
352 + if ( 'plugin_information' !== $action || empty( $args->slug ) || ! $this->is_plugin_slug( $args->slug ) ) {
353 + return $data;
354 + }
355 +
356 + $requirements = $this->get_version_requirements();
357 +
358 + if ( ! $requirements ) {
359 + return $data;
360 + }
361 +
362 + $is_object = is_object( $data ) && ! is_wp_error( $data );
363 +
364 + if ( ! $is_object && ! is_array( $data ) ) {
365 + return $data;
366 + }
367 +
368 + foreach ( $requirements as $key => $value ) {
369 + if ( ! $is_object ) {
370 + if ( empty( $data[ $key ] ) ) {
371 + $data[ $key ] = $value;
372 + }
373 + continue;
374 + }
375 +
376 + if ( empty( $data->$key ) ) {
377 + $data->$key = $value;
378 + }
379 + }
380 +
381 + return $data;
382 + }
383 +
384 + /**
385 + * Gets the versions this add-on reports to WordPress.
386 + *
387 + * Lite's own values describe every add-on, apart from the few that bundle a library with a
388 + * higher floor of its own.
389 + *
390 + * @since 6.35
391 + *
392 + * @return array<string,string> Keyed by the names WordPress uses, tested, requires and requires_php.
393 + */
394 + public function get_version_requirements() {
395 + $requirements = self::get_lite_requirements();
396 + $addon = self::$addon_requirements[ $this->plugin_slug ] ?? array();
397 +
398 + foreach ( $addon as $key => $version ) {
399 + $is_higher = empty( $requirements[ $key ] ) || version_compare( $version, $requirements[ $key ], '>' );
400 +
401 + if ( $is_higher ) {
402 + $requirements[ $key ] = $version;
403 + }
404 + }
405 +
406 + /**
407 + * Filters the versions a single add-on reports to WordPress.
408 + *
409 + * @since 6.35
410 + *
411 + * @param array<string,string> $requirements Keyed by tested, requires and requires_php.
412 + * @param string $plugin_slug The add-on's slug, for example pdfs.
413 + */
414 + $requirements = apply_filters( 'frm_addon_version_requirements', $requirements, $this->plugin_slug );
415 +
416 + return is_array( $requirements ) ? array_filter( $requirements ) : array();
417 + }
418 +
419 + /**
420 + * Gets the WordPress version the add-ons report as tested.
421 + *
422 + * @since 6.35
423 + *
424 + * @return string The tested version, or an empty string if the readme has none.
425 + */
426 + public static function get_tested_wp_version() {
427 + return self::get_lite_requirements()['tested'];
428 + }
429 +
430 + /**
431 + * Gets the versions Lite declares, which the add-ons report as their own.
432 + *
433 + * Read from Lite's readme, which is the same place wordpress.org reads them from, so the
434 + * add-ons report what Lite reports without anything being added to the API.
435 + *
436 + * @since 6.35
437 + *
438 + * @return array<string,string> Keyed by tested, requires and requires_php. Values may be empty.
439 + */
440 + public static function get_lite_requirements() {
441 + if ( null !== self::$lite_requirements ) {
442 + return self::$lite_requirements;
443 + }
444 +
445 + $headers = array(
446 + 'tested' => 'Tested up to',
447 + 'requires' => 'Requires at least',
448 + 'requires_php' => 'Requires PHP',
449 + );
450 +
451 + $versions = array(
452 + 'tested' => '',
453 + 'requires' => '',
454 + 'requires_php' => '',
455 + );
456 +
457 + $readme = FrmAppHelper::plugin_path() . '/readme.txt';
458 +
459 + if ( is_readable( $readme ) ) {
460 + $data = get_file_data( $readme, $headers );
461 +
462 + foreach ( $versions as $key => $version ) {
463 + $versions[ $key ] = isset( $data[ $key ] ) ? trim( $data[ $key ] ) : '';
464 + }
465 + }
466 +
467 + /**
468 + * Filters the versions read from Lite's readme before the add-ons report them.
469 + *
470 + * @since 6.35
471 + *
472 + * @param array<string,string> $versions Keyed by tested, requires and requires_php.
473 + */
474 + $versions = apply_filters( 'frm_lite_version_requirements', $versions );
475 +
476 + if ( ! is_array( $versions ) ) {
477 + $versions = array();
478 + }
479 +
480 + $versions['tested'] = self::expand_tested_branch( $versions['tested'] ?? '' );
481 +
482 + self::$lite_requirements = $versions;
483 +
484 + return self::$lite_requirements;
485 + }
486 +
487 + /**
488 + * Expands a tested release branch to the release running on this site.
489 + *
490 + * A readme names a branch, like 7.0, while wordpress.org reports the newest release in
491 + * that branch, like 7.0.4. The difference matters because WordPress compares the tested
492 + * version to the current one exactly, so a site on 7.0.4 reading 7.0 is warned that the
493 + * plugin is untested when it is not. Only versions within the tested branch are expanded,
494 + * so a genuinely older tested version is still reported as older.
495 + *
496 + * @since 6.35
497 + *
498 + * @param string $tested The tested version from the readme.
499 + *
237 500 * @return string
238 501 */
502 + private static function expand_tested_branch( $tested ) {
503 + if ( ! $tested ) {
504 + return $tested;
505 + }
506 +
507 + // Drop any pre-release suffix, since 7.1-RC4 is not a release to report as tested.
508 + $current = preg_replace( '/[^0-9.].*$/', '', get_bloginfo( 'version' ) );
509 +
510 + if ( self::get_version_branch( $current ) !== self::get_version_branch( $tested ) ) {
511 + return $tested;
512 + }
513 +
514 + return version_compare( $current, $tested, '>' ) ? $current : $tested;
515 + }
516 +
517 + /**
518 + * Reduces a version to its major.minor release branch.
519 + *
520 + * @since 6.35
521 + *
522 + * @param string $version A WordPress version.
523 + *
524 + * @return string The branch, or an empty string if the version cannot be read.
525 + */
526 + private static function get_version_branch( $version ) {
527 + if ( ! preg_match( '/^(\d+)\.(\d+)/', $version, $matches ) ) {
528 + return '';
529 + }
530 +
531 + return $matches[1] . '.' . $matches[2];
532 + }
533 +
534 + /**
535 + * @return string
536 + */
239 537 public function get_license() {
240 538 $license = $this->maybe_get_pro_license();
241 539
242 540 if ( $license ) {
@@ -357,9 +655,9 @@
357 655 * Don't save an invalid license.
358 656 *
359 657 * @since 6.8.3
360 658 *
361 - * @param bool $is_valid If license activation was successful.
659 + * @param bool|string $is_valid If license activation was successful. May be a string 'valid'.
362 660 *
363 661 * @return void
364 662 */
365 663 protected function maybe_set_active( $is_valid ) {
@@ -377,9 +675,9 @@
377 675 $this->license = '';
378 676 }
379 677
380 678 /**
381 - * @param bool $is_active
679 + * @param bool|string $is_active Value may include 'valid'.
382 680 *
383 681 * @return void
384 682 */
385 683 public function set_active( $is_active ) {
@@ -443,11 +741,17 @@
443 741
444 742 $api = new FrmApplicationApi( $this->license );
445 743 $api->reset_cached();
446 744
745 + // The Sales API tries to pull API data in the constructor.
746 + // But we do not need sales data here.
747 + FrmSalesApi::prevent_new_sales_requests();
748 +
447 749 $api = new FrmSalesApi();
448 750 $api->reset_cached();
449 751
752 + FrmSalesApi::allow_new_sales_requests();
753 +
450 754 $api = new FrmStyleApi();
451 755 $api->reset_cached();
452 756 }
453 757
@@ -479,12 +783,9 @@
479 783 */
480 784 public function show_license_message( $file, $plugin ) {
481 785 $message = '';
482 786
483 - if ( empty( $this->license ) ) {
484 - /* translators: %1$s: Plugin name, %2$s: Start link HTML, %3$s: end link HTML */
485 - $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>' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
486 - } else {
787 + if ( $this->license ) {
487 788 $api = new FrmFormApi( $this->license );
488 789 $errors = $api->error_for_license();
489 790
490 791 if ( $errors ) {
@@ -489,8 +790,11 @@
489 790
490 791 if ( $errors ) {
491 792 $message = reset( $errors );
492 793 }
794 + } else {
795 + /* translators: %1$s: Plugin name, %2$s: Start link HTML, %3$s: end link HTML */
796 + $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>' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
493 797 }
494 798
495 799 if ( ! $message ) {
496 800 return;
@@ -631,15 +935,17 @@
631 935 *
632 936 * @return void
633 937 */
634 938 private function maybe_use_beta_url( &$version_info ) {
635 - if ( $this->get_beta && ! empty( $version_info->beta ) ) {
636 - $version_info->new_version = $version_info->beta['version'];
637 - $version_info->package = $version_info->beta['package'];
939 + if ( ! $this->get_beta || empty( $version_info->beta ) ) {
940 + return;
941 + }
638 942
639 - if ( ! empty( $version_info->plugin ) ) {
640 - $version_info->plugin = $version_info->beta['plugin'];
641 - }
943 + $version_info->new_version = $version_info->beta['version'];
944 + $version_info->package = $version_info->beta['package'];
945 +
946 + if ( ! empty( $version_info->plugin ) ) {
947 + $version_info->plugin = $version_info->beta['plugin'];
642 948 }
643 949 }
644 950
645 951 /**
@@ -679,9 +985,9 @@
679 985 /**
680 986 * @return void
681 987 */
682 988 private function is_license_revoked() {
683 - if ( empty( $this->license ) || empty( $this->plugin_slug ) || isset( $_POST['license'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
989 + if ( ! $this->license || ! $this->plugin_slug || isset( $_POST['license'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
684 990 return;
685 991 }
686 992
687 993 if ( $this->get_defined_license() ) {
@@ -689,14 +995,19 @@
689 995 return;
690 996 }
691 997
692 998 // Only check weekly.
693 - if ( $this->checked_recently( '7 days', 'valid' ) || $this->is_running() ) {
999 + if ( $this->checked_recently( '7 days' ) || $this->is_running() ) {
694 1000 return;
695 1001 }
696 1002
697 1003 $response = $this->get_license_status();
698 1004
1005 + if ( ! empty( $this->save_status['response_code'] ) && 429 === $this->save_status['response_code'] ) {
1006 + // If we got a rate limit response, don't clear the license.
1007 + return;
1008 + }
1009 +
699 1010 if ( 'revoked' === $response['status'] || 'blocked' === $response['status'] || 'disabled' === $response['status'] || 'missing' === $response['status'] ) {
700 1011 $this->clear_license();
701 1012 }
702 1013 }
@@ -703,31 +1014,45 @@
703 1014
704 1015 /**
705 1016 * Has this been checked too recently?
706 1017 *
707 - * @param string $time ie. '1 day'.
708 - * @param string $required_status Return false if the last check does not match. ie 'valid'.
1018 + * @param string $time ie. '1 day'.
709 1019 *
710 - * @return bool
1020 + * @return bool True if the last check time was recent.
711 1021 */
712 - private function checked_recently( $time, $required_status = '' ) {
1022 + private function checked_recently( $time ) {
713 1023 $last_checked = $this->last_checked();
714 - $is_429 = isset( $last_checked['response_code'] ) && 429 === $last_checked['response_code'];
715 1024
1025 + if ( ! $last_checked ) {
1026 + return false;
1027 + }
1028 +
1029 + $is_429 = isset( $last_checked['response_code'] ) && 429 === $last_checked['response_code'];
1030 +
1031 + // If the last check was a a rate limit error, adjust the check time.
716 1032 if ( $is_429 ) {
717 - // If the last check was a a rate limit, we'll need to check again sooner.
718 - $time = '5 minutes';
719 - $required_status = '';
1033 + // If the time is 2 minutes, do not adjust it so people
1034 + // can still try to activate again in 2 minutes (and not 5).
1035 + switch ( $time ) {
1036 + case '7 days':
1037 + // 7 days is used to check for license revocation.
1038 + $time = '30 minutes';
1039 + break;
1040 + case '1 day':
1041 + // 1 day is used for defined license constants.
1042 + // The response won't change often, so we can check less frequently.
1043 + $time = '2 hours';
1044 + break;
1045 + }
720 1046 }
721 1047
722 - if ( $required_status && ( ! isset( $last_checked['status'] ) || $last_checked['status'] !== $required_status ) ) {
723 - // If the last check was invalid, we don't need to check again.
724 - return true;
1048 + if ( empty( $last_checked['time'] ) ) {
1049 + // If we do not have time, data is really old.
1050 + return false;
725 1051 }
726 1052
727 - $checked_time = $last_checked['time'] ?? false;
728 - $time_ago = gmdate( 'Y-m-d H:i:s', strtotime( '-' . $time ) );
729 - return $checked_time && $checked_time > $time_ago;
1053 + $time_ago = gmdate( 'Y-m-d H:i:s', strtotime( '-' . $time ) );
1054 + return $last_checked['time'] > $time_ago;
730 1055 }
731 1056
732 1057 /**
733 1058 * @since 6.8.3 Switched to an array to store extra response info.
@@ -745,12 +1070,17 @@
745 1070 return $last_checked ? $last_checked : array();
746 1071 }
747 1072
748 1073 /**
1074 + * @since 6.30 Added the $is_valid param.
1075 + *
1076 + * @param bool $is_valid
1077 + *
749 1078 * @return void
750 1079 */
751 - private function update_last_checked() {
752 - $this->save_response['time'] = gmdate( 'Y-m-d H:i:s' );
1080 + private function update_last_checked( $is_valid ) {
1081 + $this->save_response['time'] = gmdate( 'Y-m-d H:i:s' );
1082 + $this->save_response['is_valid'] = $is_valid;
753 1083
754 1084 if ( is_multisite() ) {
755 1085 update_site_option( $this->transient_key(), $this->save_response );
756 1086 } else {
@@ -820,8 +1150,10 @@
820 1150 $response = $this->get_license_status();
821 1151 $response['message'] = '';
822 1152 $response['success'] = false;
823 1153
1154 + $is_valid = false;
1155 +
824 1156 if ( $response['error'] ) {
825 1157 $response['message'] = $response['status'];
826 1158 } else {
827 1159 $messages = $this->get_messages();
@@ -831,18 +1163,17 @@
831 1163 } else {
832 1164 $response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) );
833 1165 }
834 1166
835 - $is_valid = false;
836 -
837 1167 if ( 'valid' === $response['status'] ) {
838 1168 $is_valid = 'valid';
839 1169 $response['success'] = true;
840 1170 }
1171 +
841 1172 $this->maybe_set_active( $is_valid );
842 1173 }
843 1174
844 - $this->update_last_checked();
1175 + $this->update_last_checked( (bool) $is_valid );
845 1176
846 1177 return $response;
847 1178 }
848 1179
@@ -875,13 +1206,15 @@
875 1206 'status' => 'missing',
876 1207 'error' => true,
877 1208 );
878 1209
879 - if ( empty( $this->license ) ) {
1210 + if ( ! $this->license ) {
880 1211 $response['error'] = false;
881 1212 return $response;
882 1213 }
883 1214
1215 + $is_valid = false;
1216 +
884 1217 try {
885 1218 $response['error'] = false;
886 1219 $license_data = $this->send_mothership_request( 'activate_license' );
887 1220
@@ -889,8 +1222,9 @@
889 1222 if ( is_array( $license_data ) ) {
890 1223 if ( ! empty( $license_data['license'] ) && in_array( $license_data['license'], array( 'valid', 'invalid' ), true ) ) {
891 1224 $response['status'] = $license_data['license'];
892 1225 $this->save_status['status'] = $license_data['license'];
1226 + $is_valid = 'valid' === $license_data['license'];
893 1227 }
894 1228 } else {
895 1229 $response['status'] = $license_data;
896 1230 }
@@ -897,9 +1231,9 @@
897 1231 } catch ( Exception $e ) {
898 1232 $response['status'] = $e->getMessage();
899 1233 }
900 1234
901 - $this->update_last_checked();
1235 + $this->update_last_checked( $is_valid );
902 1236 $this->done_running();
903 1237 return $response;
904 1238 }
905 1239
@@ -979,10 +1313,9 @@
979 1313 */
980 1314 private static function set_license_from_post() {
981 1315 $plugin_slug = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
982 1316 $this_plugin = self::get_addon( $plugin_slug );
983 - $license = $this_plugin->get_license();
984 - $this_plugin->license = $license;
1317 + $this_plugin->license = $this_plugin->get_license();
985 1318 return $this_plugin;
986 1319 }
987 1320
988 1321 /**
@@ -1008,14 +1341,16 @@
1008 1341 'timeout' => 25,
1009 1342 'user-agent' => $this->plugin_slug . '/' . $this->version . '; ' . get_bloginfo( 'url' ),
1010 1343 );
1011 1344
1012 - $resp = wp_remote_post(
1345 + $resp = wp_remote_post(
1013 1346 $this->store_url . '?l=' . urlencode( base64_encode( $this->license ) ),
1014 1347 $arg_array
1015 1348 );
1016 - $body = wp_remote_retrieve_body( $resp );
1017 - $this->save_status = array( 'response_code' => wp_remote_retrieve_response_code( $resp ) );
1349 + $response_code = wp_remote_retrieve_response_code( $resp );
1350 + $body = wp_remote_retrieve_body( $resp );
1351 + $this->save_status = array( 'response_code' => $response_code );
1352 + $this->save_response['response_code'] = $response_code;
1018 1353
1019 1354 $message = __( 'Your License Key was invalid', 'formidable' );
1020 1355
1021 1356 if ( is_wp_error( $resp ) ) {