| @@ -77,9 +77,9 @@ | ||
| 77 | 77 | |
| 78 | 78 | $this->init_form_id( $form_id ); |
| 79 | 79 | $this->init_fields(); |
| 80 | 80 | |
| 81 | - if ( empty( $this->fields ) ) { | |
| 81 | + if ( ! $this->fields ) { | |
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $this->init_plain_text( $atts ); |
| @@ -123,9 +123,9 @@ | ||
| 123 | 123 | * |
| 124 | 124 | * @return void |
| 125 | 125 | */ |
| 126 | 126 | protected function init_plain_text( $atts ) { |
| 127 | - if ( isset( $atts['plain_text'] ) && $atts['plain_text'] ) { | |
| 127 | + if ( ! empty( $atts['plain_text'] ) ) { | |
| 128 | 128 | $this->is_plain_text = true; |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| @@ -164,9 +164,9 @@ | ||
| 164 | 164 | * |
| 165 | 165 | * @return array|string |
| 166 | 166 | */ |
| 167 | 167 | public function content() { |
| 168 | - if ( ! $this->form_id || empty( $this->fields ) ) { | |
| 168 | + if ( ! $this->form_id || ! $this->fields ) { | |
| 169 | 169 | return ''; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if ( $this->format === 'array' ) { |
| @@ -215,11 +215,10 @@ | ||
| 215 | 215 | */ |
| 216 | 216 | protected function get_table() { |
| 217 | 217 | $content = $this->table_generator->generate_table_header(); |
| 218 | 218 | $content .= $this->generate_content_for_all_fields(); |
| 219 | - $content .= $this->table_generator->generate_table_footer(); | |
| 220 | 219 | |
| 221 | - return $content; | |
| 220 | + return $content . $this->table_generator->generate_table_footer(); | |
| 222 | 221 | } |
| 223 | 222 | |
| 224 | 223 | /** |
| 225 | 224 | * Generate the content for all fields |
| @@ -247,15 +246,13 @@ | ||
| 247 | 246 | * |
| 248 | 247 | * @return string |
| 249 | 248 | */ |
| 250 | 249 | protected function generate_field_content( $field ) { |
| 251 | - if ( in_array( $field->type, $this->skip_fields ) ) { | |
| 250 | + if ( in_array( $field->type, $this->skip_fields, true ) ) { | |
| 252 | 251 | return ''; |
| 253 | 252 | } |
| 254 | 253 | |
| 255 | - $row = $this->generate_two_cell_shortcode_row( $field ); | |
| 256 | - | |
| 257 | - return $row; | |
| 254 | + return $this->generate_two_cell_shortcode_row( $field ); | |
| 258 | 255 | } |
| 259 | 256 | |
| 260 | 257 | /** |
| 261 | 258 | * Generate a two cell row of shortcodes for an HTML or plain text table |
| @@ -267,10 +264,9 @@ | ||
| 267 | 264 | * |
| 268 | 265 | * @return string |
| 269 | 266 | */ |
| 270 | 267 | protected function generate_two_cell_shortcode_row( $field, $value = null ) { |
| 271 | - $row = '[if ' . $field->id . ']'; | |
| 272 | - | |
| 268 | + $row = '[if ' . $field->id . ']'; | |
| 273 | 269 | $label = '[' . $field->id . ' show=field_label]'; |
| 274 | 270 | |
| 275 | 271 | if ( $value === null ) { |
| 276 | 272 | $value = '[' . $field->id . ']'; |
| @@ -300,9 +296,9 @@ | ||
| 300 | 296 | * |
| 301 | 297 | * @return void |
| 302 | 298 | */ |
| 303 | 299 | protected function add_field_array( $field ) { |
| 304 | - if ( in_array( $field->type, $this->skip_fields ) ) { | |
| 300 | + if ( in_array( $field->type, $this->skip_fields, true ) ) { | |
| 305 | 301 | return; |
| 306 | 302 | } |
| 307 | 303 | |
| 308 | 304 | $this->add_single_field_array( $field, $field->id ); |
| @@ -335,9 +331,9 @@ | ||
| 335 | 331 | * |
| 336 | 332 | * @return bool |
| 337 | 333 | */ |
| 338 | 334 | protected function is_plain_text_format() { |
| 339 | - return ( $this->format === 'text' && $this->is_plain_text === true ); | |
| 335 | + return $this->format === 'text' && $this->is_plain_text === true; | |
| 340 | 336 | } |
| 341 | 337 | |
| 342 | 338 | /** |
| 343 | 339 | * Check if the format is default HTML |
| @@ -346,7 +342,7 @@ | ||
| 346 | 342 | * |
| 347 | 343 | * @return bool |
| 348 | 344 | */ |
| 349 | 345 | protected function is_table_format() { |
| 350 | - return ( $this->format === 'text' && $this->is_plain_text === false ); | |
| 346 | + return $this->format === 'text' && $this->is_plain_text === false; | |
| 351 | 347 | } |
| 352 | 348 | } |