PluginProbe
Document Embedder – let visitors read files without downloading / 1.8.6
Document Embedder – let visitors read files without downloading v1.8.6
2.3.1 2.3.0 2.2.1 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.3 1.7.4 1.7.6 1.7.9 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 2.0.0 2.0.1 2.0.2 All 30 releases
document-emberdder / admin / framework / fields / date / date.php

date.php in Document Embedder – let visitors read files without downloading 1.8.6, at admin/framework/fields/date/date.php

65 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' ) ) { die; } // Cannot access directly.
2 /**
3 *
4 * Field: date
5 *
6 * @since 1.0.0
7 * @version 1.0.0
8 *
9 */
10 if ( ! class_exists( 'CSF_Field_date' ) ) {
11 class CSF_Field_date extends CSF_Fields {
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 $default_settings = array(
20 'dateFormat' => 'mm/dd/yy',
21 );
22
23 $settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
24 $settings = wp_parse_args( $settings, $default_settings );
25
26 echo $this->field_before();
27
28 if ( ! empty( $this->field['from_to'] ) ) {
29
30 $args = wp_parse_args( $this->field, array(
31 'text_from' => esc_html__( 'From', 'csf' ),
32 'text_to' => esc_html__( 'To', 'csf' ),
33 ) );
34
35 $value = wp_parse_args( $this->value, array(
36 'from' => '',
37 'to' => '',
38 ) );
39
40 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>';
41 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>';
42
43 } else {
44
45 echo '<input type="text" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes() .'/>';
46
47 }
48
49 echo '<div class="csf-date-settings" data-settings="'. esc_attr( json_encode( $settings ) ) .'"></div>';
50
51 echo $this->field_after();
52
53 }
54
55 public function enqueue() {
56
57 if ( ! wp_script_is( 'jquery-ui-datepicker' ) ) {
58 wp_enqueue_script( 'jquery-ui-datepicker' );
59 }
60
61 }
62
63 }
64 }
65