PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.4.1
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.4.1
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
← All changes | Libs/adminify-framework/fields/datetime/datetime.php +40 -40 4.1.173.2.4.1 View file →
@@ -1,5 +1,6 @@
1 -<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
1 +<?php if ( ! defined( 'ABSPATH' ) ) {
2 + die; } // Cannot access directly.
2 3 /**
3 4 *
4 5 * Field: datetime
5 6 *
@@ -4,58 +5,57 @@
4 5 * Field: datetime
5 6 *
6 7 * @since 1.0.0
7 8 * @version 1.0.0
8 - *
9 9 */
10 10 if ( ! class_exists( 'ADMINIFY_Field_datetime' ) ) {
11 - class ADMINIFY_Field_datetime extends ADMINIFY_Fields {
11 + class ADMINIFY_Field_datetime extends ADMINIFY_Fields {
12 12
13 - public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14 - parent::__construct( $field, $value, $unique, $where, $parent );
15 - }
13 + public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14 + parent::__construct( $field, $value, $unique, $where, $parent );
15 + }
16 16
17 - public function render() {
17 + public function render() {
18 + $defaults = [
19 + 'allowInput' => true,
20 + ];
18 21
19 - $defaults = array(
20 - 'allowInput' => true,
21 - );
22 + $settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : [];
22 23
23 - $settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
24 + if ( ! isset( $settings['noCalendar'] ) ) {
25 + $defaults['dateFormat'] = 'm/d/Y';
26 + }
24 27
25 - if ( ! isset( $settings['noCalendar'] ) ) {
26 - $defaults['dateFormat'] = 'm/d/Y';
27 - }
28 + $settings = wp_parse_args( $settings, $defaults );
28 29
29 - $settings = wp_parse_args( $settings, $defaults );
30 + echo wp_kses_post( $this->field_before() );
30 31
31 - echo $this->field_before();
32 + if ( ! empty( $this->field['from_to'] ) ) {
33 + $args = wp_parse_args(
34 + $this->field,
35 + [
36 + 'text_from' => esc_html__( 'From', 'adminify' ),
37 + 'text_to' => esc_html__( 'To', 'adminify' ),
38 + ]
39 + );
32 40
33 - if ( ! empty( $this->field['from_to'] ) ) {
41 + $value = wp_parse_args(
42 + $this->value,
43 + [
44 + 'from' => '',
45 + 'to' => '',
46 + ]
47 + );
34 48
35 - $args = wp_parse_args( $this->field, array(
36 - 'text_from' => esc_html__( 'From', 'adminify' ),
37 - 'text_to' => esc_html__( 'To', 'adminify' ),
38 - ) );
49 + echo '<label class="adminify--from">' . esc_attr( $args['text_from'] ) . ' <input type="text" name="' . esc_attr( $this->field_name( '[from]' ) ) . '" value="' . esc_attr( $value['from'] ) . '"' . wp_kses_post( $this->field_attributes() ) . ' data-type="from" /></label>';
50 + echo '<label class="adminify--to">' . esc_attr( $args['text_to'] ) . ' <input type="text" name="' . esc_attr( $this->field_name( '[to]' ) ) . '" value="' . esc_attr( $value['to'] ) . '"' . wp_kses_post( $this->field_attributes() ) . ' data-type="to" /></label>';
51 + } else {
52 + echo '<input type="text" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . wp_kses_post( $this->field_attributes() ) . '/>';
53 + }
39 54
40 - $value = wp_parse_args( $this->value, array(
41 - 'from' => '',
42 - 'to' => '',
43 - ) );
55 + echo '<div class="adminify-datetime-settings" data-settings="' . esc_attr( json_encode( $settings ) ) . '"></div>';
44 56
45 - echo '<label class="adminify--from">'. esc_attr( $args['text_from'] ) .' <input type="text" name="'. esc_attr( $this->field_name( '[from]' ) ) .'" value="'. esc_attr( $value['from'] ) .'"'. $this->field_attributes() .' data-type="from" /></label>';
46 - echo '<label class="adminify--to">'. esc_attr( $args['text_to'] ) .' <input type="text" name="'. esc_attr( $this->field_name( '[to]' ) ) .'" value="'. esc_attr( $value['to'] ) .'"'. $this->field_attributes() .' data-type="to" /></label>';
57 + echo wp_kses_post( $this->field_after() );
58 + }
47 59
48 - } else {
49 -
50 - echo '<input type="text" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes() .'/>';
51 -
52 - }
53 -
54 - echo '<div class="adminify-datetime-settings" data-settings="'. esc_attr( json_encode( $settings ) ) .'"></div>';
55 -
56 - echo $this->field_after();
57 -
58 - }
59 -
60 - }
60 + }
61 61 }