PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.3.2
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.3.2
2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 trunk 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 All 57 releases
darkify / src / Admin / Framework / fields / datetime / datetime.php

datetime.php in Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) 1.3.2, at src/Admin/Framework/fields/datetime/datetime.php

66 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) {
2 die; } // Cannot access directly.
3 /**
4 *
5 * Field: datetime
6 *
7 * @since 1.0.0
8 * @version 1.0.0
9 */
10 if ( ! class_exists( 'DarkifyField_datetime' ) ) {
11 class DarkifyField_datetime extends DarkifyFields {
12
13 public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
14 parent::__construct( $field, $value, $unique, $where, $parent );
15 }
16
17 public function render() {
18
19 $defaults = array(
20 'allowInput' => true,
21 );
22
23 $settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
24
25 if ( ! isset( $settings['noCalendar'] ) ) {
26 $defaults['dateFormat'] = 'm/d/Y';
27 }
28
29 $settings = wp_parse_args( $settings, $defaults );
30
31 echo wp_kses_post( $this->field_before() );
32
33 if ( ! empty( $this->field['from_to'] ) ) {
34
35 $args = wp_parse_args(
36 $this->field,
37 array(
38 'text_from' => esc_html__( 'From', 'darkify' ),
39 'text_to' => esc_html__( 'To', 'darkify' ),
40 )
41 );
42
43 $value = wp_parse_args(
44 $this->value,
45 array(
46 'from' => '',
47 'to' => '',
48 )
49 );
50
51 echo '<label class="darkify--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>';
52 echo '<label class="darkify--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>';
53
54 } else {
55
56 echo '<input type="text" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . wp_kses_post( $this->field_attributes() ) . '/>';
57
58 }
59
60 echo '<div class="darkify-datetime-settings" data-settings="' . esc_attr( wp_json_encode( $settings ) ) . '"></div>';
61
62 echo wp_kses_post( $this->field_after() );
63 }
64 }
65 }
66