PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.24.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.24.1
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/FrmHtmlHelper.php +5 -15 6.316.24.1 View file →
@@ -21,9 +21,9 @@
21 21 *
22 22 * @type bool|null $echo True if you want the toggle to echo. False if you want it to return an HTML string.
23 23 * }
24 24 *
25 - * @return string|null
25 + * @return string|void
26 26 */
27 27 public static function toggle( $id, $name, $args ) {
28 28 wp_enqueue_script( 'formidable_settings' );
29 29 return FrmAppHelper::clip(
@@ -30,9 +30,9 @@
30 30 // @phpstan-ignore-next-line
31 31 function () use ( $id, $name, $args ) {
32 32 require FrmAppHelper::plugin_path() . '/classes/views/shared/toggle.php';
33 33 },
34 - $args['echo'] ?? false
34 + isset( $args['echo'] ) ? $args['echo'] : false
35 35 );
36 36 }
37 37
38 38 /**
@@ -44,9 +44,8 @@
44 44 *
45 45 * @param string $option The string used as the option label.
46 46 * @param bool $selected True if the option should be selected.
47 47 * @param array $params Other HTML params for the option.
48 - *
49 48 * @return void
50 49 */
51 50 public static function echo_dropdown_option( $option, $selected, $params = array() ) {
52 51 echo '<option ';
@@ -92,15 +91,14 @@
92 91 if ( '' !== $value && ! is_numeric( $value ) ) {
93 92 $pattern = '/^([0-9.]*)(' . implode( '|', array_map( 'preg_quote', $units ) ) . ')?$/';
94 93 preg_match( $pattern, $value, $matches );
95 94 $selected_unit = $matches[2] ?? '';
96 -
97 95 if ( ! empty( $matches[1] ) ) {
98 96 $value = $matches[1];
99 97 }
100 98 }
101 99
102 - $input_number_attrs = array_merge(
100 + $input_number_attrs = array_merge(
103 101 $args['input_number_attrs'],
104 102 array(
105 103 'type' => ! empty( $selected_unit ) ? 'number' : 'text',
106 104 'value' => $value,
@@ -106,21 +104,14 @@
106 104 'value' => $value,
107 105 'class' => trim( 'frm-unit-input-control ' . ( $args['input_number_attrs']['class'] ?? '' ) ),
108 106 )
109 107 );
110 -
111 - $hidden_value = $args['value'];
112 -
113 - if ( is_numeric( $hidden_value ) ) {
114 - $hidden_value .= $args['default_unit'];
115 - }
116 - // phpcs:disable Generic.WhiteSpace.ScopeIndent
117 108 ?>
118 109 <span class="frm-unit-input">
119 - <input type="hidden" value="<?php echo esc_attr( $hidden_value ); ?>" <?php FrmAppHelper::array_to_html_params( $args['field_attrs'], true ); ?> />
110 + <input type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php FrmAppHelper::array_to_html_params( $args['field_attrs'], true ); ?> />
120 111 <input <?php FrmAppHelper::array_to_html_params( $input_number_attrs, true ); ?> />
121 112 <span class="frm-input-group-suffix">
122 - <select aria-label="<?php esc_attr_e( 'Select unit', 'formidable' ); ?>" tabindex="0">
113 + <select aria-label="<?php echo esc_attr__( 'Select unit', 'formidable' ); ?>" tabindex="0">
123 114 <?php
124 115 foreach ( $units as $unit ) {
125 116 self::echo_dropdown_option( $unit, $unit === ( $selected_unit ?? $args['default_unit'] ), array( 'value' => $unit ) );
126 117 }
@@ -128,7 +119,6 @@
128 119 </select>
129 120 </span>
130 121 </span>
131 122 <?php
132 - // phpcs:enable Generic.WhiteSpace.ScopeIndent
133 123 }
134 124 }