← All changes
|
admin/views/sp-framework/fields/number/number.php
+5
-24
2.4.11
→
2.2.10
View file →
| @@ -8,25 +8,11 @@ | ||
| 8 | 8 | * @version 1.0.0 |
| 9 | 9 | */ |
| 10 | 10 | if ( ! class_exists( 'SP_PC_Field_number' ) ) { |
| 11 | 11 | class SP_PC_Field_number extends SP_PC_Fields { |
| 12 | - /** | |
| 13 | - * Constructor | |
| 14 | - * | |
| 15 | - * @param [type] $field | |
| 16 | - * @param string $value | |
| 17 | - * @param string $unique | |
| 18 | - * @param string $where | |
| 19 | - * @param string $parent | |
| 20 | - */ | |
| 21 | 12 | public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) { |
| 22 | 13 | parent::__construct( $field, $value, $unique, $where, $parent ); |
| 23 | 14 | } |
| 24 | - /** | |
| 25 | - * Render method. | |
| 26 | - * | |
| 27 | - * @return void | |
| 28 | - */ | |
| 29 | 15 | public function render() { |
| 30 | 16 | $args = wp_parse_args( |
| 31 | 17 | $this->field, |
| 32 | 18 | array( |
| @@ -32,21 +18,16 @@ | ||
| 32 | 18 | array( |
| 33 | 19 | 'unit' => '', |
| 34 | 20 | ) |
| 35 | 21 | ); |
| 36 | - echo wp_kses_post( $this->field_before() ); | |
| 22 | + echo $this->field_before(); | |
| 37 | 23 | echo '<div class="spf--wrap">'; |
| 38 | - echo '<input type="number" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . wp_kses_post( $this->field_attributes( array( 'class' => 'spf-input-number' ) ) ) . '/>'; | |
| 39 | - echo ( ! empty( $args['unit'] ) ) ? '<span class="spf--unit">' . esc_html( $args['unit'] ) . '</span>' : ''; | |
| 24 | + echo '<input type="number" name="' . $this->field_name() . '" value="' . $this->value . '"' . $this->field_attributes( array( 'class' => 'spf-input-number' ) ) . '/>'; | |
| 25 | + echo ( ! empty( $args['unit'] ) ) ? '<span class="spf--unit">' . $args['unit'] . '</span>' : ''; | |
| 40 | 26 | echo '</div>'; |
| 41 | 27 | echo '<div class="clear"></div>'; |
| 42 | - echo wp_kses_post( $this->field_after() ); | |
| 28 | + echo $this->field_after(); | |
| 43 | 29 | } |
| 44 | - /** | |
| 45 | - * The output method. | |
| 46 | - * | |
| 47 | - * @return mixed | |
| 48 | - */ | |
| 49 | 30 | public function output() { |
| 50 | 31 | $output = ''; |
| 51 | 32 | $elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] ); |
| 52 | 33 | $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : ''; |
| @@ -51,9 +32,9 @@ | ||
| 51 | 32 | $elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] ); |
| 52 | 33 | $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : ''; |
| 53 | 34 | $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'width'; |
| 54 | 35 | $unit = ( ! empty( $this->field['unit'] ) ) ? $this->field['unit'] : 'px'; |
| 55 | - if ( ! empty( $elements ) && isset( $this->value ) && '' !== $this->value ) { | |
| 36 | + if ( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) { | |
| 56 | 37 | foreach ( $elements as $key_property => $element ) { |
| 57 | 38 | if ( is_numeric( $key_property ) ) { |
| 58 | 39 | if ( $mode ) { |
| 59 | 40 | $output = implode( ',', $elements ) . '{' . $mode . ':' . $this->value . $unit . $important . ';}'; |