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/models/FrmTableHTMLGenerator.php +15 -87 6.256.7.2 View file →
@@ -53,26 +53,8 @@
53 53 */
54 54 protected $td_style = '';
55 55
56 56 /**
57 - * Cell padding.
58 - *
59 - * @since 6.25
60 - *
61 - * @var string
62 - */
63 - protected $cell_padding = '7px 9px';
64 -
65 - /**
66 - * Table width.
67 - *
68 - * @since 6.25
69 - *
70 - * @var string
71 - */
72 - protected $width = '';
73 -
74 - /**
75 57 * Used to add a class in tables. Set in Pro.
76 58 *
77 59 * @var bool
78 60 * @since 5.4.2
@@ -87,17 +69,8 @@
87 69 */
88 70 public function __construct( $type, $atts = array() ) {
89 71
90 72 $this->type = (string) $type;
91 -
92 - if ( isset( $atts['cell_padding'] ) ) {
93 - $this->cell_padding = $atts['cell_padding'];
94 - }
95 -
96 - if ( isset( $atts['width'] ) ) {
97 - $this->width = $atts['width'];
98 - }
99 -
100 73 $this->init_style_settings( $atts );
101 74 $this->init_use_inline_style( $atts );
102 75 $this->init_direction( $atts );
103 76 $this->init_table_style();
@@ -132,9 +105,9 @@
132 105 $this->style_settings[ $key ] = $this->get_color_markup( $this->style_settings[ $key ] );
133 106 }
134 107 }
135 108
136 - $this->style_settings['class'] = $atts['class'] ?? '';
109 + $this->style_settings['class'] = isset( $atts['class'] ) ? $atts['class'] : '';
137 110 }
138 111
139 112 /**
140 113 * Set the use_inline_style property
@@ -172,9 +145,9 @@
172 145 */
173 146 private function init_table_style() {
174 147 if ( $this->use_inline_style === true ) {
175 148
176 - $this->table_style = ' style="' . esc_attr( 'border-spacing:0;font-size:' . $this->style_settings['font_size'] . ';line-height:135%;' );
149 + $this->table_style = ' style="' . esc_attr( 'font-size:' . $this->style_settings['font_size'] . ';line-height:135%;' );
177 150 $this->table_style .= esc_attr( 'border-bottom:' . $this->style_settings['border_width'] . ' solid ' . $this->style_settings['border_color'] . ';' ) . '"';
178 151
179 152 }
180 153
@@ -180,12 +153,8 @@
180 153
181 154 if ( ! empty( $this->style_settings['class'] ) ) {
182 155 $this->table_style .= ' class="' . esc_attr( $this->style_settings['class'] ) . '"';
183 156 }
184 -
185 - if ( ! empty( $this->width ) ) {
186 - $this->table_style .= ' width="' . esc_attr( $this->width ) . '"';
187 - }
188 157 }
189 158
190 159 /**
191 160 * Set the td_style property
@@ -195,43 +164,24 @@
195 164 */
196 165 private function init_td_style() {
197 166 if ( $this->use_inline_style === true ) {
198 167
199 - $td_style_attributes = 'text-align:' . ( $this->direction === 'rtl' ? 'right' : 'left' ) . ';';
200 - $td_style_attributes .= 'color:' . $this->style_settings['text_color'] . ';padding:' . $this->cell_padding . ';vertical-align:top;';
168 + $td_style_attributes = 'text-align:' . ( $this->direction == 'rtl' ? 'right' : 'left' ) . ';';
169 + $td_style_attributes .= 'color:' . $this->style_settings['text_color'] . ';padding:7px 9px;vertical-align:top;';
201 170 $td_style_attributes .= 'border-top:' . $this->style_settings['border_width'] . ' solid ' . $this->style_settings['border_color'] . ';';
202 171
203 - $this->td_style = ' style="' . esc_attr( $td_style_attributes ) . '"';
172 + $this->td_style = ' style="' . $td_style_attributes . '"';
204 173 }
205 174 }
206 175
207 176 /**
208 - * Removes border CSS from HTML.
177 + * Determine if setting is for a color, e.g. text color, background color, or border color
209 178 *
210 - * @since 6.25
179 + * @param string $setting_key Name of setting.
211 180 *
212 - * @param string $html The HTML.
213 - * @param string $position The border position. Default is `top`.
214 - * @return string
215 - */
216 - public function remove_border( $html, $position = 'top' ) {
217 - $search = sprintf(
218 - 'border-%1$s:%2$s solid %3$s;',
219 - $position,
220 - $this->style_settings['border_width'],
221 - $this->style_settings['border_color']
222 - );
223 -
224 - return str_replace( $search, '', $html );
225 - }
226 -
227 - /**
228 - * Determine if setting is for a color, e.g. text color, background color, or border color
229 - *
230 181 * @since 2.05
231 - * @param string $setting_key Name of setting.
232 182 *
233 - * @return bool
183 + * @return boolean
234 184 */
235 185 private function is_color_setting( $setting_key ) {
236 186 return strpos( $setting_key, 'color' ) !== false;
237 187 }
@@ -238,10 +188,11 @@
238 188
239 189 /**
240 190 * Get color markup from color setting value
241 191 *
192 + * @param string $color_markup value of a color setting, with format #FFFFF, FFFFFF, or white.
193 + *
242 194 * @since 2.05
243 - * @param string $color_markup value of a color setting, with format #FFFFF, FFFFFF, or white.
244 195 *
245 196 * @return string
246 197 */
247 198 private function get_color_markup( $color_markup ) {
@@ -270,13 +221,12 @@
270 221 * Get the table row style
271 222 *
272 223 * @since 2.04
273 224 * @since 5.0.16 Changed scope from `private` to `protected`.
274 - * @since 6.25 Changed scope from `protected` to `public`.
275 225 *
276 226 * @return string
277 227 */
278 - public function tr_style() {
228 + protected function tr_style() {
279 229
280 230 if ( $this->type === 'shortcode' ) {
281 231 $tr_style = ' style="[frm-alt-color]"';
282 232 } elseif ( $this->use_inline_style ) {
@@ -288,30 +238,8 @@
288 238 return $tr_style;
289 239 }
290 240
291 241 /**
292 - * Gets table style.
293 - *
294 - * @since 6.25
295 - *
296 - * @return string
297 - */
298 - public function get_table_style() {
299 - return $this->table_style;
300 - }
301 -
302 - /**
303 - * Gets td style.
304 - *
305 - * @since 6.25
306 - *
307 - * @return string
308 - */
309 - public function get_td_style() {
310 - return $this->td_style;
311 - }
312 -
313 - /**
314 242 * Switch the odd property from true to false or false to true
315 243 *
316 244 * @since 2.04
317 245 * @since 5.0.16 Changed scope from `private` to `protected`.
@@ -331,9 +259,9 @@
331 259 *
332 260 * @return string
333 261 */
334 262 public function generate_table_header() {
335 - return '<table cellspacing="0"' . $this->table_style . '><tbody>' . "\r\n";
263 + return '<table cellspacing="0" ' . $this->table_style . '><tbody>' . "\r\n";
336 264 }
337 265
338 266 /**
339 267 * Generate a table footer
@@ -356,13 +284,13 @@
356 284 *
357 285 * @return string
358 286 */
359 287 public function generate_two_cell_table_row( $label, $value ) {
360 - $row = '<tr' . $this->tr_style();
288 + $row = '<tr' . $this->tr_style();
361 289 $row .= $this->add_row_class( $value === '' );
362 290 $row .= '>';
363 291
364 - $label = '<th scope="row"' . $this->td_style . '>' . wp_kses_post( $label ) . '</th>';
292 + $label = '<th' . $this->td_style . '>' . wp_kses_post( $label ) . '</th>';
365 293 $value = '<td' . $this->td_style . '>' . wp_kses_post( $value ) . '</td>';
366 294
367 295 if ( 'rtl' == $this->direction ) {
368 296 $row .= $value;
@@ -388,9 +316,9 @@
388 316 *
389 317 * @return string
390 318 */
391 319 public function generate_single_cell_table_row( $value ) {
392 - $row = '<tr' . $this->tr_style();
320 + $row = '<tr' . $this->tr_style();
393 321 $row .= $this->add_row_class();
394 322 $row .= '>';
395 323 $row .= '<td colspan="2"' . $this->td_style . '>' . $value . '</td>';
396 324 $row .= '</tr>' . "\r\n";