@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | |
37 | - $this->widgets = apply_filters( 'simcal_get_widgets', array( |
|
37 | + $this->widgets = apply_filters('simcal_get_widgets', array( |
|
38 | 38 | 'SimpleCalendar\Widgets\Calendar' |
39 | - ), array() ); |
|
39 | + ), array()); |
|
40 | 40 | |
41 | - add_action( 'widgets_init', array( $this, 'register' ) ); |
|
41 | + add_action('widgets_init', array($this, 'register')); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | |
51 | 51 | $widgets = $this->widgets; |
52 | 52 | |
53 | - if ( ! empty( $widgets ) && is_array( $widgets ) ) { |
|
54 | - foreach ( $widgets as $widget ) { |
|
55 | - register_widget( $widget ); |
|
53 | + if ( ! empty($widgets) && is_array($widgets)) { |
|
54 | + foreach ($widgets as $widget) { |
|
55 | + register_widget($widget); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - do_action( 'simcal_register_widgets' ); |
|
59 | + do_action('simcal_register_widgets'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use SimpleCalendar\Abstracts\Calendar_View; |
10 | 10 | use SimpleCalendar\Abstracts\Widget; |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -46,18 +46,18 @@ discard block |
||
46 | 46 | public function __construct() { |
47 | 47 | |
48 | 48 | $id_base = 'gce_widget'; // old id kept for legacy reasons |
49 | - $name = __( 'Simple Calendar', 'google-calendar-events' ); |
|
49 | + $name = __('Simple Calendar', 'google-calendar-events'); |
|
50 | 50 | $widget_options = array( |
51 | - 'description' => __( 'Display a calendar of events from one of your calendar feeds.', 'google-calendar-events' ) |
|
51 | + 'description' => __('Display a calendar of events from one of your calendar feeds.', 'google-calendar-events') |
|
52 | 52 | ); |
53 | 53 | |
54 | - parent::__construct( $id_base, $name, $widget_options ); |
|
54 | + parent::__construct($id_base, $name, $widget_options); |
|
55 | 55 | |
56 | - if ( is_admin() ) { |
|
57 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
56 | + if (is_admin()) { |
|
57 | + if ( ! defined('DOING_AJAX')) { |
|
58 | 58 | $this->calendars = simcal_get_calendars(); |
59 | 59 | } else { |
60 | - $this->calendars = get_transient( '_simple-calendar_feed_ids' ); |
|
60 | + $this->calendars = get_transient('_simple-calendar_feed_ids'); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | } |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | * @param array $args Display arguments. |
71 | 71 | * @param array $instance The settings for the particular instance of the widget. |
72 | 72 | */ |
73 | - public function widget( $args, $instance ) { |
|
73 | + public function widget($args, $instance) { |
|
74 | 74 | |
75 | 75 | echo $args['before_widget']; |
76 | 76 | |
77 | - if ( ! empty( $instance['title'] ) ) { |
|
77 | + if ( ! empty($instance['title'])) { |
|
78 | 78 | |
79 | - echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; |
|
79 | + echo $args['before_title'].apply_filters('widget_title', $instance['title']).$args['after_title']; |
|
80 | 80 | } |
81 | 81 | |
82 | - $id = isset( $instance['calendar_id'] ) ? absint( $instance['calendar_id'] ) : 0; |
|
83 | - if ( $id > 0 ) { |
|
84 | - simcal_print_calendar( $id ); |
|
82 | + $id = isset($instance['calendar_id']) ? absint($instance['calendar_id']) : 0; |
|
83 | + if ($id > 0) { |
|
84 | + simcal_print_calendar($id); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | echo $args['after_widget']; |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return array Settings to save or bool false to cancel saving. |
103 | 103 | */ |
104 | - public function update( $new_instance, $old_instance ) { |
|
104 | + public function update($new_instance, $old_instance) { |
|
105 | 105 | |
106 | 106 | $instance = array(); |
107 | 107 | |
108 | - $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? sanitize_text_field( $new_instance['title'] ) : ''; |
|
109 | - $instance['calendar_id'] = ( ! empty( $new_instance['calendar_id'] ) ) ? absint( $new_instance['calendar_id'] ) : ''; |
|
108 | + $instance['title'] = ( ! empty($new_instance['title'])) ? sanitize_text_field($new_instance['title']) : ''; |
|
109 | + $instance['calendar_id'] = ( ! empty($new_instance['calendar_id'])) ? absint($new_instance['calendar_id']) : ''; |
|
110 | 110 | |
111 | 111 | return $instance; |
112 | 112 | } |
@@ -120,34 +120,34 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - public function form( $instance ) { |
|
123 | + public function form($instance) { |
|
124 | 124 | |
125 | - $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : __( 'Calendar', 'google-calendar-events' ); |
|
126 | - $calendar_id = isset( $instance['calendar_id'] ) ? esc_attr( $instance['calendar_id'] ) : ''; |
|
125 | + $title = isset($instance['title']) ? esc_attr($instance['title']) : __('Calendar', 'google-calendar-events'); |
|
126 | + $calendar_id = isset($instance['calendar_id']) ? esc_attr($instance['calendar_id']) : ''; |
|
127 | 127 | |
128 | 128 | ?> |
129 | 129 | <div class="simcal-calendar-widget-settings"> |
130 | 130 | |
131 | 131 | <p> |
132 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'google-calendar-events' ); ?></label> |
|
132 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'google-calendar-events'); ?></label> |
|
133 | 133 | <br> |
134 | 134 | <input type="text" |
135 | - name="<?php echo $this->get_field_name( 'title' ); ?>" |
|
136 | - id="<?php echo $this->get_field_id( 'title' ); ?>" |
|
135 | + name="<?php echo $this->get_field_name('title'); ?>" |
|
136 | + id="<?php echo $this->get_field_id('title'); ?>" |
|
137 | 137 | class="widefat simcal-field simcal-field-standard simcal-field-text" |
138 | 138 | value="<?php echo $title; ?>"> |
139 | 139 | </p> |
140 | 140 | |
141 | 141 | <p> |
142 | - <label for="<?php echo $this->get_field_id( 'calendar_id' ); ?>"><?php _e( 'Calendar:', 'google-calendar-events' ); ?></label> |
|
142 | + <label for="<?php echo $this->get_field_id('calendar_id'); ?>"><?php _e('Calendar:', 'google-calendar-events'); ?></label> |
|
143 | 143 | <br> |
144 | - <?php $multiselect = count( $this->calendars ) > 15 ? ' simcal-field-select-enhanced' : ''; ?> |
|
145 | - <select name="<?php echo $this->get_field_name( 'calendar_id' ) ?>" |
|
146 | - id="<?php echo $this->get_field_id( 'calendar_id' ) ?>" |
|
144 | + <?php $multiselect = count($this->calendars) > 15 ? ' simcal-field-select-enhanced' : ''; ?> |
|
145 | + <select name="<?php echo $this->get_field_name('calendar_id') ?>" |
|
146 | + id="<?php echo $this->get_field_id('calendar_id') ?>" |
|
147 | 147 | class="simcal-field simcal-field-select<?php echo $multiselect; ?>" |
148 | - data-noresults="<?php __( 'No calendars found.', 'google-calendar-events' ); ?>"> |
|
149 | - <?php foreach ( $this->calendars as $id => $name ) : ?> |
|
150 | - <option value="<?php echo $id; ?>" <?php selected( $id, $calendar_id, true ); ?>><?php echo $name; ?></option> |
|
148 | + data-noresults="<?php __('No calendars found.', 'google-calendar-events'); ?>"> |
|
149 | + <?php foreach ($this->calendars as $id => $name) : ?> |
|
150 | + <option value="<?php echo $id; ?>" <?php selected($id, $calendar_id, true); ?>><?php echo $name; ?></option> |
|
151 | 151 | <?php endforeach; ?> |
152 | 152 | </select> |
153 | 153 | </p> |
@@ -6,20 +6,20 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Exit if not uninstalling from WordPress. |
9 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
9 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
13 | 13 | // Get user options whether to delete settings and/or data. |
14 | -$settings = get_option( 'simple-calendar_settings_advanced' ); |
|
14 | +$settings = get_option('simple-calendar_settings_advanced'); |
|
15 | 15 | |
16 | -if ( isset( $settings['installation']['delete_settings'] ) ) { |
|
16 | +if (isset($settings['installation']['delete_settings'])) { |
|
17 | 17 | $delete_settings = 'yes' == $settings['installation']['delete_settings'] ? true : false; |
18 | 18 | } else { |
19 | 19 | $delete_settings = false; |
20 | 20 | } |
21 | 21 | |
22 | -if ( isset( $settings['installation']['erase_data'] ) ) { |
|
22 | +if (isset($settings['installation']['erase_data'])) { |
|
23 | 23 | $erase_data = 'yes' == $settings['installation']['erase_data'] ? true : false; |
24 | 24 | } else { |
25 | 25 | $erase_data = false; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | global $wpdb; |
29 | 29 | |
30 | 30 | // Delete settings. |
31 | -if ( ( $delete_settings === true ) || ( $erase_data === true ) ) { |
|
31 | +if (($delete_settings === true) || ($erase_data === true)) { |
|
32 | 32 | $wpdb->query( |
33 | 33 | " |
34 | 34 | DELETE FROM $wpdb->options WHERE option_name LIKE '%simple-calendar%'; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | // Delete calendar data. |
40 | -if ( $erase_data === true ) { |
|
40 | +if ($erase_data === true) { |
|
41 | 41 | |
42 | 42 | // Delete calendar posts. |
43 | 43 | $wpdb->query( |
@@ -47,20 +47,20 @@ discard block |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | // Delete calendar postmeta. |
50 | - $wpdb->query( " |
|
50 | + $wpdb->query(" |
|
51 | 51 | DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL; |
52 | 52 | " |
53 | 53 | ); |
54 | 54 | |
55 | 55 | // Delete calendar terms. |
56 | - $terms = get_terms( array( |
|
56 | + $terms = get_terms(array( |
|
57 | 57 | 'calendar_category', |
58 | 58 | 'calendar_feed', |
59 | 59 | 'calendar_type', |
60 | - ) ); |
|
61 | - if ( ! empty( $terms ) && is_array( $terms ) ) { |
|
62 | - foreach ( $terms as $term ) { |
|
63 | - wp_delete_term( $term->term_id, $term->taxonomy ); |
|
60 | + )); |
|
61 | + if ( ! empty($terms) && is_array($terms)) { |
|
62 | + foreach ($terms as $term) { |
|
63 | + wp_delete_term($term->term_id, $term->taxonomy); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use Carbon\Carbon; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -234,30 +234,30 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @param array $event |
236 | 236 | */ |
237 | - public function __construct( array $event ) { |
|
237 | + public function __construct(array $event) { |
|
238 | 238 | |
239 | 239 | /* ================= * |
240 | 240 | * Event Identifiers * |
241 | 241 | * ================= */ |
242 | 242 | |
243 | 243 | // Event unique id. |
244 | - if ( ! empty( $event['uid'] ) ) { |
|
245 | - $this->uid = esc_attr( $event['uid'] ); |
|
244 | + if ( ! empty($event['uid'])) { |
|
245 | + $this->uid = esc_attr($event['uid']); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | // Event source. |
249 | - if ( ! empty( $event['source'] ) ) { |
|
250 | - $this->source = esc_attr( $event['source'] ); |
|
249 | + if ( ! empty($event['source'])) { |
|
250 | + $this->source = esc_attr($event['source']); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | // Event parent calendar id. |
254 | - if ( ! empty( $event['calendar'] ) ) { |
|
255 | - $this->calendar = max( intval( $event['calendar'] ), 0 ); |
|
254 | + if ( ! empty($event['calendar'])) { |
|
255 | + $this->calendar = max(intval($event['calendar']), 0); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | // Event parent calendar timezone. |
259 | - if ( ! empty( $event['timezone'] ) ) { |
|
260 | - $this->timezone = esc_attr( $event['timezone'] ); |
|
259 | + if ( ! empty($event['timezone'])) { |
|
260 | + $this->timezone = esc_attr($event['timezone']); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /* ============= * |
@@ -265,23 +265,23 @@ discard block |
||
265 | 265 | * ============= */ |
266 | 266 | |
267 | 267 | // Event title. |
268 | - if ( ! empty( $event['title'] ) ) { |
|
269 | - $this->title = esc_html( $event['title'] ); |
|
268 | + if ( ! empty($event['title'])) { |
|
269 | + $this->title = esc_html($event['title']); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | // Event description. |
273 | - if ( ! empty( $event['description'] ) ) { |
|
274 | - $this->description = wp_kses_post( $event['description'] ); |
|
273 | + if ( ! empty($event['description'])) { |
|
274 | + $this->description = wp_kses_post($event['description']); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | // Event link URL. |
278 | - if ( ! empty( $event['link'] ) ) { |
|
279 | - $this->link = esc_url_raw( $event['link'] ); |
|
278 | + if ( ! empty($event['link'])) { |
|
279 | + $this->link = esc_url_raw($event['link']); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | // Event visibility. |
283 | - if ( ! empty( $event['visibility'] ) ) { |
|
284 | - $this->visibility = esc_attr( $event['visibility'] ); |
|
283 | + if ( ! empty($event['visibility'])) { |
|
284 | + $this->visibility = esc_attr($event['visibility']); |
|
285 | 285 | $this->public = $this->visibility == 'public' ? true : false; |
286 | 286 | } |
287 | 287 | |
@@ -289,34 +289,34 @@ discard block |
||
289 | 289 | * Event Start * |
290 | 290 | * =========== */ |
291 | 291 | |
292 | - if ( ! empty( $event['start'] ) ) { |
|
293 | - $this->start = is_numeric( $event['start'] ) ? intval( $event['start'] ) : 0; |
|
294 | - if ( ! empty( $event['start_utc'] ) ) { |
|
295 | - $this->start_utc = is_numeric( $event['start_utc'] ) ? intval( $event['start_utc'] ) : 0; |
|
292 | + if ( ! empty($event['start'])) { |
|
293 | + $this->start = is_numeric($event['start']) ? intval($event['start']) : 0; |
|
294 | + if ( ! empty($event['start_utc'])) { |
|
295 | + $this->start_utc = is_numeric($event['start_utc']) ? intval($event['start_utc']) : 0; |
|
296 | 296 | } |
297 | - if ( ! empty( $event['start_timezone'] ) ) { |
|
298 | - $this->start_timezone = esc_attr( $event['start_timezone'] ); |
|
297 | + if ( ! empty($event['start_timezone'])) { |
|
298 | + $this->start_timezone = esc_attr($event['start_timezone']); |
|
299 | 299 | } |
300 | - $this->start_dt = Carbon::createFromTimestamp( $this->start, $this->start_timezone ); |
|
301 | - $start_location = isset( $event['start_location'] ) ? $event['start_location'] : ''; |
|
302 | - $this->start_location = $this->esc_location( $start_location ); |
|
300 | + $this->start_dt = Carbon::createFromTimestamp($this->start, $this->start_timezone); |
|
301 | + $start_location = isset($event['start_location']) ? $event['start_location'] : ''; |
|
302 | + $this->start_location = $this->esc_location($start_location); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | /* ========= * |
306 | 306 | * Event End * |
307 | 307 | * ========= */ |
308 | 308 | |
309 | - if ( ! empty( $event['end'] ) ) { |
|
310 | - $this->end = is_numeric( $event['end'] ) ? intval( $event['end'] ): false; |
|
311 | - if ( ! empty( $event['end_timezone'] ) ) { |
|
312 | - $this->end_timezone = esc_attr( $event['end_timezone'] ); |
|
309 | + if ( ! empty($event['end'])) { |
|
310 | + $this->end = is_numeric($event['end']) ? intval($event['end']) : false; |
|
311 | + if ( ! empty($event['end_timezone'])) { |
|
312 | + $this->end_timezone = esc_attr($event['end_timezone']); |
|
313 | 313 | } |
314 | - if ( ! empty( $event['end_utc'] ) ) { |
|
315 | - $this->end_utc = is_numeric( $event['end_utc'] ) ? intval( $event['end_utc'] ) : false; |
|
316 | - $this->end_dt = Carbon::createFromTimestamp( $this->end, $this->end_timezone ); |
|
314 | + if ( ! empty($event['end_utc'])) { |
|
315 | + $this->end_utc = is_numeric($event['end_utc']) ? intval($event['end_utc']) : false; |
|
316 | + $this->end_dt = Carbon::createFromTimestamp($this->end, $this->end_timezone); |
|
317 | 317 | } |
318 | - $end_location = isset( $event['end_location'] ) ? $event['end_location'] : ''; |
|
319 | - $this->end_location = $this->esc_location( $end_location ); |
|
318 | + $end_location = isset($event['end_location']) ? $event['end_location'] : ''; |
|
319 | + $this->end_location = $this->esc_location($end_location); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /* ================== * |
@@ -324,18 +324,18 @@ discard block |
||
324 | 324 | * ================== */ |
325 | 325 | |
326 | 326 | // Whole day event. |
327 | - if ( ! empty( $event['whole_day'] ) ) { |
|
328 | - $this->whole_day = true === $event['whole_day'] ? true: false; |
|
327 | + if ( ! empty($event['whole_day'])) { |
|
328 | + $this->whole_day = true === $event['whole_day'] ? true : false; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | // Multi day event. |
332 | - if ( ! empty( $event['multiple_days'] ) ) { |
|
333 | - $this->multiple_days = max( absint( $event['multiple_days'] ), 1 ); |
|
332 | + if ( ! empty($event['multiple_days'])) { |
|
333 | + $this->multiple_days = max(absint($event['multiple_days']), 1); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | // Event recurrence. |
337 | - if ( isset( $event['recurrence'] ) ) { |
|
338 | - $this->recurrence = ! empty( $event['recurrence'] ) ? $event['recurrence'] : false; |
|
337 | + if (isset($event['recurrence'])) { |
|
338 | + $this->recurrence = ! empty($event['recurrence']) ? $event['recurrence'] : false; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | /* ========== * |
@@ -343,18 +343,18 @@ discard block |
||
343 | 343 | * ========== */ |
344 | 344 | |
345 | 345 | // Event has venue(s). |
346 | - if ( $this->start_location['venue'] || $this->end_location['venue'] ) { |
|
346 | + if ($this->start_location['venue'] || $this->end_location['venue']) { |
|
347 | 347 | $this->venue = true; |
348 | 348 | } |
349 | 349 | |
350 | 350 | // Event meta. |
351 | - if ( ! empty( $event['meta'] ) ) { |
|
352 | - $this->meta = is_array( $event['meta'] ) ? $event['meta'] : array(); |
|
351 | + if ( ! empty($event['meta'])) { |
|
352 | + $this->meta = is_array($event['meta']) ? $event['meta'] : array(); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | // Event template. |
356 | - if ( ! empty( $event['template'] ) ) { |
|
357 | - $this->template = wp_kses_post( $event['template'] ); |
|
356 | + if ( ! empty($event['template'])) { |
|
357 | + $this->template = wp_kses_post($event['template']); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | } |
@@ -369,27 +369,27 @@ discard block |
||
369 | 369 | * |
370 | 370 | * @return array |
371 | 371 | */ |
372 | - private function esc_location( $var = '' ) { |
|
372 | + private function esc_location($var = '') { |
|
373 | 373 | |
374 | 374 | $location = array(); |
375 | 375 | |
376 | - if ( is_string( $var ) ) { |
|
376 | + if (is_string($var)) { |
|
377 | 377 | $var = array( |
378 | 378 | 'name' => $var, |
379 | 379 | 'address' => $var, |
380 | 380 | ); |
381 | - } elseif ( is_bool( $var ) || is_null( $var ) ) { |
|
381 | + } elseif (is_bool($var) || is_null($var)) { |
|
382 | 382 | $var = array(); |
383 | 383 | } else { |
384 | 384 | $var = (array) $var; |
385 | 385 | } |
386 | 386 | |
387 | - $location['name'] = isset( $var['name'] ) ? esc_attr( strip_tags( $var['name'] ) ) : ''; |
|
388 | - $location['address'] = isset( $var['address'] ) ? esc_attr( strip_tags( $var['address'] ) ) : ''; |
|
389 | - $location['lat'] = isset( $var['lat'] ) ? $this->esc_coordinate( $var['lat'] ) : 0; |
|
390 | - $location['lng'] = isset( $var['lng'] ) ? $this->esc_coordinate( $var['lng'] ) : 0; |
|
387 | + $location['name'] = isset($var['name']) ? esc_attr(strip_tags($var['name'])) : ''; |
|
388 | + $location['address'] = isset($var['address']) ? esc_attr(strip_tags($var['address'])) : ''; |
|
389 | + $location['lat'] = isset($var['lat']) ? $this->esc_coordinate($var['lat']) : 0; |
|
390 | + $location['lng'] = isset($var['lng']) ? $this->esc_coordinate($var['lng']) : 0; |
|
391 | 391 | |
392 | - if ( ! empty( $location['name'] ) || ! empty( $location['address'] ) ) { |
|
392 | + if ( ! empty($location['name']) || ! empty($location['address'])) { |
|
393 | 393 | $location['venue'] = true; |
394 | 394 | } else { |
395 | 395 | $location['venue'] = false; |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | * |
409 | 409 | * @return int|float |
410 | 410 | */ |
411 | - private function esc_coordinate( $latlng = 0 ) { |
|
412 | - return is_numeric( $latlng ) ? floatval( $latlng ) : 0; |
|
411 | + private function esc_coordinate($latlng = 0) { |
|
412 | + return is_numeric($latlng) ? floatval($latlng) : 0; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | /** |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | * |
423 | 423 | * @return bool |
424 | 424 | */ |
425 | - public function set_timezone( $tz ) { |
|
426 | - if ( in_array( $tz, timezone_identifiers_list() ) ) { |
|
425 | + public function set_timezone($tz) { |
|
426 | + if (in_array($tz, timezone_identifiers_list())) { |
|
427 | 427 | $this->timezone = $tz; |
428 | 428 | return true; |
429 | 429 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | * @return bool |
450 | 450 | */ |
451 | 451 | public function starts_today() { |
452 | - return $this->start_dt->setTimezone( $this->timezone )->isToday(); |
|
452 | + return $this->start_dt->setTimezone($this->timezone)->isToday(); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @return bool |
461 | 461 | */ |
462 | 462 | public function ends_today() { |
463 | - return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isToday() : true; |
|
463 | + return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isToday() : true; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | * @return bool |
472 | 472 | */ |
473 | 473 | public function starts_tomorrow() { |
474 | - return $this->start_dt->setTimezone( $this->timezone )->isTomorrow(); |
|
474 | + return $this->start_dt->setTimezone($this->timezone)->isTomorrow(); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * @return bool |
483 | 483 | */ |
484 | 484 | public function ends_tomorrow() { |
485 | - return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isTomorrow() : false; |
|
485 | + return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isTomorrow() : false; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | /** |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @return bool |
494 | 494 | */ |
495 | 495 | public function started_yesterday() { |
496 | - return $this->start_dt->setTimezone( $this->timezone )->isYesterday(); |
|
496 | + return $this->start_dt->setTimezone($this->timezone)->isYesterday(); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | /** |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * @return bool |
505 | 505 | */ |
506 | 506 | public function ended_yesterday() { |
507 | - return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isYesterday() : false; |
|
507 | + return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isYesterday() : false; |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | /** |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @return bool |
516 | 516 | */ |
517 | 517 | public function starts_future() { |
518 | - return $this->start_dt->setTimezone( $this->timezone )->isFuture(); |
|
518 | + return $this->start_dt->setTimezone($this->timezone)->isFuture(); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | /** |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | * @return bool |
527 | 527 | */ |
528 | 528 | public function ends_future() { |
529 | - return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isFuture() : false; |
|
529 | + return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isFuture() : false; |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | /** |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @return bool |
538 | 538 | */ |
539 | 539 | public function started_past() { |
540 | - return $this->start_dt->setTimezone( $this->timezone )->isPast(); |
|
540 | + return $this->start_dt->setTimezone($this->timezone)->isPast(); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @return bool |
549 | 549 | */ |
550 | 550 | public function ended_past() { |
551 | - return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isPast() : false; |
|
551 | + return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isPast() : false; |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | /** |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @return string |
562 | 562 | */ |
563 | - public function get_color( $default = '' ) { |
|
564 | - if ( isset( $this->meta['color'] ) ) { |
|
565 | - return ! empty( $this->meta['color'] ) ? esc_attr( $this->meta['color'] ) : $default; |
|
563 | + public function get_color($default = '') { |
|
564 | + if (isset($this->meta['color'])) { |
|
565 | + return ! empty($this->meta['color']) ? esc_attr($this->meta['color']) : $default; |
|
566 | 566 | } |
567 | 567 | return $default; |
568 | 568 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * @return array |
576 | 576 | */ |
577 | 577 | public function get_attachments() { |
578 | - return isset( $this->meta['attachments'] ) ? $this->meta['attachments'] : array(); |
|
578 | + return isset($this->meta['attachments']) ? $this->meta['attachments'] : array(); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | /** |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | * @return array |
587 | 587 | */ |
588 | 588 | public function get_attendees() { |
589 | - return isset( $this->meta['attendees'] ) ? $this->meta['attendees'] : array(); |
|
589 | + return isset($this->meta['attendees']) ? $this->meta['attendees'] : array(); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | /** |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @return array |
598 | 598 | */ |
599 | 599 | public function get_organizer() { |
600 | - return isset( $this->meta['organizer'] ) ? $this->meta['organizer'] : array(); |
|
600 | + return isset($this->meta['organizer']) ? $this->meta['organizer'] : array(); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Calendars\Admin; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - if ( simcal_is_admin_screen() !== false ) { |
|
28 | - add_action( 'simcal_settings_meta_calendar_panel', array( $this, 'add_settings_meta_calendar_panel' ), 10, 1 ); |
|
27 | + if (simcal_is_admin_screen() !== false) { |
|
28 | + add_action('simcal_settings_meta_calendar_panel', array($this, 'add_settings_meta_calendar_panel'), 10, 1); |
|
29 | 29 | } |
30 | - add_action( 'simcal_process_settings_meta', array( $this, 'process_meta' ), 10, 1 ); |
|
30 | + add_action('simcal_process_settings_meta', array($this, 'process_meta'), 10, 1); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param int $post_id |
78 | 78 | */ |
79 | - public function add_settings_meta_calendar_panel( $post_id ) { |
|
79 | + public function add_settings_meta_calendar_panel($post_id) { |
|
80 | 80 | |
81 | 81 | ?> |
82 | 82 | <table id="default-calendar-settings"> |
83 | 83 | <thead> |
84 | - <tr><th colspan="2"><?php _e( 'Default calendar', 'google-calendar-events' ); ?></th></tr> |
|
84 | + <tr><th colspan="2"><?php _e('Default calendar', 'google-calendar-events'); ?></th></tr> |
|
85 | 85 | </thead> |
86 | 86 | <tbody class="simcal-panel-section"> |
87 | 87 | |
@@ -89,46 +89,46 @@ discard block |
||
89 | 89 | <th></th> |
90 | 90 | <td> |
91 | 91 | <p class="description"> |
92 | - <?php _e( "Tip: If calendar styles appear to be missing and/or navigation isn't working, try going to", 'google-calendar-events' ); ?> |
|
93 | - <a href="<?php echo esc_url( add_query_arg( array ( 'page' => 'simple-calendar_settings', 'tab' => 'advanced' ), admin_url( 'admin.php' ) ) ); ?>"> |
|
94 | - <?php _e( 'Calendars → Settings → Advanced', 'google-calendar-events' ); ?></a> |
|
95 | - <?php _e( 'and enable', 'google-calendar-events' ); ?> <strong><?php _e( 'Always Enqueue', 'google-calendar-events' ); ?></strong>. |
|
92 | + <?php _e("Tip: If calendar styles appear to be missing and/or navigation isn't working, try going to", 'google-calendar-events'); ?> |
|
93 | + <a href="<?php echo esc_url(add_query_arg(array('page' => 'simple-calendar_settings', 'tab' => 'advanced'), admin_url('admin.php'))); ?>"> |
|
94 | + <?php _e('Calendars → Settings → Advanced', 'google-calendar-events'); ?></a> |
|
95 | + <?php _e('and enable', 'google-calendar-events'); ?> <strong><?php _e('Always Enqueue', 'google-calendar-events'); ?></strong>. |
|
96 | 96 | </p> |
97 | 97 | </td> |
98 | 98 | </tr> |
99 | 99 | |
100 | 100 | <tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;"> |
101 | - <th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Event bubbles', 'google-calendar-events' ); ?></label></th> |
|
101 | + <th><label for="_default_calendar_event_bubbles_action"><?php _e('Event bubbles', 'google-calendar-events'); ?></label></th> |
|
102 | 102 | <td> |
103 | 103 | <?php |
104 | 104 | |
105 | - $bubbles = get_post_meta( $post_id, '_default_calendar_event_bubble_trigger', true ); |
|
105 | + $bubbles = get_post_meta($post_id, '_default_calendar_event_bubble_trigger', true); |
|
106 | 106 | |
107 | - simcal_print_field( array( |
|
107 | + simcal_print_field(array( |
|
108 | 108 | 'type' => 'radio', |
109 | 109 | 'inline' => 'inline', |
110 | 110 | 'name' => '_default_calendar_event_bubble_trigger', |
111 | 111 | 'id' => '_default_calendar_event_bubble_trigger', |
112 | - 'tooltip' => __( 'Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events' ), |
|
112 | + 'tooltip' => __('Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events'), |
|
113 | 113 | 'value' => $bubbles ? $bubbles : 'hover', |
114 | 114 | 'default' => 'hover', |
115 | 115 | 'options' => array( |
116 | - 'click' => __( 'Click', 'google-calendar-events' ), |
|
117 | - 'hover' => __( 'Hover', 'google-calendar-events' ), |
|
116 | + 'click' => __('Click', 'google-calendar-events'), |
|
117 | + 'hover' => __('Hover', 'google-calendar-events'), |
|
118 | 118 | ), |
119 | - ) ); |
|
119 | + )); |
|
120 | 120 | |
121 | 121 | ?> |
122 | 122 | </td> |
123 | 123 | </tr> |
124 | 124 | <tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;"> |
125 | - <th><label for="_default_calendar_trim_titles"><?php _e( 'Trim event titles', 'google-calendar-events' ); ?></label></th> |
|
125 | + <th><label for="_default_calendar_trim_titles"><?php _e('Trim event titles', 'google-calendar-events'); ?></label></th> |
|
126 | 126 | <td> |
127 | 127 | <?php |
128 | 128 | |
129 | - $trim = get_post_meta( $post_id, '_default_calendar_trim_titles', true ); |
|
129 | + $trim = get_post_meta($post_id, '_default_calendar_trim_titles', true); |
|
130 | 130 | |
131 | - simcal_print_field( array( |
|
131 | + simcal_print_field(array( |
|
132 | 132 | 'type' => 'checkbox', |
133 | 133 | 'name' => '_default_calendar_trim_titles', |
134 | 134 | 'id' => '_default_calendar_trim_titles', |
@@ -139,34 +139,34 @@ discard block |
||
139 | 139 | 'attributes' => array( |
140 | 140 | 'data-show-next-if-value' => 'yes', |
141 | 141 | ), |
142 | - ) ); |
|
142 | + )); |
|
143 | 143 | |
144 | - simcal_print_field( array( |
|
144 | + simcal_print_field(array( |
|
145 | 145 | 'type' => 'standard', |
146 | 146 | 'subtype' => 'number', |
147 | 147 | 'name' => '_default_calendar_trim_titles_chars', |
148 | 148 | 'id' => '_default_calendar_trim_titles_chars', |
149 | - 'tooltip' => __( 'Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events' ), |
|
149 | + 'tooltip' => __('Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events'), |
|
150 | 150 | 'class' => array( |
151 | 151 | 'simcal-field-tiny', |
152 | 152 | ), |
153 | - 'value' => 'yes' == $trim ? strval( max( absint( get_post_meta( $post_id, '_default_calendar_trim_titles_chars', true ) ), 1 ) ) : '20', |
|
153 | + 'value' => 'yes' == $trim ? strval(max(absint(get_post_meta($post_id, '_default_calendar_trim_titles_chars', true)), 1)) : '20', |
|
154 | 154 | 'attributes' => array( |
155 | 155 | 'min' => '1', |
156 | 156 | ), |
157 | - ) ); |
|
157 | + )); |
|
158 | 158 | |
159 | 159 | ?> |
160 | 160 | </td> |
161 | 161 | </tr> |
162 | 162 | <tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;"> |
163 | - <th><label for="_default_calendar_list_grouped_span"><?php _e( 'Span', 'google-calendar-events' ); ?></label></th> |
|
163 | + <th><label for="_default_calendar_list_grouped_span"><?php _e('Span', 'google-calendar-events'); ?></label></th> |
|
164 | 164 | <td> |
165 | 165 | <?php |
166 | 166 | |
167 | - $list_span = max( absint( get_post_meta( $post_id, '_default_calendar_list_range_span', true ) ), 1 ); |
|
167 | + $list_span = max(absint(get_post_meta($post_id, '_default_calendar_list_range_span', true)), 1); |
|
168 | 168 | |
169 | - simcal_print_field( array( |
|
169 | + simcal_print_field(array( |
|
170 | 170 | 'type' => 'standard', |
171 | 171 | 'subtype' => 'number', |
172 | 172 | 'name' => '_default_calendar_list_range_span', |
@@ -175,78 +175,78 @@ discard block |
||
175 | 175 | 'simcal-field-tiny', |
176 | 176 | 'simcal-field-inline', |
177 | 177 | ), |
178 | - 'value' => strval( $list_span ), |
|
178 | + 'value' => strval($list_span), |
|
179 | 179 | 'attributes' => array( |
180 | 180 | 'min' => '1', |
181 | 181 | ), |
182 | - ) ); |
|
182 | + )); |
|
183 | 183 | |
184 | - $list_type = get_post_meta( $post_id, '_default_calendar_list_range_type', true ); |
|
184 | + $list_type = get_post_meta($post_id, '_default_calendar_list_range_type', true); |
|
185 | 185 | |
186 | - simcal_print_field( array( |
|
186 | + simcal_print_field(array( |
|
187 | 187 | 'type' => 'select', |
188 | 188 | 'name' => '_default_calendar_list_range_type', |
189 | 189 | 'id' => '_default_calendar_list_range_type', |
190 | - 'tooltip' => __( 'Range of events to show on each calendar page.', 'google-calendar-events' ), |
|
190 | + 'tooltip' => __('Range of events to show on each calendar page.', 'google-calendar-events'), |
|
191 | 191 | 'class' => array( |
192 | 192 | 'simcal-field-inline', |
193 | 193 | ), |
194 | 194 | 'value' => $list_type, |
195 | 195 | 'options' => array( |
196 | - 'monthly' => __( 'Month(s)', 'google-calendar-events' ), |
|
197 | - 'weekly' => __( 'Week(s)', 'google-calendar-events' ), |
|
198 | - 'daily' => __( 'Day(s)', 'google-calendar-events' ), |
|
199 | - 'events' => __( 'Event(s)', 'google-calendar-events' ), |
|
196 | + 'monthly' => __('Month(s)', 'google-calendar-events'), |
|
197 | + 'weekly' => __('Week(s)', 'google-calendar-events'), |
|
198 | + 'daily' => __('Day(s)', 'google-calendar-events'), |
|
199 | + 'events' => __('Event(s)', 'google-calendar-events'), |
|
200 | 200 | ), |
201 | - ) ); |
|
201 | + )); |
|
202 | 202 | |
203 | 203 | ?> |
204 | 204 | </td> |
205 | 205 | </tr> |
206 | 206 | <tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;"> |
207 | - <th><label for="_default_calendar_list_header"><?php _e( 'Hide header', 'google-calendar-events' ); ?></label></th> |
|
207 | + <th><label for="_default_calendar_list_header"><?php _e('Hide header', 'google-calendar-events'); ?></label></th> |
|
208 | 208 | <td> |
209 | 209 | <?php |
210 | 210 | |
211 | - $header = get_post_meta( $post_id, '_default_calendar_list_header', true ); |
|
211 | + $header = get_post_meta($post_id, '_default_calendar_list_header', true); |
|
212 | 212 | |
213 | - simcal_print_field( array( |
|
213 | + simcal_print_field(array( |
|
214 | 214 | 'type' => 'checkbox', |
215 | 215 | 'name' => '_default_calendar_list_header', |
216 | 216 | 'id' => '_default_calendar_list_header', |
217 | - 'tooltip' => __( 'You can use this to hide the month header for this calendar.', 'google-calendar-events' ), |
|
217 | + 'tooltip' => __('You can use this to hide the month header for this calendar.', 'google-calendar-events'), |
|
218 | 218 | 'value' => 'yes' == $header ? 'yes' : 'no', |
219 | - ) ); |
|
219 | + )); |
|
220 | 220 | |
221 | 221 | ?> |
222 | 222 | </td> |
223 | 223 | </tr> |
224 | 224 | <tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;"> |
225 | - <th><label for="_default_calendar_compact_list"><?php _e( 'Compact list', 'google-calendar-events' ); ?></label></th> |
|
225 | + <th><label for="_default_calendar_compact_list"><?php _e('Compact list', 'google-calendar-events'); ?></label></th> |
|
226 | 226 | <td> |
227 | 227 | <?php |
228 | 228 | |
229 | - $compact = get_post_meta( $post_id, '_default_calendar_compact_list', true ); |
|
229 | + $compact = get_post_meta($post_id, '_default_calendar_compact_list', true); |
|
230 | 230 | |
231 | - simcal_print_field( array( |
|
231 | + simcal_print_field(array( |
|
232 | 232 | 'type' => 'checkbox', |
233 | 233 | 'name' => '_default_calendar_compact_list', |
234 | 234 | 'id' => '_default_calendar_compact_list', |
235 | - 'tooltip' => __( 'Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events' ), |
|
235 | + 'tooltip' => __('Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events'), |
|
236 | 236 | 'value' => 'yes' == $compact ? 'yes' : 'no', |
237 | - ) ); |
|
237 | + )); |
|
238 | 238 | |
239 | 239 | ?> |
240 | 240 | </td> |
241 | 241 | </tr> |
242 | 242 | <tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
243 | - <th><label for="_default_calendar_limit_visible_events"><?php _e( 'Limit visible events', 'google-calendar-events' ); ?></label></th> |
|
243 | + <th><label for="_default_calendar_limit_visible_events"><?php _e('Limit visible events', 'google-calendar-events'); ?></label></th> |
|
244 | 244 | <td> |
245 | 245 | <?php |
246 | 246 | |
247 | - $limit = get_post_meta( $post_id, '_default_calendar_limit_visible_events', true ); |
|
247 | + $limit = get_post_meta($post_id, '_default_calendar_limit_visible_events', true); |
|
248 | 248 | |
249 | - simcal_print_field( array( |
|
249 | + simcal_print_field(array( |
|
250 | 250 | 'type' => 'checkbox', |
251 | 251 | 'name' => '_default_calendar_limit_visible_events', |
252 | 252 | 'id' => '_default_calendar_limit_visible_events', |
@@ -257,17 +257,17 @@ discard block |
||
257 | 257 | 'attributes' => array( |
258 | 258 | 'data-show-next-if-value' => 'yes', |
259 | 259 | ) |
260 | - ) ); |
|
260 | + )); |
|
261 | 261 | |
262 | - $visible_events = absint( get_post_meta( $post_id, '_default_calendar_visible_events', true ) ); |
|
262 | + $visible_events = absint(get_post_meta($post_id, '_default_calendar_visible_events', true)); |
|
263 | 263 | $visible_events = $visible_events > 0 ? $visible_events : 3; |
264 | 264 | |
265 | - simcal_print_field( array( |
|
265 | + simcal_print_field(array( |
|
266 | 266 | 'type' => 'standard', |
267 | 267 | 'subtype' => 'number', |
268 | 268 | 'name' => '_default_calendar_visible_events', |
269 | 269 | 'id' => '_default_calendar_visible_events', |
270 | - 'tooltip' => __( 'Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events' ), |
|
270 | + 'tooltip' => __('Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events'), |
|
271 | 271 | 'class' => array( |
272 | 272 | 'simcal-field-tiny', |
273 | 273 | ), |
@@ -275,23 +275,23 @@ discard block |
||
275 | 275 | 'attributes' => array( |
276 | 276 | 'min' => '1', |
277 | 277 | ) |
278 | - ) ); |
|
278 | + )); |
|
279 | 279 | |
280 | 280 | ?> |
281 | 281 | </td> |
282 | 282 | </tr> |
283 | 283 | <tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
284 | - <th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Expand multi day events', 'google-calendar-events' ); ?></label></th> |
|
284 | + <th><label for="_default_calendar_event_bubbles_action"><?php _e('Expand multi day events', 'google-calendar-events'); ?></label></th> |
|
285 | 285 | <td> |
286 | 286 | <?php |
287 | 287 | |
288 | - simcal_print_field( array( |
|
288 | + simcal_print_field(array( |
|
289 | 289 | 'type' => 'checkbox', |
290 | 290 | 'name' => '_default_calendar_expand_multi_day_events', |
291 | 291 | 'id' => '_default_calendar_expand_multi_day_events', |
292 | - 'tooltip' => __( 'Show events spanning multiple days on each day.', 'google-calendar-events' ), |
|
293 | - 'value' => get_post_meta( $post_id, '_default_calendar_expand_multi_day_events', true ), |
|
294 | - ) ); |
|
292 | + 'tooltip' => __('Show events spanning multiple days on each day.', 'google-calendar-events'), |
|
293 | + 'value' => get_post_meta($post_id, '_default_calendar_expand_multi_day_events', true), |
|
294 | + )); |
|
295 | 295 | |
296 | 296 | ?> |
297 | 297 | </td> |
@@ -299,70 +299,70 @@ discard block |
||
299 | 299 | </tbody> |
300 | 300 | <?php |
301 | 301 | |
302 | - $settings = get_option( 'simple-calendar_settings_calendars' ); |
|
303 | - $default_theme = isset( $settings['default-calendar']['theme'] ) ? $settings['default-calendar']['theme'] : 'light'; |
|
302 | + $settings = get_option('simple-calendar_settings_calendars'); |
|
303 | + $default_theme = isset($settings['default-calendar']['theme']) ? $settings['default-calendar']['theme'] : 'light'; |
|
304 | 304 | $default_today_color = /*isset( $settings['default-calendar']['today_color'] ) ? $settings['default-calendar']['today_color'] :*/ '#1e73be'; |
305 | 305 | $default_days_events_color = /*isset( $settings['default-calendar']['days_events_color'] ) ? $settings['default-calendar']['days_events_color'] :*/ '#000000'; |
306 | 306 | |
307 | 307 | ?> |
308 | 308 | <tbody class="simcal-panel-section"> |
309 | 309 | <tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
310 | - <th><label for="_default_calendar_style_theme"><?php _e( 'Theme', 'google-calendar-events' ); ?></label></th> |
|
310 | + <th><label for="_default_calendar_style_theme"><?php _e('Theme', 'google-calendar-events'); ?></label></th> |
|
311 | 311 | <td> |
312 | 312 | <?php |
313 | 313 | |
314 | - $saved = get_post_meta( $post_id, '_default_calendar_style_theme', true ); |
|
314 | + $saved = get_post_meta($post_id, '_default_calendar_style_theme', true); |
|
315 | 315 | $value = ! $saved ? $default_theme : $saved; |
316 | 316 | |
317 | - simcal_print_field( array( |
|
317 | + simcal_print_field(array( |
|
318 | 318 | 'type' => 'select', |
319 | 319 | 'name' => '_default_calendar_style_theme', |
320 | 320 | 'id' => '_default_calendar_style_theme', |
321 | 321 | 'value' => $value, |
322 | - 'tooltip' => __( 'Choose a calendar theme to match your site theme.', 'google-calendar-events' ), |
|
322 | + 'tooltip' => __('Choose a calendar theme to match your site theme.', 'google-calendar-events'), |
|
323 | 323 | 'options' => array( |
324 | - 'light' => __( 'Light', 'google-calendar-events' ), |
|
325 | - 'dark' => __( 'Dark', 'google-calendar-events' ), |
|
324 | + 'light' => __('Light', 'google-calendar-events'), |
|
325 | + 'dark' => __('Dark', 'google-calendar-events'), |
|
326 | 326 | ), |
327 | - ) ); |
|
327 | + )); |
|
328 | 328 | |
329 | 329 | ?> |
330 | 330 | </td> |
331 | 331 | </tr> |
332 | 332 | <tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
333 | - <th><label for="_default_calendar_style_today"><?php _e( 'Today', 'google-calendar-events' ); ?></label></th> |
|
333 | + <th><label for="_default_calendar_style_today"><?php _e('Today', 'google-calendar-events'); ?></label></th> |
|
334 | 334 | <td> |
335 | 335 | <?php |
336 | 336 | |
337 | - $saved = get_post_meta( $post_id, '_default_calendar_style_today', true ); |
|
337 | + $saved = get_post_meta($post_id, '_default_calendar_style_today', true); |
|
338 | 338 | $value = ! $saved ? $default_today_color : $saved; |
339 | 339 | |
340 | - simcal_print_field( array( |
|
340 | + simcal_print_field(array( |
|
341 | 341 | 'type' => 'standard', |
342 | 342 | 'subtype' => 'color-picker', |
343 | 343 | 'name' => '_default_calendar_style_today', |
344 | 344 | 'id' => '_default_calendar_style_today', |
345 | 345 | 'value' => $value, |
346 | - ) ); |
|
346 | + )); |
|
347 | 347 | |
348 | 348 | ?> |
349 | 349 | </td> |
350 | 350 | </tr> |
351 | 351 | <tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
352 | - <th><label for="_default_calendar_style_days_events"><?php _e( 'Days with events', 'google-calendar-events' ); ?></label></th> |
|
352 | + <th><label for="_default_calendar_style_days_events"><?php _e('Days with events', 'google-calendar-events'); ?></label></th> |
|
353 | 353 | <td> |
354 | 354 | <?php |
355 | 355 | |
356 | - $saved = get_post_meta( $post_id, '_default_calendar_style_days_events', true ); |
|
356 | + $saved = get_post_meta($post_id, '_default_calendar_style_days_events', true); |
|
357 | 357 | $value = ! $saved ? $default_days_events_color : $saved; |
358 | 358 | |
359 | - simcal_print_field( array( |
|
359 | + simcal_print_field(array( |
|
360 | 360 | 'type' => 'standard', |
361 | 361 | 'subtype' => 'color-picker', |
362 | 362 | 'name' => '_default_calendar_style_days_events', |
363 | 363 | 'id' => '_default_calendar_style_days_events', |
364 | 364 | 'value' => $value, |
365 | - ) ); |
|
365 | + )); |
|
366 | 366 | |
367 | 367 | ?> |
368 | 368 | </td> |
@@ -384,55 +384,55 @@ discard block |
||
384 | 384 | * |
385 | 385 | * @param int $post_id |
386 | 386 | */ |
387 | - public function process_meta( $post_id ) { |
|
387 | + public function process_meta($post_id) { |
|
388 | 388 | |
389 | 389 | // Theme. |
390 | - $theme = isset( $_POST['_default_calendar_style_theme'] ) ? sanitize_key( $_POST['_default_calendar_style_theme'] ) : 'light'; |
|
391 | - update_post_meta( $post_id, '_default_calendar_style_theme', $theme ); |
|
390 | + $theme = isset($_POST['_default_calendar_style_theme']) ? sanitize_key($_POST['_default_calendar_style_theme']) : 'light'; |
|
391 | + update_post_meta($post_id, '_default_calendar_style_theme', $theme); |
|
392 | 392 | |
393 | 393 | // Today color. |
394 | - $today_color = isset( $_POST['_default_calendar_style_today'] ) ? sanitize_text_field( $_POST['_default_calendar_style_today'] ) : '#FF000'; |
|
395 | - update_post_meta( $post_id, '_default_calendar_style_today', $today_color ); |
|
394 | + $today_color = isset($_POST['_default_calendar_style_today']) ? sanitize_text_field($_POST['_default_calendar_style_today']) : '#FF000'; |
|
395 | + update_post_meta($post_id, '_default_calendar_style_today', $today_color); |
|
396 | 396 | |
397 | 397 | // Days with events color. |
398 | - $days_events_color = isset( $_POST['_default_calendar_style_days_events'] ) ? sanitize_text_field( $_POST['_default_calendar_style_days_events'] ) : '#000000'; |
|
399 | - update_post_meta( $post_id, '_default_calendar_style_days_events', $days_events_color ); |
|
398 | + $days_events_color = isset($_POST['_default_calendar_style_days_events']) ? sanitize_text_field($_POST['_default_calendar_style_days_events']) : '#000000'; |
|
399 | + update_post_meta($post_id, '_default_calendar_style_days_events', $days_events_color); |
|
400 | 400 | |
401 | 401 | // List range span. |
402 | - $span = isset( $_POST['_default_calendar_list_range_span'] ) ? max( absint( $_POST['_default_calendar_list_range_span'] ), 1 ) : 1; |
|
403 | - update_post_meta( $post_id, '_default_calendar_list_range_span', $span ); |
|
402 | + $span = isset($_POST['_default_calendar_list_range_span']) ? max(absint($_POST['_default_calendar_list_range_span']), 1) : 1; |
|
403 | + update_post_meta($post_id, '_default_calendar_list_range_span', $span); |
|
404 | 404 | |
405 | 405 | // List range type. |
406 | - $group = isset( $_POST['_default_calendar_list_range_type'] ) ? sanitize_key( $_POST['_default_calendar_list_range_type'] ) : 'monthly'; |
|
407 | - update_post_meta( $post_id, '_default_calendar_list_range_type', $group ); |
|
406 | + $group = isset($_POST['_default_calendar_list_range_type']) ? sanitize_key($_POST['_default_calendar_list_range_type']) : 'monthly'; |
|
407 | + update_post_meta($post_id, '_default_calendar_list_range_type', $group); |
|
408 | 408 | |
409 | 409 | // Hide header. |
410 | - $header = isset( $_POST['_default_calendar_list_header'] ) ? 'yes' : 'no'; |
|
411 | - update_post_meta( $post_id, '_default_calendar_list_header', $header ); |
|
410 | + $header = isset($_POST['_default_calendar_list_header']) ? 'yes' : 'no'; |
|
411 | + update_post_meta($post_id, '_default_calendar_list_header', $header); |
|
412 | 412 | |
413 | 413 | // Compact list. |
414 | - $compact = isset( $_POST['_default_calendar_compact_list'] ) ? 'yes' : 'no'; |
|
415 | - update_post_meta( $post_id, '_default_calendar_compact_list', $compact ); |
|
414 | + $compact = isset($_POST['_default_calendar_compact_list']) ? 'yes' : 'no'; |
|
415 | + update_post_meta($post_id, '_default_calendar_compact_list', $compact); |
|
416 | 416 | |
417 | 417 | // Limit number of initially visible daily events. |
418 | - $limit = isset( $_POST['_default_calendar_limit_visible_events'] ) ? 'yes' : 'no'; |
|
419 | - update_post_meta( $post_id, '_default_calendar_limit_visible_events', $limit ); |
|
420 | - $number = isset( $_POST['_default_calendar_visible_events'] ) ? absint( $_POST['_default_calendar_visible_events'] ) : 3; |
|
421 | - update_post_meta( $post_id, '_default_calendar_visible_events', $number ); |
|
418 | + $limit = isset($_POST['_default_calendar_limit_visible_events']) ? 'yes' : 'no'; |
|
419 | + update_post_meta($post_id, '_default_calendar_limit_visible_events', $limit); |
|
420 | + $number = isset($_POST['_default_calendar_visible_events']) ? absint($_POST['_default_calendar_visible_events']) : 3; |
|
421 | + update_post_meta($post_id, '_default_calendar_visible_events', $number); |
|
422 | 422 | |
423 | 423 | // Grid event bubbles action. |
424 | - $bubbles = isset( $_POST['_default_calendar_event_bubble_trigger'] ) ? esc_attr( $_POST['_default_calendar_event_bubble_trigger'] ) : 'hover'; |
|
425 | - update_post_meta( $post_id, '_default_calendar_event_bubble_trigger', $bubbles ); |
|
424 | + $bubbles = isset($_POST['_default_calendar_event_bubble_trigger']) ? esc_attr($_POST['_default_calendar_event_bubble_trigger']) : 'hover'; |
|
425 | + update_post_meta($post_id, '_default_calendar_event_bubble_trigger', $bubbles); |
|
426 | 426 | |
427 | 427 | // Trim event titles characters length. |
428 | - $trim = isset( $_POST['_default_calendar_trim_titles'] ) ? 'yes' : 'no'; |
|
429 | - update_post_meta( $post_id, '_default_calendar_trim_titles', $trim ); |
|
430 | - $chars = isset( $_POST['_default_calendar_trim_titles_chars'] ) ? max( absint( $_POST['_default_calendar_trim_titles_chars'] ), 1 ) : 20; |
|
431 | - update_post_meta( $post_id, '_default_calendar_trim_titles_chars', $chars ); |
|
428 | + $trim = isset($_POST['_default_calendar_trim_titles']) ? 'yes' : 'no'; |
|
429 | + update_post_meta($post_id, '_default_calendar_trim_titles', $trim); |
|
430 | + $chars = isset($_POST['_default_calendar_trim_titles_chars']) ? max(absint($_POST['_default_calendar_trim_titles_chars']), 1) : 20; |
|
431 | + update_post_meta($post_id, '_default_calendar_trim_titles_chars', $chars); |
|
432 | 432 | |
433 | 433 | // Expand multiple day events on each day. |
434 | - $multi_day = isset( $_POST['_default_calendar_expand_multi_day_events'] ) ? 'yes' : 'no'; |
|
435 | - update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', $multi_day ); |
|
434 | + $multi_day = isset($_POST['_default_calendar_expand_multi_day_events']) ? 'yes' : 'no'; |
|
435 | + update_post_meta($post_id, '_default_calendar_expand_multi_day_events', $multi_day); |
|
436 | 436 | |
437 | 437 | } |
438 | 438 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | namespace SimpleCalendar\Admin; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | 38 | |
39 | - $this->install = isset( $_GET['simcal_install'] ) ? esc_attr( $_GET['simcal_install'] ) : ''; |
|
39 | + $this->install = isset($_GET['simcal_install']) ? esc_attr($_GET['simcal_install']) : ''; |
|
40 | 40 | |
41 | - add_action( 'admin_menu', array( $this, 'welcome_page_tabs' ) ); |
|
42 | - add_action( 'admin_head', array( $this, 'remove_submenu_pages' ) ); |
|
41 | + add_action('admin_menu', array($this, 'welcome_page_tabs')); |
|
42 | + add_action('admin_head', array($this, 'remove_submenu_pages')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function welcome_page_tabs() { |
51 | 51 | |
52 | - $welcome_page_name = __( 'About Simple Calendar', 'google-calendar-events' ); |
|
53 | - $welcome_page_title = __( 'Welcome to Simple Calendar', 'google-calendar-events' ); |
|
52 | + $welcome_page_name = __('About Simple Calendar', 'google-calendar-events'); |
|
53 | + $welcome_page_title = __('Welcome to Simple Calendar', 'google-calendar-events'); |
|
54 | 54 | |
55 | - $page = isset( $_GET['page'] ) ? $_GET['page'] : 'simple-calendar_about'; |
|
55 | + $page = isset($_GET['page']) ? $_GET['page'] : 'simple-calendar_about'; |
|
56 | 56 | |
57 | - switch ( $page ) { |
|
57 | + switch ($page) { |
|
58 | 58 | |
59 | 59 | case 'simple-calendar_about' : |
60 | 60 | $page = add_dashboard_page( |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | $welcome_page_name, |
63 | 63 | 'manage_options', |
64 | 64 | 'simple-calendar_about', |
65 | - array( $this, 'about_screen' ) |
|
65 | + array($this, 'about_screen') |
|
66 | 66 | ); |
67 | - add_action( 'admin_print_styles-' . $page, array( $this, 'styles' ) ); |
|
67 | + add_action('admin_print_styles-'.$page, array($this, 'styles')); |
|
68 | 68 | break; |
69 | 69 | |
70 | 70 | case 'simple-calendar_credits' : |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | $welcome_page_name, |
74 | 74 | 'manage_options', |
75 | 75 | 'simple-calendar_credits', |
76 | - array( $this, 'credits_screen' ) |
|
76 | + array($this, 'credits_screen') |
|
77 | 77 | ); |
78 | - add_action( 'admin_print_styles-' . $page, array( $this, 'styles' ) ); |
|
78 | + add_action('admin_print_styles-'.$page, array($this, 'styles')); |
|
79 | 79 | break; |
80 | 80 | |
81 | 81 | case 'simple-calendar_translators' : |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | $welcome_page_name, |
85 | 85 | 'manage_options', |
86 | 86 | 'simple-calendar_translators', |
87 | - array( $this, 'translators_screen' ) |
|
87 | + array($this, 'translators_screen') |
|
88 | 88 | ); |
89 | - add_action( 'admin_print_styles-' . $page, array( $this, 'styles' ) ); |
|
89 | + add_action('admin_print_styles-'.$page, array($this, 'styles')); |
|
90 | 90 | break; |
91 | 91 | } |
92 | 92 | |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | * @since 3.0.0 |
99 | 99 | */ |
100 | 100 | public function remove_submenu_pages() { |
101 | - remove_submenu_page( 'index.php', 'simple-calendar_about' ); |
|
102 | - remove_submenu_page( 'index.php', 'simple-calendar_credits' ); |
|
103 | - remove_submenu_page( 'index.php', 'simple-calendar_translators' ); |
|
101 | + remove_submenu_page('index.php', 'simple-calendar_about'); |
|
102 | + remove_submenu_page('index.php', 'simple-calendar_credits'); |
|
103 | + remove_submenu_page('index.php', 'simple-calendar_translators'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -129,18 +129,18 @@ discard block |
||
129 | 129 | |
130 | 130 | ?> |
131 | 131 | <p> |
132 | - <a href="<?php echo admin_url( 'edit.php?post_type=calendar' ); ?>" |
|
132 | + <a href="<?php echo admin_url('edit.php?post_type=calendar'); ?>" |
|
133 | 133 | class="button button-primary" |
134 | - ><?php _e( 'Calendars', 'google-calendar-events' ); ?></a> |
|
135 | - <a href="<?php echo esc_url( add_query_arg( 'page', 'simple-calendar_settings', admin_url( 'admin.php' ) ) ); ?>" |
|
134 | + ><?php _e('Calendars', 'google-calendar-events'); ?></a> |
|
135 | + <a href="<?php echo esc_url(add_query_arg('page', 'simple-calendar_settings', admin_url('admin.php'))); ?>" |
|
136 | 136 | class="button button-primary" |
137 | - ><?php _e( 'Settings', 'google-calendar-events' ); ?></a> |
|
138 | - <a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'add-ons' ), 'core-plugin', 'welcome-page' ); ?>" |
|
137 | + ><?php _e('Settings', 'google-calendar-events'); ?></a> |
|
138 | + <a href="<?php echo simcal_ga_campaign_url(simcal_get_url('add-ons'), 'core-plugin', 'welcome-page'); ?>" |
|
139 | 139 | class="docs button button-primary" target="_blank" |
140 | - ><?php _e( 'Add-ons', 'google-calendar-events' ); ?></a> |
|
141 | - <a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'docs' ), 'core-plugin', 'welcome-page' ); ?>" |
|
140 | + ><?php _e('Add-ons', 'google-calendar-events'); ?></a> |
|
141 | + <a href="<?php echo simcal_ga_campaign_url(simcal_get_url('docs'), 'core-plugin', 'welcome-page'); ?>" |
|
142 | 142 | class="docs button button-primary" target="_blank" |
143 | - ><?php _e( 'Documentation', 'google-calendar-events' ); ?></a> |
|
143 | + ><?php _e('Documentation', 'google-calendar-events'); ?></a> |
|
144 | 144 | </p> |
145 | 145 | <?php |
146 | 146 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | <h1> |
158 | 158 | <?php |
159 | 159 | /* translators: %s prints the current version of the plugin. */ |
160 | - printf( __( 'Welcome to Simple Calendar %s', 'google-calendar-events' ), SIMPLE_CALENDAR_VERSION ); |
|
160 | + printf(__('Welcome to Simple Calendar %s', 'google-calendar-events'), SIMPLE_CALENDAR_VERSION); |
|
161 | 161 | ?> |
162 | 162 | </h1> |
163 | 163 | |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | <?php |
166 | 166 | |
167 | 167 | // Difference message if updating vs fresh install. |
168 | - if ( 'update' == $this->install ) { |
|
169 | - $message = __( 'Thanks for updating to the latest version!', 'google-calendar-events' ); |
|
168 | + if ('update' == $this->install) { |
|
169 | + $message = __('Thanks for updating to the latest version!', 'google-calendar-events'); |
|
170 | 170 | } else { |
171 | - $message = __( 'Thanks for installing!', 'google-calendar-events' ); |
|
171 | + $message = __('Thanks for installing!', 'google-calendar-events'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | echo $message; |
175 | 175 | |
176 | 176 | /* translators: %s prints the current version of the plugin. */ |
177 | - printf( ' ' . __( "Simple Calendar %s has many new display options and is much easier to configure. We think you'll really enjoy using it.", 'google-calendar-events' ), SIMPLE_CALENDAR_VERSION ); |
|
177 | + printf(' '.__("Simple Calendar %s has many new display options and is much easier to configure. We think you'll really enjoy using it.", 'google-calendar-events'), SIMPLE_CALENDAR_VERSION); |
|
178 | 178 | |
179 | 179 | ?> |
180 | 180 | </div> |
@@ -184,21 +184,21 @@ discard block |
||
184 | 184 | <?php $this->main_nav_links(); ?> |
185 | 185 | |
186 | 186 | <h2 class="nav-tab-wrapper"> |
187 | - <a class="nav-tab <?php if ( $_GET['page'] == 'simple-calendar_about' ) { |
|
187 | + <a class="nav-tab <?php if ($_GET['page'] == 'simple-calendar_about') { |
|
188 | 188 | echo 'nav-tab-active'; |
189 | 189 | } ?>" |
190 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'simple-calendar_about' ), 'index.php' ) ) ); ?>" |
|
191 | - ><?php _e( "What's New", 'google-calendar-events' ); ?></a> |
|
192 | - <a class="nav-tab <?php if ( $_GET['page'] == 'simple-calendar_credits' ) { |
|
190 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'simple-calendar_about'), 'index.php'))); ?>" |
|
191 | + ><?php _e("What's New", 'google-calendar-events'); ?></a> |
|
192 | + <a class="nav-tab <?php if ($_GET['page'] == 'simple-calendar_credits') { |
|
193 | 193 | echo 'nav-tab-active'; |
194 | 194 | } ?>" |
195 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'simple-calendar_credits' ), 'index.php' ) ) ); ?>" |
|
196 | - ><?php _e( 'Credits', 'google-calendar-events' ); ?></a> |
|
197 | - <a class="nav-tab <?php if ( $_GET['page'] == 'simple-calendar_translators' ) { |
|
195 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'simple-calendar_credits'), 'index.php'))); ?>" |
|
196 | + ><?php _e('Credits', 'google-calendar-events'); ?></a> |
|
197 | + <a class="nav-tab <?php if ($_GET['page'] == 'simple-calendar_translators') { |
|
198 | 198 | echo 'nav-tab-active'; |
199 | 199 | } ?>" |
200 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'simple-calendar_translators' ), 'index.php' ) ) ); ?>" |
|
201 | - ><?php _e( 'Translators', 'google-calendar-events' ); ?></a> |
|
200 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'simple-calendar_translators'), 'index.php'))); ?>" |
|
201 | + ><?php _e('Translators', 'google-calendar-events'); ?></a> |
|
202 | 202 | </h2> |
203 | 203 | <?php |
204 | 204 | |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * @since 3.0.0 |
211 | 211 | */ |
212 | 212 | public function about_screen() { |
213 | - $welcome_image_about_path = SIMPLE_CALENDAR_ASSETS . '/images/welcome'; |
|
214 | - $welcome_gcal_pro_link = simcal_ga_campaign_url( simcal_get_url( 'gcal-pro' ), 'core-plugin', 'welcome-page' ); |
|
213 | + $welcome_image_about_path = SIMPLE_CALENDAR_ASSETS.'/images/welcome'; |
|
214 | + $welcome_gcal_pro_link = simcal_ga_campaign_url(simcal_get_url('gcal-pro'), 'core-plugin', 'welcome-page'); |
|
215 | 215 | |
216 | 216 | ?> |
217 | 217 | <div id="simcal-welcome"> |
@@ -219,18 +219,18 @@ discard block |
||
219 | 219 | |
220 | 220 | <?php $this->intro(); ?> |
221 | 221 | |
222 | - <h3><?php _e( 'Modern calendar displays with easily updateable event text and color options.', 'google-calendar-events' ); ?></h3> |
|
223 | - <img src="<?php echo $welcome_image_about_path . '/grid-view-custom-colors.png'; ?>" /> |
|
222 | + <h3><?php _e('Modern calendar displays with easily updateable event text and color options.', 'google-calendar-events'); ?></h3> |
|
223 | + <img src="<?php echo $welcome_image_about_path.'/grid-view-custom-colors.png'; ?>" /> |
|
224 | 224 | |
225 | - <h3><?php _e( 'Mobile responsive and widget ready.', 'google-calendar-events' ); ?></h3> |
|
226 | - <img src="<?php echo $welcome_image_about_path . '/list-view-widget.png'; ?>" /> |
|
227 | - <img src="<?php echo $welcome_image_about_path . '/grid-view-widget-dark-theme.png'; ?>" /> |
|
225 | + <h3><?php _e('Mobile responsive and widget ready.', 'google-calendar-events'); ?></h3> |
|
226 | + <img src="<?php echo $welcome_image_about_path.'/list-view-widget.png'; ?>" /> |
|
227 | + <img src="<?php echo $welcome_image_about_path.'/grid-view-widget-dark-theme.png'; ?>" /> |
|
228 | 228 | |
229 | - <h3><?php _e( 'Simpler, more intuitive calendar settings.', 'google-calendar-events' ); ?></h3> |
|
230 | - <img src="<?php echo $welcome_image_about_path . '/calendar-settings-appearance.png'; ?>" /> |
|
229 | + <h3><?php _e('Simpler, more intuitive calendar settings.', 'google-calendar-events'); ?></h3> |
|
230 | + <img src="<?php echo $welcome_image_about_path.'/calendar-settings-appearance.png'; ?>" /> |
|
231 | 231 | |
232 | - <h3><?php echo sprintf( __( 'Extendible with add-ons like <a href="%s" target="_blank">Google Calendar Pro</a>.', 'google-calendar-events' ), $welcome_gcal_pro_link ); ?></h3> |
|
233 | - <a href="<?php echo $welcome_gcal_pro_link; ?>" target="_blank"><img src="<?php echo $welcome_image_about_path . '/google-calendar-pro-list-view-annotated.png'; ?>" /></a> |
|
232 | + <h3><?php echo sprintf(__('Extendible with add-ons like <a href="%s" target="_blank">Google Calendar Pro</a>.', 'google-calendar-events'), $welcome_gcal_pro_link); ?></h3> |
|
233 | + <a href="<?php echo $welcome_gcal_pro_link; ?>" target="_blank"><img src="<?php echo $welcome_image_about_path.'/google-calendar-pro-list-view-annotated.png'; ?>" /></a> |
|
234 | 234 | |
235 | 235 | <hr/> |
236 | 236 | |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | <?php |
258 | 258 | |
259 | 259 | printf( |
260 | - __( "Simple Calendar is created by a worldwide team of developers. If you'd like to contribute please visit our <a href='%s' target='_blank'>GitHub repo</a>.", 'google-calendar-events' ), |
|
261 | - simcal_get_url( 'github' ) |
|
260 | + __("Simple Calendar is created by a worldwide team of developers. If you'd like to contribute please visit our <a href='%s' target='_blank'>GitHub repo</a>.", 'google-calendar-events'), |
|
261 | + simcal_get_url('github') |
|
262 | 262 | ); |
263 | 263 | |
264 | 264 | ?> |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | <div class="wrap about-wrap translators-wrap"> |
283 | 283 | <?php $this->intro(); ?> |
284 | 284 | <p class="about-description"> |
285 | - <?php _e( 'Simple Calendar has been kindly translated into several other languages by contributors from all over the world.', 'google-calendar-events' ); ?> |
|
285 | + <?php _e('Simple Calendar has been kindly translated into several other languages by contributors from all over the world.', 'google-calendar-events'); ?> |
|
286 | 286 | </p> |
287 | 287 | <p class="about-description"> |
288 | - <a href="https://translate.wordpress.org/projects/wp-plugins/google-calendar-events" target="_blank"><?php _e( 'Click here to help translate', 'google-calendar-events' ); ?></a> |
|
288 | + <a href="https://translate.wordpress.org/projects/wp-plugins/google-calendar-events" target="_blank"><?php _e('Click here to help translate', 'google-calendar-events'); ?></a> |
|
289 | 289 | </p> |
290 | 290 | <?php |
291 | 291 | |
@@ -314,31 +314,31 @@ discard block |
||
314 | 314 | |
315 | 315 | $contributors = $this->get_contributors(); |
316 | 316 | |
317 | - if ( empty( $contributors ) ) { |
|
317 | + if (empty($contributors)) { |
|
318 | 318 | return ''; |
319 | 319 | } |
320 | 320 | |
321 | 321 | $contributor_list = '<ul class="wp-people-group">'; |
322 | 322 | |
323 | - foreach ( $contributors as $contributor ) { |
|
323 | + foreach ($contributors as $contributor) { |
|
324 | 324 | |
325 | 325 | // Skip contributor bots |
326 | - $contributor_bots = array( 'gitter-badger' ); |
|
327 | - if ( in_array( $contributor->login, $contributor_bots ) ) { |
|
326 | + $contributor_bots = array('gitter-badger'); |
|
327 | + if (in_array($contributor->login, $contributor_bots)) { |
|
328 | 328 | continue; |
329 | 329 | } |
330 | 330 | |
331 | 331 | $contributor_list .= '<li class="wp-person">'; |
332 | 332 | $contributor_list .= sprintf( |
333 | 333 | '<a href="%s" title="%s" target="_blank">%s</a>', |
334 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
335 | - esc_html( sprintf( __( 'View %s', 'google-calendar-events' ), $contributor->login ) ), |
|
336 | - sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) ) |
|
334 | + esc_url('https://github.com/'.$contributor->login), |
|
335 | + esc_html(sprintf(__('View %s', 'google-calendar-events'), $contributor->login)), |
|
336 | + sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login)) |
|
337 | 337 | ); |
338 | 338 | $contributor_list .= sprintf( |
339 | 339 | '<a class="web" href="%s" target="_blank">%s</a>', |
340 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
341 | - esc_html( $contributor->login ) |
|
340 | + esc_url('https://github.com/'.$contributor->login), |
|
341 | + esc_html($contributor->login) |
|
342 | 342 | ); |
343 | 343 | $contributor_list .= '</li>'; |
344 | 344 | |
@@ -358,24 +358,24 @@ discard block |
||
358 | 358 | */ |
359 | 359 | public function get_contributors() { |
360 | 360 | |
361 | - $contributors = get_transient( '_simple-calendar_contributors' ); |
|
362 | - if ( false !== $contributors ) { |
|
361 | + $contributors = get_transient('_simple-calendar_contributors'); |
|
362 | + if (false !== $contributors) { |
|
363 | 363 | return $contributors; |
364 | 364 | } |
365 | 365 | |
366 | 366 | $response = wp_safe_remote_get( |
367 | 367 | 'https://api.github.com/repos/moonstonemedia/Simple-Calendar/contributors' |
368 | 368 | ); |
369 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
369 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
370 | 370 | return array(); |
371 | 371 | } |
372 | 372 | |
373 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
374 | - if ( ! is_array( $contributors ) ) { |
|
373 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
374 | + if ( ! is_array($contributors)) { |
|
375 | 375 | return array(); |
376 | 376 | } |
377 | 377 | |
378 | - set_transient( '_simple-calendar_contributors', $contributors, HOUR_IN_SECONDS ); |
|
378 | + set_transient('_simple-calendar_contributors', $contributors, HOUR_IN_SECONDS); |
|
379 | 379 | |
380 | 380 | return $contributors; |
381 | 381 | } |
@@ -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; // Exit if accessed directly. |
13 | 13 | } |
14 | 14 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param array $field |
30 | 30 | */ |
31 | - public function __construct( $field ) { |
|
31 | + public function __construct($field) { |
|
32 | 32 | $this->type_class = 'simcal-field-checkboxes'; |
33 | - parent::__construct( $field ); |
|
33 | + parent::__construct($field); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -40,33 +40,33 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function html() { |
42 | 42 | |
43 | - if ( ! empty( $this->options ) && count( (array) $this->options ) > 1 ) { |
|
43 | + if ( ! empty($this->options) && count((array) $this->options) > 1) { |
|
44 | 44 | |
45 | - if ( ! empty( $this->description ) ) { |
|
46 | - echo '<p class="description">' . wp_kses_post( $this->description ) . ' ' . $this->tooltip . '</p>'; |
|
45 | + if ( ! empty($this->description)) { |
|
46 | + echo '<p class="description">'.wp_kses_post($this->description).' '.$this->tooltip.'</p>'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | ?> |
50 | - <fieldset class="<?php echo $this->class; ?>" <?php echo ! empty( $this->style ) ? 'style="' . $this->style . '"' : ''; ?>> |
|
50 | + <fieldset class="<?php echo $this->class; ?>" <?php echo ! empty($this->style) ? 'style="'.$this->style.'"' : ''; ?>> |
|
51 | 51 | <?php |
52 | 52 | |
53 | - if ( ! empty( $this->title ) ) { |
|
54 | - echo '<legend class="screen-reader-text"><span>' . $this->title . '</span></legend>'; |
|
53 | + if ( ! empty($this->title)) { |
|
54 | + echo '<legend class="screen-reader-text"><span>'.$this->title.'</span></legend>'; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | ?> |
58 | 58 | <ul> |
59 | - <?php foreach ( $this->options as $option => $name ) : ?> |
|
59 | + <?php foreach ($this->options as $option => $name) : ?> |
|
60 | 60 | <li> |
61 | - <label for="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>"> |
|
61 | + <label for="<?php echo $this->id.'-'.trim(strval($option)); ?>"> |
|
62 | 62 | <input name="<?php echo $this->name; ?>" |
63 | - id="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>" |
|
63 | + id="<?php echo $this->id.'-'.trim(strval($option)); ?>" |
|
64 | 64 | class="simcal-field simcal-field-checkbox" |
65 | 65 | type="checkbox" |
66 | - value="<?php echo trim( strval( $option ) ); ?>" |
|
67 | - <?php checked( $this->value, 'yes', true ); ?> |
|
66 | + value="<?php echo trim(strval($option)); ?>" |
|
67 | + <?php checked($this->value, 'yes', true); ?> |
|
68 | 68 | <?php echo $this->attributes; ?> |
69 | - /><?php echo esc_attr( $name ); ?> |
|
69 | + /><?php echo esc_attr($name); ?> |
|
70 | 70 | </label> |
71 | 71 | </li> |
72 | 72 | <?php endforeach; ?> |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | } else { |
78 | 78 | |
79 | 79 | ?> |
80 | - <span class="simcal-field-bool" <?php echo $this->style ? 'style="' . $this->style . '"' : ''; ?>> |
|
81 | - <?php if ( ! empty( $this->title ) ) : ?> |
|
80 | + <span class="simcal-field-bool" <?php echo $this->style ? 'style="'.$this->style.'"' : ''; ?>> |
|
81 | + <?php if ( ! empty($this->title)) : ?> |
|
82 | 82 | <span class="screen-reader-text"><?php echo $this->title; ?></span> |
83 | 83 | <?php endif; ?> |
84 | 84 | <input name="<?php echo $this->name; ?>" |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | id="<?php echo $this->id; ?>" |
87 | 87 | class="simcal-field simcal-field-checkbox <?php echo $this->class; ?>" |
88 | 88 | value="yes" |
89 | - <?php checked( $this->value, 'yes', true ); ?> |
|
90 | - <?php echo $this->attributes; ?>/><?php _e( 'Yes', 'google-calendar-events' ); ?> |
|
89 | + <?php checked($this->value, 'yes', true); ?> |
|
90 | + <?php echo $this->attributes; ?>/><?php _e('Yes', 'google-calendar-events'); ?> |
|
91 | 91 | </span> |
92 | 92 | <?php |
93 | 93 | |
94 | 94 | echo $this->tooltip; |
95 | 95 | |
96 | - if ( ! empty( $this->description ) ) { |
|
97 | - echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>'; |
|
96 | + if ( ! empty($this->description)) { |
|
97 | + echo '<p class="description">'.wp_kses_post($this->description).'</p>'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | use SimpleCalendar\Abstracts\Admin_Page; |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param string $page |
55 | 55 | */ |
56 | - public function __construct( $page = 'settings' ) { |
|
56 | + public function __construct($page = 'settings') { |
|
57 | 57 | |
58 | 58 | $this->page = $page; |
59 | - $settings_pages = ! is_null( \SimpleCalendar\plugin()->objects ) ? simcal_get_admin_pages() : ''; |
|
59 | + $settings_pages = ! is_null(\SimpleCalendar\plugin()->objects) ? simcal_get_admin_pages() : ''; |
|
60 | 60 | $settings_page_tabs = array(); |
61 | - $tabs = isset( $settings_pages[ $page ] ) ? $settings_pages[ $page ] : false; |
|
61 | + $tabs = isset($settings_pages[$page]) ? $settings_pages[$page] : false; |
|
62 | 62 | |
63 | - if ( $tabs && is_array( $tabs ) ) { |
|
64 | - foreach ( $tabs as $tab ) { |
|
63 | + if ($tabs && is_array($tabs)) { |
|
64 | + foreach ($tabs as $tab) { |
|
65 | 65 | |
66 | - $settings_page = simcal_get_admin_page( $tab ); |
|
66 | + $settings_page = simcal_get_admin_page($tab); |
|
67 | 67 | |
68 | - if ( $settings_page instanceof Admin_Page ) { |
|
69 | - $settings_page_tabs[ $settings_page->id ] = $settings_page; |
|
68 | + if ($settings_page instanceof Admin_Page) { |
|
69 | + $settings_page_tabs[$settings_page->id] = $settings_page; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | // The first tab is the default tab when opening a page. |
77 | - $this->tab = isset( $tabs[0] ) ? $tabs[0] : ''; |
|
77 | + $this->tab = isset($tabs[0]) ? $tabs[0] : ''; |
|
78 | 78 | |
79 | - do_action( 'simcal_admin_pages', $page ); |
|
79 | + do_action('simcal_admin_pages', $page); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | |
92 | 92 | $settings = array(); |
93 | 93 | |
94 | - if ( ! empty( $this->settings ) && is_array( $this->settings ) ) { |
|
95 | - foreach ( $this->settings as $id => $object ) { |
|
94 | + if ( ! empty($this->settings) && is_array($this->settings)) { |
|
95 | + foreach ($this->settings as $id => $object) { |
|
96 | 96 | |
97 | - if ( $object instanceof Admin_Page ) { |
|
97 | + if ($object instanceof Admin_Page) { |
|
98 | 98 | |
99 | 99 | $settings_page = $object->get_settings(); |
100 | 100 | |
101 | - if ( isset( $settings_page[ $id ] ) ) { |
|
102 | - $settings[ $id ] = $settings_page[ $id ]; |
|
101 | + if (isset($settings_page[$id])) { |
|
102 | + $settings[$id] = $settings_page[$id]; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -118,48 +118,48 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @param array $settings |
120 | 120 | */ |
121 | - public function register_settings( $settings = array() ) { |
|
121 | + public function register_settings($settings = array()) { |
|
122 | 122 | |
123 | 123 | $settings = $settings ? $settings : $this->get_settings(); |
124 | 124 | |
125 | - if ( ! empty( $settings ) && is_array( $settings ) ) { |
|
125 | + if ( ! empty($settings) && is_array($settings)) { |
|
126 | 126 | |
127 | - foreach ( $settings as $tab_id => $settings_page ) { |
|
127 | + foreach ($settings as $tab_id => $settings_page) { |
|
128 | 128 | |
129 | - if ( isset( $settings_page['sections'] ) ) { |
|
129 | + if (isset($settings_page['sections'])) { |
|
130 | 130 | |
131 | 131 | $sections = $settings_page['sections']; |
132 | 132 | |
133 | - if ( ! empty( $sections ) && is_array( $sections ) ) { |
|
133 | + if ( ! empty($sections) && is_array($sections)) { |
|
134 | 134 | |
135 | - foreach ( $sections as $section_id => $section ) { |
|
135 | + foreach ($sections as $section_id => $section) { |
|
136 | 136 | |
137 | 137 | add_settings_section( |
138 | 138 | $section_id, |
139 | - isset( $section['title'] ) ? $section['title'] : '', |
|
140 | - isset( $section['callback'] ) ? $section['callback'] : '', |
|
141 | - 'simple-calendar_' . $this->page . '_' . $tab_id |
|
139 | + isset($section['title']) ? $section['title'] : '', |
|
140 | + isset($section['callback']) ? $section['callback'] : '', |
|
141 | + 'simple-calendar_'.$this->page.'_'.$tab_id |
|
142 | 142 | ); |
143 | 143 | |
144 | - if ( isset( $section['fields'] ) ) { |
|
144 | + if (isset($section['fields'])) { |
|
145 | 145 | |
146 | 146 | $fields = $section['fields']; |
147 | 147 | |
148 | - if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
148 | + if ( ! empty($fields) && is_array($fields)) { |
|
149 | 149 | |
150 | - foreach ( $fields as $field ) { |
|
150 | + foreach ($fields as $field) { |
|
151 | 151 | |
152 | - if ( isset( $field['id'] ) && isset( $field['type'] ) ) { |
|
152 | + if (isset($field['id']) && isset($field['type'])) { |
|
153 | 153 | |
154 | - $field_object = simcal_get_field( $field, $field['type'] ); |
|
154 | + $field_object = simcal_get_field($field, $field['type']); |
|
155 | 155 | |
156 | - if ( $field_object instanceof Field ) { |
|
156 | + if ($field_object instanceof Field) { |
|
157 | 157 | |
158 | 158 | add_settings_field( |
159 | 159 | $field['id'], |
160 | - isset( $field['title'] ) ? $field['title'] : '', |
|
161 | - array( $field_object, 'html' ), |
|
162 | - 'simple-calendar_' . $this->page . '_' . $tab_id, |
|
160 | + isset($field['title']) ? $field['title'] : '', |
|
161 | + array($field_object, 'html'), |
|
162 | + 'simple-calendar_'.$this->page.'_'.$tab_id, |
|
163 | 163 | $section_id |
164 | 164 | ); |
165 | 165 | |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | |
174 | 174 | } // are there fields? |
175 | 175 | |
176 | - $page = simcal_get_admin_page( $tab_id ); |
|
176 | + $page = simcal_get_admin_page($tab_id); |
|
177 | 177 | |
178 | 178 | register_setting( |
179 | - 'simple-calendar_' . $this->page . '_' . $tab_id, |
|
180 | - 'simple-calendar_' . $this->page . '_' . $tab_id, |
|
181 | - $page instanceof Admin_Page ? array( $page, 'validate' ) : '' |
|
179 | + 'simple-calendar_'.$this->page.'_'.$tab_id, |
|
180 | + 'simple-calendar_'.$this->page.'_'.$tab_id, |
|
181 | + $page instanceof Admin_Page ? array($page, 'validate') : '' |
|
182 | 182 | ); |
183 | 183 | |
184 | 184 | } // loop sections |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | global $current_tab; |
204 | 204 | |
205 | 205 | // Get current tab/section |
206 | - $current_tab = empty( $_GET['tab'] ) ? $this->tab : sanitize_title( $_GET['tab'] ); |
|
206 | + $current_tab = empty($_GET['tab']) ? $this->tab : sanitize_title($_GET['tab']); |
|
207 | 207 | $this->tab = $current_tab; |
208 | 208 | |
209 | 209 | ?> |
@@ -215,45 +215,45 @@ discard block |
||
215 | 215 | |
216 | 216 | // Include settings pages |
217 | 217 | $settings_pages = self::get_settings(); |
218 | - if ( ! empty( $settings_pages ) && is_array( $settings_pages ) ) { |
|
218 | + if ( ! empty($settings_pages) && is_array($settings_pages)) { |
|
219 | 219 | |
220 | 220 | echo '<h2 class="nav-tab-wrapper simcal-nav-tab-wrapper">'; |
221 | 221 | |
222 | 222 | // Get tabs for the settings page |
223 | - if ( ! empty( $settings_pages ) && is_array( $settings_pages ) ) { |
|
223 | + if ( ! empty($settings_pages) && is_array($settings_pages)) { |
|
224 | 224 | |
225 | - foreach ( $settings_pages as $id => $settings ) { |
|
225 | + foreach ($settings_pages as $id => $settings) { |
|
226 | 226 | |
227 | - $tab_id = isset( $id ) ? $id : ''; |
|
228 | - $tab_label = isset( $settings['label'] ) ? $settings['label'] : ''; |
|
229 | - $tab_link = admin_url( 'edit.php?post_type=calendar&page=simple-calendar_' . $this->page . '&tab=' . $tab_id ); |
|
227 | + $tab_id = isset($id) ? $id : ''; |
|
228 | + $tab_label = isset($settings['label']) ? $settings['label'] : ''; |
|
229 | + $tab_link = admin_url('edit.php?post_type=calendar&page=simple-calendar_'.$this->page.'&tab='.$tab_id); |
|
230 | 230 | |
231 | - echo '<a href="' . $tab_link . '" class="nav-tab ' . ( $current_tab == $tab_id ? 'nav-tab-active' : '' ) . '">' . $tab_label . '</a>'; |
|
231 | + echo '<a href="'.$tab_link.'" class="nav-tab '.($current_tab == $tab_id ? 'nav-tab-active' : '').'">'.$tab_label.'</a>'; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | } |
235 | 235 | |
236 | - do_action( 'simcal_admin_page_' . $this->page . '_tabs' ); |
|
236 | + do_action('simcal_admin_page_'.$this->page.'_tabs'); |
|
237 | 237 | |
238 | 238 | echo '</h2>'; |
239 | 239 | |
240 | 240 | settings_errors(); |
241 | 241 | |
242 | - foreach ( $settings_pages as $tab_id => $contents ) { |
|
242 | + foreach ($settings_pages as $tab_id => $contents) { |
|
243 | 243 | |
244 | - if ( $tab_id === $current_tab ) { |
|
244 | + if ($tab_id === $current_tab) { |
|
245 | 245 | |
246 | - echo isset( $contents['description'] ) ? '<p>' . $contents['description'] . '</p>' : ''; |
|
246 | + echo isset($contents['description']) ? '<p>'.$contents['description'].'</p>' : ''; |
|
247 | 247 | |
248 | - do_action( 'simcal_admin_page_' . $this->page . '_' . $current_tab . '_start' ); |
|
248 | + do_action('simcal_admin_page_'.$this->page.'_'.$current_tab.'_start'); |
|
249 | 249 | |
250 | - settings_fields( 'simple-calendar_' . $this->page . '_' . $tab_id ); |
|
251 | - do_settings_sections( 'simple-calendar_' . $this->page . '_' . $tab_id ); |
|
250 | + settings_fields('simple-calendar_'.$this->page.'_'.$tab_id); |
|
251 | + do_settings_sections('simple-calendar_'.$this->page.'_'.$tab_id); |
|
252 | 252 | |
253 | - do_action( 'simcal_admin_page_' . $this->page . '_' . $current_tab . '_end' ); |
|
253 | + do_action('simcal_admin_page_'.$this->page.'_'.$current_tab.'_end'); |
|
254 | 254 | |
255 | - $submit = apply_filters( 'simcal_admin_page_' . $this->page . '_' . $current_tab . '_submit', true ); |
|
256 | - if ( true === $submit ) { |
|
255 | + $submit = apply_filters('simcal_admin_page_'.$this->page.'_'.$current_tab.'_submit', true); |
|
256 | + if (true === $submit) { |
|
257 | 257 | submit_button(); |
258 | 258 | } |
259 | 259 | } |
@@ -263,17 +263,17 @@ discard block |
||
263 | 263 | // Add option to show we ran through default settings |
264 | 264 | // We also run a check here for the main settings page option. This is to determine if this is a fresh install or if they already had |
265 | 265 | // the plugin installed. The main feed settings page would give the best idea of that since user's have to enter an API key on this page to get it working. |
266 | - if ( false === get_option( 'simple-calendar_defaults' ) && false === get_option( 'simple-calendar_settings_feeds' ) ) { |
|
266 | + if (false === get_option('simple-calendar_defaults') && false === get_option('simple-calendar_settings_feeds')) { |
|
267 | 267 | |
268 | - $default_advanced = array ( |
|
269 | - 'assets' => array ( |
|
268 | + $default_advanced = array( |
|
269 | + 'assets' => array( |
|
270 | 270 | 'always_enqueue' => 'yes', |
271 | 271 | ), |
272 | 272 | ); |
273 | 273 | |
274 | - update_option( 'simple-calendar_settings_advanced', $default_advanced ); |
|
274 | + update_option('simple-calendar_settings_advanced', $default_advanced); |
|
275 | 275 | |
276 | - add_option( 'simple-calendar_defaults', 1 ); |
|
276 | + add_option('simple-calendar_defaults', 1); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Admin_Page; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function __construct() { |
30 | 30 | $this->id = 'advanced'; |
31 | 31 | $this->option_group = 'settings'; |
32 | - $this->label = __( 'Advanced', 'google-calendar-events' ); |
|
32 | + $this->label = __('Advanced', 'google-calendar-events'); |
|
33 | 33 | //$this->description = __( 'Advanced settings.', 'google-calendar-events' ); |
34 | 34 | $this->sections = $this->add_sections(); |
35 | 35 | $this->fields = $this->add_fields(); |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | * @return array |
44 | 44 | */ |
45 | 45 | public function add_sections() { |
46 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', array( |
|
46 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', array( |
|
47 | 47 | 'assets' => array( |
48 | - 'title' => __( 'Scripts and Styles', 'google-calendar-events' ), |
|
49 | - 'description' => __( 'Manage front end assets that handle the calendars appearance and user interface.', 'google-calendar-events' ) |
|
48 | + 'title' => __('Scripts and Styles', 'google-calendar-events'), |
|
49 | + 'description' => __('Manage front end assets that handle the calendars appearance and user interface.', 'google-calendar-events') |
|
50 | 50 | ), |
51 | 51 | 'installation' => array( |
52 | - 'title' => __( 'Installation', 'google-calendar-events' ), |
|
53 | - 'description' => __( 'Manage your data (plugin settings and saved calendars).', 'google-calendar-events' ) |
|
52 | + 'title' => __('Installation', 'google-calendar-events'), |
|
53 | + 'description' => __('Manage your data (plugin settings and saved calendars).', 'google-calendar-events') |
|
54 | 54 | ) |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -65,57 +65,57 @@ discard block |
||
65 | 65 | public function add_fields() { |
66 | 66 | |
67 | 67 | $fields = array(); |
68 | - $this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id ); |
|
68 | + $this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id); |
|
69 | 69 | |
70 | - foreach ( $this->sections as $section => $a ) : |
|
70 | + foreach ($this->sections as $section => $a) : |
|
71 | 71 | |
72 | - if ( 'assets' == $section ) { |
|
72 | + if ('assets' == $section) { |
|
73 | 73 | |
74 | - $fields[ $section ] = array( |
|
74 | + $fields[$section] = array( |
|
75 | 75 | 'always_enqueue' => array( |
76 | - 'title' => __( 'Always Enqueue', 'google-calendar-events' ), |
|
77 | - 'tooltip' => __( 'If ticked, this option will load all scripts on every page load.', 'google-calendar-events' ), |
|
76 | + 'title' => __('Always Enqueue', 'google-calendar-events'), |
|
77 | + 'tooltip' => __('If ticked, this option will load all scripts on every page load.', 'google-calendar-events'), |
|
78 | 78 | 'type' => 'checkbox', |
79 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][always_enqueue]', |
|
80 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-always-enqueue', |
|
81 | - 'value' => $this->get_option_value( $section, 'always_enqueue' ), |
|
79 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][always_enqueue]', |
|
80 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-always-enqueue', |
|
81 | + 'value' => $this->get_option_value($section, 'always_enqueue'), |
|
82 | 82 | ), |
83 | 83 | 'disable_css' => array( |
84 | - 'title' => __( 'Disable Styles', 'google-calendar-events' ), |
|
85 | - 'tooltip' => __( 'If ticked, this option will prevent front end stylesheet to load.', 'google-calendar-events' ), |
|
84 | + 'title' => __('Disable Styles', 'google-calendar-events'), |
|
85 | + 'tooltip' => __('If ticked, this option will prevent front end stylesheet to load.', 'google-calendar-events'), |
|
86 | 86 | 'type' => 'checkbox', |
87 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][disable_css]', |
|
88 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-disable-css', |
|
89 | - 'value' => $this->get_option_value( $section, 'disable_css' ) |
|
87 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][disable_css]', |
|
88 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-disable-css', |
|
89 | + 'value' => $this->get_option_value($section, 'disable_css') |
|
90 | 90 | ), |
91 | 91 | 'disable_js' => array( |
92 | - 'title' => __( 'Disable Scripts', 'google-calendar-events' ), |
|
93 | - 'tooltip' => __( 'If ticked, this option will prevent front end JavaScript to load.', 'google-calendar-events' ), |
|
92 | + 'title' => __('Disable Scripts', 'google-calendar-events'), |
|
93 | + 'tooltip' => __('If ticked, this option will prevent front end JavaScript to load.', 'google-calendar-events'), |
|
94 | 94 | 'type' => 'checkbox', |
95 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][disable_js]', |
|
96 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-disable-js', |
|
97 | - 'value' => $this->get_option_value( $section, 'disable_js' ) |
|
95 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][disable_js]', |
|
96 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-disable-js', |
|
97 | + 'value' => $this->get_option_value($section, 'disable_js') |
|
98 | 98 | ) |
99 | 99 | ); |
100 | 100 | |
101 | - } elseif ( 'installation' == $section ) { |
|
101 | + } elseif ('installation' == $section) { |
|
102 | 102 | |
103 | - $fields[ $section ] = array( |
|
103 | + $fields[$section] = array( |
|
104 | 104 | 'delete_settings' => array( |
105 | - 'title' => __( 'Delete settings', 'google-calendar-events' ), |
|
106 | - 'tooltip' => __( 'Tick this option if you want to wipe this plugin settings from database when uninstalling.', 'google-calendar-events' ), |
|
105 | + 'title' => __('Delete settings', 'google-calendar-events'), |
|
106 | + 'tooltip' => __('Tick this option if you want to wipe this plugin settings from database when uninstalling.', 'google-calendar-events'), |
|
107 | 107 | 'type' => 'checkbox', |
108 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][delete_settings]', |
|
109 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-delete-settings', |
|
110 | - 'value' => $this->get_option_value( $section, 'delete_settings' ), |
|
108 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][delete_settings]', |
|
109 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-delete-settings', |
|
110 | + 'value' => $this->get_option_value($section, 'delete_settings'), |
|
111 | 111 | ), |
112 | 112 | 'erase_data' => array( |
113 | - 'title' => __( 'Erase calendar data', 'google-calendar-events' ), |
|
114 | - 'tooltip' => __( 'By default your data will be retained in database even after uninstall. Tick this option if you want to delete all your calendar data when uninstalling.', 'google-calendar-events' ), |
|
113 | + 'title' => __('Erase calendar data', 'google-calendar-events'), |
|
114 | + 'tooltip' => __('By default your data will be retained in database even after uninstall. Tick this option if you want to delete all your calendar data when uninstalling.', 'google-calendar-events'), |
|
115 | 115 | 'type' => 'checkbox', |
116 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][erase_data]', |
|
117 | - 'id' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '-delete-data', |
|
118 | - 'value' => $this->get_option_value( $section, 'erase_data' ), |
|
116 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][erase_data]', |
|
117 | + 'id' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'-delete-data', |
|
118 | + 'value' => $this->get_option_value($section, 'erase_data'), |
|
119 | 119 | ) |
120 | 120 | ); |
121 | 121 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | endforeach; |
125 | 125 | |
126 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields ); |
|
126 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | } |