PluginProbe
Cool Timeline (Horizontal & Vertical Timeline) / trunk
Cool Timeline (Horizontal & Vertical Timeline) vtrunk
3.4.0 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 2.2.3 2.3.3 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.6.1 2.7.1 2.8.3 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 All 79 releases
cool-timeline / admin / codestar-framework / fields / date / date.php

date.php in Cool Timeline (Horizontal & Vertical Timeline) trunk, at admin/codestar-framework/fields/date/date.php

78 lines 2.1 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;
3 } // Cannot access directly.
4 // phpcs:ignoreFile WordPress.Security.EscapeOutput.OutputNotEscaped
5 /**
6 *
7 * Field: date
8 *
9 * @since 1.0.0
10 * @version 1.0.0
11 */
12 if ( ! class_exists( 'CSF_Field_date' ) ) {
13 class CSF_Field_date extends CSF_Fields {
14
15
16 public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
17
18 parent::__construct( $field, $value, $unique, $where, $parent );
19 }
20
21 public function render() {
22
23 $default_settings = array(
24 'dateFormat' => 'mm/dd/yy',
25 );
26
27 $settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
28 $settings = wp_parse_args( $settings, $default_settings );
29
30 echo $this->field_before();
31
32 if ( ! empty( $this->field['from_to'] ) ) {
33
34 // phpcs:disable WordPress.WP.I18n.TextDomainMismatch
35 $args = wp_parse_args(
36 $this->field,
37 array(
38 'text_from' => esc_html__( 'From', 'csf' ),
39 'text_to' => esc_html__( 'To', 'csf' ),
40 )
41 );
42 // phpcs:enable WordPress.WP.I18n.TextDomainMismatch
43
44 $value = wp_parse_args(
45 $this->value,
46 array(
47 'from' => '',
48 'to' => '',
49 )
50 );
51
52 echo '<label class="csf--from">' . esc_attr( $args['text_from'] ) . ' <input type="text" name="' . esc_attr( $this->field_name( '[from]' ) ) . '" value="' . esc_attr( $value['from'] ) . '"' . $this->field_attributes() . '/></label>';
53 echo '<label class="csf--to">' . esc_attr( $args['text_to'] ) . ' <input type="text" name="' . esc_attr( $this->field_name( '[to]' ) ) . '" value="' . esc_attr( $value['to'] ) . '"' . $this->field_attributes() . '/></label>';
54
55 } else {
56
57 echo '<input type="text" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . $this->field_attributes() . '/>';
58
59 }
60
61 echo '<div class="csf-date-settings" data-settings="' . esc_attr( json_encode( $settings ) ) . '"></div>';
62
63 echo $this->field_after();
64
65 }
66
67 public function enqueue() {
68
69 if ( ! wp_script_is( 'jquery-ui-datepicker' ) ) {
70 wp_enqueue_script( 'jquery-ui-datepicker' );
71 }
72
73 }
74
75 }
76 }
77
78