PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7.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 +45 -32 6.5.16.7.2 View file →
@@ -297,12 +297,13 @@
297 297 }
298 298
299 299 /**
300 300 * @since 4.08
301 + * @since 6.7 This is public.
301 302 *
302 303 * @return array|false
303 304 */
304 - protected static function get_primary_license_info() {
305 + public static function get_primary_license_info() {
305 306 $installed_addons = apply_filters( 'frm_installed_addons', array() );
306 307 if ( empty( $installed_addons ) || ! isset( $installed_addons['formidable_pro'] ) ) {
307 308 return false;
308 309 }
@@ -351,20 +352,21 @@
351 352 // don't show an update if the plugin isn't installed
352 353 continue;
353 354 }
354 355
355 - $wp_plugin = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
356 - $wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
356 + $wp_plugin = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
357 + $wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
358 + $plugin->slug = explode( '/', $folder )[0];
357 359
358 360 if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
359 - $slug = explode( '/', $folder );
360 - $plugin->slug = $slug[0];
361 361 $transient->response[ $folder ] = $plugin;
362 + } else {
363 + $transient->no_update[ $folder ] = $plugin;
362 364 }
363 365
364 366 $transient->checked[ $folder ] = $wp_version;
365 367
366 - }
368 + }//end foreach
367 369
368 370 return $transient;
369 371 }
370 372
@@ -387,9 +389,9 @@
387 389 * Check if a plugin is installed before showing an update for it
388 390 *
389 391 * @since 3.05
390 392 *
391 - * @param string $plugin - the folder/filename.php for a plugin
393 + * @param string $plugin The folder/filename.php for a plugin.
392 394 *
393 395 * @return bool - True if installed
394 396 */
395 397 protected static function is_installed( $plugin ) {
@@ -444,9 +446,9 @@
444 446 'code' => $addon_info['error']['code'],
445 447 );
446 448 }
447 449 }
448 - }
450 + }//end foreach
449 451
450 452 return $version_info;
451 453 }
452 454
@@ -453,9 +455,9 @@
453 455 /**
454 456 * Get the action link for an addon that isn't active.
455 457 *
456 458 * @since 3.06.03
457 - * @param string $plugin The plugin slug
459 + * @param string $plugin The plugin slug.
458 460 * @return array
459 461 */
460 462 public static function install_link( $plugin ) {
461 463 $link = array();
@@ -485,9 +487,9 @@
485 487 $link = array(
486 488 'url' => 'formidable-' . $plugin . '/formidable-' . $plugin . '.php',
487 489 'class' => 'frm-activate-addon',
488 490 );
489 - }
491 + }//end if
490 492
491 493 return $link;
492 494 }
493 495
@@ -492,9 +494,9 @@
492 494 }
493 495
494 496 /**
495 497 * @since 4.09
496 - * @param string $plugin The plugin slug
498 + * @param string $plugin The plugin slug.
497 499 * @return array|false
498 500 */
499 501 protected static function get_addon( $plugin ) {
500 502 $addons = self::get_api_addons();
@@ -523,10 +525,10 @@
523 525
524 526 /**
525 527 * @since 3.04.03
526 528 *
527 - * @param array $addons
528 - * @param object $license The FrmAddon object
529 + * @param array $addons
530 + * @param object $license The FrmAddon object.
529 531 *
530 532 * @return array
531 533 */
532 534 public static function get_addon_for_license( $addons, $license ) {
@@ -603,9 +605,9 @@
603 605 self::prepare_addon_link( $addon['link'] );
604 606
605 607 self::set_addon_status( $addon );
606 608 $addons[ $id ] = $addon;
607 - }
609 + }//end foreach
608 610 }
609 611
610 612 /**
611 613 * @return bool
@@ -937,9 +939,9 @@
937 939 *
938 940 * @return string
939 941 */
940 942 protected static function get_current_plugin() {
941 - if ( ! isset( self::$plugin ) ) {
943 + if ( empty( self::$plugin ) ) {
942 944 self::$plugin = FrmAppHelper::get_param( 'plugin', '', 'post', 'esc_url_raw' );
943 945 }
944 946 return self::$plugin;
945 947 }
@@ -1023,10 +1025,8 @@
1023 1025 *
1024 1026 * @since 3.04.02
1025 1027 */
1026 1028 protected static function install_addon() {
1027 - FrmAppHelper::permission_check( 'install_plugins' );
1028 -
1029 1029 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1030 1030
1031 1031 $download_url = self::get_current_plugin();
1032 1032
@@ -1109,9 +1109,9 @@
1109 1109
1110 1110 /**
1111 1111 * @since 3.04.02
1112 1112 *
1113 - * @param string $installed The plugin folder name with file name
1113 + * @param string $installed The plugin folder name with file name.
1114 1114 */
1115 1115 protected static function maybe_activate_addon( $installed ) {
1116 1116 if ( ! $installed ) {
1117 1117 return;
@@ -1179,17 +1179,13 @@
1179 1179 *
1180 1180 * @return bool
1181 1181 */
1182 1182 public static function can_install_addon_api() {
1183 - if ( ! current_user_can( 'activate_plugins' ) ) {
1184 - return false;
1185 - }
1186 -
1187 1183 // Verify params present (auth & download link).
1188 1184 $post_auth = FrmAppHelper::get_param( 'token', '', 'request', 'sanitize_text_field' );
1189 1185 $post_url = FrmAppHelper::get_param( 'file_url', '', 'request', 'sanitize_text_field' );
1190 1186
1191 - if ( empty( $post_auth ) || empty( $post_url ) ) {
1187 + if ( ! $post_auth || ! $post_url ) {
1192 1188 return false;
1193 1189 }
1194 1190
1195 1191 // Verify auth.
@@ -1249,21 +1245,32 @@
1249 1245
1250 1246 /**
1251 1247 * Render a conditional action button for a specified plugin
1252 1248 *
1253 - * @param string $plugin
1249 + * @since 4.09
1250 + *
1251 + * @param string $plugin
1254 1252 * @param array|string $upgrade_link_args
1255 - * @since 4.09
1253 + * @return void
1256 1254 */
1257 1255 public static function conditional_action_button( $plugin, $upgrade_link_args ) {
1258 1256 if ( is_callable( 'FrmProAddonsController::conditional_action_button' ) ) {
1259 - return FrmProAddonsController::conditional_action_button( $plugin, $upgrade_link_args );
1257 + FrmProAddonsController::conditional_action_button( $plugin, $upgrade_link_args );
1258 + return;
1260 1259 }
1261 1260
1262 1261 $addon = self::get_addon( $plugin );
1263 1262 $upgrade_link = FrmAppHelper::admin_upgrade_link( $upgrade_link_args );
1264 1263
1264 + if ( ! is_array( $upgrade_link_args ) ) {
1265 + // A string $upgrade_link_args is used for the utm-medium value when calling
1266 + // FrmAppHelper::admin_upgrade_link above.
1267 + // For self::addon_upgrade_link, we'll pass just an empty array with the link key (set below).
1268 + $upgrade_link_args = array();
1269 + }
1270 +
1265 1271 $upgrade_link_args['link'] = $upgrade_link;
1272 +
1266 1273 self::addon_upgrade_link( $addon, $upgrade_link_args );
1267 1274 }
1268 1275
1269 1276 /**
@@ -1270,16 +1277,22 @@
1270 1277 * Render a conditional action button for an add on
1271 1278 *
1272 1279 * @since 4.09.01
1273 1280 *
1274 - * @param array $addon
1275 - * @param string|false $license_type
1276 - * @param string $plan_required
1277 - * @param string $upgrade_link
1281 + * @param array $atts {
1282 + * Button attributes.
1283 + *
1284 + * @type array $addon
1285 + * @type string|false $license_type
1286 + * @type string $plan_required
1287 + * @type string $upgrade_link
1288 + * }
1289 + * @return void
1278 1290 */
1279 1291 public static function show_conditional_action_button( $atts ) {
1280 1292 if ( is_callable( 'FrmProAddonsController::show_conditional_action_button' ) ) {
1281 - return FrmProAddonsController::show_conditional_action_button( $atts );
1293 + FrmProAddonsController::show_conditional_action_button( $atts );
1294 + return;
1282 1295 }
1283 1296
1284 1297 self::addon_upgrade_link( $atts['addon'], $atts['upgrade_link'] );
1285 1298 }
@@ -1459,9 +1472,9 @@
1459 1472 * @deprecated 3.04.03
1460 1473 * @codeCoverageIgnore
1461 1474 *
1462 1475 * @param boolean $return
1463 - * @param string $package
1476 + * @param string $package
1464 1477 *
1465 1478 * @return boolean
1466 1479 */
1467 1480 public static function add_shorten_edd_filename_filter( $return, $package ) {