PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.4.1
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.4.1
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / admin / views / sp-framework / fields / date / date.php

date.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 2.4.1, at admin/views/sp-framework/fields/date/date.php

90 lines 2.3 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 /**
5 *
6 * Field: date
7 *
8 * @since 2.0
9 * @version 2.0
10 */
11 if ( ! class_exists( 'SP_PC_Field_date' ) ) {
12 class SP_PC_Field_date extends SP_PC_Fields {
13
14 /**
15 * The constructor.
16 *
17 * @param attributes $field The fields array.
18 * @param string $value
19 * @param string $unique
20 * @param string $where
21 * @param string $parent
22 */
23 public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
24 parent::__construct( $field, $value, $unique, $where, $parent );
25 }
26 /**
27 * The render method.
28 *
29 * @return void
30 */
31 public function render() {
32
33 $default_settings = array(
34 'dateFormat' => 'mm/dd/yy',
35 );
36
37 $view_options = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
38 $view_options = wp_parse_args( $view_options, $default_settings );
39
40 echo wp_kses_post( $this->field_before() );
41
42 if ( ! empty( $this->field['from_to'] ) ) {
43
44 $args = wp_parse_args(
45 $this->field,
46 array(
47 'text_from' => 'From',
48 'text_to' => 'To',
49 )
50 );
51
52 $value = wp_parse_args(
53 $this->value,
54 array(
55 'from' => '',
56 'to' => '',
57 )
58 );
59
60 echo '<label class="spf--from">' . esc_html( $args['text_from'] ) . ' <input type="text" name="' . esc_attr( $this->field_name( '[from]' ) ) . '" value="' . esc_attr( $value['from'] ) . '"' . wp_kses_post( $this->field_attributes() ) . '/></label>';
61 echo '<label class="spf--to">' . esc_html( $args['text_to'] ) . ' <input type="text" name="' . esc_attr( $this->field_name( '[to]' ) ) . '" value="' . esc_attr( $value['to'] ) . '"' . wp_kses_post( $this->field_attributes() ) . '/></label>';
62
63 } else {
64
65 echo '<input type="text" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '"' . wp_kses_post( $this->field_attributes() ) . '/>';
66
67 }
68
69 echo '<div class="spf-date-settings" data-settings="' . esc_attr( json_encode( $view_options ) ) . '"></div>';
70
71 echo wp_kses_post( $this->field_after() );
72
73 }
74
75 /**
76 * Enqueue Date Picker.
77 *
78 * @return void
79 */
80 public function enqueue() {
81
82 if ( ! wp_script_is( 'jquery-ui-datepicker' ) ) {
83 wp_enqueue_script( 'jquery-ui-datepicker' );
84 }
85
86 }
87
88 }
89 }
90