PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 4.11.02
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v4.11.02
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 +45 -264 6.4.14.11.02 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,10 +10,11 @@
18 10 return;
19 11 }
20 12
21 13 $label = __( 'Add-Ons', 'formidable' );
22 - $label = '<span style="color:#fe5a1d">' . $label . '</span>';
23 -
14 + if ( FrmAppHelper::pro_is_installed() ) {
15 + $label = '<span style="color:#fe5a1d">' . $label . '</span>';
16 + }
24 17 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Add-Ons', 'formidable' ), $label, 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
25 18
26 19 if ( ! FrmAppHelper::pro_is_installed() ) {
27 20 add_submenu_page(
@@ -26,9 +19,9 @@
26 19 if ( ! FrmAppHelper::pro_is_installed() ) {
27 20 add_submenu_page(
28 21 'formidable',
29 22 'Formidable | ' . __( 'Upgrade', 'formidable' ),
30 - '<span class="frm-upgrade-submenu">' . __( 'Upgrade', 'formidable' ) . '</span>',
23 + '<span style="color:#fe5a1d">' . __( 'Upgrade', 'formidable' ) . '</span>',
31 24 'frm_view_forms',
32 25 'formidable-pro-upgrade',
33 26 'FrmAddonsController::upgrade_to_pro'
34 27 );
@@ -37,11 +30,8 @@
37 30 exit;
38 31 }
39 32 }
40 33
41 - /**
42 - * @return void
43 - */
44 34 public static function list_addons() {
45 35 FrmAppHelper::include_svg();
46 36 $installed_addons = apply_filters( 'frm_installed_addons', array() );
47 37 $license_type = '';
@@ -72,11 +62,8 @@
72 62
73 63 include( FrmAppHelper::plugin_path() . '/classes/views/addons/list.php' );
74 64 }
75 65
76 - /**
77 - * @return void
78 - */
79 66 public static function license_settings() {
80 67 $plugins = apply_filters( 'frm_installed_addons', array() );
81 68 if ( empty( $plugins ) ) {
82 69 esc_html_e( 'There are no plugins on your site that require a license', 'formidable' );
@@ -88,11 +75,8 @@
88 75
89 76 include( FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php' );
90 77 }
91 78
92 - /**
93 - * @return array
94 - */
95 79 protected static function get_api_addons() {
96 80 $api = new FrmFormApi();
97 81 $addons = $api->get_api_info();
98 82
@@ -123,10 +107,10 @@
123 107 'docs' => '',
124 108 '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 109 ),
126 110 '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.',
111 + 'title' => 'MailChimp Forms',
112 + '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 113 ),
130 114 'registration' => array(
131 115 'title' => 'User Registration Forms',
132 116 'link' => 'downloads/user-registration/',
@@ -188,13 +172,8 @@
188 172 'views' => array(
189 173 'title' => 'Formidable Views',
190 174 'excerpt' => 'Add the power of views to your Formidable Forms to display your form submissions in listings, tables, calendars, and more.',
191 175 ),
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 176 );
198 177
199 178 $defaults = array(
200 179 'released' => '',
@@ -251,11 +230,8 @@
251 230 }
252 231
253 232 /**
254 233 * @since 4.08
255 - *
256 - * @param array $addons
257 - * @return array
258 234 */
259 235 protected static function get_pro_from_addons( $addons ) {
260 236 return isset( $addons['93790'] ) ? $addons['93790'] : array();
261 237 }
@@ -297,10 +273,8 @@
297 273 }
298 274
299 275 /**
300 276 * @since 4.08
301 - *
302 - * @return array|false
303 277 */
304 278 protected static function get_primary_license_info() {
305 279 $installed_addons = apply_filters( 'frm_installed_addons', array() );
306 280 if ( empty( $installed_addons ) || ! isset( $installed_addons['formidable_pro'] ) ) {
@@ -330,12 +304,17 @@
330 304 if ( empty( $installed_addons ) ) {
331 305 return $transient;
332 306 }
333 307
334 - $version_info = self::fill_update_addon_info( $installed_addons );
308 + $version_info = self::fill_update_addon_info( $installed_addons );
309 +
335 310 $transient->last_checked = time();
336 - $wp_plugins = self::get_plugins();
337 311
312 + if ( ! function_exists( 'get_plugins' ) ) {
313 + require_once ABSPATH . 'wp-admin/includes/plugin.php';
314 + }
315 + $wp_plugins = get_plugins();
316 +
338 317 foreach ( $version_info as $id => $plugin ) {
339 318 $plugin = (object) $plugin;
340 319
341 320 if ( ! isset( $plugin->new_version ) || ! isset( $plugin->package ) ) {
@@ -368,23 +347,8 @@
368 347 return $transient;
369 348 }
370 349
371 350 /**
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 351 * Check if a plugin is installed before showing an update for it
388 352 *
389 353 * @since 3.05
390 354 *
@@ -392,9 +356,14 @@
392 356 *
393 357 * @return bool - True if installed
394 358 */
395 359 protected static function is_installed( $plugin ) {
396 - $all_plugins = self::get_plugins();
360 + if ( ! function_exists( 'get_plugins' ) ) {
361 + require_once ABSPATH . 'wp-admin/includes/plugin.php';
362 + }
363 +
364 + $all_plugins = get_plugins();
365 +
397 366 return isset( $all_plugins[ $plugin ] );
398 367 }
399 368
400 369 /**
@@ -480,13 +449,8 @@
480 449
481 450 if ( ! empty( $link ) ) {
482 451 $link['status'] = $addon['status']['type'];
483 452 }
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 453 }
490 454
491 455 return $link;
492 456 }
@@ -544,11 +508,8 @@
544 508
545 509 return $plugin;
546 510 }
547 511
548 - /**
549 - * @return void
550 - */
551 512 protected static function prepare_addons( &$addons ) {
552 513 $activate_url = '';
553 514 if ( current_user_can( 'activate_plugins' ) ) {
554 515 $activate_url = add_query_arg( array( 'action' => 'activate' ), admin_url( 'plugins.php' ) );
@@ -571,19 +532,12 @@
571 532 $addon['plugin'] = $file_name;
572 533 }
573 534 }
574 535
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 -
536 + $addon['installed'] = self::is_installed( $file_name );
583 537 $addon['activate_url'] = '';
584 538
585 - if ( $addon['installed'] && ! empty( $activate_url ) && ! self::is_plugin_active( $file_name, $slug ) ) {
539 + if ( $addon['installed'] && ! empty( $activate_url ) && ! is_plugin_active( $file_name ) ) {
586 540 $addon['activate_url'] = add_query_arg(
587 541 array(
588 542 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $file_name ),
589 543 'plugin' => $file_name,
@@ -607,32 +561,9 @@
607 561 }
608 562 }
609 563
610 564 /**
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 565 * @since 3.04.02
633 - *
634 - * @return void
635 566 */
636 567 protected static function prepare_addon_link( &$link ) {
637 568 $site_url = 'https://formidableforms.com/';
638 569 if ( strpos( $link, 'http' ) !== 0 ) {
@@ -651,10 +582,8 @@
651 582 * Add the status to the addon array. Status options are:
652 583 * installed, active, not installed
653 584 *
654 585 * @since 3.04.02
655 - *
656 - * @return void
657 586 */
658 587 protected static function set_addon_status( &$addon ) {
659 588 if ( ! empty( $addon['activate_url'] ) ) {
660 589 $addon['status'] = array(
@@ -673,11 +602,8 @@
673 602 );
674 603 }
675 604 }
676 605
677 - /**
678 - * @return void
679 - */
680 606 public static function upgrade_to_pro() {
681 607 FrmAppHelper::include_svg();
682 608
683 609 $link_parts = array(
@@ -887,16 +813,14 @@
887 813 /**
888 814 * Install Pro after connection with Formidable.
889 815 *
890 816 * @since 4.02.05
891 - *
892 - * @return void
893 817 */
894 818 public static function connect_pro() {
895 819 FrmAppHelper::permission_check( 'install_plugins' );
896 820 check_ajax_referer( 'frm_ajax', 'nonce' );
897 821
898 - $url = self::get_current_plugin();
822 + $url = FrmAppHelper::get_post_param( 'plugin', '', 'sanitize_text_field' );
899 823 if ( FrmAppHelper::pro_is_installed() || empty( $url ) ) {
900 824 wp_die();
901 825 }
902 826
@@ -902,9 +826,9 @@
902 826
903 827 $response = array();
904 828
905 829 // It's already installed and active.
906 - $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
830 + $active = activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
907 831 if ( is_wp_error( $active ) ) {
908 832 // The plugin was installed, but not active. Download it now.
909 833 self::ajax_install_addon();
910 834 } else {
@@ -916,41 +840,15 @@
916 840 wp_die();
917 841 }
918 842
919 843 /**
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 844 * @since 4.08
949 845 */
950 846 protected static function download_and_activate() {
847 + // Set the current screen to avoid undefined notices.
951 848 if ( is_admin() ) {
952 - FrmAppHelper::set_current_screen_and_hook_suffix();
849 + global $hook_suffix;
850 + set_current_screen();
953 851 }
954 852
955 853 self::maybe_show_cred_form();
956 854
@@ -962,10 +860,8 @@
962 860 }
963 861
964 862 /**
965 863 * @since 3.04.02
966 - *
967 - * @return void
968 864 */
969 865 protected static function maybe_show_cred_form() {
970 866 if ( ! function_exists( 'request_filesystem_credentials' ) ) {
971 867 include_once( ABSPATH . 'wp-admin/includes/file.php' );
@@ -1002,23 +898,8 @@
1002 898 ob_end_clean();
1003 899 }
1004 900
1005 901 /**
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 902 * We do not need any extra credentials if we have gotten this far,
1022 903 * so let's install the plugin.
1023 904 *
1024 905 * @since 3.04.02
@@ -1023,21 +904,12 @@
1023 904 *
1024 905 * @since 3.04.02
1025 906 */
1026 907 protected static function install_addon() {
1027 - FrmAppHelper::permission_check( 'install_plugins' );
908 + require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1028 909
1029 - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
910 + $download_url = FrmAppHelper::get_param( 'plugin', '', 'post', 'esc_url_raw' );
1030 911
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 912 // Create the plugin upgrader with our custom skin.
1041 913 $installer = new Plugin_Upgrader( new FrmInstallerSkin() );
1042 914 $installer->install( $download_url );
1043 915
@@ -1044,9 +916,9 @@
1044 916 // Flush the cache and return the newly installed plugin basename.
1045 917 wp_cache_flush();
1046 918
1047 919 $plugin = $installer->plugin_info();
1048 - if ( ! $plugin ) {
920 + if ( empty( $plugin ) ) {
1049 921 return array(
1050 922 'message' => 'Plugin was not installed. ' . $installer->result,
1051 923 'success' => false,
1052 924 );
@@ -1055,60 +927,27 @@
1055 927 }
1056 928
1057 929 /**
1058 930 * @since 3.06.03
1059 - *
1060 - * @return void
1061 931 */
1062 932 public static function ajax_activate_addon() {
1063 933
1064 934 self::install_addon_permissions();
1065 935
1066 - FrmAppHelper::set_current_screen_and_hook_suffix();
936 + // Set the current screen to avoid undefined notices.
937 + global $hook_suffix;
938 + set_current_screen();
1067 939
1068 940 $plugin = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
1069 941 self::maybe_activate_addon( $plugin );
1070 942
1071 - echo json_encode( self::get_addon_activation_response() );
943 + // Send back a response.
944 + echo json_encode( __( 'Your plugin has been activated. Please reload the page to see more options.', 'formidable' ) );
1072 945 wp_die();
1073 946 }
1074 947
1075 948 /**
1076 - * @return array
1077 - */
1078 - private static function get_addon_activation_response() {
1079 - $activating_page = self::get_activating_page();
1080 -
1081 - $response = array(
1082 - 'message' => __( 'Your plugin has been activated. Would you like to save and reload the page now?', 'formidable' ),
1083 - 'saveAndReload' => $activating_page,
1084 - );
1085 -
1086 - return $response;
1087 - }
1088 -
1089 - /**
1090 - * Return a string that reflects the page from which the addon is being activated on,
1091 - * if it is from settings or form builder, otherwise return empty string.
1092 - *
1093 - * @return string
1094 - */
1095 - private static function get_activating_page() {
1096 - $referer = FrmAppHelper::get_server_value( 'HTTP_REFERER' );
1097 - if ( false !== strpos( $referer, 'frm_action=settings' ) ) {
1098 - return 'settings';
1099 - }
1100 -
1101 - if ( false !== strpos( $referer, 'frm_action=edit' ) ) {
1102 - return 'form_builder';
1103 - }
1104 -
1105 - return '';
1106 - }
1107 -
1108 - /**
1109 949 * @since 3.04.02
1110 - *
1111 950 * @param string $installed The plugin folder name with file name
1112 951 */
1113 952 protected static function maybe_activate_addon( $installed ) {
1114 953 if ( ! $installed ) {
@@ -1114,9 +953,9 @@
1114 953 if ( ! $installed ) {
1115 954 return;
1116 955 }
1117 956
1118 - $activate = self::activate_plugin( $installed );
957 + $activate = activate_plugin( $installed );
1119 958 if ( is_wp_error( $activate ) ) {
1120 959 // Ignore the invalid header message that shows with nested plugins.
1121 960 if ( $activate->get_error_code() !== 'no_plugin_header' ) {
1122 961 if ( wp_doing_ajax() ) {
@@ -1134,15 +973,13 @@
1134 973 /**
1135 974 * Run security checks before installing
1136 975 *
1137 976 * @since 3.04.02
1138 - *
1139 - * @return void
1140 977 */
1141 978 protected static function install_addon_permissions() {
1142 979 check_ajax_referer( 'frm_ajax', 'nonce' );
1143 980
1144 - if ( ! current_user_can( 'activate_plugins' ) || ! self::get_current_plugin() ) {
981 + if ( ! current_user_can( 'activate_plugins' ) || ! isset( $_POST['plugin'] ) ) {
1145 982 echo json_encode( true );
1146 983 wp_die();
1147 984 }
1148 985 }
@@ -1148,10 +985,8 @@
1148 985 }
1149 986
1150 987 /**
1151 988 * @since 4.08
1152 - *
1153 - * @return string
1154 989 */
1155 990 public static function connect_link() {
1156 991 $auth = get_option( 'frm_connect_token' );
1157 992 if ( empty( $auth ) ) {
@@ -1177,12 +1012,8 @@
1177 1012 *
1178 1013 * @return bool
1179 1014 */
1180 1015 public static function can_install_addon_api() {
1181 - if ( ! current_user_can( 'activate_plugins' ) ) {
1182 - return false;
1183 - }
1184 -
1185 1016 // Verify params present (auth & download link).
1186 1017 $post_auth = FrmAppHelper::get_param( 'token', '', 'request', 'sanitize_text_field' );
1187 1018 $post_url = FrmAppHelper::get_param( 'file_url', '', 'request', 'sanitize_text_field' );
1188 1019
@@ -1204,9 +1035,11 @@
1204 1035 *
1205 1036 * @since 4.08
1206 1037 */
1207 1038 public static function install_addon_api() {
1208 - self::$plugin = FrmAppHelper::get_param( 'file_url', '', 'request', 'esc_url_raw' );
1039 + // Sanitize when it's used to prevent double sanitizing.
1040 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
1041 + $_POST['plugin'] = isset( $_REQUEST['file_url'] ) ? $_REQUEST['file_url'] : ''; // Set for later use
1209 1042
1210 1043 $error = esc_html__( 'Could not install an upgrade. Please download from formidableforms.com and install manually.', 'formidable' );
1211 1044
1212 1045 // Delete so cannot replay.
@@ -1212,9 +1045,9 @@
1212 1045 // Delete so cannot replay.
1213 1046 delete_option( 'frm_connect_token' );
1214 1047
1215 1048 // It's already installed and active.
1216 - $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
1049 + $active = activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
1217 1050 if ( is_wp_error( $active ) ) {
1218 1051 // Download plugin now.
1219 1052 $response = self::download_and_activate();
1220 1053 if ( is_array( $response ) && isset( $response['success'] ) ) {
@@ -1225,9 +1058,9 @@
1225 1058 // If empty license, save it now.
1226 1059 if ( empty( self::get_pro_license() ) && function_exists( 'load_formidable_pro' ) ) {
1227 1060 load_formidable_pro();
1228 1061 $license = stripslashes( FrmAppHelper::get_param( 'key', '', 'request', 'sanitize_text_field' ) );
1229 - if ( ! $license ) {
1062 + if ( empty( $license ) ) {
1230 1063 return array(
1231 1064 'success' => false,
1232 1065 'error' => 'That site does not have a valid license key.',
1233 1066 );
@@ -1265,9 +1098,8 @@
1265 1098 /**
1266 1099 * Render a conditional action button for an add on
1267 1100 *
1268 1101 * @since 4.09.01
1269 - *
1270 1102 * @param array $addon
1271 1103 * @param string|false $license_type
1272 1104 * @param string $plan_required
1273 1105 * @param string $upgrade_link
@@ -1281,12 +1113,8 @@
1281 1113 }
1282 1114
1283 1115 /**
1284 1116 * @since 4.09.01
1285 - *
1286 - * @param array|false $addon
1287 - *
1288 - * @return void
1289 1117 */
1290 1118 protected static function addon_upgrade_link( $addon, $upgrade_link ) {
1291 1119 if ( $addon ) {
1292 1120 $upgrade_link .= '&utm_content=' . $addon['slug'];
@@ -1296,9 +1124,9 @@
1296 1124 // Solutions will go to a separate page.
1297 1125 $upgrade_link = FrmAppHelper::admin_upgrade_link( 'addons', $addon['link'] );
1298 1126 }
1299 1127 ?>
1300 - <a class="install-now button frm-button-secondary frm-button-sm" href="<?php echo esc_url( $upgrade_link ); ?>" target="_blank" rel="noopener" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>">
1128 + <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' ); ?>">
1301 1129 <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?>
1302 1130 </a>
1303 1131 <?php
1304 1132 }
@@ -1304,62 +1132,22 @@
1304 1132 }
1305 1133
1306 1134 /**
1307 1135 * @since 3.04.02
1308 - *
1309 - * @return void
1310 1136 */
1311 1137 public static function ajax_install_addon() {
1312 1138 self::install_addon_permissions();
1313 1139
1314 - $result = self::download_and_activate();
1315 - if ( isset( $result['success'] ) && ! $result['success'] ) {
1316 - echo json_encode( $result );
1317 - wp_die();
1318 - }
1140 + self::download_and_activate();
1319 1141
1320 - echo json_encode( self::get_addon_activation_response() );
1142 + // Send back a response.
1143 + echo json_encode( __( 'Your plugin has been installed. Please reload the page to see more options.', 'formidable' ) );
1321 1144 wp_die();
1322 1145 }
1323 1146
1324 1147 /**
1325 - * Allowed URLs used for internal source of plugins installation.
1326 - *
1327 - * @since 6.3.1
1328 - *
1329 - * @return array
1330 - */
1331 - private static function allowed_external_urls() {
1332 - $allowed_url_list = array(
1333 - 'https://downloads.wordpress.org/plugin/formidable-gravity-forms-importer.zip',
1334 - 'https://downloads.wordpress.org/plugin/formidable-import-pirate-forms.zip',
1335 - 'https://downloads.wordpress.org/plugin/wp-mail-smtp.zip',
1336 - );
1337 -
1338 - /**
1339 - * List of URLs used in plugin formidable internal installation.
1340 - *
1341 - * @since 6.3.1
1342 - *
1343 - * @param array $allowed_url_list List of URLs.
1344 - */
1345 - $allowed_url_list = apply_filters( 'frm_allowed_external_urls', $allowed_url_list );
1346 -
1347 - if ( ! is_array( $allowed_url_list ) ) {
1348 - _doing_it_wrong( __METHOD__, 'Only an array of URLs could be used within this filter.', '6.3.1' );
1349 -
1350 - return array();
1351 - }
1352 -
1353 - return $allowed_url_list;
1354 - }
1355 -
1356 - /**
1357 1148 * @since 4.06.02
1358 - *
1359 1149 * @deprecated 4.09.01
1360 - *
1361 - * @return void
1362 1150 */
1363 1151 public static function ajax_multiple_addons() {
1364 1152 FrmDeprecated::ajax_multiple_addons();
1365 1153 }
@@ -1406,14 +1194,10 @@
1406 1194 }
1407 1195
1408 1196 /**
1409 1197 * @since 3.04.03
1410 - *
1411 1198 * @deprecated 3.06
1412 - *
1413 1199 * @codeCoverageIgnore
1414 - *
1415 - * @return void
1416 1200 */
1417 1201 public static function reset_cached_addons( $license = '' ) {
1418 1202 FrmDeprecated::reset_cached_addons( $license );
1419 1203 }
@@ -1447,12 +1231,9 @@
1447 1231 }
1448 1232
1449 1233 /**
1450 1234 * @deprecated 3.04.03
1451 - *
1452 1235 * @codeCoverageIgnore
1453 - *
1454 - * @return void
1455 1236 */
1456 1237 public static function get_licenses() {
1457 1238 FrmDeprecated::get_licenses();
1458 1239 }