PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.5
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.5
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 +13 -124 6.35.5 View file →
@@ -37,11 +37,8 @@
37 37 exit;
38 38 }
39 39 }
40 40
41 - /**
42 - * @return void
43 - */
44 41 public static function list_addons() {
45 42 FrmAppHelper::include_svg();
46 43 $installed_addons = apply_filters( 'frm_installed_addons', array() );
47 44 $license_type = '';
@@ -72,11 +69,8 @@
72 69
73 70 include( FrmAppHelper::plugin_path() . '/classes/views/addons/list.php' );
74 71 }
75 72
76 - /**
77 - * @return void
78 - */
79 73 public static function license_settings() {
80 74 $plugins = apply_filters( 'frm_installed_addons', array() );
81 75 if ( empty( $plugins ) ) {
82 76 esc_html_e( 'There are no plugins on your site that require a license', 'formidable' );
@@ -88,11 +82,8 @@
88 82
89 83 include( FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php' );
90 84 }
91 85
92 - /**
93 - * @return array
94 - */
95 86 protected static function get_api_addons() {
96 87 $api = new FrmFormApi();
97 88 $addons = $api->get_api_info();
98 89
@@ -123,10 +114,10 @@
123 114 'docs' => '',
124 115 '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 116 ),
126 117 '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.',
118 + 'title' => 'MailChimp Forms',
119 + '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 120 ),
130 121 'registration' => array(
131 122 'title' => 'User Registration Forms',
132 123 'link' => 'downloads/user-registration/',
@@ -251,11 +242,8 @@
251 242 }
252 243
253 244 /**
254 245 * @since 4.08
255 - *
256 - * @param array $addons
257 - * @return array
258 246 */
259 247 protected static function get_pro_from_addons( $addons ) {
260 248 return isset( $addons['93790'] ) ? $addons['93790'] : array();
261 249 }
@@ -297,10 +285,8 @@
297 285 }
298 286
299 287 /**
300 288 * @since 4.08
301 - *
302 - * @return array|false
303 289 */
304 290 protected static function get_primary_license_info() {
305 291 $installed_addons = apply_filters( 'frm_installed_addons', array() );
306 292 if ( empty( $installed_addons ) || ! isset( $installed_addons['formidable_pro'] ) ) {
@@ -330,12 +316,14 @@
330 316 if ( empty( $installed_addons ) ) {
331 317 return $transient;
332 318 }
333 319
334 - $version_info = self::fill_update_addon_info( $installed_addons );
320 + $version_info = self::fill_update_addon_info( $installed_addons );
321 +
335 322 $transient->last_checked = time();
336 - $wp_plugins = self::get_plugins();
337 323
324 + $wp_plugins = FrmAppHelper::get_plugins();
325 +
338 326 foreach ( $version_info as $id => $plugin ) {
339 327 $plugin = (object) $plugin;
340 328
341 329 if ( ! isset( $plugin->new_version ) || ! isset( $plugin->package ) ) {
@@ -368,23 +356,8 @@
368 356 return $transient;
369 357 }
370 358
371 359 /**
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 360 * Check if a plugin is installed before showing an update for it
388 361 *
389 362 * @since 3.05
390 363 *
@@ -392,9 +365,9 @@
392 365 *
393 366 * @return bool - True if installed
394 367 */
395 368 protected static function is_installed( $plugin ) {
396 - $all_plugins = self::get_plugins();
369 + $all_plugins = FrmAppHelper::get_plugins();
397 370 return isset( $all_plugins[ $plugin ] );
398 371 }
399 372
400 373 /**
@@ -544,11 +517,8 @@
544 517
545 518 return $plugin;
546 519 }
547 520
548 - /**
549 - * @return void
550 - */
551 521 protected static function prepare_addons( &$addons ) {
552 522 $activate_url = '';
553 523 if ( current_user_can( 'activate_plugins' ) ) {
554 524 $activate_url = add_query_arg( array( 'action' => 'activate' ), admin_url( 'plugins.php' ) );
@@ -606,11 +576,8 @@
606 576 $addons[ $id ] = $addon;
607 577 }
608 578 }
609 579
610 - /**
611 - * @return bool
612 - */
613 580 private static function is_plugin_active( $file_name, $slug ) {
614 581 if ( 'formidable-views/formidable-views.php' === $file_name ) {
615 582 return self::get_active_views_version() === $slug;
616 583 }
@@ -629,10 +596,8 @@
629 596 }
630 597
631 598 /**
632 599 * @since 3.04.02
633 - *
634 - * @return void
635 600 */
636 601 protected static function prepare_addon_link( &$link ) {
637 602 $site_url = 'https://formidableforms.com/';
638 603 if ( strpos( $link, 'http' ) !== 0 ) {
@@ -651,10 +616,8 @@
651 616 * Add the status to the addon array. Status options are:
652 617 * installed, active, not installed
653 618 *
654 619 * @since 3.04.02
655 - *
656 - * @return void
657 620 */
658 621 protected static function set_addon_status( &$addon ) {
659 622 if ( ! empty( $addon['activate_url'] ) ) {
660 623 $addon['status'] = array(
@@ -673,11 +636,8 @@
673 636 );
674 637 }
675 638 }
676 639
677 - /**
678 - * @return void
679 - */
680 640 public static function upgrade_to_pro() {
681 641 FrmAppHelper::include_svg();
682 642
683 643 $link_parts = array(
@@ -887,10 +847,8 @@
887 847 /**
888 848 * Install Pro after connection with Formidable.
889 849 *
890 850 * @since 4.02.05
891 - *
892 - * @return void
893 851 */
894 852 public static function connect_pro() {
895 853 FrmAppHelper::permission_check( 'install_plugins' );
896 854 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -902,9 +860,9 @@
902 860
903 861 $response = array();
904 862
905 863 // It's already installed and active.
906 - $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
864 + $active = activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
907 865 if ( is_wp_error( $active ) ) {
908 866 // The plugin was installed, but not active. Download it now.
909 867 self::ajax_install_addon();
910 868 } else {
@@ -916,24 +874,8 @@
916 874 wp_die();
917 875 }
918 876
919 877 /**
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 878 * @since 5.0.10
937 879 *
938 880 * @return string
939 881 */
@@ -962,10 +904,8 @@
962 904 }
963 905
964 906 /**
965 907 * @since 3.04.02
966 - *
967 - * @return void
968 908 */
969 909 protected static function maybe_show_cred_form() {
970 910 if ( ! function_exists( 'request_filesystem_credentials' ) ) {
971 911 include_once( ABSPATH . 'wp-admin/includes/file.php' );
@@ -1002,24 +942,8 @@
1002 942 ob_end_clean();
1003 943 }
1004 944
1005 945 /**
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' ) ||
1017 - ( strpos( $download_url, 'https://downloads.wordpress.org/plugin' ) === 0 && substr_compare( $download_url, '.zip', -4 ) === 0 )
1018 - );
1019 - }
1020 -
1021 - /**
1022 946 * We do not need any extra credentials if we have gotten this far,
1023 947 * so let's install the plugin.
1024 948 *
1025 949 * @since 3.04.02
@@ -1028,15 +952,8 @@
1028 952 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1029 953
1030 954 $download_url = self::get_current_plugin();
1031 955
1032 - if ( ! self::url_is_allowed( $download_url ) ) {
1033 - return array(
1034 - 'message' => 'Plugin URL is not valid',
1035 - 'success' => false,
1036 - );
1037 - }
1038 -
1039 956 // Create the plugin upgrader with our custom skin.
1040 957 $installer = new Plugin_Upgrader( new FrmInstallerSkin() );
1041 958 $installer->install( $download_url );
1042 959
@@ -1054,10 +971,8 @@
1054 971 }
1055 972
1056 973 /**
1057 974 * @since 3.06.03
1058 - *
1059 - * @return void
1060 975 */
1061 976 public static function ajax_activate_addon() {
1062 977
1063 978 self::install_addon_permissions();
@@ -1071,9 +986,9 @@
1071 986 wp_die();
1072 987 }
1073 988
1074 989 /**
1075 - * @return array
990 + * @return array|string
1076 991 */
1077 992 private static function get_addon_activation_response() {
1078 993 $activating_page = self::get_activating_page();
1079 994
@@ -1105,9 +1020,8 @@
1105 1020 }
1106 1021
1107 1022 /**
1108 1023 * @since 3.04.02
1109 - *
1110 1024 * @param string $installed The plugin folder name with file name
1111 1025 */
1112 1026 protected static function maybe_activate_addon( $installed ) {
1113 1027 if ( ! $installed ) {
@@ -1113,9 +1027,9 @@
1113 1027 if ( ! $installed ) {
1114 1028 return;
1115 1029 }
1116 1030
1117 - $activate = self::activate_plugin( $installed );
1031 + $activate = activate_plugin( $installed );
1118 1032 if ( is_wp_error( $activate ) ) {
1119 1033 // Ignore the invalid header message that shows with nested plugins.
1120 1034 if ( $activate->get_error_code() !== 'no_plugin_header' ) {
1121 1035 if ( wp_doing_ajax() ) {
@@ -1133,10 +1047,8 @@
1133 1047 /**
1134 1048 * Run security checks before installing
1135 1049 *
1136 1050 * @since 3.04.02
1137 - *
1138 - * @return void
1139 1051 */
1140 1052 protected static function install_addon_permissions() {
1141 1053 check_ajax_referer( 'frm_ajax', 'nonce' );
1142 1054
@@ -1147,10 +1059,8 @@
1147 1059 }
1148 1060
1149 1061 /**
1150 1062 * @since 4.08
1151 - *
1152 - * @return string
1153 1063 */
1154 1064 public static function connect_link() {
1155 1065 $auth = get_option( 'frm_connect_token' );
1156 1066 if ( empty( $auth ) ) {
@@ -1207,9 +1117,9 @@
1207 1117 // Delete so cannot replay.
1208 1118 delete_option( 'frm_connect_token' );
1209 1119
1210 1120 // It's already installed and active.
1211 - $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
1121 + $active = activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
1212 1122 if ( is_wp_error( $active ) ) {
1213 1123 // Download plugin now.
1214 1124 $response = self::download_and_activate();
1215 1125 if ( is_array( $response ) && isset( $response['success'] ) ) {
@@ -1260,9 +1170,8 @@
1260 1170 /**
1261 1171 * Render a conditional action button for an add on
1262 1172 *
1263 1173 * @since 4.09.01
1264 - *
1265 1174 * @param array $addon
1266 1175 * @param string|false $license_type
1267 1176 * @param string $plan_required
1268 1177 * @param string $upgrade_link
@@ -1276,12 +1185,8 @@
1276 1185 }
1277 1186
1278 1187 /**
1279 1188 * @since 4.09.01
1280 - *
1281 - * @param array|false $addon
1282 - *
1283 - * @return void
1284 1189 */
1285 1190 protected static function addon_upgrade_link( $addon, $upgrade_link ) {
1286 1191 if ( $addon ) {
1287 1192 $upgrade_link .= '&utm_content=' . $addon['slug'];
@@ -1291,9 +1196,9 @@
1291 1196 // Solutions will go to a separate page.
1292 1197 $upgrade_link = FrmAppHelper::admin_upgrade_link( 'addons', $addon['link'] );
1293 1198 }
1294 1199 ?>
1295 - <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' ); ?>">
1200 + <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' ); ?>">
1296 1201 <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?>
1297 1202 </a>
1298 1203 <?php
1299 1204 }
@@ -1299,19 +1204,13 @@
1299 1204 }
1300 1205
1301 1206 /**
1302 1207 * @since 3.04.02
1303 - *
1304 - * @return void
1305 1208 */
1306 1209 public static function ajax_install_addon() {
1307 1210 self::install_addon_permissions();
1308 1211
1309 - $result = self::download_and_activate();
1310 - if ( isset( $result['success'] ) && ! $result['success'] ) {
1311 - echo json_encode( $result );
1312 - wp_die();
1313 - }
1212 + self::download_and_activate();
1314 1213
1315 1214 echo json_encode( self::get_addon_activation_response() );
1316 1215 wp_die();
1317 1216 }
@@ -1317,12 +1216,9 @@
1317 1216 }
1318 1217
1319 1218 /**
1320 1219 * @since 4.06.02
1321 - *
1322 1220 * @deprecated 4.09.01
1323 - *
1324 - * @return void
1325 1221 */
1326 1222 public static function ajax_multiple_addons() {
1327 1223 FrmDeprecated::ajax_multiple_addons();
1328 1224 }
@@ -1369,14 +1265,10 @@
1369 1265 }
1370 1266
1371 1267 /**
1372 1268 * @since 3.04.03
1373 - *
1374 1269 * @deprecated 3.06
1375 - *
1376 1270 * @codeCoverageIgnore
1377 - *
1378 - * @return void
1379 1271 */
1380 1272 public static function reset_cached_addons( $license = '' ) {
1381 1273 FrmDeprecated::reset_cached_addons( $license );
1382 1274 }
@@ -1410,12 +1302,9 @@
1410 1302 }
1411 1303
1412 1304 /**
1413 1305 * @deprecated 3.04.03
1414 - *
1415 1306 * @codeCoverageIgnore
1416 - *
1417 - * @return void
1418 1307 */
1419 1308 public static function get_licenses() {
1420 1309 FrmDeprecated::get_licenses();
1421 1310 }