| @@ -9,30 +9,22 @@ | ||
| 9 | 9 | class FrmFieldDefault extends FrmFieldType { |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @var bool |
| 13 | - * | |
| 14 | 13 | * @since 3.0 |
| 15 | 14 | */ |
| 16 | 15 | protected $holds_email_values = true; |
| 17 | 16 | |
| 18 | 17 | /** |
| 19 | - * @param string $type | |
| 20 | - * | |
| 21 | - * @return void | |
| 18 | + * @param $type string | |
| 22 | 19 | */ |
| 23 | 20 | protected function set_type( $type ) { |
| 24 | - if ( ! $type ) { | |
| 21 | + if ( empty( $type ) ) { | |
| 25 | 22 | $type = 'text'; |
| 26 | 23 | } |
| 27 | 24 | parent::set_type( $type ); |
| 28 | 25 | } |
| 29 | 26 | |
| 30 | - /** | |
| 31 | - * @param string $name | |
| 32 | - * | |
| 33 | - * @return void | |
| 34 | - */ | |
| 35 | 27 | public function show_on_form_builder( $name = '' ) { |
| 36 | 28 | $field = FrmFieldsHelper::setup_edit_vars( $this->field ); |
| 37 | 29 | |
| 38 | 30 | ob_start(); |
| @@ -37,23 +29,18 @@ | ||
| 37 | 29 | |
| 38 | 30 | ob_start(); |
| 39 | 31 | do_action( 'frm_display_added_fields', $field ); |
| 40 | 32 | do_action( 'frm_display_added_' . $this->type . '_field', $field ); |
| 41 | - $input_html = ob_get_clean(); | |
| 33 | + $input_html = ob_get_contents(); | |
| 34 | + ob_end_clean(); | |
| 42 | 35 | |
| 43 | - if ( ! $input_html ) { | |
| 44 | - echo $this->builder_text_field( $name ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 36 | + if ( empty( $input_html ) ) { | |
| 37 | + echo $this->builder_text_field( $name ); // WPCS: XSS ok. | |
| 45 | 38 | } else { |
| 46 | - echo $input_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 39 | + echo $input_html; // WPCS: XSS ok. | |
| 47 | 40 | } |
| 48 | 41 | } |
| 49 | 42 | |
| 50 | - /** | |
| 51 | - * @param array $args | |
| 52 | - * @param array $shortcode_atts | |
| 53 | - * | |
| 54 | - * @return string | |
| 55 | - */ | |
| 56 | 43 | public function front_field_input( $args, $shortcode_atts ) { |
| 57 | 44 | $pass_args = array( |
| 58 | 45 | 'errors' => $args['errors'], |
| 59 | 46 | 'html_id' => $args['html_id'], |
| @@ -60,9 +47,10 @@ | ||
| 60 | 47 | ); |
| 61 | 48 | ob_start(); |
| 62 | 49 | do_action( 'frm_form_fields', $this->field, $args['field_name'], $pass_args ); |
| 63 | 50 | do_action( 'frm_form_field_' . $this->type, $this->field, $args['field_name'], $pass_args ); |
| 64 | - $input_html = ob_get_clean(); | |
| 51 | + $input_html = ob_get_contents(); | |
| 52 | + ob_end_clean(); | |
| 65 | 53 | |
| 66 | - return is_string( $input_html ) ? $input_html : ''; | |
| 54 | + return $input_html; | |
| 67 | 55 | } |
| 68 | 56 | } |