PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7
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/helpers/FrmAppHelper.php +54 -12 6.56.7 View file →
@@ -3,9 +3,9 @@
3 3 die( 'You are not allowed to call this page directly.' );
4 4 }
5 5
6 6 class FrmAppHelper {
7 - public static $db_version = 98; // Version of the database we are moving to.
7 + public static $db_version = 100; // Version of the database we are moving to.
8 8 public static $pro_db_version = 37; //deprecated
9 9 public static $font_version = 7;
10 10
11 11 /**
@@ -14,12 +14,19 @@
14 14 private static $added_gmt_offset_filter = false;
15 15
16 16 /**
17 17 * @since 2.0
18 + *
19 + * @var string
18 20 */
19 - public static $plug_version = '6.5';
21 + public static $plug_version = '6.7';
20 22
21 23 /**
24 + * @var bool
25 + */
26 + private static $included_svg = false;
27 +
28 + /**
22 29 * @since 1.07.02
23 30 *
24 31 * @param none
25 32 *
@@ -148,9 +155,9 @@
148 155
149 156 public static function get_menu_name() {
150 157 $frm_settings = self::get_settings();
151 158
152 - return $frm_settings->menu;
159 + return FrmAddonsController::is_license_expired() ? 'Formidable' : $frm_settings->menu;
153 160 }
154 161
155 162 /**
156 163 * Determine if the current branding is set to 'formidable'.
@@ -394,14 +401,13 @@
394 401
395 402 /**
396 403 * Get the server OS
397 404 *
398 - * @since 6.4.x
405 + * @since 6.4.2
399 406 *
400 407 * @return string
401 408 */
402 409 public static function get_server_os() {
403 -
404 410 if ( function_exists( 'php_uname' ) ) {
405 411 return php_uname( 's' );
406 412 }
407 413
@@ -1110,11 +1116,18 @@
1110 1116 /**
1111 1117 * Include svg images.
1112 1118 *
1113 1119 * @since 4.0.02
1120 + * @return void
1114 1121 */
1115 1122 public static function include_svg() {
1116 - include_once self::plugin_path() . '/images/icons.svg';
1123 + if ( self::$included_svg ) {
1124 + return;
1125 + }
1126 +
1127 + // Use readfile instead of include_once because of a default security rule in Snuffleupagus.
1128 + readfile( self::plugin_path() . '/images/icons.svg' );
1129 + self::$included_svg = true;
1117 1130 }
1118 1131
1119 1132 /**
1120 1133 * Convert an associative array to HTML values.
@@ -1244,9 +1257,9 @@
1244 1257 do_action( $atts['link_hook']['hook'], $atts['link_hook']['param'] );
1245 1258 return;
1246 1259 }
1247 1260
1248 - if ( empty( $atts['new_link'] ) && empty( $atts['trigger_new_form_modal'] ) && empty( $atts['class'] ) ) {
1261 + if ( empty( $atts['new_link'] ) && empty( $atts['create_form'] ) && empty( $atts['class'] ) ) {
1249 1262 // Do not render a button if none of these attributes are set.
1250 1263 return;
1251 1264 }
1252 1265
@@ -1252,12 +1265,8 @@
1252 1265
1253 1266 $href = ! empty( $atts['new_link'] ) ? esc_url( $atts['new_link'] ) : '#';
1254 1267 $class = 'button button-primary frm-button-primary';
1255 1268
1256 - if ( ! empty( $atts['trigger_new_form_modal'] ) ) {
1257 - $class .= ' frm-trigger-new-form-modal';
1258 - }
1259 -
1260 1269 if ( ! empty( $atts['class'] ) ) {
1261 1270 $class .= ' ' . $atts['class'];
1262 1271 }
1263 1272
@@ -1666,9 +1675,8 @@
1666 1675 $pro_cap = array(
1667 1676 'frm_create_entries' => __( 'Add Entries from Admin Area', 'formidable' ),
1668 1677 'frm_edit_entries' => __( 'Edit Entries from Admin Area', 'formidable' ),
1669 1678 'frm_view_reports' => __( 'View Reports', 'formidable' ),
1670 - 'frm_edit_displays' => __( 'Add/Edit Views', 'formidable' ),
1671 1679 );
1672 1680 /**
1673 1681 * @since 5.3.1
1674 1682 *
@@ -1675,8 +1683,14 @@
1675 1683 * @param array<string,string> $pro_cap
1676 1684 */
1677 1685 $pro_cap = apply_filters( 'frm_pro_capabilities', $pro_cap );
1678 1686
1687 + if ( ! array_key_exists( 'frm_edit_displays', $pro_cap ) && is_callable( 'FrmProAppHelper::views_is_installed' ) && FrmProAppHelper::views_is_installed() ) {
1688 + // For backward compatibility, add the Add/Edit Views permission if Pro is not up to date.
1689 + // This was added in 6.5.4. Remove this in the future.
1690 + $pro_cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
1691 + }
1692 +
1679 1693 if ( 'pro_only' === $type ) {
1680 1694 return $pro_cap;
1681 1695 }
1682 1696
@@ -2389,11 +2403,37 @@
2389 2403
2390 2404 unset( $total_len, $word );
2391 2405 }
2392 2406
2407 + $sub = self::maybe_force_truncate_on_string_with_no_spaces( $sub, $length );
2408 +
2393 2409 return $sub . ( ( $len < $original_len ) ? $continue : '' );
2394 2410 }
2395 2411
2412 + /**
2413 + * If the string is still too long because there may not have been any spaces, force truncate.
2414 + *
2415 + * @since 6.5.4
2416 + *
2417 + * @param string $sub Current substring.
2418 + * @param int $length The length limit.
2419 + * @return string
2420 + */
2421 + private static function maybe_force_truncate_on_string_with_no_spaces( $sub, $length ) {
2422 + if ( strlen( $sub ) < $length + 50 ) {
2423 + // If the string isn't way over the limit, leave it.
2424 + return $sub;
2425 + }
2426 +
2427 + $first_space = strpos( $sub, ' ', $length );
2428 + if ( false !== $first_space ) {
2429 + // Ignore anything with spaces.
2430 + return $sub;
2431 + }
2432 +
2433 + return substr( $sub, 0, $length + 10 );
2434 + }
2435 +
2396 2436 public static function mb_function( $function_names, $args ) {
2397 2437 $mb_function_name = $function_names[0];
2398 2438 $function_name = $function_names[1];
2399 2439 if ( function_exists( $mb_function_name ) ) {
@@ -3076,8 +3116,10 @@
3076 3116 'no_items_found' => __( 'No items found.', 'formidable' ),
3077 3117 'field_already_used' => __( 'Oops. You have already used that field.', 'formidable' ),
3078 3118 'saving' => '', // Deprecated in 6.0.
3079 3119 'saved' => '', // Deprecated in 6.0.
3120 + // translators: %1$s: HTML open tag, %2$s: HTML end tag.
3121 + 'holdShiftMsg' => esc_html__( 'You can hold %1$sShift%2$s on your keyboard to select multiple fields', 'formidable' ),
3080 3122 );
3081 3123 /**
3082 3124 * @param array $admin_script_strings
3083 3125 */