| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | * Version of the database we are moving to. |
| 10 | 10 | * |
| 11 | 11 | * @var int |
| 12 | 12 | */ |
| 13 | - public static $db_version = 104; | |
| 13 | + public static $db_version = 103; | |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Used by the API add-on. |
| 17 | 17 | * |
| @@ -28,9 +28,9 @@ | ||
| 28 | 28 | * @since 2.0 |
| 29 | 29 | * |
| 30 | 30 | * @var string |
| 31 | 31 | */ |
| 32 | - public static $plug_version = '6.25'; | |
| 32 | + public static $plug_version = '6.22.1'; | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * @var bool |
| 36 | 36 | */ |
| @@ -55,9 +55,9 @@ | ||
| 55 | 55 | /** |
| 56 | 56 | * @return string |
| 57 | 57 | */ |
| 58 | 58 | public static function plugin_path() { |
| 59 | - return dirname( __DIR__, 2 ); | |
| 59 | + return dirname( dirname( __DIR__ ) ); | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * @return string |
| @@ -127,9 +127,9 @@ | ||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $anchor = ''; |
| 130 | 130 | if ( is_array( $args ) ) { |
| 131 | - $medium = $args['medium'] ?? ''; | |
| 131 | + $medium = isset( $args['medium'] ) ? $args['medium'] : ''; | |
| 132 | 132 | if ( isset( $args['content'] ) ) { |
| 133 | 133 | $content = $args['content']; |
| 134 | 134 | } |
| 135 | 135 | if ( isset( $args['anchor'] ) ) { |
| @@ -214,9 +214,9 @@ | ||
| 214 | 214 | */ |
| 215 | 215 | public static function get_menu_name() { |
| 216 | 216 | $frm_settings = self::get_settings(); |
| 217 | 217 | |
| 218 | - return FrmAddonsController::is_license_expired() || ! self::pro_is_installed() ? 'Formidable' : $frm_settings->menu; | |
| 218 | + return FrmAddonsController::is_license_expired() ? 'Formidable' : $frm_settings->menu; | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
| 222 | 222 | * Determine if the current branding is set to 'formidable'. |
| @@ -662,9 +662,9 @@ | ||
| 662 | 662 | continue; |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | $p = trim( $p, ']' ); |
| 666 | - $value = $value[ $p ] ?? $default; | |
| 666 | + $value = isset( $value[ $p ] ) ? $value[ $p ] : $default; | |
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | return $value; |
| @@ -1023,9 +1023,9 @@ | ||
| 1023 | 1023 | if ( $allowed === 'all' ) { |
| 1024 | 1024 | $allowed_html = $html; |
| 1025 | 1025 | } elseif ( ! empty( $allowed ) ) { |
| 1026 | 1026 | foreach ( (array) $allowed as $a ) { |
| 1027 | - $allowed_html[ $a ] = $html[ $a ] ?? array(); | |
| 1027 | + $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array(); | |
| 1028 | 1028 | } |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | return apply_filters( 'frm_striphtml_allowed_tags', $allowed_html ); |
| @@ -1290,9 +1290,8 @@ | ||
| 1290 | 1290 | */ |
| 1291 | 1291 | public static function add_allowed_icon_tags( $allowed_html ) { |
| 1292 | 1292 | $allowed_html['svg']['data-open'] = true; |
| 1293 | 1293 | $allowed_html['svg']['title'] = true; |
| 1294 | - $allowed_html['svg']['tabindex'] = true; | |
| 1295 | 1294 | return $allowed_html; |
| 1296 | 1295 | } |
| 1297 | 1296 | |
| 1298 | 1297 | /** |
| @@ -1540,9 +1539,8 @@ | ||
| 1540 | 1539 | 'tosearch' => '', |
| 1541 | 1540 | 'text' => __( 'Search', 'formidable' ), |
| 1542 | 1541 | 'input_id' => '', |
| 1543 | 1542 | 'value' => false, |
| 1544 | - 'class' => '', | |
| 1545 | 1543 | ); |
| 1546 | 1544 | $atts = array_merge( $defaults, $atts ); |
| 1547 | 1545 | |
| 1548 | 1546 | if ( $atts['input_id'] === 'template' && empty( $atts['tosearch'] ) ) { |
| @@ -1575,13 +1573,13 @@ | ||
| 1575 | 1573 | if ( ! empty( $atts['tosearch'] ) ) { |
| 1576 | 1574 | $input_atts['autocomplete'] = 'off'; |
| 1577 | 1575 | } |
| 1578 | 1576 | ?> |
| 1579 | - <p class="frm-search <?php echo esc_attr( $atts['class'] ); ?>"> | |
| 1577 | + <p class="frm-search"> | |
| 1580 | 1578 | <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"> |
| 1581 | 1579 | <?php echo esc_html( $atts['text'] ); ?>: |
| 1582 | 1580 | </label> |
| 1583 | - <?php self::icon_by_class( 'frm_icon_font frm_search_icon frm_svg20' ); ?> | |
| 1581 | + <span class="frmfont frm_search_icon"></span> | |
| 1584 | 1582 | <input <?php self::array_to_html_params( $input_atts, true ); ?> /> |
| 1585 | 1583 | <?php |
| 1586 | 1584 | if ( empty( $atts['tosearch'] ) ) { |
| 1587 | 1585 | submit_button( $atts['text'], 'button-secondary', '', false, array( 'id' => 'search-submit' ) ); |
| @@ -1832,10 +1830,10 @@ | ||
| 1832 | 1830 | * @return array |
| 1833 | 1831 | */ |
| 1834 | 1832 | private static function get_dropdown_value_and_label_from_option( $option, $key, $args ) { |
| 1835 | 1833 | if ( is_array( $option ) ) { |
| 1836 | - $value = $option[ $args['value_key'] ] ?? ''; | |
| 1837 | - $label = $option[ $args['label_key'] ] ?? ''; | |
| 1834 | + $value = isset( $option[ $args['value_key'] ] ) ? $option[ $args['value_key'] ] : ''; | |
| 1835 | + $label = isset( $option[ $args['label_key'] ] ) ? $option[ $args['label_key'] ] : ''; | |
| 1838 | 1836 | } else { |
| 1839 | 1837 | $value = $key; |
| 1840 | 1838 | $label = $option; |
| 1841 | 1839 | } |
| @@ -2009,9 +2007,9 @@ | ||
| 2009 | 2007 | |
| 2010 | 2008 | foreach ( $editable_roles as $role => $details ) { |
| 2011 | 2009 | $name = translate_user_role( $details['name'] ); |
| 2012 | 2010 | ?> |
| 2013 | - <option value="<?php echo esc_attr( $role ); ?>" <?php self::selected( $capability, $role ); ?>><?php echo esc_html( $name ); ?></option> | |
| 2011 | + <option value="<?php echo esc_attr( $role ); ?>" <?php self::selected( $capability, $role ); ?>><?php echo esc_html( $name ); ?> </option> | |
| 2014 | 2012 | <?php |
| 2015 | 2013 | unset( $role, $details ); |
| 2016 | 2014 | } |
| 2017 | 2015 | } |
| @@ -2040,8 +2038,14 @@ | ||
| 2040 | 2038 | * @param array<string,string> $pro_cap |
| 2041 | 2039 | */ |
| 2042 | 2040 | $pro_cap = apply_filters( 'frm_pro_capabilities', $pro_cap ); |
| 2043 | 2041 | |
| 2042 | + if ( ! array_key_exists( 'frm_edit_displays', $pro_cap ) && is_callable( 'FrmProAppHelper::views_is_installed' ) && FrmProAppHelper::views_is_installed() ) { | |
| 2043 | + // For backward compatibility, add the Add/Edit Views permission if Pro is not up to date. | |
| 2044 | + // This was added in 6.5.4. Remove this in the future. | |
| 2045 | + $pro_cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' ); | |
| 2046 | + } | |
| 2047 | + | |
| 2044 | 2048 | if ( 'pro_only' === $type ) { |
| 2045 | 2049 | return $pro_cap; |
| 2046 | 2050 | } |
| 2047 | 2051 | |
| @@ -2529,13 +2533,13 @@ | ||
| 2529 | 2533 | * @param int $num_chars |
| 2530 | 2534 | * @return string |
| 2531 | 2535 | */ |
| 2532 | 2536 | public static function generate_new_key( $num_chars ) { |
| 2533 | - $max_slug_value = 36 ** $num_chars; | |
| 2537 | + $max_slug_value = pow( 36, $num_chars ); | |
| 2534 | 2538 | |
| 2535 | 2539 | // We want to have at least 2 characters in the slug. |
| 2536 | 2540 | $min_slug_value = 37; |
| 2537 | - return base_convert( random_int( $min_slug_value, $max_slug_value ), 10, 36 ); | |
| 2541 | + return base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 ); | |
| 2538 | 2542 | } |
| 2539 | 2543 | |
| 2540 | 2544 | /** |
| 2541 | 2545 | * @param string $key |
| @@ -2587,9 +2591,9 @@ | ||
| 2587 | 2591 | 'fields' => array(), |
| 2588 | 2592 | ); |
| 2589 | 2593 | |
| 2590 | 2594 | foreach ( array( 'name', 'description' ) as $var ) { |
| 2591 | - $default_val = $record->{$var} ?? ''; | |
| 2595 | + $default_val = isset( $record->{$var} ) ? $record->{$var} : ''; | |
| 2592 | 2596 | $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
| 2593 | 2597 | unset( $var, $default_val ); |
| 2594 | 2598 | } |
| 2595 | 2599 | |
| @@ -2614,9 +2618,9 @@ | ||
| 2614 | 2618 | if ( ! self::is_admin_page() ) { |
| 2615 | 2619 | // Don't prep default values on the form settings page. |
| 2616 | 2620 | $field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true ); |
| 2617 | 2621 | } |
| 2618 | - $args['parent_form_id'] = $args['parent_form_id'] ?? $field->form_id; | |
| 2622 | + $args['parent_form_id'] = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id; | |
| 2619 | 2623 | self::fill_field_defaults( $field, $record, $values, $args ); |
| 2620 | 2624 | } |
| 2621 | 2625 | } |
| 2622 | 2626 | } |
| @@ -2644,9 +2648,9 @@ | ||
| 2644 | 2648 | } else { |
| 2645 | 2649 | $meta_value = FrmEntryMeta::get_meta_value( $record, $field->id ); |
| 2646 | 2650 | }//end if |
| 2647 | 2651 | |
| 2648 | - $field_type = $post_values['field_options'][ 'type_' . $field->id ] ?? $field->type; | |
| 2652 | + $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type; | |
| 2649 | 2653 | if ( isset( $post_values['item_meta'][ $field->id ] ) ) { |
| 2650 | 2654 | $new_value = $post_values['item_meta'][ $field->id ]; |
| 2651 | 2655 | self::unserialize_or_decode( $new_value ); |
| 2652 | 2656 | } else { |
| @@ -2748,9 +2752,9 @@ | ||
| 2748 | 2752 | } |
| 2749 | 2753 | |
| 2750 | 2754 | foreach ( array( 'before', 'after', 'submit' ) as $h ) { |
| 2751 | 2755 | if ( ! isset( $values[ $h . '_html' ] ) ) { |
| 2752 | - $values[ $h . '_html' ] = ( $post_values['options'][ $h . '_html' ] ?? FrmFormsHelper::get_default_html( $h ) ); | |
| 2756 | + $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) ); | |
| 2753 | 2757 | } |
| 2754 | 2758 | unset( $h ); |
| 2755 | 2759 | } |
| 2756 | 2760 | } |
| @@ -3174,9 +3178,9 @@ | ||
| 3174 | 3178 | |
| 3175 | 3179 | public static function maybe_add_tooltip( $name, $class = 'closed', $form_name = '' ) { |
| 3176 | 3180 | $tooltips = array( |
| 3177 | 3181 | 'action_title' => __( 'Give this action a label for easy reference.', 'formidable' ), |
| 3178 | - 'email_to' => __( 'Add one or more recipient addresses separated by a ",". FORMAT: Name <[email protected]> or [email protected]. [default-email] is the address set in the global "Default Email Address" settings.', 'formidable' ), | |
| 3182 | + 'email_to' => __( 'Add one or more recipient addresses separated by a ",". FORMAT: Name <[email protected]> or [email protected]. [admin_email] is the address set in WP General Settings.', 'formidable' ), | |
| 3179 | 3183 | 'cc' => __( 'Add CC addresses separated by a ",". FORMAT: Name <[email protected]> or [email protected].', 'formidable' ), |
| 3180 | 3184 | 'bcc' => __( 'Add BCC addresses separated by a ",". FORMAT: Name <[email protected]> or [email protected].', 'formidable' ), |
| 3181 | 3185 | 'reply_to' => __( 'If you would like a different reply to address than the "from" address, add a single address here. FORMAT: Name <[email protected]> or [email protected].', 'formidable' ), |
| 3182 | 3186 | 'from' => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ), |
| @@ -3903,8 +3907,14 @@ | ||
| 3903 | 3907 | |
| 3904 | 3908 | $new_args['options'] = (array) $new_args['options']; |
| 3905 | 3909 | $new_args['input_attrs'] = (array) $new_args['input_attrs']; |
| 3906 | 3910 | |
| 3911 | + // Set the number of columns. | |
| 3912 | + $new_args['col_class'] = ceil( 12 / count( $new_args['options'] ) ); | |
| 3913 | + if ( $new_args['col_class'] > 6 ) { | |
| 3914 | + $new_args['col_class'] = ceil( $new_args['col_class'] / 2 ); | |
| 3915 | + } | |
| 3916 | + | |
| 3907 | 3917 | /** |
| 3908 | 3918 | * Allows modifying the arguments of images_dropdown() method. |
| 3909 | 3919 | * |
| 3910 | 3920 | * @since 5.0.04 |
| @@ -4214,18 +4224,15 @@ | ||
| 4214 | 4224 | return array_key_exists( 'status', $link ) || array_key_exists( 'class', $link ); |
| 4215 | 4225 | } |
| 4216 | 4226 | |
| 4217 | 4227 | /** |
| 4218 | - * Enhances upgrade data parameters with installation link and plan requirement information. | |
| 4219 | - * | |
| 4220 | 4228 | * @since 5.0.17 |
| 4221 | 4229 | * |
| 4222 | - * @param string $plugin The plugin slug to get installation data for. | |
| 4223 | - * @param array $params Initial parameters for the upgrade data. | |
| 4224 | - * @param bool $detailed Whether to include detailed information. | |
| 4225 | - * @return array Modified parameters with installation data. | |
| 4230 | + * @param string $plugin | |
| 4231 | + * @param array $params | |
| 4232 | + * @return array | |
| 4226 | 4233 | */ |
| 4227 | - public static function get_upgrade_data_params( $plugin, $params, $detailed = false ) { | |
| 4234 | + public static function get_upgrade_data_params( $plugin, $params ) { | |
| 4228 | 4235 | $link = FrmAddonsController::install_link( $plugin ); |
| 4229 | 4236 | if ( ! $link ) { |
| 4230 | 4237 | return $params; |
| 4231 | 4238 | } |
| @@ -4236,15 +4243,11 @@ | ||
| 4236 | 4243 | if ( ! isset( $params['medium'] ) ) { |
| 4237 | 4244 | $params['medium'] = $plugin; |
| 4238 | 4245 | } |
| 4239 | 4246 | } else { |
| 4240 | - $params['requires'] = $params['requires'] ?? FrmFormsHelper::get_plan_required( $link ); | |
| 4247 | + $params['requires'] = FrmFormsHelper::get_plan_required( $link ); | |
| 4241 | 4248 | } |
| 4242 | 4249 | |
| 4243 | - if ( $detailed ) { | |
| 4244 | - $params['plugin-status'] = $link['status'] ?? ''; | |
| 4245 | - } | |
| 4246 | - | |
| 4247 | 4250 | return $params; |
| 4248 | 4251 | } |
| 4249 | 4252 | |
| 4250 | 4253 | /** |
| @@ -4592,26 +4595,6 @@ | ||
| 4592 | 4595 | */ |
| 4593 | 4596 | public static function no_gdpr_cookies() { |
| 4594 | 4597 | $frm_settings = self::get_settings(); |
| 4595 | 4598 | return $frm_settings->enable_gdpr && $frm_settings->no_gdpr_cookies; |
| 4596 | - } | |
| 4597 | - | |
| 4598 | - /** | |
| 4599 | - * Check if a string is valid UTF-8. | |
| 4600 | - * | |
| 4601 | - * @since 6.24 | |
| 4602 | - * | |
| 4603 | - * @param string $string The string to check. | |
| 4604 | - * @return bool | |
| 4605 | - */ | |
| 4606 | - public static function is_valid_utf8( $string ) { | |
| 4607 | - // wp_is_valid_utf8 is added in WP 6.9. | |
| 4608 | - if ( function_exists( 'wp_is_valid_utf8' ) ) { | |
| 4609 | - return wp_is_valid_utf8( $string ); | |
| 4610 | - } | |
| 4611 | - // As of WP 6.9, seems_utf8 is deprecated. | |
| 4612 | - if ( function_exists( 'seems_utf8' ) ) { | |
| 4613 | - return seems_utf8( $string ); | |
| 4614 | - } | |
| 4615 | - return false; | |
| 4616 | 4599 | } |
| 4617 | 4600 | } |