PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0
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/controllers/FrmAddonsController.php +43 -299 6.5.25.0 View file →
@@ -4,16 +4,8 @@
4 4 }
5 5
6 6 class FrmAddonsController {
7 7
8 - /**
9 - * @var string $plugin
10 - */
11 - protected static $plugin;
12 -
13 - /**
14 - * @return void
15 - */
16 8 public static function menu() {
17 9 if ( ! current_user_can( 'activate_plugins' ) ) {
18 10 return;
19 11 }
@@ -18,9 +10,9 @@
18 10 return;
19 11 }
20 12
21 13 $label = __( 'Add-Ons', 'formidable' );
22 - $label = '<span style="color:#1da867">' . $label . '</span>';
14 + $label = '<span style="color:#fe5a1d">' . $label . '</span>';
23 15
24 16 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Add-Ons', 'formidable' ), $label, 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
25 17
26 18 if ( ! FrmAppHelper::pro_is_installed() ) {
@@ -37,11 +29,8 @@
37 29 exit;
38 30 }
39 31 }
40 32
41 - /**
42 - * @return void
43 - */
44 33 public static function list_addons() {
45 34 FrmAppHelper::include_svg();
46 35 $installed_addons = apply_filters( 'frm_installed_addons', array() );
47 36 $license_type = '';
@@ -72,11 +61,8 @@
72 61
73 62 include( FrmAppHelper::plugin_path() . '/classes/views/addons/list.php' );
74 63 }
75 64
76 - /**
77 - * @return void
78 - */
79 65 public static function license_settings() {
80 66 $plugins = apply_filters( 'frm_installed_addons', array() );
81 67 if ( empty( $plugins ) ) {
82 68 esc_html_e( 'There are no plugins on your site that require a license', 'formidable' );
@@ -88,11 +74,8 @@
88 74
89 75 include( FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php' );
90 76 }
91 77
92 - /**
93 - * @return array
94 - */
95 78 protected static function get_api_addons() {
96 79 $api = new FrmFormApi();
97 80 $addons = $api->get_api_info();
98 81
@@ -123,10 +106,10 @@
123 106 'docs' => '',
124 107 'excerpt' => 'Enhance your basic Formidable forms with a plethora of Pro field types and features. Create advanced forms and data-driven applications in minutes.',
125 108 ),
126 109 'mailchimp' => array(
127 - 'title' => 'Mailchimp Forms',
128 - 'excerpt' => 'Get on the path to more sales and leads in a matter of minutes. Add leads to a Mailchimp mailing list when they submit forms and update their information along with the entry.',
110 + 'title' => 'MailChimp Forms',
111 + 'excerpt' => 'Get on the path to more sales and leads in a matter of minutes. Add leads to a MailChimp mailing list when they submit forms and update their information along with the entry.',
129 112 ),
130 113 'registration' => array(
131 114 'title' => 'User Registration Forms',
132 115 'link' => 'downloads/user-registration/',
@@ -188,13 +171,8 @@
188 171 'views' => array(
189 172 'title' => 'Formidable Views',
190 173 'excerpt' => 'Add the power of views to your Formidable Forms to display your form submissions in listings, tables, calendars, and more.',
191 174 ),
192 - 'quiz_maker' => array(
193 - 'title' => 'Quiz Maker',
194 - 'link' => 'downloads/quiz-maker/',
195 - 'excerpt' => 'Make quizzes, automatically score them and show user scores.',
196 - ),
197 175 );
198 176
199 177 $defaults = array(
200 178 'released' => '',
@@ -251,11 +229,8 @@
251 229 }
252 230
253 231 /**
254 232 * @since 4.08
255 - *
256 - * @param array $addons
257 - * @return array
258 233 */
259 234 protected static function get_pro_from_addons( $addons ) {
260 235 return isset( $addons['93790'] ) ? $addons['93790'] : array();
261 236 }
@@ -297,10 +272,8 @@
297 272 }
298 273
299 274 /**
300 275 * @since 4.08
301 - *
302 - * @return array|false
303 276 */
304 277 protected static function get_primary_license_info() {
305 278 $installed_addons = apply_filters( 'frm_installed_addons', array() );
306 279 if ( empty( $installed_addons ) || ! isset( $installed_addons['formidable_pro'] ) ) {
@@ -330,12 +303,17 @@
330 303 if ( empty( $installed_addons ) ) {
331 304 return $transient;
332 305 }
333 306
334 - $version_info = self::fill_update_addon_info( $installed_addons );
307 + $version_info = self::fill_update_addon_info( $installed_addons );
308 +
335 309 $transient->last_checked = time();
336 - $wp_plugins = self::get_plugins();
337 310
311 + if ( ! function_exists( 'get_plugins' ) ) {
312 + require_once ABSPATH . 'wp-admin/includes/plugin.php';
313 + }
314 + $wp_plugins = get_plugins();
315 +
338 316 foreach ( $version_info as $id => $plugin ) {
339 317 $plugin = (object) $plugin;
340 318
341 319 if ( ! isset( $plugin->new_version ) || ! isset( $plugin->package ) ) {
@@ -368,23 +346,8 @@
368 346 return $transient;
369 347 }
370 348
371 349 /**
372 - * Copy of FrmAppHelper::get_plugins.
373 - * Because this gets called on "pre_set_site_transient_update_plugins" an old version of FrmAppHelper may be loaded on plugin update.
374 - * This means that trying to access FrmAppHelper::get_plugins when upgrading from a Lite version before v5.5 results in a one-off error.
375 - *
376 - * @since 5.5.2
377 - * @return array
378 - */
379 - protected static function get_plugins() {
380 - if ( ! function_exists( 'get_plugins' ) ) {
381 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
382 - }
383 - return get_plugins();
384 - }
385 -
386 - /**
387 350 * Check if a plugin is installed before showing an update for it
388 351 *
389 352 * @since 3.05
390 353 *
@@ -392,9 +355,14 @@
392 355 *
393 356 * @return bool - True if installed
394 357 */
395 358 protected static function is_installed( $plugin ) {
396 - $all_plugins = self::get_plugins();
359 + if ( ! function_exists( 'get_plugins' ) ) {
360 + require_once ABSPATH . 'wp-admin/includes/plugin.php';
361 + }
362 +
363 + $all_plugins = get_plugins();
364 +
397 365 return isset( $all_plugins[ $plugin ] );
398 366 }
399 367
400 368 /**
@@ -480,13 +448,8 @@
480 448
481 449 if ( ! empty( $link ) ) {
482 450 $link['status'] = $addon['status']['type'];
483 451 }
484 - } elseif ( current_user_can( 'activate_plugins' ) && self::is_installed( 'formidable-' . $plugin . '/formidable-' . $plugin . '.php' ) ) {
485 - $link = array(
486 - 'url' => 'formidable-' . $plugin . '/formidable-' . $plugin . '.php',
487 - 'class' => 'frm-activate-addon',
488 - );
489 452 }
490 453
491 454 return $link;
492 455 }
@@ -544,11 +507,8 @@
544 507
545 508 return $plugin;
546 509 }
547 510
548 - /**
549 - * @return void
550 - */
551 511 protected static function prepare_addons( &$addons ) {
552 512 $activate_url = '';
553 513 if ( current_user_can( 'activate_plugins' ) ) {
554 514 $activate_url = add_query_arg( array( 'action' => 'activate' ), admin_url( 'plugins.php' ) );
@@ -571,19 +531,12 @@
571 531 $addon['plugin'] = $file_name;
572 532 }
573 533 }
574 534
575 - $addon['installed'] = self::is_installed( $file_name );
576 - if ( $addon['installed'] && 'formidable-views/formidable-views.php' === $file_name ) {
577 - $active_views_version = self::get_active_views_version();
578 - if ( false !== $active_views_version && $slug !== $active_views_version ) {
579 - $addon['installed'] = false;
580 - }
581 - }
582 -
535 + $addon['installed'] = self::is_installed( $file_name );
583 536 $addon['activate_url'] = '';
584 537
585 - if ( $addon['installed'] && ! empty( $activate_url ) && ! self::is_plugin_active( $file_name, $slug ) ) {
538 + if ( $addon['installed'] && ! empty( $activate_url ) && ! is_plugin_active( $file_name ) ) {
586 539 $addon['activate_url'] = add_query_arg(
587 540 array(
588 541 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $file_name ),
589 542 'plugin' => $file_name,
@@ -607,32 +560,9 @@
607 560 }
608 561 }
609 562
610 563 /**
611 - * @return bool
612 - */
613 - private static function is_plugin_active( $file_name, $slug ) {
614 - if ( 'formidable-views/formidable-views.php' === $file_name ) {
615 - return self::get_active_views_version() === $slug;
616 - }
617 - return is_plugin_active( $file_name );
618 - }
619 -
620 - /**
621 - * @return string|false either 'visual-views' or 'views', false if one is not found.
622 - */
623 - private static function get_active_views_version() {
624 - if ( ! is_callable( 'FrmViewsAppHelper::plugin_version' ) ) {
625 - return false;
626 - }
627 - $plugin_version = FrmViewsAppHelper::plugin_version();
628 - return version_compare( $plugin_version, '5.0', '>=' ) ? 'visual-views' : 'views';
629 - }
630 -
631 - /**
632 564 * @since 3.04.02
633 - *
634 - * @return void
635 565 */
636 566 protected static function prepare_addon_link( &$link ) {
637 567 $site_url = 'https://formidableforms.com/';
638 568 if ( strpos( $link, 'http' ) !== 0 ) {
@@ -651,10 +581,8 @@
651 581 * Add the status to the addon array. Status options are:
652 582 * installed, active, not installed
653 583 *
654 584 * @since 3.04.02
655 - *
656 - * @return void
657 585 */
658 586 protected static function set_addon_status( &$addon ) {
659 587 if ( ! empty( $addon['activate_url'] ) ) {
660 588 $addon['status'] = array(
@@ -673,11 +601,8 @@
673 601 );
674 602 }
675 603 }
676 604
677 - /**
678 - * @return void
679 - */
680 605 public static function upgrade_to_pro() {
681 606 FrmAppHelper::include_svg();
682 607
683 608 $link_parts = array(
@@ -887,16 +812,14 @@
887 812 /**
888 813 * Install Pro after connection with Formidable.
889 814 *
890 815 * @since 4.02.05
891 - *
892 - * @return void
893 816 */
894 817 public static function connect_pro() {
895 818 FrmAppHelper::permission_check( 'install_plugins' );
896 819 check_ajax_referer( 'frm_ajax', 'nonce' );
897 820
898 - $url = self::get_current_plugin();
821 + $url = FrmAppHelper::get_post_param( 'plugin', '', 'sanitize_text_field' );
899 822 if ( FrmAppHelper::pro_is_installed() || empty( $url ) ) {
900 823 wp_die();
901 824 }
902 825
@@ -902,9 +825,9 @@
902 825
903 826 $response = array();
904 827
905 828 // It's already installed and active.
906 - $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
829 + $active = activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
907 830 if ( is_wp_error( $active ) ) {
908 831 // The plugin was installed, but not active. Download it now.
909 832 self::ajax_install_addon();
910 833 } else {
@@ -916,41 +839,15 @@
916 839 wp_die();
917 840 }
918 841
919 842 /**
920 - * @since 5.5.2
921 - *
922 - * @param string $plugin
923 - * @param string $redirect
924 - * @param bool $network_wide
925 - * @param bool $silent
926 - * @return null|WP_Error Null on success, WP_Error on invalid file.
927 - */
928 - protected static function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) {
929 - if ( ! function_exists( 'activate_plugin' ) ) {
930 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
931 - }
932 - return activate_plugin( $plugin, $redirect, $network_wide, $silent );
933 - }
934 -
935 - /**
936 - * @since 5.0.10
937 - *
938 - * @return string
939 - */
940 - protected static function get_current_plugin() {
941 - if ( ! isset( self::$plugin ) ) {
942 - self::$plugin = FrmAppHelper::get_param( 'plugin', '', 'post', 'esc_url_raw' );
943 - }
944 - return self::$plugin;
945 - }
946 -
947 - /**
948 843 * @since 4.08
949 844 */
950 845 protected static function download_and_activate() {
846 + // Set the current screen to avoid undefined notices.
951 847 if ( is_admin() ) {
952 - FrmAppHelper::set_current_screen_and_hook_suffix();
848 + global $hook_suffix;
849 + set_current_screen();
953 850 }
954 851
955 852 self::maybe_show_cred_form();
956 853
@@ -962,10 +859,8 @@
962 859 }
963 860
964 861 /**
965 862 * @since 3.04.02
966 - *
967 - * @return void
968 863 */
969 864 protected static function maybe_show_cred_form() {
970 865 if ( ! function_exists( 'request_filesystem_credentials' ) ) {
971 866 include_once( ABSPATH . 'wp-admin/includes/file.php' );
@@ -1002,23 +897,8 @@
1002 897 ob_end_clean();
1003 898 }
1004 899
1005 900 /**
1006 - * Checks if an addon download url is allowed.
1007 - *
1008 - * @since 6.2
1009 - *
1010 - * @param string $download_url
1011 - *
1012 - * @return bool
1013 - */
1014 - public static function url_is_allowed( $download_url ) {
1015 - return (
1016 - FrmAppHelper::validate_url_is_in_s3_bucket( $download_url, 'zip' ) || in_array( $download_url, self::allowed_external_urls(), true )
1017 - );
1018 - }
1019 -
1020 - /**
1021 901 * We do not need any extra credentials if we have gotten this far,
1022 902 * so let's install the plugin.
1023 903 *
1024 904 * @since 3.04.02
@@ -1023,21 +903,12 @@
1023 903 *
1024 904 * @since 3.04.02
1025 905 */
1026 906 protected static function install_addon() {
1027 - FrmAppHelper::permission_check( 'install_plugins' );
907 + require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1028 908
1029 - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
909 + $download_url = FrmAppHelper::get_param( 'plugin', '', 'post', 'esc_url_raw' );
1030 910
1031 - $download_url = self::get_current_plugin();
1032 -
1033 - if ( ! self::url_is_allowed( $download_url ) ) {
1034 - return array(
1035 - 'message' => 'Plugin URL is not valid',
1036 - 'success' => false,
1037 - );
1038 - }
1039 -
1040 911 // Create the plugin upgrader with our custom skin.
1041 912 $installer = new Plugin_Upgrader( new FrmInstallerSkin() );
1042 913 $installer->install( $download_url );
1043 914
@@ -1044,9 +915,9 @@
1044 915 // Flush the cache and return the newly installed plugin basename.
1045 916 wp_cache_flush();
1046 917
1047 918 $plugin = $installer->plugin_info();
1048 - if ( ! $plugin ) {
919 + if ( empty( $plugin ) ) {
1049 920 return array(
1050 921 'message' => 'Plugin was not installed. ' . $installer->result,
1051 922 'success' => false,
1052 923 );
@@ -1055,62 +926,27 @@
1055 926 }
1056 927
1057 928 /**
1058 929 * @since 3.06.03
1059 - *
1060 - * @return void
1061 930 */
1062 931 public static function ajax_activate_addon() {
1063 932
1064 933 self::install_addon_permissions();
1065 934
1066 - FrmAppHelper::set_current_screen_and_hook_suffix();
935 + // Set the current screen to avoid undefined notices.
936 + global $hook_suffix;
937 + set_current_screen();
1067 938
1068 939 $plugin = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
1069 940 self::maybe_activate_addon( $plugin );
1070 941
1071 - echo json_encode( self::get_addon_activation_response() );
942 + // Send back a response.
943 + echo json_encode( __( 'Your plugin has been activated. Please reload the page to see more options.', 'formidable' ) );
1072 944 wp_die();
1073 945 }
1074 946
1075 947 /**
1076 - * @return array
1077 - */
1078 - private static function get_addon_activation_response() {
1079 - $activating_page = self::get_activating_page();
1080 -
1081 - $message = $activating_page ? __( 'Your plugin has been activated. Would you like to save and reload the page now?', 'formidable' ) : __( 'Your plugin has been activated.', 'formidable' );
1082 -
1083 - $response = array(
1084 - 'message' => $message,
1085 - 'saveAndReload' => $activating_page,
1086 - );
1087 -
1088 - return $response;
1089 - }
1090 -
1091 - /**
1092 - * Return a string that reflects the page from which the addon is being activated on,
1093 - * if it is from settings or form builder, otherwise return empty string.
1094 - *
1095 - * @return string
1096 - */
1097 - private static function get_activating_page() {
1098 - $referer = FrmAppHelper::get_server_value( 'HTTP_REFERER' );
1099 - if ( false !== strpos( $referer, 'frm_action=settings' ) ) {
1100 - return 'settings';
1101 - }
1102 -
1103 - if ( false !== strpos( $referer, 'frm_action=edit' ) ) {
1104 - return 'form_builder';
1105 - }
1106 -
1107 - return '';
1108 - }
1109 -
1110 - /**
1111 948 * @since 3.04.02
1112 - *
1113 949 * @param string $installed The plugin folder name with file name
1114 950 */
1115 951 protected static function maybe_activate_addon( $installed ) {
1116 952 if ( ! $installed ) {
@@ -1116,9 +952,9 @@
1116 952 if ( ! $installed ) {
1117 953 return;
1118 954 }
1119 955
1120 - $activate = self::activate_plugin( $installed );
956 + $activate = activate_plugin( $installed );
1121 957 if ( is_wp_error( $activate ) ) {
1122 958 // Ignore the invalid header message that shows with nested plugins.
1123 959 if ( $activate->get_error_code() !== 'no_plugin_header' ) {
1124 960 if ( wp_doing_ajax() ) {
@@ -1136,15 +972,13 @@
1136 972 /**
1137 973 * Run security checks before installing
1138 974 *
1139 975 * @since 3.04.02
1140 - *
1141 - * @return void
1142 976 */
1143 977 protected static function install_addon_permissions() {
1144 978 check_ajax_referer( 'frm_ajax', 'nonce' );
1145 979
1146 - if ( ! current_user_can( 'activate_plugins' ) || ! self::get_current_plugin() ) {
980 + if ( ! current_user_can( 'activate_plugins' ) || ! isset( $_POST['plugin'] ) ) {
1147 981 echo json_encode( true );
1148 982 wp_die();
1149 983 }
1150 984 }
@@ -1150,10 +984,8 @@
1150 984 }
1151 985
1152 986 /**
1153 987 * @since 4.08
1154 - *
1155 - * @return string
1156 988 */
1157 989 public static function connect_link() {
1158 990 $auth = get_option( 'frm_connect_token' );
1159 991 if ( empty( $auth ) ) {
@@ -1179,12 +1011,8 @@
1179 1011 *
1180 1012 * @return bool
1181 1013 */
1182 1014 public static function can_install_addon_api() {
1183 - if ( ! current_user_can( 'activate_plugins' ) ) {
1184 - return false;
1185 - }
1186 -
1187 1015 // Verify params present (auth & download link).
1188 1016 $post_auth = FrmAppHelper::get_param( 'token', '', 'request', 'sanitize_text_field' );
1189 1017 $post_url = FrmAppHelper::get_param( 'file_url', '', 'request', 'sanitize_text_field' );
1190 1018
@@ -1206,9 +1034,11 @@
1206 1034 *
1207 1035 * @since 4.08
1208 1036 */
1209 1037 public static function install_addon_api() {
1210 - self::$plugin = FrmAppHelper::get_param( 'file_url', '', 'request', 'esc_url_raw' );
1038 + // Sanitize when it's used to prevent double sanitizing.
1039 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
1040 + $_POST['plugin'] = isset( $_REQUEST['file_url'] ) ? $_REQUEST['file_url'] : ''; // Set for later use
1211 1041
1212 1042 $error = esc_html__( 'Could not install an upgrade. Please download from formidableforms.com and install manually.', 'formidable' );
1213 1043
1214 1044 // Delete so cannot replay.
@@ -1214,9 +1044,9 @@
1214 1044 // Delete so cannot replay.
1215 1045 delete_option( 'frm_connect_token' );
1216 1046
1217 1047 // It's already installed and active.
1218 - $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
1048 + $active = activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
1219 1049 if ( is_wp_error( $active ) ) {
1220 1050 // Download plugin now.
1221 1051 $response = self::download_and_activate();
1222 1052 if ( is_array( $response ) && isset( $response['success'] ) ) {
@@ -1227,9 +1057,9 @@
1227 1057 // If empty license, save it now.
1228 1058 if ( empty( self::get_pro_license() ) && function_exists( 'load_formidable_pro' ) ) {
1229 1059 load_formidable_pro();
1230 1060 $license = stripslashes( FrmAppHelper::get_param( 'key', '', 'request', 'sanitize_text_field' ) );
1231 - if ( ! $license ) {
1061 + if ( empty( $license ) ) {
1232 1062 return array(
1233 1063 'success' => false,
1234 1064 'error' => 'That site does not have a valid license key.',
1235 1065 );
@@ -1260,11 +1090,9 @@
1260 1090 }
1261 1091
1262 1092 $addon = self::get_addon( $plugin );
1263 1093 $upgrade_link = FrmAppHelper::admin_upgrade_link( $upgrade_link_args );
1264 -
1265 - $upgrade_link_args['link'] = $upgrade_link;
1266 - self::addon_upgrade_link( $addon, $upgrade_link_args );
1094 + self::addon_upgrade_link( $addon, $upgrade_link );
1267 1095 }
1268 1096
1269 1097 /**
1270 1098 * Render a conditional action button for an add on
@@ -1269,9 +1097,8 @@
1269 1097 /**
1270 1098 * Render a conditional action button for an add on
1271 1099 *
1272 1100 * @since 4.09.01
1273 - *
1274 1101 * @param array $addon
1275 1102 * @param string|false $license_type
1276 1103 * @param string $plan_required
1277 1104 * @param string $upgrade_link
@@ -1285,18 +1112,10 @@
1285 1112 }
1286 1113
1287 1114 /**
1288 1115 * @since 4.09.01
1289 - *
1290 - * @param array|false $addon
1291 - * @param string|array $upgrade_link
1292 - *
1293 - * @return void
1294 1116 */
1295 1117 protected static function addon_upgrade_link( $addon, $upgrade_link ) {
1296 - $atts = is_array( $upgrade_link ) ? $upgrade_link : array();
1297 - $upgrade_link = is_array( $upgrade_link ) ? $upgrade_link['link'] : $upgrade_link;
1298 -
1299 1118 if ( $addon ) {
1300 1119 $upgrade_link .= '&utm_content=' . $addon['slug'];
1301 1120 }
1302 1121
@@ -1303,15 +1122,10 @@
1303 1122 if ( $addon && isset( $addon['categories'] ) && in_array( 'Solution', $addon['categories'], true ) ) {
1304 1123 // Solutions will go to a separate page.
1305 1124 $upgrade_link = FrmAppHelper::admin_upgrade_link( 'addons', $addon['link'] );
1306 1125 }
1307 -
1308 - $class = ! empty( $atts['class'] ) ? $atts['class'] : '';
1309 - if ( strpos( $class, 'frm-button' ) === false ) {
1310 - $class .= ' frm-button-secondary frm-button-sm';
1311 - }
1312 1126 ?>
1313 - <a class="install-now button <?php echo esc_attr( $class ); ?>" href="<?php echo esc_url( $upgrade_link ); ?>" target="_blank" rel="noopener" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>">
1127 + <a class="install-now button button-secondary frm-button-secondary" href="<?php echo esc_url( $upgrade_link ); ?>" target="_blank" rel="noopener" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>">
1314 1128 <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?>
1315 1129 </a>
1316 1130 <?php
1317 1131 }
@@ -1317,85 +1131,22 @@
1317 1131 }
1318 1132
1319 1133 /**
1320 1134 * @since 3.04.02
1321 - *
1322 - * @return void
1323 1135 */
1324 1136 public static function ajax_install_addon() {
1325 1137 self::install_addon_permissions();
1326 1138
1327 - $result = self::download_and_activate();
1328 - if ( isset( $result['success'] ) && ! $result['success'] ) {
1329 - echo json_encode( $result );
1330 - wp_die();
1331 - }
1139 + self::download_and_activate();
1332 1140
1333 - echo json_encode( self::get_addon_activation_response() );
1141 + // Send back a response.
1142 + echo json_encode( __( 'Your plugin has been installed. Please reload the page to see more options.', 'formidable' ) );
1334 1143 wp_die();
1335 1144 }
1336 1145
1337 1146 /**
1338 - * Allowed URLs used for internal source of plugins installation.
1339 - *
1340 - * @since 6.3.1
1341 - *
1342 - * @return array
1343 - */
1344 - private static function allowed_external_urls() {
1345 - $allowed_url_list = array(
1346 - 'https://downloads.wordpress.org/plugin/formidable-gravity-forms-importer.zip',
1347 - 'https://downloads.wordpress.org/plugin/formidable-import-pirate-forms.zip',
1348 - 'https://downloads.wordpress.org/plugin/wp-mail-smtp.zip',
1349 - );
1350 -
1351 - /**
1352 - * List of URLs used in plugin formidable internal installation.
1353 - *
1354 - * @since 6.3.1
1355 - *
1356 - * @param array $allowed_url_list List of URLs.
1357 - */
1358 - $allowed_url_list = apply_filters( 'frm_allowed_external_urls', $allowed_url_list );
1359 -
1360 - if ( ! is_array( $allowed_url_list ) ) {
1361 - _doing_it_wrong( __METHOD__, 'Only an array of URLs could be used within this filter.', '6.3.1' );
1362 -
1363 - return array();
1364 - }
1365 -
1366 - return $allowed_url_list;
1367 - }
1368 -
1369 - /**
1370 - * Gets required plan for an addon.
1371 - *
1372 - * @since 6.4.2
1373 - *
1374 - * @return string Empty string if no plan is required for active license.
1375 - */
1376 - public static function get_addon_required_plan( $addon_id ) {
1377 - $api = new FrmFormApi();
1378 - $addons = $api->get_api_info();
1379 -
1380 - if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) {
1381 - $dates = $addons[ $addon_id ];
1382 - $requires = FrmFormsHelper::get_plan_required( $dates );
1383 - }
1384 -
1385 - if ( ! isset( $requires ) || ! is_string( $requires ) ) {
1386 - $requires = '';
1387 - }
1388 -
1389 - return $requires;
1390 - }
1391 -
1392 - /**
1393 1147 * @since 4.06.02
1394 - *
1395 1148 * @deprecated 4.09.01
1396 - *
1397 - * @return void
1398 1149 */
1399 1150 public static function ajax_multiple_addons() {
1400 1151 FrmDeprecated::ajax_multiple_addons();
1401 1152 }
@@ -1442,14 +1193,10 @@
1442 1193 }
1443 1194
1444 1195 /**
1445 1196 * @since 3.04.03
1446 - *
1447 1197 * @deprecated 3.06
1448 - *
1449 1198 * @codeCoverageIgnore
1450 - *
1451 - * @return void
1452 1199 */
1453 1200 public static function reset_cached_addons( $license = '' ) {
1454 1201 FrmDeprecated::reset_cached_addons( $license );
1455 1202 }
@@ -1483,12 +1230,9 @@
1483 1230 }
1484 1231
1485 1232 /**
1486 1233 * @deprecated 3.04.03
1487 - *
1488 1234 * @codeCoverageIgnore
1489 - *
1490 - * @return void
1491 1235 */
1492 1236 public static function get_licenses() {
1493 1237 FrmDeprecated::get_licenses();
1494 1238 }