| @@ -1,8 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - die( 'You are not allowed to call this page directly.' ); | |
| 4 | -} | |
| 5 | 2 | |
| 6 | 3 | /** |
| 7 | 4 | * @since 3.0 |
| 8 | 5 | */ |
| @@ -13,16 +10,8 @@ | ||
| 13 | 10 | * @since 3.0 |
| 14 | 11 | */ |
| 15 | 12 | protected $type = 'textarea'; |
| 16 | 13 | |
| 17 | - /** | |
| 18 | - * @var bool | |
| 19 | - */ | |
| 20 | - protected $array_allowed = false; | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * @return bool[] | |
| 24 | - */ | |
| 25 | 14 | protected function field_settings_for_type() { |
| 26 | 15 | return array( |
| 27 | 16 | 'size' => true, |
| 28 | 17 | 'clear_on_focus' => true, |
| @@ -28,11 +17,8 @@ | ||
| 28 | 17 | 'clear_on_focus' => true, |
| 29 | 18 | ); |
| 30 | 19 | } |
| 31 | 20 | |
| 32 | - /** | |
| 33 | - * @return array | |
| 34 | - */ | |
| 35 | 21 | protected function extra_field_opts() { |
| 36 | 22 | return array( |
| 37 | 23 | 'max' => '5', |
| 38 | 24 | ); |
| @@ -39,28 +25,22 @@ | ||
| 39 | 25 | } |
| 40 | 26 | |
| 41 | 27 | /** |
| 42 | 28 | * @param string $name |
| 43 | - * | |
| 44 | - * @return void | |
| 45 | 29 | */ |
| 46 | 30 | public function show_on_form_builder( $name = '' ) { |
| 47 | 31 | $size = FrmField::get_option( $this->field, 'size' ); |
| 48 | - $max = FrmField::get_option( $this->field, 'max' ); | |
| 32 | + $size_html = $size ? ' style="width:' . esc_attr( $size . ( is_numeric( $size ) ? 'px' : '' ) ) . '";' : ''; | |
| 49 | 33 | |
| 50 | - echo '<textarea name="' . esc_attr( $this->html_name( $name ) ) . '" rows="' . esc_attr( $max ) . '" id="' . esc_attr( $this->html_id() ) . '" class="dyn_default_value"'; | |
| 34 | + $max = FrmField::get_option( $this->field, 'max' ); | |
| 35 | + $default_value = FrmAppHelper::esc_textarea( force_balance_tags( $this->get_field_column( 'default_value' ) ) ); | |
| 51 | 36 | |
| 52 | - if ( $size ) { | |
| 53 | - if ( is_numeric( $size ) ) { | |
| 54 | - $size .= 'px'; | |
| 55 | - } | |
| 56 | - $style = 'width:' . $size . ';'; | |
| 57 | - echo ' style="' . esc_attr( $style ) . '"'; | |
| 58 | - } | |
| 59 | - | |
| 60 | - echo '>'; | |
| 61 | - echo FrmAppHelper::esc_textarea( force_balance_tags( $this->get_field_column( 'default_value' ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 62 | - echo '</textarea>'; | |
| 37 | + echo '<textarea name="' . esc_attr( $this->html_name( $name ) ) . '" ' . // WPCS: XSS ok. | |
| 38 | + $size_html // WPCS: XSS ok. | |
| 39 | + . ' rows="' . esc_attr( $max ) . '" ' . | |
| 40 | + 'id="' . esc_attr( $this->html_id() ) . '" class="dyn_default_value">' . | |
| 41 | + $default_value // WPCS: XSS ok. | |
| 42 | + . '</textarea>'; | |
| 63 | 43 | } |
| 64 | 44 | |
| 65 | 45 | protected function prepare_display_value( $value, $atts ) { |
| 66 | 46 | FrmFieldsHelper::run_wpautop( $atts, $value ); |
| @@ -65,21 +45,8 @@ | ||
| 65 | 45 | protected function prepare_display_value( $value, $atts ) { |
| 66 | 46 | FrmFieldsHelper::run_wpautop( $atts, $value ); |
| 67 | 47 | |
| 68 | 48 | return $value; |
| 69 | - } | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * @since 6.0 | |
| 73 | - * | |
| 74 | - * @param array $field | |
| 75 | - * @param string $default_name | |
| 76 | - * @param mixed $default_value | |
| 77 | - * | |
| 78 | - * @return void | |
| 79 | - */ | |
| 80 | - public function show_default_value_field( $field, $default_name, $default_value ) { | |
| 81 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/textarea-default-value-field.php'; | |
| 82 | 49 | } |
| 83 | 50 | |
| 84 | 51 | /** |
| 85 | 52 | * @param array $args |