PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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 +16 -22 6.26 → trunk View file →
@@ -182,12 +182,10 @@
182 182 * @return void
183 183 */
184 184 private function init_table_style() {
185 185 if ( $this->use_inline_style === true ) {
186 -
187 186 $this->table_style = ' style="' . esc_attr( 'border-spacing:0;font-size:' . $this->style_settings['font_size'] . ';line-height:135%;' );
188 187 $this->table_style .= esc_attr( 'border-bottom:' . $this->style_settings['border_width'] . ' solid ' . $this->style_settings['border_color'] . ';' ) . '"';
189 -
190 188 }
191 189
192 190 if ( ! empty( $this->style_settings['class'] ) ) {
193 191 $this->table_style .= ' class="' . esc_attr( $this->style_settings['class'] ) . '"';
@@ -192,9 +190,9 @@
192 190 if ( ! empty( $this->style_settings['class'] ) ) {
193 191 $this->table_style .= ' class="' . esc_attr( $this->style_settings['class'] ) . '"';
194 192 }
195 193
196 - if ( ! empty( $this->width ) ) {
194 + if ( $this->width ) {
197 195 $this->table_style .= ' width="' . esc_attr( $this->width ) . '"';
198 196 }
199 197 }
200 198
@@ -205,16 +203,17 @@
205 203 *
206 204 * @return void
207 205 */
208 206 private function init_td_style() {
209 - if ( $this->use_inline_style === true ) {
207 + if ( $this->use_inline_style !== true ) {
208 + return;
209 + }
210 210
211 - $td_style_attributes = 'text-align:' . ( $this->direction === 'rtl' ? 'right' : 'left' ) . ';';
212 - $td_style_attributes .= 'color:' . $this->style_settings['text_color'] . ';padding:' . $this->cell_padding . ';vertical-align:top;';
213 - $td_style_attributes .= 'border-top:' . $this->style_settings['border_width'] . ' solid ' . $this->style_settings['border_color'] . ';';
211 + $td_style_attributes = 'text-align:' . ( $this->direction === 'rtl' ? 'right' : 'left' ) . ';';
212 + $td_style_attributes .= 'color:' . $this->style_settings['text_color'] . ';padding:' . $this->cell_padding . ';vertical-align:top;';
213 + $td_style_attributes .= 'border-top:' . $this->style_settings['border_width'] . ' solid ' . $this->style_settings['border_color'] . ';';
214 214
215 - $this->td_style = ' style="' . esc_attr( $td_style_attributes ) . '"';
216 - }
215 + $this->td_style = ' style="' . esc_attr( $td_style_attributes ) . '"';
217 216 }
218 217
219 218 /**
220 219 * Removes border CSS from HTML.
@@ -246,9 +245,9 @@
246 245 *
247 246 * @return bool
248 247 */
249 248 private function is_color_setting( $setting_key ) {
250 - return strpos( $setting_key, 'color' ) !== false;
249 + return str_contains( $setting_key, 'color' );
251 250 }
252 251
253 252 /**
254 253 * Get color markup from color setting value
@@ -263,9 +262,9 @@
263 262 $color_markup = trim( $color_markup );
264 263
265 264 // Check if each character in string is valid hex digit
266 265 if ( FrmAppHelper::ctype_xdigit( $color_markup ) ) {
267 - $color_markup = '#' . $color_markup;
266 + return '#' . $color_markup;
268 267 }
269 268
270 269 return $color_markup;
271 270 }
@@ -277,9 +276,9 @@
277 276 *
278 277 * @return string
279 278 */
280 279 private function table_row_background_color() {
281 - return ( $this->odd ? $this->style_settings['bg_color'] : $this->style_settings['alt_bg_color'] );
280 + return $this->odd ? $this->style_settings['bg_color'] : $this->style_settings['alt_bg_color'];
282 281 }
283 282
284 283 /**
285 284 * Get the table row style
@@ -290,9 +289,8 @@
290 289 *
291 290 * @return string
292 291 */
293 292 public function tr_style() {
294 -
295 293 if ( $this->type === 'shortcode' ) {
296 294 $tr_style = ' style="[frm-alt-color]"';
297 295 } elseif ( $this->use_inline_style ) {
298 296 $tr_style = ' style="background-color:' . $this->table_row_background_color() . ';"';
@@ -372,16 +370,15 @@
372 370 *
373 371 * @return string
374 372 */
375 373 public function generate_two_cell_table_row( $label, $value, $args = array() ) {
376 - $row = '<tr' . $this->tr_style();
377 - $row .= $this->add_row_class( $value === '' );
378 - $row .= '>';
379 -
374 + $row = '<tr' . $this->tr_style();
375 + $row .= $this->add_row_class( $value === '' );
376 + $row .= '>';
380 377 $label = '<th scope="row"' . $this->td_style . '>' . wp_kses_post( $label ) . '</th>';
381 378 $value = '<td' . $this->td_style . '>' . $this->filter_value_for_display( $value, $args ) . '</td>';
382 379
383 - if ( 'rtl' == $this->direction ) {
380 + if ( 'rtl' === $this->direction ) {
384 381 $row .= $value;
385 382 $row .= $label;
386 383 } else {
387 384 $row .= $label;
@@ -451,10 +448,7 @@
451 448 if ( $this->is_child ) {
452 449 $class .= ' frm-child-row';
453 450 }
454 451
455 - if ( $class ) {
456 - $class = ' class="' . trim( $class ) . '"';
457 - }
458 - return $class;
452 + return $class ? ' class="' . trim( $class ) . '"' : $class;
459 453 }
460 454 }