PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.5.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.5.2
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 +9 -158 6.5.35.5.2 View file →
@@ -18,9 +18,9 @@
18 18 return;
19 19 }
20 20
21 21 $label = __( 'Add-Ons', 'formidable' );
22 - $label = '<span style="color:#1da867">' . $label . '</span>';
22 + $label = '<span style="color:#fe5a1d">' . $label . '</span>';
23 23
24 24 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Add-Ons', 'formidable' ), $label, 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
25 25
26 26 if ( ! FrmAppHelper::pro_is_installed() ) {
@@ -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'] ) ) {
@@ -544,11 +530,8 @@
544 530
545 531 return $plugin;
546 532 }
547 533
548 - /**
549 - * @return void
550 - */
551 534 protected static function prepare_addons( &$addons ) {
552 535 $activate_url = '';
553 536 if ( current_user_can( 'activate_plugins' ) ) {
554 537 $activate_url = add_query_arg( array( 'action' => 'activate' ), admin_url( 'plugins.php' ) );
@@ -606,11 +589,8 @@
606 589 $addons[ $id ] = $addon;
607 590 }
608 591 }
609 592
610 - /**
611 - * @return bool
612 - */
613 593 private static function is_plugin_active( $file_name, $slug ) {
614 594 if ( 'formidable-views/formidable-views.php' === $file_name ) {
615 595 return self::get_active_views_version() === $slug;
616 596 }
@@ -629,10 +609,8 @@
629 609 }
630 610
631 611 /**
632 612 * @since 3.04.02
633 - *
634 - * @return void
635 613 */
636 614 protected static function prepare_addon_link( &$link ) {
637 615 $site_url = 'https://formidableforms.com/';
638 616 if ( strpos( $link, 'http' ) !== 0 ) {
@@ -651,10 +629,8 @@
651 629 * Add the status to the addon array. Status options are:
652 630 * installed, active, not installed
653 631 *
654 632 * @since 3.04.02
655 - *
656 - * @return void
657 633 */
658 634 protected static function set_addon_status( &$addon ) {
659 635 if ( ! empty( $addon['activate_url'] ) ) {
660 636 $addon['status'] = array(
@@ -673,11 +649,8 @@
673 649 );
674 650 }
675 651 }
676 652
677 - /**
678 - * @return void
679 - */
680 653 public static function upgrade_to_pro() {
681 654 FrmAppHelper::include_svg();
682 655
683 656 $link_parts = array(
@@ -887,10 +860,8 @@
887 860 /**
888 861 * Install Pro after connection with Formidable.
889 862 *
890 863 * @since 4.02.05
891 - *
892 - * @return void
893 864 */
894 865 public static function connect_pro() {
895 866 FrmAppHelper::permission_check( 'install_plugins' );
896 867 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -962,10 +933,8 @@
962 933 }
963 934
964 935 /**
965 936 * @since 3.04.02
966 - *
967 - * @return void
968 937 */
969 938 protected static function maybe_show_cred_form() {
970 939 if ( ! function_exists( 'request_filesystem_credentials' ) ) {
971 940 include_once( ABSPATH . 'wp-admin/includes/file.php' );
@@ -1002,23 +971,8 @@
1002 971 ob_end_clean();
1003 972 }
1004 973
1005 974 /**
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 975 * We do not need any extra credentials if we have gotten this far,
1022 976 * so let's install the plugin.
1023 977 *
1024 978 * @since 3.04.02
@@ -1027,15 +981,8 @@
1027 981 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1028 982
1029 983 $download_url = self::get_current_plugin();
1030 984
1031 - if ( ! self::url_is_allowed( $download_url ) ) {
1032 - return array(
1033 - 'message' => 'Plugin URL is not valid',
1034 - 'success' => false,
1035 - );
1036 - }
1037 -
1038 985 // Create the plugin upgrader with our custom skin.
1039 986 $installer = new Plugin_Upgrader( new FrmInstallerSkin() );
1040 987 $installer->install( $download_url );
1041 988
@@ -1053,10 +1000,8 @@
1053 1000 }
1054 1001
1055 1002 /**
1056 1003 * @since 3.06.03
1057 - *
1058 - * @return void
1059 1004 */
1060 1005 public static function ajax_activate_addon() {
1061 1006
1062 1007 self::install_addon_permissions();
@@ -1070,17 +1015,15 @@
1070 1015 wp_die();
1071 1016 }
1072 1017
1073 1018 /**
1074 - * @return array
1019 + * @return array|string
1075 1020 */
1076 1021 private static function get_addon_activation_response() {
1077 1022 $activating_page = self::get_activating_page();
1078 1023
1079 - $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' );
1080 -
1081 1024 $response = array(
1082 - 'message' => $message,
1025 + 'message' => __( 'Your plugin has been activated. Would you like to save and reload the page now?', 'formidable' ),
1083 1026 'saveAndReload' => $activating_page,
1084 1027 );
1085 1028
1086 1029 return $response;
@@ -1106,9 +1049,8 @@
1106 1049 }
1107 1050
1108 1051 /**
1109 1052 * @since 3.04.02
1110 - *
1111 1053 * @param string $installed The plugin folder name with file name
1112 1054 */
1113 1055 protected static function maybe_activate_addon( $installed ) {
1114 1056 if ( ! $installed ) {
@@ -1134,10 +1076,8 @@
1134 1076 /**
1135 1077 * Run security checks before installing
1136 1078 *
1137 1079 * @since 3.04.02
1138 - *
1139 - * @return void
1140 1080 */
1141 1081 protected static function install_addon_permissions() {
1142 1082 check_ajax_referer( 'frm_ajax', 'nonce' );
1143 1083
@@ -1148,10 +1088,8 @@
1148 1088 }
1149 1089
1150 1090 /**
1151 1091 * @since 4.08
1152 - *
1153 - * @return string
1154 1092 */
1155 1093 public static function connect_link() {
1156 1094 $auth = get_option( 'frm_connect_token' );
1157 1095 if ( empty( $auth ) ) {
@@ -1181,9 +1119,9 @@
1181 1119 // Verify params present (auth & download link).
1182 1120 $post_auth = FrmAppHelper::get_param( 'token', '', 'request', 'sanitize_text_field' );
1183 1121 $post_url = FrmAppHelper::get_param( 'file_url', '', 'request', 'sanitize_text_field' );
1184 1122
1185 - if ( ! $post_auth || ! $post_url ) {
1123 + if ( empty( $post_auth ) || empty( $post_url ) ) {
1186 1124 return false;
1187 1125 }
1188 1126
1189 1127 // Verify auth.
@@ -1254,11 +1192,9 @@
1254 1192 }
1255 1193
1256 1194 $addon = self::get_addon( $plugin );
1257 1195 $upgrade_link = FrmAppHelper::admin_upgrade_link( $upgrade_link_args );
1258 -
1259 - $upgrade_link_args['link'] = $upgrade_link;
1260 - self::addon_upgrade_link( $addon, $upgrade_link_args );
1196 + self::addon_upgrade_link( $addon, $upgrade_link );
1261 1197 }
1262 1198
1263 1199 /**
1264 1200 * Render a conditional action button for an add on
@@ -1263,9 +1199,8 @@
1263 1199 /**
1264 1200 * Render a conditional action button for an add on
1265 1201 *
1266 1202 * @since 4.09.01
1267 - *
1268 1203 * @param array $addon
1269 1204 * @param string|false $license_type
1270 1205 * @param string $plan_required
1271 1206 * @param string $upgrade_link
@@ -1279,18 +1214,10 @@
1279 1214 }
1280 1215
1281 1216 /**
1282 1217 * @since 4.09.01
1283 - *
1284 - * @param array|false $addon
1285 - * @param string|array $upgrade_link
1286 - *
1287 - * @return void
1288 1218 */
1289 1219 protected static function addon_upgrade_link( $addon, $upgrade_link ) {
1290 - $atts = is_array( $upgrade_link ) ? $upgrade_link : array();
1291 - $upgrade_link = is_array( $upgrade_link ) ? $upgrade_link['link'] : $upgrade_link;
1292 -
1293 1220 if ( $addon ) {
1294 1221 $upgrade_link .= '&utm_content=' . $addon['slug'];
1295 1222 }
1296 1223
@@ -1297,15 +1224,10 @@
1297 1224 if ( $addon && isset( $addon['categories'] ) && in_array( 'Solution', $addon['categories'], true ) ) {
1298 1225 // Solutions will go to a separate page.
1299 1226 $upgrade_link = FrmAppHelper::admin_upgrade_link( 'addons', $addon['link'] );
1300 1227 }
1301 -
1302 - $class = ! empty( $atts['class'] ) ? $atts['class'] : '';
1303 - if ( strpos( $class, 'frm-button' ) === false ) {
1304 - $class .= ' frm-button-secondary frm-button-sm';
1305 - }
1306 1228 ?>
1307 - <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' ); ?>">
1229 + <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' ); ?>">
1308 1230 <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?>
1309 1231 </a>
1310 1232 <?php
1311 1233 }
@@ -1311,19 +1233,13 @@
1311 1233 }
1312 1234
1313 1235 /**
1314 1236 * @since 3.04.02
1315 - *
1316 - * @return void
1317 1237 */
1318 1238 public static function ajax_install_addon() {
1319 1239 self::install_addon_permissions();
1320 1240
1321 - $result = self::download_and_activate();
1322 - if ( isset( $result['success'] ) && ! $result['success'] ) {
1323 - echo json_encode( $result );
1324 - wp_die();
1325 - }
1241 + self::download_and_activate();
1326 1242
1327 1243 echo json_encode( self::get_addon_activation_response() );
1328 1244 wp_die();
1329 1245 }
@@ -1328,68 +1244,10 @@
1328 1244 wp_die();
1329 1245 }
1330 1246
1331 1247 /**
1332 - * Allowed URLs used for internal source of plugins installation.
1333 - *
1334 - * @since 6.3.1
1335 - *
1336 - * @return array
1337 - */
1338 - private static function allowed_external_urls() {
1339 - $allowed_url_list = array(
1340 - 'https://downloads.wordpress.org/plugin/formidable-gravity-forms-importer.zip',
1341 - 'https://downloads.wordpress.org/plugin/formidable-import-pirate-forms.zip',
1342 - 'https://downloads.wordpress.org/plugin/wp-mail-smtp.zip',
1343 - );
1344 -
1345 - /**
1346 - * List of URLs used in plugin formidable internal installation.
1347 - *
1348 - * @since 6.3.1
1349 - *
1350 - * @param array $allowed_url_list List of URLs.
1351 - */
1352 - $allowed_url_list = apply_filters( 'frm_allowed_external_urls', $allowed_url_list );
1353 -
1354 - if ( ! is_array( $allowed_url_list ) ) {
1355 - _doing_it_wrong( __METHOD__, 'Only an array of URLs could be used within this filter.', '6.3.1' );
1356 -
1357 - return array();
1358 - }
1359 -
1360 - return $allowed_url_list;
1361 - }
1362 -
1363 - /**
1364 - * Gets required plan for an addon.
1365 - *
1366 - * @since 6.4.2
1367 - *
1368 - * @return string Empty string if no plan is required for active license.
1369 - */
1370 - public static function get_addon_required_plan( $addon_id ) {
1371 - $api = new FrmFormApi();
1372 - $addons = $api->get_api_info();
1373 -
1374 - if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) {
1375 - $dates = $addons[ $addon_id ];
1376 - $requires = FrmFormsHelper::get_plan_required( $dates );
1377 - }
1378 -
1379 - if ( ! isset( $requires ) || ! is_string( $requires ) ) {
1380 - $requires = '';
1381 - }
1382 -
1383 - return $requires;
1384 - }
1385 -
1386 - /**
1387 1248 * @since 4.06.02
1388 - *
1389 1249 * @deprecated 4.09.01
1390 - *
1391 - * @return void
1392 1250 */
1393 1251 public static function ajax_multiple_addons() {
1394 1252 FrmDeprecated::ajax_multiple_addons();
1395 1253 }
@@ -1436,14 +1294,10 @@
1436 1294 }
1437 1295
1438 1296 /**
1439 1297 * @since 3.04.03
1440 - *
1441 1298 * @deprecated 3.06
1442 - *
1443 1299 * @codeCoverageIgnore
1444 - *
1445 - * @return void
1446 1300 */
1447 1301 public static function reset_cached_addons( $license = '' ) {
1448 1302 FrmDeprecated::reset_cached_addons( $license );
1449 1303 }
@@ -1477,12 +1331,9 @@
1477 1331 }
1478 1332
1479 1333 /**
1480 1334 * @deprecated 3.04.03
1481 - *
1482 1335 * @codeCoverageIgnore
1483 - *
1484 - * @return void
1485 1336 */
1486 1337 public static function get_licenses() {
1487 1338 FrmDeprecated::get_licenses();
1488 1339 }