Completed
Pull Request — master (#1661)
by
unknown
01:13
created
src/wordlift/metabox/field/class-wl-metabox-field-date.php 2 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -21,63 +21,63 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class Wl_Metabox_Field_Date extends Wl_Metabox_Field {
23 23
 
24
-	/**
25
-	 * Attribute to distinguish between date formats, inferred from the schema property export type
26
-	 *
27
-	 * @since  3.2.0
28
-	 * @access protected
29
-	 * @var string $date_format The date format.
30
-	 */
31
-	protected $date_format;
32
-
33
-	/**
34
-	 * Boolean flag to decide if the calendar should include time or not
35
-	 *
36
-	 * @since  3.2.0
37
-	 * @access protected
38
-	 * @var boolean $timepicker A boolean flag.
39
-	 */
40
-	protected $timepicker;
41
-
42
-	/**
43
-	 * Whether the calendar should be displayed or not.
44
-	 *
45
-	 * @since  3.14.0
46
-	 * @access protected
47
-	 * @var boolean $no_calendar Whether the calendar should be displayed or not.
48
-	 */
49
-	protected $no_calendar;
50
-
51
-	/**
52
-	 * {@inheritdoc}
53
-	 */
54
-	public function __construct( $args, $id, $type ) {
55
-		parent::__construct( $args, $id, $type );
56
-
57
-		$this->no_calendar = false;
58
-
59
-		// Distinguish between date and datetime
60
-		if ( isset( $this->raw_custom_field['export_type'] ) && 'xsd:dateTime' === $this->raw_custom_field['export_type'] ) {
61
-			$this->date_format = 'Y/m/d H:i';
62
-			$this->timepicker  = true;
63
-		} else {
64
-			$this->date_format = 'Y/m/d';
65
-			$this->timepicker  = false;
66
-		}
67
-
68
-	}
69
-
70
-	/**
71
-	 * @param mixed $date
72
-	 *
73
-	 * @return string
74
-	 */
75
-	public function html_input( $date ) {
76
-
77
-		$this->log->debug( "Creating date input with date value $date..." );
78
-
79
-		ob_start();
80
-		?>
24
+    /**
25
+     * Attribute to distinguish between date formats, inferred from the schema property export type
26
+     *
27
+     * @since  3.2.0
28
+     * @access protected
29
+     * @var string $date_format The date format.
30
+     */
31
+    protected $date_format;
32
+
33
+    /**
34
+     * Boolean flag to decide if the calendar should include time or not
35
+     *
36
+     * @since  3.2.0
37
+     * @access protected
38
+     * @var boolean $timepicker A boolean flag.
39
+     */
40
+    protected $timepicker;
41
+
42
+    /**
43
+     * Whether the calendar should be displayed or not.
44
+     *
45
+     * @since  3.14.0
46
+     * @access protected
47
+     * @var boolean $no_calendar Whether the calendar should be displayed or not.
48
+     */
49
+    protected $no_calendar;
50
+
51
+    /**
52
+     * {@inheritdoc}
53
+     */
54
+    public function __construct( $args, $id, $type ) {
55
+        parent::__construct( $args, $id, $type );
56
+
57
+        $this->no_calendar = false;
58
+
59
+        // Distinguish between date and datetime
60
+        if ( isset( $this->raw_custom_field['export_type'] ) && 'xsd:dateTime' === $this->raw_custom_field['export_type'] ) {
61
+            $this->date_format = 'Y/m/d H:i';
62
+            $this->timepicker  = true;
63
+        } else {
64
+            $this->date_format = 'Y/m/d';
65
+            $this->timepicker  = false;
66
+        }
67
+
68
+    }
69
+
70
+    /**
71
+     * @param mixed $date
72
+     *
73
+     * @return string
74
+     */
75
+    public function html_input( $date ) {
76
+
77
+        $this->log->debug( "Creating date input with date value $date..." );
78
+
79
+        ob_start();
80
+        ?>
81 81
 		<div class="wl-input-wrapper">
82 82
 			<input
83 83
 					type="text"
@@ -92,34 +92,34 @@  discard block
 block discarded – undo
92 92
 			</button>
93 93
 		</div>
94 94
 		<?php
95
-		$html = ob_get_clean();
95
+        $html = ob_get_clean();
96 96
 
97
-		return $html;
98
-	}
97
+        return $html;
98
+    }
99 99
 
100
-	public function html_wrapper_close() {
100
+    public function html_wrapper_close() {
101 101
 
102
-		// Should the widget include time picker?
103
-		$timepicker  = wp_json_encode( $this->timepicker );
104
-		$no_calendar = wp_json_encode( $this->no_calendar );
102
+        // Should the widget include time picker?
103
+        $timepicker  = wp_json_encode( $this->timepicker );
104
+        $no_calendar = wp_json_encode( $this->no_calendar );
105 105
 
106
-		// Set up the datetimepicker.
107
-		//
108
-		// See https://github.com/trentrichardson/jQuery-Timepicker-Addon
109
-		// See in http://trentrichardson.com/examples/timepicker.
106
+        // Set up the datetimepicker.
107
+        //
108
+        // See https://github.com/trentrichardson/jQuery-Timepicker-Addon
109
+        // See in http://trentrichardson.com/examples/timepicker.
110 110
 
111
-		$js = wp_json_encode(
112
-			array(
113
-				'enableTime' => $timepicker,
114
-				'noCalendar' => $no_calendar,
115
-				'time_24hr'  => true,
116
-				'dateFormat' => $this->date_format,
117
-			)
118
-		);
111
+        $js = wp_json_encode(
112
+            array(
113
+                'enableTime' => $timepicker,
114
+                'noCalendar' => $no_calendar,
115
+                'time_24hr'  => true,
116
+                'dateFormat' => $this->date_format,
117
+            )
118
+        );
119 119
 
120 120
         // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
121
-		@ob_start();
122
-		?>
121
+        @ob_start();
122
+        ?>
123 123
 		<script type='text/javascript'>
124 124
 			(function ($) {
125 125
 				$(function () {
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 			})(jQuery);
129 129
 		</script>
130 130
 		<?php
131
-		$html = ob_get_clean();
131
+        $html = ob_get_clean();
132 132
 
133
-		$html .= parent::html_wrapper_close();
133
+        $html .= parent::html_wrapper_close();
134 134
 
135
-		return $html;
136
-	}
135
+        return $html;
136
+    }
137 137
 
138 138
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	/**
52 52
 	 * {@inheritdoc}
53 53
 	 */
54
-	public function __construct( $args, $id, $type ) {
55
-		parent::__construct( $args, $id, $type );
54
+	public function __construct($args, $id, $type) {
55
+		parent::__construct($args, $id, $type);
56 56
 
57 57
 		$this->no_calendar = false;
58 58
 
59 59
 		// Distinguish between date and datetime
60
-		if ( isset( $this->raw_custom_field['export_type'] ) && 'xsd:dateTime' === $this->raw_custom_field['export_type'] ) {
60
+		if (isset($this->raw_custom_field['export_type']) && 'xsd:dateTime' === $this->raw_custom_field['export_type']) {
61 61
 			$this->date_format = 'Y/m/d H:i';
62 62
 			$this->timepicker  = true;
63 63
 		} else {
@@ -72,23 +72,23 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string
74 74
 	 */
75
-	public function html_input( $date ) {
75
+	public function html_input($date) {
76 76
 
77
-		$this->log->debug( "Creating date input with date value $date..." );
77
+		$this->log->debug("Creating date input with date value $date...");
78 78
 
79 79
 		ob_start();
80 80
 		?>
81 81
 		<div class="wl-input-wrapper">
82 82
 			<input
83 83
 					type="text"
84
-					class="<?php echo esc_attr( $this->meta_name ); ?>"
85
-					name="wl_metaboxes[<?php echo esc_attr( $this->meta_name ); ?>][]"
86
-					value="<?php echo esc_attr( $date ); ?>"
84
+					class="<?php echo esc_attr($this->meta_name); ?>"
85
+					name="wl_metaboxes[<?php echo esc_attr($this->meta_name); ?>][]"
86
+					value="<?php echo esc_attr($date); ?>"
87 87
 					style="width:88%"
88 88
 			/>
89 89
 
90 90
 			<button class="button wl-remove-input wl-button" type="button">
91
-				<?php esc_html_e( 'Remove', 'wordlift' ); ?>
91
+				<?php esc_html_e('Remove', 'wordlift'); ?>
92 92
 			</button>
93 93
 		</div>
94 94
 		<?php
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	public function html_wrapper_close() {
101 101
 
102 102
 		// Should the widget include time picker?
103
-		$timepicker  = wp_json_encode( $this->timepicker );
104
-		$no_calendar = wp_json_encode( $this->no_calendar );
103
+		$timepicker  = wp_json_encode($this->timepicker);
104
+		$no_calendar = wp_json_encode($this->no_calendar);
105 105
 
106 106
 		// Set up the datetimepicker.
107 107
 		//
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		<script type='text/javascript'>
124 124
 			(function ($) {
125 125
 				$(function () {
126
-					$('.<?php echo esc_js( $this->meta_name ); ?>[type=text]').flatpickr(<?php echo $js; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);
126
+					$('.<?php echo esc_js($this->meta_name); ?>[type=text]').flatpickr(<?php echo $js; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);
127 127
 				});
128 128
 			})(jQuery);
129 129
 		</script>
Please login to merge, or discard this patch.