@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Abstracts; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -84,27 +84,27 @@ discard block |
||
84 | 84 | |
85 | 85 | $settings = array(); |
86 | 86 | |
87 | - $settings[ $this->id ] = array( |
|
87 | + $settings[$this->id] = array( |
|
88 | 88 | 'label' => $this->label, |
89 | 89 | 'description' => $this->description, |
90 | 90 | ); |
91 | 91 | |
92 | - if ( ! empty( $this->sections ) && is_array( $this->sections ) ) { |
|
92 | + if ( ! empty($this->sections) && is_array($this->sections)) { |
|
93 | 93 | |
94 | - foreach ( $this->sections as $section => $content ) { |
|
94 | + foreach ($this->sections as $section => $content) { |
|
95 | 95 | |
96 | - $settings[ $this->id ]['sections'][ $section ] = array( |
|
97 | - 'title' => isset( $content['title'] ) ? $content['title'] : '', |
|
98 | - 'description' => isset( $content['description'] ) ? $content['description'] : '', |
|
99 | - 'callback' => array( $this, 'add_settings_section_callback' ), |
|
100 | - 'fields' => isset( $this->fields[ $section ] ) ? $this->fields[ $section ] : '', |
|
96 | + $settings[$this->id]['sections'][$section] = array( |
|
97 | + 'title' => isset($content['title']) ? $content['title'] : '', |
|
98 | + 'description' => isset($content['description']) ? $content['description'] : '', |
|
99 | + 'callback' => array($this, 'add_settings_section_callback'), |
|
100 | + 'fields' => isset($this->fields[$section]) ? $this->fields[$section] : '', |
|
101 | 101 | ); |
102 | 102 | |
103 | 103 | } |
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | - return apply_filters( 'simcal_get_' . $this->option_group . '_' . $this->id , $settings ); |
|
107 | + return apply_filters('simcal_get_'.$this->option_group.'_'.$this->id, $settings); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @return string |
120 | 120 | */ |
121 | - protected function get_option_value( $section, $setting ) { |
|
121 | + protected function get_option_value($section, $setting) { |
|
122 | 122 | |
123 | 123 | $option = $this->values; |
124 | 124 | |
125 | - if ( ! empty( $option ) && is_array( $option ) ) { |
|
126 | - return isset( $option[ $section ][ $setting ] ) ? $option[ $section ][ $setting ] : ''; |
|
125 | + if ( ! empty($option) && is_array($option)) { |
|
126 | + return isset($option[$section][$setting]) ? $option[$section][$setting] : ''; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | return ''; |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @return string |
158 | 158 | */ |
159 | - public function add_settings_section_callback( $section ) { |
|
159 | + public function add_settings_section_callback($section) { |
|
160 | 160 | |
161 | - $callback = isset( $section['callback'][0] ) ? $section['callback'][0] : ''; |
|
162 | - $sections = isset( $callback->sections ) ? $callback->sections : ''; |
|
163 | - $description = isset( $sections[ $section['id'] ]['description'] ) ? $sections[ $section['id'] ]['description'] : ''; |
|
164 | - $default = $description ? '<p>' . $description . '</p>' : ''; |
|
161 | + $callback = isset($section['callback'][0]) ? $section['callback'][0] : ''; |
|
162 | + $sections = isset($callback->sections) ? $callback->sections : ''; |
|
163 | + $description = isset($sections[$section['id']]['description']) ? $sections[$section['id']]['description'] : ''; |
|
164 | + $default = $description ? '<p>'.$description.'</p>' : ''; |
|
165 | 165 | |
166 | - echo apply_filters( 'simcal_' . $this->option_group . '_' . $this->id . '_sections_callback', $default ); |
|
166 | + echo apply_filters('simcal_'.$this->option_group.'_'.$this->id.'_sections_callback', $default); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return array Sanitized settings. |
179 | 179 | */ |
180 | - public function validate( $settings ) { |
|
180 | + public function validate($settings) { |
|
181 | 181 | |
182 | 182 | $sanitized = ''; |
183 | 183 | |
184 | - if ( is_array( $settings ) ) { |
|
185 | - foreach ( $settings as $k => $v ) { |
|
186 | - $sanitized[ $k ] = simcal_sanitize_input( $v ); |
|
184 | + if (is_array($settings)) { |
|
185 | + foreach ($settings as $k => $v) { |
|
186 | + $sanitized[$k] = simcal_sanitize_input($v); |
|
187 | 187 | } |
188 | 188 | } else { |
189 | - $sanitized = simcal_sanitize_input( $settings ); |
|
189 | + $sanitized = simcal_sanitize_input($settings); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | return $sanitized; |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Abstracts; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param mixed $args |
28 | 28 | */ |
29 | - public function __construct( $args = '' ); |
|
29 | + public function __construct($args = ''); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Return the parent calendar type. |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return array |
77 | 77 | */ |
78 | - public function scripts( $min = '' ); |
|
78 | + public function scripts($min = ''); |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Styles. |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return array |
90 | 90 | */ |
91 | - public function styles( $min = '' ); |
|
91 | + public function styles($min = ''); |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Print HTML. |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Abstracts; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -148,68 +148,68 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @param array $field Field data. |
150 | 150 | */ |
151 | - public function __construct( $field ) { |
|
151 | + public function __construct($field) { |
|
152 | 152 | |
153 | 153 | // Field properties. |
154 | - if ( isset( $field['title'] ) ) { |
|
155 | - $this->title = esc_attr( $field['title'] ); |
|
154 | + if (isset($field['title'])) { |
|
155 | + $this->title = esc_attr($field['title']); |
|
156 | 156 | } |
157 | - if ( isset( $field['description'] ) ) { |
|
158 | - $this->description = wp_kses_post( $field['description'] ); |
|
157 | + if (isset($field['description'])) { |
|
158 | + $this->description = wp_kses_post($field['description']); |
|
159 | 159 | } |
160 | - if ( isset( $field['type'] ) ) { |
|
161 | - $this->type = esc_attr( $field['type'] ); |
|
160 | + if (isset($field['type'])) { |
|
161 | + $this->type = esc_attr($field['type']); |
|
162 | 162 | } |
163 | - if ( isset( $field['name'] ) ) { |
|
164 | - $this->name = esc_attr( $field['name'] ); |
|
163 | + if (isset($field['name'])) { |
|
164 | + $this->name = esc_attr($field['name']); |
|
165 | 165 | } |
166 | - if ( isset( $field['id'] ) ) { |
|
167 | - $this->id = esc_attr( $field['id'] ); |
|
166 | + if (isset($field['id'])) { |
|
167 | + $this->id = esc_attr($field['id']); |
|
168 | 168 | } |
169 | - if ( isset( $field['placeholder'] ) ) { |
|
170 | - $this->placeholder = esc_attr( $field['placeholder'] ); |
|
169 | + if (isset($field['placeholder'])) { |
|
170 | + $this->placeholder = esc_attr($field['placeholder']); |
|
171 | 171 | } |
172 | - if ( isset( $field['options'] ) && is_array( $field['options'] ) ) { |
|
173 | - $this->options = array_map( 'esc_attr', $field['options'] ); |
|
172 | + if (isset($field['options']) && is_array($field['options'])) { |
|
173 | + $this->options = array_map('esc_attr', $field['options']); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | // Escaping. |
177 | - if ( ! empty( $field['escaping'] ) && ( is_string( $field['escaping'] ) || is_array( $field['escaping'] ) ) ) { |
|
178 | - if ( isset( $field['default'] ) ) { |
|
179 | - $this->default = $this->escape_callback( $field['escaping'], $field['default'] ); |
|
177 | + if ( ! empty($field['escaping']) && (is_string($field['escaping']) || is_array($field['escaping']))) { |
|
178 | + if (isset($field['default'])) { |
|
179 | + $this->default = $this->escape_callback($field['escaping'], $field['default']); |
|
180 | 180 | } |
181 | - if ( isset( $field['value'] ) ) { |
|
182 | - $this->value = $this->escape_callback( $field['escaping'], $field['value'] ); |
|
181 | + if (isset($field['value'])) { |
|
182 | + $this->value = $this->escape_callback($field['escaping'], $field['value']); |
|
183 | 183 | } |
184 | 184 | } else { |
185 | - if ( isset( $field['default'] ) ) { |
|
186 | - $this->default = $this->escape( $field['default'] ); |
|
185 | + if (isset($field['default'])) { |
|
186 | + $this->default = $this->escape($field['default']); |
|
187 | 187 | } |
188 | - if ( isset( $field['value'] ) ) { |
|
189 | - $this->value = $this->escape( $field['value'] ); |
|
188 | + if (isset($field['value'])) { |
|
189 | + $this->value = $this->escape($field['value']); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | 193 | // Validation. |
194 | - if ( ! empty( $field['validation'] ) ) { |
|
195 | - $this->validation = $this->validate( $field['validation'], $this->value ); |
|
194 | + if ( ! empty($field['validation'])) { |
|
195 | + $this->validation = $this->validate($field['validation'], $this->value); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // CSS classes and styles. |
199 | - $classes = isset( $field['class'] ) ? $field['class'] : ''; |
|
200 | - $this->set_class( $classes ); |
|
201 | - if ( isset( $field['style'] ) ) { |
|
202 | - $this->set_style( $field['style'] ); |
|
199 | + $classes = isset($field['class']) ? $field['class'] : ''; |
|
200 | + $this->set_class($classes); |
|
201 | + if (isset($field['style'])) { |
|
202 | + $this->set_style($field['style']); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // Custom attributes. |
206 | - if ( isset( $field['attributes'] ) ) { |
|
207 | - $this->set_attributes( $field['attributes'] ); |
|
206 | + if (isset($field['attributes'])) { |
|
207 | + $this->set_attributes($field['attributes']); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | // Tooltip markup. |
211 | - if ( isset( $field['tooltip'] ) ) { |
|
212 | - $this->tooltip = ' <i class="simcal-icon-help simcal-help-tip" data-tip="' . esc_attr( $field['tooltip'] ) . '"></i> ' ; |
|
211 | + if (isset($field['tooltip'])) { |
|
212 | + $this->tooltip = ' <i class="simcal-icon-help simcal-help-tip" data-tip="'.esc_attr($field['tooltip']).'"></i> '; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return void |
224 | 224 | */ |
225 | - public function set_attributes( $attributes ) { |
|
225 | + public function set_attributes($attributes) { |
|
226 | 226 | |
227 | 227 | $attr = ''; |
228 | 228 | |
229 | - if ( ! empty( $attributes ) && is_array( $attributes ) ) { |
|
230 | - foreach ( $attributes as $k => $v ) { |
|
231 | - $attr .= esc_attr( $k ) . '="' . esc_attr( $v ) . '" '; |
|
229 | + if ( ! empty($attributes) && is_array($attributes)) { |
|
230 | + foreach ($attributes as $k => $v) { |
|
231 | + $attr .= esc_attr($k).'="'.esc_attr($v).'" '; |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - public function set_style( $css ) { |
|
247 | + public function set_style($css) { |
|
248 | 248 | |
249 | 249 | $styles = ''; |
250 | 250 | |
251 | - if ( ! empty( $css ) && is_array( $css ) ) { |
|
252 | - foreach ( $css as $k => $v ) { |
|
253 | - $styles .= esc_attr( $k ) . ': ' . esc_attr( $v ) . '; '; |
|
251 | + if ( ! empty($css) && is_array($css)) { |
|
252 | + foreach ($css as $k => $v) { |
|
253 | + $styles .= esc_attr($k).': '.esc_attr($v).'; '; |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
@@ -266,23 +266,23 @@ discard block |
||
266 | 266 | * |
267 | 267 | * @return void |
268 | 268 | */ |
269 | - public function set_class( $class ) { |
|
269 | + public function set_class($class) { |
|
270 | 270 | |
271 | 271 | $classes = ''; |
272 | 272 | $type_class = ''; |
273 | 273 | $error = ''; |
274 | 274 | |
275 | - if ( ! empty( $class ) && is_array( $class ) ) { |
|
276 | - $classes = implode( ' ', array_map( 'esc_attr', $class ) ); |
|
275 | + if ( ! empty($class) && is_array($class)) { |
|
276 | + $classes = implode(' ', array_map('esc_attr', $class)); |
|
277 | 277 | } |
278 | - if ( ! empty( $this->type_class ) ) { |
|
279 | - $type_class = esc_attr( $this->type_class ); |
|
278 | + if ( ! empty($this->type_class)) { |
|
279 | + $type_class = esc_attr($this->type_class); |
|
280 | 280 | } |
281 | - if ( true !== $this->validation && ! empty( $this->validation ) ) { |
|
281 | + if (true !== $this->validation && ! empty($this->validation)) { |
|
282 | 282 | $error = 'simcal-field-error '; |
283 | 283 | } |
284 | 284 | |
285 | - $this->class = trim( $error . 'simcal-field ' . $type_class . ' ' . $classes ); |
|
285 | + $this->class = trim($error.'simcal-field '.$type_class.' '.$classes); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return array|string |
299 | 299 | */ |
300 | - protected function escape( $value ) { |
|
301 | - return ! empty( $value ) ? ( is_array( $value ) ? array_map( 'esc_attr', $value ) : esc_attr( $value ) ) : ''; |
|
300 | + protected function escape($value) { |
|
301 | + return ! empty($value) ? (is_array($value) ? array_map('esc_attr', $value) : esc_attr($value)) : ''; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @return mixed |
316 | 316 | */ |
317 | - protected function escape_callback( $callback, $value ) { |
|
318 | - if ( $callback && ( is_string( $callback ) || is_array( $callback ) ) ) { |
|
319 | - return call_user_func( $callback, $value ); |
|
317 | + protected function escape_callback($callback, $value) { |
|
318 | + if ($callback && (is_string($callback) || is_array($callback))) { |
|
319 | + return call_user_func($callback, $value); |
|
320 | 320 | } |
321 | - return esc_attr( $value ); |
|
321 | + return esc_attr($value); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @return true|string Expected to return bool (true) if passes, message string if not. |
336 | 336 | */ |
337 | - protected function validate( $callback, $value ) { |
|
338 | - if ( $callback && ( is_string( $callback ) || is_array( $callback ) ) ) { |
|
339 | - $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : ''; |
|
340 | - return call_user_func( $callback, $value, $screen ); |
|
337 | + protected function validate($callback, $value) { |
|
338 | + if ($callback && (is_string($callback) || is_array($callback))) { |
|
339 | + $screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
|
340 | + return call_user_func($callback, $value, $screen); |
|
341 | 341 | } |
342 | 342 | return true; |
343 | 343 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Abstracts; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | - public static function html( $post ); |
|
31 | + public static function html($post); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Validate and save the meta box fields. |
@@ -40,6 +40,6 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - public static function save( $post_id, $post ); |
|
43 | + public static function save($post_id, $post); |
|
44 | 44 | |
45 | 45 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Abstracts; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return void |
38 | 38 | */ |
39 | - public function widget( $args, $instance ); |
|
39 | + public function widget($args, $instance); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Update a particular instance of the widget. |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return array Settings to save or bool false to cancel saving. |
54 | 54 | */ |
55 | - public function update( $new_instance, $old_instance ); |
|
55 | + public function update($new_instance, $old_instance); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Print the settings update form. |
@@ -63,6 +63,6 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return string |
65 | 65 | */ |
66 | - public function form( $instance ); |
|
66 | + public function form($instance); |
|
67 | 67 | |
68 | 68 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | namespace SimpleCalendar\Admin; |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @param string $post_type |
43 | 43 | */ |
44 | - public function __construct( $post_type ) { |
|
45 | - $this->bulk_action_post_type = post_type_exists( $post_type ) ? $post_type : ''; |
|
44 | + public function __construct($post_type) { |
|
45 | + $this->bulk_action_post_type = post_type_exists($post_type) ? $post_type : ''; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param array $args |
55 | 55 | */ |
56 | - public function register_bulk_action( $args ) { |
|
56 | + public function register_bulk_action($args) { |
|
57 | 57 | |
58 | 58 | $func = array(); |
59 | - $func['action_name'] = isset( $args['action_name'] ) ? sanitize_key( $args['action_name'] ) : ''; |
|
60 | - $func['callback'] = isset( $args['callback'] ) ? $args['callback'] : ''; |
|
61 | - $func['menu_text'] = isset( $args['menu_text'] ) ? esc_attr( $args['menu_text'] ) : ''; |
|
62 | - $func['admin_notice'] = isset( $args['admin_notice'] ) ? esc_attr( $args['admin_notice'] ) : ''; |
|
59 | + $func['action_name'] = isset($args['action_name']) ? sanitize_key($args['action_name']) : ''; |
|
60 | + $func['callback'] = isset($args['callback']) ? $args['callback'] : ''; |
|
61 | + $func['menu_text'] = isset($args['menu_text']) ? esc_attr($args['menu_text']) : ''; |
|
62 | + $func['admin_notice'] = isset($args['admin_notice']) ? esc_attr($args['admin_notice']) : ''; |
|
63 | 63 | |
64 | - if ( $func['action_name'] && $func['callback'] ) { |
|
65 | - $this->actions[ $func['action_name'] ] = $func; |
|
64 | + if ($func['action_name'] && $func['callback']) { |
|
65 | + $this->actions[$func['action_name']] = $func; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * @since 3.0.0 |
75 | 75 | */ |
76 | 76 | public function init() { |
77 | - if ( is_admin() ) { |
|
78 | - add_action( 'admin_footer-edit.php', array( $this, 'custom_bulk_admin_footer' ) ); |
|
79 | - add_action( 'load-edit.php', array( $this, 'custom_bulk_action' ) ); |
|
80 | - add_action( 'admin_notices', array( $this, 'custom_bulk_admin_notices' ) ); |
|
77 | + if (is_admin()) { |
|
78 | + add_action('admin_footer-edit.php', array($this, 'custom_bulk_admin_footer')); |
|
79 | + add_action('load-edit.php', array($this, 'custom_bulk_action')); |
|
80 | + add_action('admin_notices', array($this, 'custom_bulk_admin_notices')); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | global $post_type; |
92 | 92 | |
93 | 93 | // Only permit actions with defined post type. |
94 | - if ( $post_type == $this->bulk_action_post_type ) { |
|
94 | + if ($post_type == $this->bulk_action_post_type) { |
|
95 | 95 | |
96 | 96 | ?> |
97 | 97 | <script type="text/javascript"> |
98 | 98 | jQuery( document ).ready( function() { |
99 | - <?php foreach ( $this->actions as $action_name => $action ) : ?> |
|
99 | + <?php foreach ($this->actions as $action_name => $action) : ?> |
|
100 | 100 | jQuery( '<option>' ).val( '<?php echo $action_name ?>' ).text( '<?php echo $action['menu_text'] ?>').appendTo( 'select[name="action"]' ); |
101 | 101 | jQuery( '<option>' ).val( '<?php echo $action_name ?>' ).text( '<?php echo $action['menu_text'] ?>').appendTo( 'select[name="action2"]' ); |
102 | 102 | <?php endforeach; ?> |
@@ -120,65 +120,65 @@ discard block |
||
120 | 120 | global $typenow; |
121 | 121 | $post_type = $typenow; |
122 | 122 | |
123 | - if ( $post_type == $this->bulk_action_post_type ) { |
|
123 | + if ($post_type == $this->bulk_action_post_type) { |
|
124 | 124 | |
125 | 125 | // Get the action. |
126 | 126 | // Depending on your resource type this could be WP_Users_List_Table, WP_Comments_List_Table, etc. |
127 | - $wp_list_table = _get_list_table( 'WP_Posts_List_Table' ); |
|
127 | + $wp_list_table = _get_list_table('WP_Posts_List_Table'); |
|
128 | 128 | $action = $wp_list_table->current_action(); |
129 | 129 | |
130 | 130 | // Allow only defined actions. |
131 | - $allowed_actions = array_keys( $this->actions ); |
|
132 | - if ( ! in_array( $action, $allowed_actions ) ) { |
|
131 | + $allowed_actions = array_keys($this->actions); |
|
132 | + if ( ! in_array($action, $allowed_actions)) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
136 | 136 | // Security check. |
137 | - check_admin_referer( 'bulk-posts' ); |
|
137 | + check_admin_referer('bulk-posts'); |
|
138 | 138 | |
139 | 139 | // Make sure ids are submitted. |
140 | 140 | // Depending on the resource type, this may be 'media' or 'ids'. |
141 | - if ( isset( $_REQUEST['post'] ) ) { |
|
142 | - $post_ids = array_map( 'intval', $_REQUEST['post'] ); |
|
141 | + if (isset($_REQUEST['post'])) { |
|
142 | + $post_ids = array_map('intval', $_REQUEST['post']); |
|
143 | 143 | } |
144 | 144 | |
145 | - if ( empty( $post_ids ) ) { |
|
145 | + if (empty($post_ids)) { |
|
146 | 146 | return; |
147 | 147 | } |
148 | 148 | |
149 | 149 | // This is based on wp-admin/edit.php. |
150 | 150 | $sendback = remove_query_arg( |
151 | - array( 'exported', 'untrashed', 'deleted', 'ids' ), |
|
151 | + array('exported', 'untrashed', 'deleted', 'ids'), |
|
152 | 152 | wp_get_referer() |
153 | 153 | ); |
154 | - if ( ! $sendback ) { |
|
155 | - $sendback = admin_url( "edit.php?post_type=$post_type" ); |
|
154 | + if ( ! $sendback) { |
|
155 | + $sendback = admin_url("edit.php?post_type=$post_type"); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | $pagenum = $wp_list_table->get_pagenum(); |
159 | - $sendback = add_query_arg( 'paged', $pagenum, $sendback ); |
|
159 | + $sendback = add_query_arg('paged', $pagenum, $sendback); |
|
160 | 160 | |
161 | 161 | // Check that we have anonymous function as a callback. |
162 | - $anon_fns = array_filter( $this->actions[ $action ], function( $el ) { |
|
162 | + $anon_fns = array_filter($this->actions[$action], function($el) { |
|
163 | 163 | return $el instanceof \Closure; |
164 | 164 | } ); |
165 | 165 | |
166 | - if ( count( $anon_fns ) > 0 ) { |
|
167 | - $this->actions[ $action ]['callback']( $post_ids ); |
|
166 | + if (count($anon_fns) > 0) { |
|
167 | + $this->actions[$action]['callback']($post_ids); |
|
168 | 168 | } else { |
169 | - call_user_func( $this->actions[ $action ]['callback'], $post_ids ); |
|
169 | + call_user_func($this->actions[$action]['callback'], $post_ids); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | $sendback = add_query_arg( |
173 | - array( 'success_action' => $action, 'ids' => join( ',', $post_ids ) ), |
|
173 | + array('success_action' => $action, 'ids' => join(',', $post_ids)), |
|
174 | 174 | $sendback |
175 | 175 | ); |
176 | 176 | $sendback = remove_query_arg( |
177 | - array( 'action', 'paged', 'mode', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view' ), |
|
177 | + array('action', 'paged', 'mode', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), |
|
178 | 178 | $sendback |
179 | 179 | ); |
180 | 180 | |
181 | - wp_redirect( $sendback ); |
|
181 | + wp_redirect($sendback); |
|
182 | 182 | |
183 | 183 | exit; |
184 | 184 | } |
@@ -193,31 +193,31 @@ discard block |
||
193 | 193 | |
194 | 194 | global $post_type, $pagenow; |
195 | 195 | |
196 | - if ( isset( $_REQUEST['ids'] ) ) { |
|
197 | - $post_ids = explode( ',', $_REQUEST['ids'] ); |
|
196 | + if (isset($_REQUEST['ids'])) { |
|
197 | + $post_ids = explode(',', $_REQUEST['ids']); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | // Make sure ids are submitted. |
201 | 201 | // Depending on the resource type, this may be 'media' or 'ids'. |
202 | - if ( empty( $post_ids ) ) { |
|
202 | + if (empty($post_ids)) { |
|
203 | 203 | return; |
204 | 204 | } |
205 | 205 | |
206 | - $post_ids_count = is_array( $post_ids ) ? count( $post_ids ) : 1; |
|
206 | + $post_ids_count = is_array($post_ids) ? count($post_ids) : 1; |
|
207 | 207 | |
208 | - if ( $pagenow == 'edit.php' && $post_type == $this->bulk_action_post_type ) { |
|
208 | + if ($pagenow == 'edit.php' && $post_type == $this->bulk_action_post_type) { |
|
209 | 209 | |
210 | - if ( isset( $_REQUEST['success_action'] ) ) { |
|
210 | + if (isset($_REQUEST['success_action'])) { |
|
211 | 211 | |
212 | 212 | // Print notice in admin bar. |
213 | - $message = $this->actions[ $_REQUEST['success_action'] ]['admin_notice']; |
|
213 | + $message = $this->actions[$_REQUEST['success_action']]['admin_notice']; |
|
214 | 214 | |
215 | - if ( is_array( $message ) ) { |
|
216 | - $message = sprintf( _n( $message['single'], $message['plural'], $post_ids_count, 'google-calendar-events' ), $post_ids_count ); |
|
215 | + if (is_array($message)) { |
|
216 | + $message = sprintf(_n($message['single'], $message['plural'], $post_ids_count, 'google-calendar-events'), $post_ids_count); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | $class = 'updated notice is-dismissible above-h2'; |
220 | - if ( ! empty( $message ) ) { |
|
220 | + if ( ! empty($message)) { |
|
221 | 221 | echo "<div class=\"{$class}\"><p>{$message}</p></div>"; |
222 | 222 | } |
223 | 223 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @param array $field |
47 | 47 | */ |
48 | - public function __construct( $field ) { |
|
48 | + public function __construct($field) { |
|
49 | 49 | |
50 | - $this->range = isset( $field['range'] ) ? ( $field['range'] === true ? true : false ) : false; |
|
51 | - $this->inline = isset( $field['inline'] ) ? ( $field['inline'] === true ? true : false ) : true; |
|
50 | + $this->range = isset($field['range']) ? ($field['range'] === true ? true : false) : false; |
|
51 | + $this->inline = isset($field['inline']) ? ($field['inline'] === true ? true : false) : true; |
|
52 | 52 | |
53 | 53 | $subtype = $this->range === true ? 'simcal-field-date-picker-range ' : ''; |
54 | - $this->type_class = 'simcal-field-date-picker ' . $subtype; |
|
54 | + $this->type_class = 'simcal-field-date-picker '.$subtype; |
|
55 | 55 | |
56 | 56 | $data = array( |
57 | 57 | 'data-inline' => $this->inline === true ? 'true' : 'false', |
58 | 58 | ); |
59 | - $field['attributes'] = isset( $field['attributes'] ) ? array_merge( $field['attributes'], $data ) : $data; |
|
59 | + $field['attributes'] = isset($field['attributes']) ? array_merge($field['attributes'], $data) : $data; |
|
60 | 60 | |
61 | - parent::__construct( $field ); |
|
61 | + parent::__construct($field); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function html() { |
70 | 70 | |
71 | - if ( ! empty( $this->description ) ) { |
|
72 | - echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>'; |
|
71 | + if ( ! empty($this->description)) { |
|
72 | + echo '<p class="description">'.wp_kses_post($this->description).'</p>'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | ?> |
76 | 76 | <div id="<?php echo $this->id; ?>" |
77 | 77 | class="<?php echo $this->class; ?>" |
78 | - <?php echo $this->style ? 'style="' . $this->style . '"' : ''; ?> |
|
78 | + <?php echo $this->style ? 'style="'.$this->style.'"' : ''; ?> |
|
79 | 79 | <?php echo $this->attributes ?>> |
80 | 80 | <?php |
81 | 81 | |
82 | - if ( false === $this->range ) { |
|
82 | + if (false === $this->range) { |
|
83 | 83 | |
84 | 84 | ?> |
85 | 85 | <i class="simcal-icon-calendar"></i> |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | readonly="readonly" /> |
91 | 91 | <?php |
92 | 92 | |
93 | - if ( true === $this->inline ) { |
|
93 | + if (true === $this->inline) { |
|
94 | 94 | echo $this->tooltip; |
95 | 95 | } |
96 | 96 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -42,19 +42,19 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param array $field |
44 | 44 | */ |
45 | - public function __construct( $field ) { |
|
45 | + public function __construct($field) { |
|
46 | 46 | |
47 | - $this->subtype = isset( $field['subtype'] ) ? $field['subtype'] : ''; |
|
48 | - $this->type_class = 'simcal-field-datetime-format simcal-field-' . $this->subtype . '-format-field'; |
|
49 | - $this->timestamp = mktime( 13, 10, 00, 1, 1, intval( date( 'Y', time() ) ) + 1 ); |
|
47 | + $this->subtype = isset($field['subtype']) ? $field['subtype'] : ''; |
|
48 | + $this->type_class = 'simcal-field-datetime-format simcal-field-'.$this->subtype.'-format-field'; |
|
49 | + $this->timestamp = mktime(13, 10, 00, 1, 1, intval(date('Y', time())) + 1); |
|
50 | 50 | |
51 | - parent::__construct( $field ); |
|
51 | + parent::__construct($field); |
|
52 | 52 | |
53 | - if ( empty( $this->value ) ) { |
|
54 | - if ( 'date' == $this->subtype ) { |
|
53 | + if (empty($this->value)) { |
|
54 | + if ('date' == $this->subtype) { |
|
55 | 55 | $this->value = 'l, d F Y'; |
56 | 56 | } |
57 | - if ( 'time' == $this->subtype ) { |
|
57 | + if ('time' == $this->subtype) { |
|
58 | 58 | $this->value = 'G:i a'; |
59 | 59 | } |
60 | 60 | } |
@@ -67,36 +67,36 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function html() { |
69 | 69 | |
70 | - $id = $this->id ? ' id="' . $this->id . '" ' : ''; |
|
71 | - $class = $this->class ? ' class="' . $this->class . '" ' : ''; |
|
72 | - $style = $this->style ? ' style="' . $this->style . '" ' : ''; |
|
70 | + $id = $this->id ? ' id="'.$this->id.'" ' : ''; |
|
71 | + $class = $this->class ? ' class="'.$this->class.'" ' : ''; |
|
72 | + $style = $this->style ? ' style="'.$this->style.'" ' : ''; |
|
73 | 73 | $attr = $this->attributes; |
74 | 74 | |
75 | 75 | ?> |
76 | - <div <?php echo $id . $class . $style . $attr; ?>> |
|
76 | + <div <?php echo $id.$class.$style.$attr; ?>> |
|
77 | 77 | <?php |
78 | 78 | |
79 | - if ( ! empty( $this->description ) ) { |
|
80 | - echo '<p class="description">' . $this->description . '</p>'; |
|
79 | + if ( ! empty($this->description)) { |
|
80 | + echo '<p class="description">'.$this->description.'</p>'; |
|
81 | 81 | } |
82 | 82 | |
83 | - $matches = array_unique( str_split( $this->value ) ); |
|
83 | + $matches = array_unique(str_split($this->value)); |
|
84 | 84 | |
85 | - if ( 'date' == $this->subtype ) { |
|
86 | - $this->print_date( $matches ); |
|
85 | + if ('date' == $this->subtype) { |
|
86 | + $this->print_date($matches); |
|
87 | 87 | } |
88 | 88 | |
89 | - if ( 'time' == $this->subtype ) { |
|
90 | - $this->print_time( $matches ); |
|
89 | + if ('time' == $this->subtype) { |
|
90 | + $this->print_time($matches); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | ?> |
94 | 94 | <input type="hidden" |
95 | 95 | name="<?php echo $this->name; ?>" |
96 | - value="<?php echo trim( $this->value ); ?>" /> |
|
96 | + value="<?php echo trim($this->value); ?>" /> |
|
97 | 97 | <span> |
98 | - <em><?php _e( 'Preview', 'google-calendar-events' ); ?>:</em> |
|
99 | - <code><?php echo date_i18n( $this->value, $this->timestamp ); ?></code> |
|
98 | + <em><?php _e('Preview', 'google-calendar-events'); ?>:</em> |
|
99 | + <code><?php echo date_i18n($this->value, $this->timestamp); ?></code> |
|
100 | 100 | </span> |
101 | 101 | </div> |
102 | 102 | <?php |
@@ -111,30 +111,30 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @param array $matches |
113 | 113 | */ |
114 | - private function print_date( $matches ) { |
|
114 | + private function print_date($matches) { |
|
115 | 115 | |
116 | - $date = array( 'weekday' => '', 'divider' => '', 'day' => '', 'month' => '', 'year' => '' ); |
|
116 | + $date = array('weekday' => '', 'divider' => '', 'day' => '', 'month' => '', 'year' => ''); |
|
117 | 117 | |
118 | - foreach ( $matches as $match ) { |
|
119 | - if ( in_array( $match, array( 'D', 'l' ) ) ) { |
|
118 | + foreach ($matches as $match) { |
|
119 | + if (in_array($match, array('D', 'l'))) { |
|
120 | 120 | $this->weekday(); |
121 | - unset( $date['weekday'] ); |
|
122 | - } elseif ( in_array( $match, array( 'd', 'j' ) ) ) { |
|
121 | + unset($date['weekday']); |
|
122 | + } elseif (in_array($match, array('d', 'j'))) { |
|
123 | 123 | $this->day(); |
124 | - unset( $date['day'] ); |
|
125 | - } elseif ( in_array( $match, array( 'F', 'M', 'm', 'n' ) ) ) { |
|
124 | + unset($date['day']); |
|
125 | + } elseif (in_array($match, array('F', 'M', 'm', 'n'))) { |
|
126 | 126 | $this->month(); |
127 | - unset( $date['month'] ); |
|
128 | - } elseif ( in_array( $match, array( 'y', 'Y' ) ) ) { |
|
127 | + unset($date['month']); |
|
128 | + } elseif (in_array($match, array('y', 'Y'))) { |
|
129 | 129 | $this->year(); |
130 | - unset( $date['year'] ); |
|
131 | - } elseif ( in_array( $match, array( '.', ',', ':', '/', '-' ) ) ) { |
|
130 | + unset($date['year']); |
|
131 | + } elseif (in_array($match, array('.', ',', ':', '/', '-'))) { |
|
132 | 132 | $this->divider(); |
133 | - unset( $date['divider'] ); |
|
133 | + unset($date['divider']); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - $this->print_fields( $date ); |
|
137 | + $this->print_fields($date); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -145,27 +145,27 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param array $matches |
147 | 147 | */ |
148 | - private function print_time( $matches ) { |
|
148 | + private function print_time($matches) { |
|
149 | 149 | |
150 | - $time = array( 'hours' => '', 'divider' => '', 'minutes' => '', 'meridiem' => '' ); |
|
150 | + $time = array('hours' => '', 'divider' => '', 'minutes' => '', 'meridiem' => ''); |
|
151 | 151 | |
152 | - foreach ( $matches as $match ) { |
|
153 | - if ( in_array( $match, array( 'h', 'H', 'g', 'G' ) ) ) { |
|
152 | + foreach ($matches as $match) { |
|
153 | + if (in_array($match, array('h', 'H', 'g', 'G'))) { |
|
154 | 154 | $this->hours(); |
155 | - unset( $time['hours'] ); |
|
156 | - } elseif ( in_array( $match, array( 'i' ) ) ) { |
|
155 | + unset($time['hours']); |
|
156 | + } elseif (in_array($match, array('i'))) { |
|
157 | 157 | $this->minutes(); |
158 | - unset( $time['minutes'] ); |
|
159 | - } elseif ( in_array( $match, array( 'A', 'a' ) ) ) { |
|
158 | + unset($time['minutes']); |
|
159 | + } elseif (in_array($match, array('A', 'a'))) { |
|
160 | 160 | $this->meridiem(); |
161 | - unset( $time['meridiem'] ); |
|
162 | - } elseif ( in_array( $match, array( '.', ',', ':', '/', '-' ) ) ) { |
|
161 | + unset($time['meridiem']); |
|
162 | + } elseif (in_array($match, array('.', ',', ':', '/', '-'))) { |
|
163 | 163 | $this->divider(); |
164 | - unset( $time['divider'] ); |
|
164 | + unset($time['divider']); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - $this->print_fields( $time ); |
|
168 | + $this->print_fields($time); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param $fields |
178 | 178 | */ |
179 | - private function print_fields( $fields ) { |
|
180 | - if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
181 | - foreach ( $fields as $func => $v ) { |
|
182 | - if ( method_exists( $this, $func ) ) { |
|
179 | + private function print_fields($fields) { |
|
180 | + if ( ! empty($fields) && is_array($fields)) { |
|
181 | + foreach ($fields as $func => $v) { |
|
182 | + if (method_exists($this, $func)) { |
|
183 | 183 | $this->$func(); |
184 | 184 | }; |
185 | 185 | } |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | ?> |
198 | 198 | <div> |
199 | 199 | <label for="<?php echo $this->id; ?>-weekday"> |
200 | - <?php _e( 'Weekday', 'google-calendar-events' ); ?> |
|
200 | + <?php _e('Weekday', 'google-calendar-events'); ?> |
|
201 | 201 | <select name="" id="<?php echo $this->id; ?>-weekday"> |
202 | 202 | <option value="" data-preview=""></option> |
203 | - <option value="D" <?php selected( 'D', strpbrk( 'D', $this->value ) ) ?> data-preview="<?php echo date_i18n( 'D', $this->timestamp ); ?>"><?php echo date_i18n( 'D', $this->timestamp ); ?></option> |
|
204 | - <option value="l" <?php selected( 'l', strpbrk( 'l', $this->value ) ) ?> data-preview="<?php echo date_i18n( 'l', $this->timestamp ); ?>"><?php echo date_i18n( 'l', $this->timestamp ); ?></option> |
|
203 | + <option value="D" <?php selected('D', strpbrk('D', $this->value)) ?> data-preview="<?php echo date_i18n('D', $this->timestamp); ?>"><?php echo date_i18n('D', $this->timestamp); ?></option> |
|
204 | + <option value="l" <?php selected('l', strpbrk('l', $this->value)) ?> data-preview="<?php echo date_i18n('l', $this->timestamp); ?>"><?php echo date_i18n('l', $this->timestamp); ?></option> |
|
205 | 205 | </select> |
206 | 206 | </label> |
207 | 207 | </div> |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | ?> |
221 | 221 | <div> |
222 | 222 | <label for="<?php echo $this->id; ?>-day"> |
223 | - <?php _e( 'Day', 'google-calendar-events' ); ?> |
|
223 | + <?php _e('Day', 'google-calendar-events'); ?> |
|
224 | 224 | <select name="" id="<?php echo $this->id; ?>-day"> |
225 | 225 | <option value="" data-preview=""></option> |
226 | - <option value="j" <?php selected( 'j', strpbrk( 'j', $this->value ) ) ?> data-preview="<?php echo date( 'j', $this->timestamp ); ?>"><?php echo date( 'j', $this->timestamp ); ?></option> |
|
227 | - <option value="d" <?php selected( 'd', strpbrk( 'd', $this->value ) ) ?> data-preview="<?php echo date( 'd', $this->timestamp ); ?>"><?php echo date( 'd', $this->timestamp ); ?></option> |
|
226 | + <option value="j" <?php selected('j', strpbrk('j', $this->value)) ?> data-preview="<?php echo date('j', $this->timestamp); ?>"><?php echo date('j', $this->timestamp); ?></option> |
|
227 | + <option value="d" <?php selected('d', strpbrk('d', $this->value)) ?> data-preview="<?php echo date('d', $this->timestamp); ?>"><?php echo date('d', $this->timestamp); ?></option> |
|
228 | 228 | </select> |
229 | 229 | </label> |
230 | 230 | </div> |
@@ -243,13 +243,13 @@ discard block |
||
243 | 243 | ?> |
244 | 244 | <div> |
245 | 245 | <label for="<?php echo $this->id; ?>-month"> |
246 | - <?php _e( 'Month', 'google-calendar-events' ); ?> |
|
246 | + <?php _e('Month', 'google-calendar-events'); ?> |
|
247 | 247 | <select name="" id="<?php echo $this->id; ?>-month"> |
248 | 248 | <option value="" data-preview=""></option> |
249 | - <option value="F" <?php selected( 'F', strpbrk( 'F', $this->value ) ) ?> data-preview="<?php echo date_i18n( 'F', $this->timestamp ); ?>"><?php echo date_i18n( 'F', $this->timestamp ); ?></option> |
|
250 | - <option value="M" <?php selected( 'M', strpbrk( 'M', $this->value ) ) ?> data-preview="<?php echo date_i18n( 'M', $this->timestamp ); ?>"><?php echo date_i18n( 'M', $this->timestamp ); ?></option> |
|
251 | - <option value="m" <?php selected( 'm', strpbrk( 'm', $this->value ) ) ?> data-preview="<?php echo date( 'm', $this->timestamp ); ?>"><?php echo date( 'm', $this->timestamp ); ?></option> |
|
252 | - <option value="n" <?php selected( 'n', strpbrk( 'n', $this->value ) ) ?> data-preview="<?php echo date( 'n', $this->timestamp ); ?>"><?php echo date( 'n', $this->timestamp ); ?></option> |
|
249 | + <option value="F" <?php selected('F', strpbrk('F', $this->value)) ?> data-preview="<?php echo date_i18n('F', $this->timestamp); ?>"><?php echo date_i18n('F', $this->timestamp); ?></option> |
|
250 | + <option value="M" <?php selected('M', strpbrk('M', $this->value)) ?> data-preview="<?php echo date_i18n('M', $this->timestamp); ?>"><?php echo date_i18n('M', $this->timestamp); ?></option> |
|
251 | + <option value="m" <?php selected('m', strpbrk('m', $this->value)) ?> data-preview="<?php echo date('m', $this->timestamp); ?>"><?php echo date('m', $this->timestamp); ?></option> |
|
252 | + <option value="n" <?php selected('n', strpbrk('n', $this->value)) ?> data-preview="<?php echo date('n', $this->timestamp); ?>"><?php echo date('n', $this->timestamp); ?></option> |
|
253 | 253 | </select> |
254 | 254 | </label> |
255 | 255 | </div> |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | ?> |
269 | 269 | <div> |
270 | 270 | <label for="<?php echo $this->id; ?>-year"> |
271 | - <?php _e( 'Year', 'google-calendar-events' ); ?> |
|
271 | + <?php _e('Year', 'google-calendar-events'); ?> |
|
272 | 272 | <select name="" id="<?php echo $this->id; ?>-year"> |
273 | 273 | <option value="" data-preview=""></option> |
274 | - <option value="Y" <?php selected( 'Y', strpbrk( 'Y', $this->value ) ) ?> data-preview="<?php echo date( 'Y', $this->timestamp ); ?>"><?php echo date( 'Y', $this->timestamp ); ?></option> |
|
275 | - <option value="y" <?php selected( 'y', strpbrk( 'y', $this->value ) ) ?> data-preview="<?php echo date( 'y', $this->timestamp ); ?>"><?php echo date( 'y', $this->timestamp ); ?></option> |
|
274 | + <option value="Y" <?php selected('Y', strpbrk('Y', $this->value)) ?> data-preview="<?php echo date('Y', $this->timestamp); ?>"><?php echo date('Y', $this->timestamp); ?></option> |
|
275 | + <option value="y" <?php selected('y', strpbrk('y', $this->value)) ?> data-preview="<?php echo date('y', $this->timestamp); ?>"><?php echo date('y', $this->timestamp); ?></option> |
|
276 | 276 | </select> |
277 | 277 | </label> |
278 | 278 | </div> |
@@ -291,13 +291,13 @@ discard block |
||
291 | 291 | ?> |
292 | 292 | <div> |
293 | 293 | <label for="<?php echo $this->id; ?>-hours"> |
294 | - <?php _e( 'Hours', 'google-calendar-events' ) ?> |
|
294 | + <?php _e('Hours', 'google-calendar-events') ?> |
|
295 | 295 | <select name="" id="<?php echo $this->id; ?>-hours"> |
296 | 296 | <option value="" data-preview=""></option> |
297 | - <option value="g" <?php selected( 'g', strpbrk( 'g', $this->value ) ); ?> data-preview="<?php echo date( 'g', $this->timestamp ); ?>"><?php echo date( 'g', $this->timestamp ) . ' (12h)'; ?></option> |
|
298 | - <option value="G" <?php selected( 'G', strpbrk( 'G', $this->value ) ); ?> data-preview="<?php echo date( 'G', $this->timestamp - 43200 ); ?>"><?php echo date( 'G', $this->timestamp - 43200 ) . ' (24h)'; ?></option> |
|
299 | - <option value="h" <?php selected( 'h', strpbrk( 'h', $this->value ) ); ?> data-preview="<?php echo date( 'h', $this->timestamp ); ?>"><?php echo date( 'h', $this->timestamp ) . ' (12h)'; ?></option> |
|
300 | - <option value="H" <?php selected( 'H', strpbrk( 'H', $this->value ) ); ?> data-preview="<?php echo date( 'H', $this->timestamp - 43200 ); ?>"><?php echo date( 'H', $this->timestamp - 43200 ) . ' (24h)'; ?></option> |
|
297 | + <option value="g" <?php selected('g', strpbrk('g', $this->value)); ?> data-preview="<?php echo date('g', $this->timestamp); ?>"><?php echo date('g', $this->timestamp).' (12h)'; ?></option> |
|
298 | + <option value="G" <?php selected('G', strpbrk('G', $this->value)); ?> data-preview="<?php echo date('G', $this->timestamp - 43200); ?>"><?php echo date('G', $this->timestamp - 43200).' (24h)'; ?></option> |
|
299 | + <option value="h" <?php selected('h', strpbrk('h', $this->value)); ?> data-preview="<?php echo date('h', $this->timestamp); ?>"><?php echo date('h', $this->timestamp).' (12h)'; ?></option> |
|
300 | + <option value="H" <?php selected('H', strpbrk('H', $this->value)); ?> data-preview="<?php echo date('H', $this->timestamp - 43200); ?>"><?php echo date('H', $this->timestamp - 43200).' (24h)'; ?></option> |
|
301 | 301 | </select> |
302 | 302 | </label> |
303 | 303 | </div> |
@@ -316,10 +316,10 @@ discard block |
||
316 | 316 | ?> |
317 | 317 | <div> |
318 | 318 | <label for="<?php echo $this->id; ?>-minutes"> |
319 | - <?php _e( 'Minutes', 'google-calendar-events' ); ?> |
|
319 | + <?php _e('Minutes', 'google-calendar-events'); ?> |
|
320 | 320 | <select name="" id="<?php echo $this->id; ?>-minutes"> |
321 | 321 | <option value="" data-preview=""></option> |
322 | - <option value="i" <?php selected( 'i', strpbrk( 'i', $this->value ) ); ?> data-preview="<?php echo date( 'i', $this->timestamp ); ?>"><?php echo date( 'i', $this->timestamp ); ?></option> |
|
322 | + <option value="i" <?php selected('i', strpbrk('i', $this->value)); ?> data-preview="<?php echo date('i', $this->timestamp); ?>"><?php echo date('i', $this->timestamp); ?></option> |
|
323 | 323 | </select> |
324 | 324 | </label> |
325 | 325 | </div> |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | ?> |
339 | 339 | <div> |
340 | 340 | <label for="<?php echo $this->id; ?>-meridiem"> |
341 | - <?php _e( 'Meridiem', 'google-calendar-events' ); ?> |
|
341 | + <?php _e('Meridiem', 'google-calendar-events'); ?> |
|
342 | 342 | <select name="" id="<?php echo $this->id; ?>-meridiem"> |
343 | 343 | <option value="" data-preview=""></option> |
344 | - <option value="a" <?php selected( 'a', strpbrk( 'a', $this->value ) ); ?> data-preview="<?php echo date( 'a', $this->timestamp ); ?>"><?php echo date( 'a', $this->timestamp ); ?></option> |
|
345 | - <option value="A" <?php selected( 'A', strpbrk( 'A', $this->value ) ); ?> data-preview="<?php echo date( 'A', $this->timestamp ); ?>"><?php echo date( 'A', $this->timestamp ); ?></option> |
|
344 | + <option value="a" <?php selected('a', strpbrk('a', $this->value)); ?> data-preview="<?php echo date('a', $this->timestamp); ?>"><?php echo date('a', $this->timestamp); ?></option> |
|
345 | + <option value="A" <?php selected('A', strpbrk('A', $this->value)); ?> data-preview="<?php echo date('A', $this->timestamp); ?>"><?php echo date('A', $this->timestamp); ?></option> |
|
346 | 346 | </select> |
347 | 347 | </label> |
348 | 348 | </div> |
@@ -361,14 +361,14 @@ discard block |
||
361 | 361 | ?> |
362 | 362 | <div> |
363 | 363 | <label for="<?php echo $this->id; ?>-divider"> |
364 | - <?php _ex( 'Divider', 'A character to separate two elements', 'google-calendar-events' ); ?> |
|
364 | + <?php _ex('Divider', 'A character to separate two elements', 'google-calendar-events'); ?> |
|
365 | 365 | <select name="" id="<?php echo $this->id; ?>-divider"> |
366 | 366 | <option value="" data-preview=""></option> |
367 | - <option value="." <?php selected( '.', strpbrk( '.', $this->value ) ); ?> data-preview="." data-trim="true">.</option> |
|
368 | - <option value=", " <?php selected( ',', strpbrk( ',', $this->value ) ); ?> data-preview=", " data-trim="true">,</option> |
|
369 | - <option value=":" <?php selected( ':', strpbrk( ':', $this->value ) ); ?> data-preview=":" data-trim="true">:</option> |
|
370 | - <option value="-" <?php selected( '-', strpbrk( '-', $this->value ) ); ?> data-preview="-" data-trim="true">-</option> |
|
371 | - <option value="/" <?php selected( '/', strpbrk( '/', $this->value ) ); ?> data-preview="/" data-trim="true">/</option> |
|
367 | + <option value="." <?php selected('.', strpbrk('.', $this->value)); ?> data-preview="." data-trim="true">.</option> |
|
368 | + <option value=", " <?php selected(',', strpbrk(',', $this->value)); ?> data-preview=", " data-trim="true">,</option> |
|
369 | + <option value=":" <?php selected(':', strpbrk(':', $this->value)); ?> data-preview=":" data-trim="true">:</option> |
|
370 | + <option value="-" <?php selected('-', strpbrk('-', $this->value)); ?> data-preview="-" data-trim="true">-</option> |
|
371 | + <option value="/" <?php selected('/', strpbrk('/', $this->value)); ?> data-preview="/" data-trim="true">/</option> |
|
372 | 372 | </select> |
373 | 373 | </label> |
374 | 374 | </div> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param array $field |
36 | 36 | */ |
37 | - public function __construct( $field ) { |
|
38 | - $this->addon = isset( $field['addon'] ) ? esc_attr( $field['addon'] ) : ''; |
|
37 | + public function __construct($field) { |
|
38 | + $this->addon = isset($field['addon']) ? esc_attr($field['addon']) : ''; |
|
39 | 39 | $this->type_class = 'simcal-field-license'; |
40 | - parent::__construct( $field ); |
|
40 | + parent::__construct($field); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,19 +47,19 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function html() { |
49 | 49 | |
50 | - if ( ! empty( $this->addon ) ) { |
|
50 | + if ( ! empty($this->addon)) { |
|
51 | 51 | |
52 | - $status = simcal_get_license_status( $this->addon ); |
|
52 | + $status = simcal_get_license_status($this->addon); |
|
53 | 53 | |
54 | - if ( empty( $status ) || in_array( $status, array( 'valid', 'invalid', 'deactivated' ) ) ) { |
|
54 | + if (empty($status) || in_array($status, array('valid', 'invalid', 'deactivated'))) { |
|
55 | 55 | $display_activate = 'display: inline-block'; |
56 | 56 | $display_deactivate = 'display: none'; |
57 | 57 | $active = 'valid' == $status ? 'display: block' : 'display: none'; |
58 | - $disabled = ''; |
|
58 | + $disabled = ''; |
|
59 | 59 | } else { |
60 | 60 | $display_activate = $active = 'display: none'; |
61 | 61 | $display_deactivate = 'display: inline-block'; |
62 | - $disabled = empty( $this->value ) ? '' : 'disabled="disabled"'; |
|
62 | + $disabled = empty($this->value) ? '' : 'disabled="disabled"'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | ?> |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | <span class="simcal-addon-manage-license-buttons"> |
75 | 75 | |
76 | 76 | <button class="button-secondary simcal-addon-manage-license deactivate" data-add-on="<?php echo $this->addon; ?>" style="<?php echo $display_deactivate; ?>"> |
77 | - <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e( 'Deactivate', 'google-calendar-events' ); ?> |
|
77 | + <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e('Deactivate', 'google-calendar-events'); ?> |
|
78 | 78 | </button> |
79 | 79 | |
80 | 80 | <button class="button-secondary simcal-addon-manage-license activate" data-add-on="<?php echo $this->addon; ?>" style="<?php echo $display_activate; ?>"> |
81 | - <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e( 'Activate', 'google-calendar-events' ); ?> |
|
81 | + <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e('Activate', 'google-calendar-events'); ?> |
|
82 | 82 | </button> |
83 | 83 | |
84 | 84 | <span class="error" style="color: red; display: none"> </span> |
85 | 85 | |
86 | - <strong class="label" style="color:green; <?php echo $active; ?>"> <?php _e( '(active)', 'google-calendar-events' ); ?></strong> |
|
86 | + <strong class="label" style="color:green; <?php echo $active; ?>"> <?php _e('(active)', 'google-calendar-events'); ?></strong> |
|
87 | 87 | |
88 | 88 | </span> |
89 | 89 |