Completed
Push — master ( 519d44...d1a272 )
by
unknown
03:05
created
includes/events/event.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/feeds/google.php 1 patch
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 use SimpleCalendar\Abstracts\Feed;
13 13
 use SimpleCalendar\Feeds\Admin\Google_Admin as Admin;
14 14
 
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -90,34 +90,34 @@  discard block
 block discarded – undo
90 90
 	 * @param string|Calendar $calendar
91 91
 	 * @param bool $load_admin
92 92
 	 */
93
-	public function __construct( $calendar = '', $load_admin = true ) {
93
+	public function __construct($calendar = '', $load_admin = true) {
94 94
 
95
-		parent::__construct( $calendar );
95
+		parent::__construct($calendar);
96 96
 
97 97
 		$this->type = 'google';
98
-		$this->name = __( 'Google Calendar', 'google-calendar-events' );
98
+		$this->name = __('Google Calendar', 'google-calendar-events');
99 99
 
100 100
 		// Google client config.
101
-		$settings = get_option( 'simple-calendar_settings_feeds' );
102
-		$this->google_api_key = isset( $settings['google']['api_key'] ) ? esc_attr( $settings['google']['api_key'] ) : '';
103
-		$this->google_client_scopes = array( \Google_Service_Calendar::CALENDAR_READONLY );
101
+		$settings = get_option('simple-calendar_settings_feeds');
102
+		$this->google_api_key = isset($settings['google']['api_key']) ? esc_attr($settings['google']['api_key']) : '';
103
+		$this->google_client_scopes = array(\Google_Service_Calendar::CALENDAR_READONLY);
104 104
 		$this->google_client = $this->get_client();
105 105
 
106
-		if ( $this->post_id > 0 ) {
106
+		if ($this->post_id > 0) {
107 107
 
108 108
 			// Google query args.
109
-			$this->google_calendar_id       = $this->esc_google_calendar_id( get_post_meta( $this->post_id, '_google_calendar_id', true ) );
110
-			$this->google_events_recurring  = esc_attr( get_post_meta( $this->post_id, '_google_events_recurring', true ) );
111
-			$this->google_search_query      = esc_attr( get_post_meta( $this->post_id, '_google_events_search_query', true ) );
112
-			$this->google_max_results       = max( absint( get_post_meta( $this->post_id, '_google_events_max_results', true ) ), 1 );
109
+			$this->google_calendar_id       = $this->esc_google_calendar_id(get_post_meta($this->post_id, '_google_calendar_id', true));
110
+			$this->google_events_recurring  = esc_attr(get_post_meta($this->post_id, '_google_events_recurring', true));
111
+			$this->google_search_query      = esc_attr(get_post_meta($this->post_id, '_google_events_search_query', true));
112
+			$this->google_max_results       = max(absint(get_post_meta($this->post_id, '_google_events_max_results', true)), 1);
113 113
 
114
-			if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
115
-				$this->events = ! empty( $this->google_api_key ) ? $this->get_events() : array();
114
+			if ( ! is_admin() || defined('DOING_AJAX')) {
115
+				$this->events = ! empty($this->google_api_key) ? $this->get_events() : array();
116 116
 			}
117 117
 		}
118 118
 
119
-		if ( is_admin() && $load_admin ) {
120
-			$admin = new Admin( $this, $this->google_api_key, $this->google_calendar_id );
119
+		if (is_admin() && $load_admin) {
120
+			$admin = new Admin($this, $this->google_api_key, $this->google_calendar_id);
121 121
 			$this->settings = $admin->settings_fields();
122 122
 		}
123 123
 	}
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return string
133 133
 	 */
134
-	public function esc_google_calendar_id( $id ) {
135
-		return base64_decode( $id );
134
+	public function esc_google_calendar_id($id) {
135
+		return base64_decode($id);
136 136
 	}
137 137
 
138 138
 	/**
@@ -146,59 +146,59 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function get_events() {
148 148
 
149
-		$calendar = get_transient( '_simple-calendar_feed_id_' . strval( $this->post_id ) . '_' . $this->type );
149
+		$calendar = get_transient('_simple-calendar_feed_id_'.strval($this->post_id).'_'.$this->type);
150 150
 
151
-		if ( empty( $calendar ) && ! empty( $this->google_calendar_id ) ) {
151
+		if (empty($calendar) && ! empty($this->google_calendar_id)) {
152 152
 
153 153
 			$error = '';
154 154
 
155 155
 			try {
156
-				$response = $this->make_request( $this->google_calendar_id );
157
-			} catch ( \Exception $e ) {
156
+				$response = $this->make_request($this->google_calendar_id);
157
+			} catch (\Exception $e) {
158 158
 				$error .= $e->getMessage();
159 159
 			}
160 160
 
161
-			if ( empty( $error ) && isset( $response['events'] ) && isset( $response['timezone'] ) ) {
161
+			if (empty($error) && isset($response['events']) && isset($response['timezone'])) {
162 162
 
163
-				$calendar = array_merge( $response, array( 'events' => array() ) );
163
+				$calendar = array_merge($response, array('events' => array()));
164 164
 
165 165
 				// If no timezone has been set, use calendar feed.
166
-				if ( 'use_calendar' == $this->timezone_setting ) {
166
+				if ('use_calendar' == $this->timezone_setting) {
167 167
 					$this->timezone = $calendar['timezone'];
168 168
 				}
169 169
 
170
-				$source = isset( $response['title'] ) ? sanitize_text_field( $response['title'] ) : '';
170
+				$source = isset($response['title']) ? sanitize_text_field($response['title']) : '';
171 171
 
172
-				if ( ! empty( $response['events'] ) && is_array( $response['events'] ) ) {
173
-					foreach ( $response['events'] as $event ) {
174
-						if ( $event instanceof \Google_Service_Calendar_Event ) {
172
+				if ( ! empty($response['events']) && is_array($response['events'])) {
173
+					foreach ($response['events'] as $event) {
174
+						if ($event instanceof \Google_Service_Calendar_Event) {
175 175
 
176 176
 							// Visibility.
177 177
 							$visibility = $event->getVisibility();
178 178
 							// Public calendars may have private events which can't be properly accessed by simple api key method.
179
-							if ( $this->type == 'google' && ( $visibility == 'private' || $visibility == 'confidential' ) ) {
179
+							if ($this->type == 'google' && ($visibility == 'private' || $visibility == 'confidential')) {
180 180
 								continue;
181 181
 							}
182 182
 
183 183
 							// Event title & description.
184
-							$title = strip_tags( $event->getSummary() );
185
-							$title = sanitize_text_field( iconv( mb_detect_encoding( $title, mb_detect_order(), true ), 'UTF-8', $title ) );
186
-							$description = wp_kses_post( iconv( mb_detect_encoding( $event->getDescription(), mb_detect_order(), true ), 'UTF-8', $event->getDescription() ) );
184
+							$title = strip_tags($event->getSummary());
185
+							$title = sanitize_text_field(iconv(mb_detect_encoding($title, mb_detect_order(), true), 'UTF-8', $title));
186
+							$description = wp_kses_post(iconv(mb_detect_encoding($event->getDescription(), mb_detect_order(), true), 'UTF-8', $event->getDescription()));
187 187
 
188 188
 							$whole_day = false;
189 189
 
190 190
 							// Event start properties.
191 191
 							$start_timezone = ! $event->getStart()->timeZone ? $calendar['timezone'] : $event->getStart()->timeZone;
192
-							if ( is_null( $event->getStart()->dateTime ) ) {
192
+							if (is_null($event->getStart()->dateTime)) {
193 193
 								// Whole day event.
194
-								$date = Carbon::parse( $event->getStart()->date );
195
-								$google_start = Carbon::createFromDate( $date->year, $date->month, $date->day, $start_timezone )->startOfDay()->addSeconds( 59 );
196
-								$google_start_utc = Carbon::createFromDate( $date->year, $date->month, $date->day, 'UTC' )->startOfDay()->addSeconds( 59 );
194
+								$date = Carbon::parse($event->getStart()->date);
195
+								$google_start = Carbon::createFromDate($date->year, $date->month, $date->day, $start_timezone)->startOfDay()->addSeconds(59);
196
+								$google_start_utc = Carbon::createFromDate($date->year, $date->month, $date->day, 'UTC')->startOfDay()->addSeconds(59);
197 197
 								$whole_day = true;
198 198
 							} else {
199
-								$date = Carbon::parse( $event->getStart()->dateTime );
200
-								$google_start     = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $start_timezone );
201
-								$google_start_utc = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, 'UTC' );
199
+								$date = Carbon::parse($event->getStart()->dateTime);
200
+								$google_start     = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $start_timezone);
201
+								$google_start_utc = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, 'UTC');
202 202
 							}
203 203
 							// Start.
204 204
 							$start = $google_start->getTimestamp();
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
 
208 208
 							$end = $end_utc = $end_timezone = '';
209 209
 							$span = 0;
210
-							if ( false == $event->getEndTimeUnspecified() ) {
210
+							if (false == $event->getEndTimeUnspecified()) {
211 211
 
212 212
 								// Event end properties.
213 213
 								$end_timezone = ! $event->getEnd()->timeZone ? $calendar['timezone'] : $event->getEnd()->timeZone;
214
-								if ( is_null( $event->getEnd()->dateTime ) ) {
214
+								if (is_null($event->getEnd()->dateTime)) {
215 215
 									// Whole day event.
216
-									$date           = Carbon::parse( $event->getEnd()->date );
217
-									$google_end     = Carbon::createFromDate( $date->year, $date->month, $date->day, $end_timezone )->endOfDay()->subSeconds( 59 );
218
-									$google_end_utc = Carbon::createFromDate( $date->year, $date->month, $date->day, 'UTC' )->endOfDay()->subSeconds( 59 );
216
+									$date           = Carbon::parse($event->getEnd()->date);
217
+									$google_end     = Carbon::createFromDate($date->year, $date->month, $date->day, $end_timezone)->endOfDay()->subSeconds(59);
218
+									$google_end_utc = Carbon::createFromDate($date->year, $date->month, $date->day, 'UTC')->endOfDay()->subSeconds(59);
219 219
 								} else {
220
-									$date           = Carbon::parse( $event->getEnd()->dateTime );
221
-									$google_end     = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $end_timezone );
222
-									$google_end_utc = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, 'UTC' );
220
+									$date           = Carbon::parse($event->getEnd()->dateTime);
221
+									$google_end     = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $end_timezone);
222
+									$google_end_utc = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, 'UTC');
223 223
 								}
224 224
 								// End.
225 225
 								$end = $google_end->getTimestamp();
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 								$end_utc = $google_end_utc->getTimestamp();
228 228
 
229 229
 								// Count multiple days.
230
-								$span = $google_start->setTimezone( $calendar['timezone'] )->diffInDays( $google_end->setTimezone( $calendar['timezone'] ) );
230
+								$span = $google_start->setTimezone($calendar['timezone'])->diffInDays($google_end->setTimezone($calendar['timezone']));
231 231
 
232
-								if ( $span == 0 ) {
233
-									if ( $google_start->toDateString() !== $google_end->toDateString() ) {
232
+								if ($span == 0) {
233
+									if ($google_start->toDateString() !== $google_end->toDateString()) {
234 234
 										$span = 1;
235 235
 									}
236 236
 								}
@@ -245,19 +245,19 @@  discard block
 block discarded – undo
245 245
 							// Recurring event.
246 246
 							$recurrence = $event->getRecurrence();
247 247
 							$recurring_id = $event->getRecurringEventId();
248
-							if ( ! $recurrence && $recurring_id ) {
248
+							if ( ! $recurrence && $recurring_id) {
249 249
 								$recurrence = true;
250 250
 							}
251 251
 
252 252
 							// Event link.
253
-							if ( 'use_calendar' == $this->timezone_setting ) {
254
-								$link = add_query_arg( array( 'ctz' => $this->timezone ), $event->getHtmlLink() );
253
+							if ('use_calendar' == $this->timezone_setting) {
254
+								$link = add_query_arg(array('ctz' => $this->timezone), $event->getHtmlLink());
255 255
 							} else {
256 256
 								$link = $event->getHtmlLink();
257 257
 							}
258 258
 
259 259
 							// Build the event.
260
-							$calendar['events'][ intval( $start ) ][] = array(
260
+							$calendar['events'][intval($start)][] = array(
261 261
 								'type'           => 'google-calendar',
262 262
 								'source'         => $source,
263 263
 								'title'          => $title,
@@ -284,24 +284,24 @@  discard block
 block discarded – undo
284 284
 						}
285 285
 					}
286 286
 
287
-					if ( ! empty( $calendar['events'] ) ) {
287
+					if ( ! empty($calendar['events'])) {
288 288
 
289
-						ksort( $calendar['events'], SORT_NUMERIC );
289
+						ksort($calendar['events'], SORT_NUMERIC);
290 290
 
291 291
 						set_transient(
292
-							'_simple-calendar_feed_id_' . strval( $this->post_id ) . '_' . $this->type,
292
+							'_simple-calendar_feed_id_'.strval($this->post_id).'_'.$this->type,
293 293
 							$calendar,
294
-							max( absint( $this->cache ), 60 )
294
+							max(absint($this->cache), 60)
295 295
 						);
296 296
 					}
297 297
 				}
298 298
 
299 299
 			} else {
300 300
 
301
-				$message  = __( 'While trying to retrieve events, Google returned an error:', 'google-calendar-events' );
302
-				$message .= '<br><br>' . $error . '<br><br>';
303
-				$message .= __( 'Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events' ) . '<br><br>';
304
-				$message .= __( 'Only you can see this notice.', 'google-calendar-events' );
301
+				$message  = __('While trying to retrieve events, Google returned an error:', 'google-calendar-events');
302
+				$message .= '<br><br>'.$error.'<br><br>';
303
+				$message .= __('Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events').'<br><br>';
304
+				$message .= __('Only you can see this notice.', 'google-calendar-events');
305 305
 
306 306
 				return $message;
307 307
 			}
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
 		}
310 310
 
311 311
 		// If no timezone has been set, use calendar feed.
312
-		if ( 'use_calendar' == $this->timezone_setting && isset( $calendar['timezone'] ) ) {
312
+		if ('use_calendar' == $this->timezone_setting && isset($calendar['timezone'])) {
313 313
 			$this->timezone = $calendar['timezone'];
314 314
 		}
315 315
 
316
-		return isset( $calendar['events'] ) ? $calendar['events'] : array();
316
+		return isset($calendar['events']) ? $calendar['events'] : array();
317 317
 	}
318 318
 
319 319
 	/**
@@ -329,67 +329,67 @@  discard block
 block discarded – undo
329 329
 	 *
330 330
 	 * @throws \Exception On request failure will throw an exception from Google.
331 331
 	 */
332
-	public function make_request( $id = '', $time_min = 0, $time_max = 0 ) {
332
+	public function make_request($id = '', $time_min = 0, $time_max = 0) {
333 333
 
334 334
 		$calendar = array();
335 335
 		$google = $this->get_service();
336 336
 
337
-		if ( ! is_null( $google ) && ! empty( $id ) ) {
337
+		if ( ! is_null($google) && ! empty($id)) {
338 338
 
339 339
 			// Build the request args.
340 340
 			$args = array();
341 341
 
342 342
 			// Expand recurring events.
343
-			if ( $this->google_events_recurring == 'show' ) {
343
+			if ($this->google_events_recurring == 'show') {
344 344
 				$args['singleEvents'] = true;
345 345
 			}
346 346
 
347 347
 			// Query events using search terms.
348
-			if ( ! empty( $this->google_search_query ) ) {
349
-				$args['q'] = rawurlencode( $this->google_search_query );
348
+			if ( ! empty($this->google_search_query)) {
349
+				$args['q'] = rawurlencode($this->google_search_query);
350 350
 			}
351 351
 
352 352
 			// Max results to query.
353
-			$args['maxResults'] = strval( min( absint( $this->google_max_results ), 2500 ) );
353
+			$args['maxResults'] = strval(min(absint($this->google_max_results), 2500));
354 354
 
355 355
 			// Specify a timezone.
356 356
 			$timezone = '';
357
-			if ( 'use_calendar' != get_post_meta( $this->post_id, '_feed_timezone_setting', true ) ) {
357
+			if ('use_calendar' != get_post_meta($this->post_id, '_feed_timezone_setting', true)) {
358 358
 				$args['timeZone'] = $timezone = $this->timezone;
359 359
 			}
360 360
 
361 361
 			// Lower bound (inclusive) for an event's end time to filter by.
362
-			$earliest_event = intval( $this->time_min );
363
-			if ( $earliest_event > 0 ) {
362
+			$earliest_event = intval($this->time_min);
363
+			if ($earliest_event > 0) {
364 364
 				$timeMin = Carbon::now();
365
-				if ( ! empty( $timezone ) ) {
366
-					$timeMin->setTimezone( $timezone );
365
+				if ( ! empty($timezone)) {
366
+					$timeMin->setTimezone($timezone);
367 367
 				}
368
-				$timeMin->setTimestamp( $earliest_event );
368
+				$timeMin->setTimestamp($earliest_event);
369 369
 				$args['timeMin'] = $timeMin->toRfc3339String();
370 370
 			}
371 371
 
372 372
 			// Upper bound (exclusive) for an event's start time to filter by.
373
-			$latest_event = intval( $this->time_max );
374
-			if ( $latest_event > 0 ) {
373
+			$latest_event = intval($this->time_max);
374
+			if ($latest_event > 0) {
375 375
 				$timeMax = Carbon::now();
376
-				if ( ! empty( $timezone ) ) {
377
-					$timeMax->setTimezone( $timezone );
376
+				if ( ! empty($timezone)) {
377
+					$timeMax->setTimezone($timezone);
378 378
 				}
379
-				$timeMax->setTimestamp( $latest_event );
379
+				$timeMax->setTimestamp($latest_event);
380 380
 				$args['timeMax'] = $timeMax->toRfc3339String();
381 381
 			}
382 382
 
383 383
 			// Query events in calendar.
384
-			$response = $google->events->listEvents( $id, $args );
384
+			$response = $google->events->listEvents($id, $args);
385 385
 
386
-			if ( $response instanceof \Google_Service_Calendar_Events ) {
386
+			if ($response instanceof \Google_Service_Calendar_Events) {
387 387
 				$calendar = array(
388 388
 					'id'            => $id,
389 389
 					'title'         => $response->getSummary(),
390 390
 					'description'   => $response->getDescription(),
391 391
 					'timezone'      => $response->getTimeZone(),
392
-					'url'           => esc_url( '//www.google.com/calendar/embed?src=' . $id ),
392
+					'url'           => esc_url('//www.google.com/calendar/embed?src='.$id),
393 393
 					'events'        => $response->getItems(),
394 394
 				);
395 395
 			}
@@ -409,10 +409,10 @@  discard block
 block discarded – undo
409 409
 	private function get_client() {
410 410
 
411 411
 		$client = new \Google_Client();
412
-		$client->setApplicationName( 'Simple Calendar' );
413
-		$client->setScopes( $this->google_client_scopes );
414
-		$client->setDeveloperKey( $this->google_api_key );
415
-		$client->setAccessType( 'online' );
412
+		$client->setApplicationName('Simple Calendar');
413
+		$client->setScopes($this->google_client_scopes);
414
+		$client->setDeveloperKey($this->google_api_key);
415
+		$client->setAccessType('online');
416 416
 
417 417
 		return $client;
418 418
 	}
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 * @return null|\Google_Service_Calendar
427 427
 	 */
428 428
 	protected function get_service() {
429
-		return $this->google_client instanceof \Google_Client ? new \Google_Service_Calendar( $this->google_client ) : null;
429
+		return $this->google_client instanceof \Google_Client ? new \Google_Service_Calendar($this->google_client) : null;
430 430
 	}
431 431
 
432 432
 }
Please login to merge, or discard this patch.
includes/feeds/grouped-calendars.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use SimpleCalendar\Abstracts\Feed;
11 11
 use SimpleCalendar\Feeds\Admin\Grouped_Calendars_Admin;
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param string|Calendar $calendar
40 40
 	 */
41
-	public function __construct( $calendar = '' ) {
41
+	public function __construct($calendar = '') {
42 42
 
43
-		parent::__construct( $calendar );
43
+		parent::__construct($calendar);
44 44
 
45 45
 		$this->type = 'grouped-calendars';
46
-		$this->name = __( 'Grouped Calendar', 'google-calendar-events' );
46
+		$this->name = __('Grouped Calendar', 'google-calendar-events');
47 47
 
48
-		if ( $this->post_id > 0 ) {
48
+		if ($this->post_id > 0) {
49 49
 			$this->set_source();
50
-			if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
50
+			if ( ! is_admin() || defined('DOING_AJAX')) {
51 51
 				$this->events = $this->get_events();
52 52
 			}
53 53
 		}
54 54
 
55
-		if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
56
-			new Grouped_Calendars_Admin( $this );
55
+		if (is_admin() && ! defined('DOING_AJAX')) {
56
+			new Grouped_Calendars_Admin($this);
57 57
 		}
58 58
 	}
59 59
 
@@ -64,38 +64,38 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param array $ids Array of calendar ids.
66 66
 	 */
67
-	public function set_source( $ids = array() ) {
67
+	public function set_source($ids = array()) {
68 68
 
69
-		$source = get_post_meta( $this->post_id, '_grouped_calendars_source', true );
69
+		$source = get_post_meta($this->post_id, '_grouped_calendars_source', true);
70 70
 
71
-		if ( 'ids' == $source ) {
71
+		if ('ids' == $source) {
72 72
 
73
-			if ( empty( $ids ) ) {
74
-				$ids = get_post_meta( $this->post_id, '_grouped_calendars_ids', true );
73
+			if (empty($ids)) {
74
+				$ids = get_post_meta($this->post_id, '_grouped_calendars_ids', true);
75 75
 			}
76 76
 
77
-			$this->calendars_ids = ! empty( $ids ) && is_array( $ids ) ? array_map( 'absint', $ids ) : array();
77
+			$this->calendars_ids = ! empty($ids) && is_array($ids) ? array_map('absint', $ids) : array();
78 78
 
79
-		} elseif ( 'category' == $source ) {
79
+		} elseif ('category' == $source) {
80 80
 
81
-			$categories = get_post_meta( $this->post_id, '_grouped_calendars_category', true );
81
+			$categories = get_post_meta($this->post_id, '_grouped_calendars_category', true);
82 82
 
83
-			if ( $categories && is_array( $categories ) ) {
83
+			if ($categories && is_array($categories)) {
84 84
 
85 85
 				$tax_query = array(
86 86
 					'taxonomy' => 'calendar_category',
87 87
 					'field'    => 'term_id',
88
-					'terms'    => array_map( 'absint', $categories ),
88
+					'terms'    => array_map('absint', $categories),
89 89
 				);
90 90
 
91
-				$calendars = get_posts( array(
91
+				$calendars = get_posts(array(
92 92
 					'post_type' => 'calendar',
93
-					'tax_query' => array( $tax_query ),
93
+					'tax_query' => array($tax_query),
94 94
 					'nopaging'  => true,
95 95
 					'fields'    => 'ids',
96
-				) );
96
+				));
97 97
 
98
-				$this->calendars_ids = ! empty( $calendars ) && is_array( $calendars ) ? $calendars : array();
98
+				$this->calendars_ids = ! empty($calendars) && is_array($calendars) ? $calendars : array();
99 99
 			}
100 100
 
101 101
 		}
@@ -111,40 +111,40 @@  discard block
 block discarded – undo
111 111
 	public function get_events() {
112 112
 
113 113
 		$ids    = $this->calendars_ids;
114
-		$events = get_transient( '_simple-calendar_feed_id_' . strval( $this->post_id ) . '_' . $this->type );
114
+		$events = get_transient('_simple-calendar_feed_id_'.strval($this->post_id).'_'.$this->type);
115 115
 
116
-		if ( empty( $events ) && ! empty( $ids ) && is_array( $ids ) ) {
116
+		if (empty($events) && ! empty($ids) && is_array($ids)) {
117 117
 
118 118
 			$events = array();
119 119
 
120
-			foreach ( $ids as $cal_id ) {
120
+			foreach ($ids as $cal_id) {
121 121
 
122
-				$calendar = simcal_get_calendar( intval( $cal_id ) );
122
+				$calendar = simcal_get_calendar(intval($cal_id));
123 123
 
124
-				if ( $calendar instanceof Calendar ) {
125
-					$events = is_array( $calendar->events ) ? $events + $calendar->events : $events;
124
+				if ($calendar instanceof Calendar) {
125
+					$events = is_array($calendar->events) ? $events + $calendar->events : $events;
126 126
 				}
127 127
 
128 128
 			}
129 129
 
130
-			if ( ! empty( $events ) ) {
130
+			if ( ! empty($events)) {
131 131
 
132 132
 				// Trim events to set the earliest one as specified in feed settings.
133
-				$earliest_event = intval( $this->time_min );
134
-				if ( $earliest_event > 0 ) {
135
-					$events = $this->array_filter_key( $events, array( $this, 'filter_events_before' ) );
133
+				$earliest_event = intval($this->time_min);
134
+				if ($earliest_event > 0) {
135
+					$events = $this->array_filter_key($events, array($this, 'filter_events_before'));
136 136
 				}
137 137
 
138 138
 				// Trim events to set the latest one as specified in feed settings.
139
-				$latest_event = intval( $this->time_max );
140
-				if ( $latest_event > 0 ) {
141
-					$events = $this->array_filter_key( $events, array( $this, 'filter_events_after' ) );
139
+				$latest_event = intval($this->time_max);
140
+				if ($latest_event > 0) {
141
+					$events = $this->array_filter_key($events, array($this, 'filter_events_after'));
142 142
 				}
143 143
 
144 144
 				set_transient(
145
-					'_simple-calendar_feed_id_' . strval( $this->post_id ) . '_' . $this->type,
145
+					'_simple-calendar_feed_id_'.strval($this->post_id).'_'.$this->type,
146 146
 					$events,
147
-					absint( $this->cache )
147
+					absint($this->cache)
148 148
 				);
149 149
 			}
150 150
 
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return array
168 168
 	 */
169
-	private function array_filter_key( array $array, $callback ) {
170
-		$matched_keys = array_filter( array_keys( $array ), $callback );
171
-		return array_intersect_key( $array, array_flip( $matched_keys ) );
169
+	private function array_filter_key(array $array, $callback) {
170
+		$matched_keys = array_filter(array_keys($array), $callback);
171
+		return array_intersect_key($array, array_flip($matched_keys));
172 172
 	}
173 173
 
174 174
 	/**
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @return bool
183 183
 	 */
184
-	private function filter_events_before( $event ) {
185
-		if ( $this->time_min !== 0 ) {
186
-			return intval( $event ) > intval( $this->time_min );
184
+	private function filter_events_before($event) {
185
+		if ($this->time_min !== 0) {
186
+			return intval($event) > intval($this->time_min);
187 187
 		}
188 188
 		return true;
189 189
 	}
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return bool
200 200
 	 */
201
-	private function filter_events_after( $event ) {
202
-		if ( $this->time_max !== 0 ) {
203
-			return intval( $event ) < intval( $this->time_max );
201
+	private function filter_events_after($event) {
202
+		if ($this->time_max !== 0) {
203
+			return intval($event) < intval($this->time_max);
204 204
 		}
205 205
 		return true;
206 206
 	}
Please login to merge, or discard this patch.
includes/calendars/admin/default-calendar-admin.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 &rarr; Settings &rarr; 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 &rarr; Settings &rarr; 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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
includes/events/event-builder.php 1 patch
Spacing   +311 added lines, -311 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Carbon\Carbon;
10 10
 use SimpleCalendar\Abstracts\Calendar;
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param Event    $event
55 55
 	 * @param Calendar $calendar
56 56
 	 */
57
-	public function __construct( Event $event, Calendar $calendar ) {
57
+	public function __construct(Event $event, Calendar $calendar) {
58 58
 		$this->event    = $event;
59 59
 		$this->calendar = $calendar;
60 60
 		$this->tags     = $this->get_content_tags();
@@ -74,84 +74,84 @@  discard block
 block discarded – undo
74 74
 			 * Content Tags *
75 75
 			 * ============ */
76 76
 
77
-			'title',                 // The event title.
78
-			'event-title',           // @deprecated An alias for 'title' tag.
79
-			'description',           // The event description.
80
-
81
-			'when',                  // Date and time of the event.
82
-			'start-time',            // Start time of the event.
83
-			'start-date',            // Start date of the event.
84
-			'start-custom',          // @deprecated Start time in a user defined format (set by tag 'format' attribute).
85
-			'start-human',           // Start time in a human friendly format.
86
-			'end-time',              // End time of the event.
87
-			'end-date',              // End date of the event.
88
-			'end-custom',            // @deprecated End date-time in a user defined format (set by tag 'format' attribute).
89
-			'end-human',             // End date-time in a human friendly format.
90
-
91
-			'duration',              // How long the events lasts, in a human-readable format.
92
-			'length',                // @deprecated An alias of 'duration' tag.
93
-
94
-			'location',              // Alias of start-location.
95
-			'start-location',        // Location name where the event starts.
96
-			'maps-link',             // @deprecated An alias for 'start-location-link' tag.
97
-			'start-location-link',   // Link to Google Maps querying the event start location address.
98
-			'end-location',          // Location name where the event ends.
99
-			'end-location-link',     // Link to Google Maps querying the event end location address.
100
-
101
-			'link',                  // An HTML link to the event URL.
102
-			'url',                   // A string with the raw event link URL.
103
-
104
-			'calendar',              // The title of the source calendar.
105
-			'feed-title',            // @deprecated An alias of 'calendar'.
106
-
107
-			'id',                    // The event unique ID.
108
-			'uid',                   // An alias of ID.
109
-			'event-id',              // @deprecated An alias for 'id' tag.
110
-			'calendar-id',           // The calendar ID.
111
-			'feed-id',               // @deprecated An alias for 'calendar-id' tag.
112
-			'cal-id',                // @deprecated An alias for 'calendar-id' tag.
77
+			'title', // The event title.
78
+			'event-title', // @deprecated An alias for 'title' tag.
79
+			'description', // The event description.
80
+
81
+			'when', // Date and time of the event.
82
+			'start-time', // Start time of the event.
83
+			'start-date', // Start date of the event.
84
+			'start-custom', // @deprecated Start time in a user defined format (set by tag 'format' attribute).
85
+			'start-human', // Start time in a human friendly format.
86
+			'end-time', // End time of the event.
87
+			'end-date', // End date of the event.
88
+			'end-custom', // @deprecated End date-time in a user defined format (set by tag 'format' attribute).
89
+			'end-human', // End date-time in a human friendly format.
90
+
91
+			'duration', // How long the events lasts, in a human-readable format.
92
+			'length', // @deprecated An alias of 'duration' tag.
93
+
94
+			'location', // Alias of start-location.
95
+			'start-location', // Location name where the event starts.
96
+			'maps-link', // @deprecated An alias for 'start-location-link' tag.
97
+			'start-location-link', // Link to Google Maps querying the event start location address.
98
+			'end-location', // Location name where the event ends.
99
+			'end-location-link', // Link to Google Maps querying the event end location address.
100
+
101
+			'link', // An HTML link to the event URL.
102
+			'url', // A string with the raw event link URL.
103
+
104
+			'calendar', // The title of the source calendar.
105
+			'feed-title', // @deprecated An alias of 'calendar'.
106
+
107
+			'id', // The event unique ID.
108
+			'uid', // An alias of ID.
109
+			'event-id', // @deprecated An alias for 'id' tag.
110
+			'calendar-id', // The calendar ID.
111
+			'feed-id', // @deprecated An alias for 'calendar-id' tag.
112
+			'cal-id', // @deprecated An alias for 'calendar-id' tag.
113 113
 
114 114
 			/* ========= *
115 115
 			 * Meta Tags *
116 116
 			 * ========= */
117 117
 
118
-			'attachments',          // List of attachments.
119
-			'attendees',            // List of attendees.
120
-			'organizer',            // Creator info.
118
+			'attachments', // List of attachments.
119
+			'attendees', // List of attendees.
120
+			'organizer', // Creator info.
121 121
 
122 122
 			/* ================ *
123 123
 			 * Conditional Tags *
124 124
 			 * ================ */
125 125
 
126
-			'if-title',              // If the event has a title.
127
-			'if-description',        // If the event has a description.
128
-
129
-			'if-now',                // If the event is taking place now.
130
-			'if-not-now',            // If the event is not taking place now (may have ended or just not started yet).
131
-			'if-started',            // If the event has started (and may as well as ended).
132
-			'if-not-started',        // If the event has NOT started yet (event could be any time in the future).
133
-			'if-ended',              // If the event has ended (event could be any time in the past).
134
-			'if-not-ended',          // If the event has NOT ended (may as well as not started yet).
135
-
136
-			'if-whole-day',          // If the event lasts the whole day.
137
-			'if-all-day',            // @deprecated Alias for 'if-whole-day'.
138
-			'if-not-whole-day',      // If the event does NOT last the whole day.
139
-			'if-not-all-day',        // @deprecated Alias for 'if-not-whole-day'.
140
-			'if-end-time',           // If the event has a set end time.
141
-			'if-no-end-time',        // If the event has NOT a set end time.
142
-
143
-			'if-multi-day',          // If the event spans multiple days.
144
-			'if-single-day',         // If the event does not span multiple days.
145
-
146
-			'if-recurring',          // If the event is a recurring event.
147
-			'if-not-recurring',      // If the event is NOT a recurring event.
148
-
149
-			'if-location',           // @deprecated Alias for 'if-start-location'.
150
-			'if-start-location',     // Does the event has a start location?
151
-			'if-end-location',       // Does the event has an end location?
152
-			'if-not-location',       // @deprecated Alias for 'if-not-start-location'.
126
+			'if-title', // If the event has a title.
127
+			'if-description', // If the event has a description.
128
+
129
+			'if-now', // If the event is taking place now.
130
+			'if-not-now', // If the event is not taking place now (may have ended or just not started yet).
131
+			'if-started', // If the event has started (and may as well as ended).
132
+			'if-not-started', // If the event has NOT started yet (event could be any time in the future).
133
+			'if-ended', // If the event has ended (event could be any time in the past).
134
+			'if-not-ended', // If the event has NOT ended (may as well as not started yet).
135
+
136
+			'if-whole-day', // If the event lasts the whole day.
137
+			'if-all-day', // @deprecated Alias for 'if-whole-day'.
138
+			'if-not-whole-day', // If the event does NOT last the whole day.
139
+			'if-not-all-day', // @deprecated Alias for 'if-not-whole-day'.
140
+			'if-end-time', // If the event has a set end time.
141
+			'if-no-end-time', // If the event has NOT a set end time.
142
+
143
+			'if-multi-day', // If the event spans multiple days.
144
+			'if-single-day', // If the event does not span multiple days.
145
+
146
+			'if-recurring', // If the event is a recurring event.
147
+			'if-not-recurring', // If the event is NOT a recurring event.
148
+
149
+			'if-location', // @deprecated Alias for 'if-start-location'.
150
+			'if-start-location', // Does the event has a start location?
151
+			'if-end-location', // Does the event has an end location?
152
+			'if-not-location', // @deprecated Alias for 'if-not-start-location'.
153 153
 			'if-not-start-location', // Does the event has NOT a start location?
154
-			'if-not-end-location',   // Does the event has NOT an end location?
154
+			'if-not-end-location', // Does the event has NOT an end location?
155 155
 
156 156
 		);
157 157
 	}
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return string
167 167
 	 */
168
-	public function parse_event_template_tags( $template_tags = '' ) {
168
+	public function parse_event_template_tags($template_tags = '') {
169 169
 
170 170
 		// Process tags.
171 171
 		$result = preg_replace_callback(
172 172
 			$this->get_regex(),
173
-			array( $this, 'process_event_content' ),
173
+			array($this, 'process_event_content'),
174 174
 			$template_tags
175 175
 		);
176 176
 
177 177
 		// Removes extra consecutive <br> tags.
178
-		return preg_replace( '#(<br */?>\s*)+#i', '<br />', trim( $result ) );
178
+		return preg_replace('#(<br */?>\s*)+#i', '<br />', trim($result));
179 179
 	}
180 180
 
181 181
 	/**
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @return string
189 189
 	 */
190
-	public function process_event_content( $match ) {
190
+	public function process_event_content($match) {
191 191
 
192
-		if ( $match[1] == '[' && $match[6] == ']' ) {
193
-			return substr( $match[0], 1, - 1 );
192
+		if ($match[1] == '[' && $match[6] == ']') {
193
+			return substr($match[0], 1, - 1);
194 194
 		}
195 195
 
196 196
 		$tag     = $match[2]; // Tag name without square brackets.
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 		$calendar = $this->calendar;
203 203
 		$event    = $this->event;
204 204
 
205
-		if ( ( $calendar instanceof Calendar ) && ( $event instanceof Event ) ) {
205
+		if (($calendar instanceof Calendar) && ($event instanceof Event)) {
206 206
 
207
-			switch ( $tag ) {
207
+			switch ($tag) {
208 208
 
209 209
 				/* ============ *
210 210
 				 * Content Tags *
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 
213 213
 				case 'title' :
214 214
 				case 'event-title' :
215
-					return $this->get_title( $event->title, $attr );
215
+					return $this->get_title($event->title, $attr);
216 216
 
217 217
 				case 'description' :
218
-					return $this->get_description( $event->description, $attr );
218
+					return $this->get_description($event->description, $attr);
219 219
 
220 220
 				case 'when' :
221
-					return $this->get_when( $event );
221
+					return $this->get_when($event);
222 222
 
223 223
 				case 'end-date' :
224 224
 				case 'end-custom' :
@@ -228,44 +228,44 @@  discard block
 block discarded – undo
228 228
 				case 'start-date' :
229 229
 				case 'start-human' :
230 230
 				case 'start-time' :
231
-					return $this->get_dt( $tag, $event, $attr );
231
+					return $this->get_dt($tag, $event, $attr);
232 232
 
233 233
 				case 'length' :
234 234
 				case 'duration' :
235
-					if ( false !== $event->end ) {
235
+					if (false !== $event->end) {
236 236
 						$duration = $event->start - $event->end - 1000;
237 237
 
238
-						if ( $event->whole_day ) {
239
-							$value = human_time_diff( $event->start, ( $event->end - 86500 ) );
238
+						if ($event->whole_day) {
239
+							$value = human_time_diff($event->start, ($event->end - 86500));
240 240
 						} else {
241
-							$value = human_time_diff( $event->start, $event->end );
241
+							$value = human_time_diff($event->start, $event->end);
242 242
 						}
243 243
 					} else {
244 244
 						$duration = '-1';
245
-						$value    = __( 'No end time', 'google-calendar-events' );
245
+						$value    = __('No end time', 'google-calendar-events');
246 246
 					}
247
-					return ' <span class="simcal-event-duration" data-event-duration="' . $duration . '">' . $value . '</span>';
247
+					return ' <span class="simcal-event-duration" data-event-duration="'.$duration.'">'.$value.'</span>';
248 248
 
249 249
 				case 'location' :
250 250
 				case 'start-location' :
251 251
 				case 'end-location' :
252 252
 					$location = $tag == 'end-location' ? $event->end_location['address'] : $event->start_location['address'];
253
-					return ' <span class="simcal-event-address simcal-event-start-location" itemprop="location" itemscope itemtype="http://schema.org/Place">' . wp_strip_all_tags( $location ) . '</span>';
253
+					return ' <span class="simcal-event-address simcal-event-start-location" itemprop="location" itemscope itemtype="http://schema.org/Place">'.wp_strip_all_tags($location).'</span>';
254 254
 
255 255
 				case 'start-location-link':
256 256
 				case 'end-location-link' :
257 257
 				case 'maps-link' :
258 258
 					$location = $tag == 'end-location-link' ? $event->end_location['address'] : $event->start_location['address'];
259
-					if ( ! empty( $location ) ) {
260
-						$url = '//maps.google.com?q=' . urlencode( $location );
261
-						return $this->make_link( $tag, $url, $calendar->get_event_html( $event, $partial ), $attr );
259
+					if ( ! empty($location)) {
260
+						$url = '//maps.google.com?q='.urlencode($location);
261
+						return $this->make_link($tag, $url, $calendar->get_event_html($event, $partial), $attr);
262 262
 					}
263 263
 					break;
264 264
 
265 265
 				case 'link' :
266 266
 				case 'url' :
267
-					$content = 'link' == $tag ? $calendar->get_event_html( $event, $partial ) : '';
268
-					return $this->make_link( $tag, $event->link, $content , $attr );
267
+					$content = 'link' == $tag ? $calendar->get_event_html($event, $partial) : '';
268
+					return $this->make_link($tag, $event->link, $content, $attr);
269 269
 
270 270
 				case 'calendar' :
271 271
 				case 'feed-title' :
@@ -287,22 +287,22 @@  discard block
 block discarded – undo
287 287
 
288 288
 				case 'attachments' :
289 289
 					$attachments = $event->get_attachments();
290
-					if ( ! empty( $attachments ) ) {
291
-						return $this->get_attachments( $attachments );
290
+					if ( ! empty($attachments)) {
291
+						return $this->get_attachments($attachments);
292 292
 					}
293 293
 					break;
294 294
 
295 295
 				case 'attendees' :
296 296
 					$attendees = $event->get_attendees();
297
-					if ( ! empty( $attendees ) ) {
298
-						return $this->get_attendees( $attendees, $attr );
297
+					if ( ! empty($attendees)) {
298
+						return $this->get_attendees($attendees, $attr);
299 299
 					}
300 300
 					break;
301 301
 
302 302
 				case 'organizer' :
303 303
 					$organizer = $event->get_organizer();
304
-					if ( ! empty( $organizer ) ) {
305
-						return $this->get_organizer( $organizer, $attr );
304
+					if ( ! empty($organizer)) {
305
+						return $this->get_organizer($organizer, $attr);
306 306
 					}
307 307
 					break;
308 308
 
@@ -311,35 +311,35 @@  discard block
 block discarded – undo
311 311
 				 * ================ */
312 312
 
313 313
 				case 'if-title':
314
-					if ( ! empty( $event->title ) ) {
315
-						return $calendar->get_event_html( $event, $partial );
314
+					if ( ! empty($event->title)) {
315
+						return $calendar->get_event_html($event, $partial);
316 316
 					}
317 317
 					break;
318 318
 
319 319
 				case 'if-description':
320
-					if ( ! empty( $event->description ) ) {
321
-						return $calendar->get_event_html( $event, $partial );
320
+					if ( ! empty($event->description)) {
321
+						return $calendar->get_event_html($event, $partial);
322 322
 					}
323 323
 					break;
324 324
 
325 325
 				case 'if-now' :
326 326
 				case 'if-not-now' :
327 327
 
328
-					$start_dt = $event->start_dt->setTimezone( $calendar->timezone );
328
+					$start_dt = $event->start_dt->setTimezone($calendar->timezone);
329 329
 					$start = $start_dt->getTimestamp();
330 330
 
331
-					if ( $event->end_dt instanceof Carbon ) {
332
-						$end = $event->end_dt->setTimezone( $calendar->timezone )->getTimestamp();
331
+					if ($event->end_dt instanceof Carbon) {
332
+						$end = $event->end_dt->setTimezone($calendar->timezone)->getTimestamp();
333 333
 					} else {
334 334
 						return '';
335 335
 					}
336 336
 
337
-					$now = ( $start <= $calendar->now ) && ( $end >= $calendar->now );
337
+					$now = ($start <= $calendar->now) && ($end >= $calendar->now);
338 338
 
339
-					if ( ( 'if-now' == $tag ) && $now ) {
340
-						return $calendar->get_event_html( $event, $partial );
341
-					} elseif ( ( 'if-not-now' == $tag ) && ( false == $now ) ) {
342
-						return $calendar->get_event_html( $event, $partial );
339
+					if (('if-now' == $tag) && $now) {
340
+						return $calendar->get_event_html($event, $partial);
341
+					} elseif (('if-not-now' == $tag) && (false == $now)) {
342
+						return $calendar->get_event_html($event, $partial);
343 343
 					}
344 344
 
345 345
 					break;
@@ -347,15 +347,15 @@  discard block
 block discarded – undo
347 347
 				case 'if-started' :
348 348
 				case 'if-not-started' :
349 349
 
350
-					$start = $event->start_dt->setTimezone( $calendar->timezone )->getTimestamp();
350
+					$start = $event->start_dt->setTimezone($calendar->timezone)->getTimestamp();
351 351
 
352
-					if ( 'if-started' == $tag ) {
353
-						if ( $start < $calendar->now ) {
354
-							return $calendar->get_event_html( $event, $partial );
352
+					if ('if-started' == $tag) {
353
+						if ($start < $calendar->now) {
354
+							return $calendar->get_event_html($event, $partial);
355 355
 						}
356
-					} elseif ( 'if-not-started' == $tag ) {
357
-						if ( $start > $calendar->now ) {
358
-							return $calendar->get_event_html( $event, $partial );
356
+					} elseif ('if-not-started' == $tag) {
357
+						if ($start > $calendar->now) {
358
+							return $calendar->get_event_html($event, $partial);
359 359
 						}
360 360
 					}
361 361
 
@@ -364,17 +364,17 @@  discard block
 block discarded – undo
364 364
 				case 'if-ended' :
365 365
 				case 'if-not-ended' :
366 366
 
367
-					if ( false !== $event->end ) {
367
+					if (false !== $event->end) {
368 368
 
369
-						$end = $event->end_dt->setTimezone( $calendar->timezone )->getTimestamp();
369
+						$end = $event->end_dt->setTimezone($calendar->timezone)->getTimestamp();
370 370
 
371
-						if ( 'if-ended' == $tag ) {
372
-							if ( $end < $calendar->now ) {
373
-								return $calendar->get_event_html( $event, $partial );
371
+						if ('if-ended' == $tag) {
372
+							if ($end < $calendar->now) {
373
+								return $calendar->get_event_html($event, $partial);
374 374
 							}
375
-						} elseif ( 'if-not-ended' == $tag ) {
376
-							if ( $end > $calendar->now ) {
377
-								return $calendar->get_event_html( $event, $partial );
375
+						} elseif ('if-not-ended' == $tag) {
376
+							if ($end > $calendar->now) {
377
+								return $calendar->get_event_html($event, $partial);
378 378
 							}
379 379
 						}
380 380
 
@@ -383,14 +383,14 @@  discard block
 block discarded – undo
383 383
 					break;
384 384
 
385 385
 				case 'if-end-time' :
386
-					if ( false !== $event->end ) {
387
-						return $calendar->get_event_html( $event, $partial );
386
+					if (false !== $event->end) {
387
+						return $calendar->get_event_html($event, $partial);
388 388
 					}
389 389
 					break;
390 390
 
391 391
 				case 'if-no-end-time' :
392
-					if ( false === $event->end ) {
393
-						return $calendar->get_event_html( $event, $partial );
392
+					if (false === $event->end) {
393
+						return $calendar->get_event_html($event, $partial);
394 394
 					}
395 395
 					break;
396 396
 
@@ -398,59 +398,59 @@  discard block
 block discarded – undo
398 398
 				case 'if-whole-day' :
399 399
 				case 'if-not-all-day' :
400 400
 				case 'if-not-whole-day' :
401
-					$bool = strstr( $tag, 'not' ) ? false : true;
402
-					if ( $bool === $event->whole_day ) {
403
-						return $calendar->get_event_html( $event, $partial );
401
+					$bool = strstr($tag, 'not') ? false : true;
402
+					if ($bool === $event->whole_day) {
403
+						return $calendar->get_event_html($event, $partial);
404 404
 					}
405 405
 					break;
406 406
 
407 407
 				case 'if-recurring' :
408
-					if ( ! empty( $event->recurrence ) ) {
409
-						return $calendar->get_event_html( $event, $partial );
408
+					if ( ! empty($event->recurrence)) {
409
+						return $calendar->get_event_html($event, $partial);
410 410
 					}
411 411
 					break;
412 412
 
413 413
 				case 'if-not-recurring' :
414
-					if ( false === $event->recurrence ) {
415
-						return $calendar->get_event_html( $event, $partial );
414
+					if (false === $event->recurrence) {
415
+						return $calendar->get_event_html($event, $partial);
416 416
 					}
417 417
 					break;
418 418
 
419 419
 				case 'if-multi-day' :
420
-					if ( false !== $event->multiple_days ) {
421
-						return $calendar->get_event_html( $event, $partial );
420
+					if (false !== $event->multiple_days) {
421
+						return $calendar->get_event_html($event, $partial);
422 422
 					}
423 423
 					break;
424 424
 
425 425
 				case 'if-single-day' :
426
-					if ( false === $event->multiple_days ) {
427
-						return $calendar->get_event_html( $event, $partial );
426
+					if (false === $event->multiple_days) {
427
+						return $calendar->get_event_html($event, $partial);
428 428
 					}
429 429
 					break;
430 430
 
431 431
 				case 'if-location' :
432 432
 				case 'if-start-location' :
433
-					if ( ! empty( $event->start_location['address'] ) ) {
434
-						return $calendar->get_event_html( $event, $partial );
433
+					if ( ! empty($event->start_location['address'])) {
434
+						return $calendar->get_event_html($event, $partial);
435 435
 					}
436 436
 					return false;
437 437
 
438 438
 				case 'if-not-location' :
439 439
 				case 'if-not-start-location' :
440
-					if ( empty( $event->start_location['address'] ) ) {
441
-						return $calendar->get_event_html( $event, $partial );
440
+					if (empty($event->start_location['address'])) {
441
+						return $calendar->get_event_html($event, $partial);
442 442
 					}
443 443
 					return '';
444 444
 
445 445
 				case 'if-not-end-location' :
446
-					if ( empty( $event->end_location['address'] ) ) {
447
-						return $calendar->get_event_html( $event, $partial );
446
+					if (empty($event->end_location['address'])) {
447
+						return $calendar->get_event_html($event, $partial);
448 448
 					}
449 449
 					return '';
450 450
 
451 451
 				case 'if-end-location' :
452
-					if ( ! empty( $event->end_location['address'] ) ) {
453
-						return $calendar->get_event_html( $event, $partial );
452
+					if ( ! empty($event->end_location['address'])) {
453
+						return $calendar->get_event_html($event, $partial);
454 454
 					}
455 455
 					return '';
456 456
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 				 * ======= */
460 460
 
461 461
 				default :
462
-					return wp_kses_post( $before . $partial . $after );
462
+					return wp_kses_post($before.$partial.$after);
463 463
 			}
464 464
 		}
465 465
 
@@ -477,15 +477,15 @@  discard block
 block discarded – undo
477 477
 	 *
478 478
 	 * @return string
479 479
 	 */
480
-	private function limit_words( $text, $limit ) {
480
+	private function limit_words($text, $limit) {
481 481
 
482
-		$text = wp_strip_all_tags( $text );
483
-		$limit = max( absint( $limit ), 0 );
482
+		$text = wp_strip_all_tags($text);
483
+		$limit = max(absint($limit), 0);
484 484
 
485
-		if ( $limit > 0 && ( str_word_count( $text, 0 ) > $limit ) ) {
486
-			$words  = str_word_count( $text, 2 );
487
-			$pos    = array_keys( $words );
488
-			$text   = trim( substr( $text, 0, $pos[ $limit ] ) ) . '&hellip;';
485
+		if ($limit > 0 && (str_word_count($text, 0) > $limit)) {
486
+			$words  = str_word_count($text, 2);
487
+			$pos    = array_keys($words);
488
+			$text   = trim(substr($text, 0, $pos[$limit])).'&hellip;';
489 489
 		}
490 490
 
491 491
 		return $text;
@@ -502,26 +502,26 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @return string
504 504
 	 */
505
-	private function get_title( $title, $attr ) {
505
+	private function get_title($title, $attr) {
506 506
 
507
-		if ( empty( $title ) ) {
507
+		if (empty($title)) {
508 508
 			return '';
509 509
 		}
510 510
 
511
-		$attr = array_merge( array(
512
-			'html'  => '',  // Parse HTML
513
-			'limit' => 0,   // Trim length to amount of words
514
-		), (array) shortcode_parse_atts( $attr ) );
511
+		$attr = array_merge(array(
512
+			'html'  => '', // Parse HTML
513
+			'limit' => 0, // Trim length to amount of words
514
+		), (array) shortcode_parse_atts($attr));
515 515
 
516
-		if ( ! empty( $attr['html'] ) ) {
517
-			$title = wp_kses_post( $title );
516
+		if ( ! empty($attr['html'])) {
517
+			$title = wp_kses_post($title);
518 518
 			$tag = 'div';
519 519
 		} else {
520
-			$title = $this->limit_words( $title, $attr['limit'] );
520
+			$title = $this->limit_words($title, $attr['limit']);
521 521
 			$tag = 'span';
522 522
 		}
523 523
 
524
-		return '<' . $tag . ' class="simcal-event-title" itemprop="name">' . $title . '</' . $tag . '>';
524
+		return '<'.$tag.' class="simcal-event-title" itemprop="name">'.$title.'</'.$tag.'>';
525 525
 	}
526 526
 
527 527
 	/**
@@ -535,40 +535,40 @@  discard block
 block discarded – undo
535 535
 	 *
536 536
 	 * @return string
537 537
 	 */
538
-	private function get_description( $description, $attr ) {
538
+	private function get_description($description, $attr) {
539 539
 
540
-		if ( empty( $description ) ) {
540
+		if (empty($description)) {
541 541
 			return '';
542 542
 		}
543 543
 
544
-		$attr = array_merge( array(
545
-			'limit'     => 0,       // Trim length to number of words
546
-			'html'      => 'no',    // Parse HTML content
547
-			'markdown'  => 'no',    // Parse Markdown content
548
-			'autolink'  => 'no',    // Automatically convert plaintext URIs to anchors
549
-		), (array) shortcode_parse_atts( $attr ) );
544
+		$attr = array_merge(array(
545
+			'limit'     => 0, // Trim length to number of words
546
+			'html'      => 'no', // Parse HTML content
547
+			'markdown'  => 'no', // Parse Markdown content
548
+			'autolink'  => 'no', // Automatically convert plaintext URIs to anchors
549
+		), (array) shortcode_parse_atts($attr));
550 550
 
551
-		$allow_html = 'no' != $attr['html']     ? true : false;
551
+		$allow_html = 'no' != $attr['html'] ? true : false;
552 552
 		$allow_md   = 'no' != $attr['markdown'] ? true : false;
553 553
 
554 554
 		$html = '<div class="simcal-event-description" itemprop="description">';
555 555
 
556 556
 		// Markdown and HTML don't play well together, use one or the other in the same tag.
557
-		if ( $allow_html || $allow_md ) {
558
-			if ( $allow_html ) {
559
-				$html .= wp_kses_post( $description );
560
-			} elseif ( $allow_md ) {
557
+		if ($allow_html || $allow_md) {
558
+			if ($allow_html) {
559
+				$html .= wp_kses_post($description);
560
+			} elseif ($allow_md) {
561 561
 				$markdown = new \Parsedown();
562
-				$html .= $markdown->text( wp_strip_all_tags( $description ) );
562
+				$html .= $markdown->text(wp_strip_all_tags($description));
563 563
 			}
564 564
 		} else {
565
-			$html .= $this->limit_words( $description, $attr['limit'] );
565
+			$html .= $this->limit_words($description, $attr['limit']);
566 566
 		}
567 567
 
568 568
 		$html .= '</div>';
569 569
 
570
-		if ( 'no' != $attr['autolink'] ) {
571
-			$html = ' ' . make_clickable( $html );
570
+		if ('no' != $attr['autolink']) {
571
+			$html = ' '.make_clickable($html);
572 572
 		}
573 573
 
574 574
 		return $html;
@@ -584,76 +584,76 @@  discard block
 block discarded – undo
584 584
 	 *
585 585
 	 * @return string
586 586
 	 */
587
-	private function get_when( Event $event ) {
587
+	private function get_when(Event $event) {
588 588
 
589
-		$start = $event->start_dt->setTimezone( $event->timezone );
590
-		$end = ! is_null( $event->end_dt ) ? $event->end_dt->setTimezone( $event->timezone ) : null;
589
+		$start = $event->start_dt->setTimezone($event->timezone);
590
+		$end = ! is_null($event->end_dt) ? $event->end_dt->setTimezone($event->timezone) : null;
591 591
 
592 592
 		$time_start = '';
593 593
 		$time_end = '';
594 594
 
595
-		if ( ! $event->whole_day ) {
595
+		if ( ! $event->whole_day) {
596 596
 
597
-			$time_start = $this->calendar->datetime_separator .
598
-			              ' <span class="simcal-event-start simcal-event-start-time" ' .
599
-			              'data-event-start="' . $start->getTimestamp() . '" ' .
600
-			              'data-event-format="' . $this->calendar->time_format . '" ' .
601
-			              'itemprop="startDate" content="' . $start->toIso8601String() . '">' .
602
-			              date_i18n( $this->calendar->time_format, $start->getTimestamp() ) .
597
+			$time_start = $this->calendar->datetime_separator.
598
+			              ' <span class="simcal-event-start simcal-event-start-time" '.
599
+			              'data-event-start="'.$start->getTimestamp().'" '.
600
+			              'data-event-format="'.$this->calendar->time_format.'" '.
601
+			              'itemprop="startDate" content="'.$start->toIso8601String().'">'.
602
+			              date_i18n($this->calendar->time_format, $start->getTimestamp()).
603 603
 			              '</span> ';
604 604
 
605
-			if ( $end instanceof Carbon ) {
605
+			if ($end instanceof Carbon) {
606 606
 
607
-				$time_end = ' <span class="simcal-event-end simcal-event-end-time" ' .
608
-				            'data-event-end="' . $end->getTimestamp() . '" ' .
609
-				            'data-event-format="' . $this->calendar->time_format . '" ' .
610
-				            'itemprop="endDate" content="' . $end->toIso8601String() . '">' .
611
-				            date_i18n( $this->calendar->time_format, $end->getTimestamp() ) .
607
+				$time_end = ' <span class="simcal-event-end simcal-event-end-time" '.
608
+				            'data-event-end="'.$end->getTimestamp().'" '.
609
+				            'data-event-format="'.$this->calendar->time_format.'" '.
610
+				            'itemprop="endDate" content="'.$end->toIso8601String().'">'.
611
+				            date_i18n($this->calendar->time_format, $end->getTimestamp()).
612 612
 				            '</span> ';
613 613
 
614 614
 			}
615 615
 
616 616
 		}
617 617
 
618
-		if ( $event->multiple_days ) {
618
+		if ($event->multiple_days) {
619 619
 
620
-			$output = ' <span class="simcal-event-start simcal-event-start-date" ' .
621
-			          'data-event-start="' . $start->getTimestamp() . '" ' .
622
-			          'data-event-format="' . $this->calendar->date_format . '" ' .
623
-			          'itemprop="startDate" content="' . $start->toIso8601String() . '">' .
624
-			          date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
625
-			          '</span> ' .
620
+			$output = ' <span class="simcal-event-start simcal-event-start-date" '.
621
+			          'data-event-start="'.$start->getTimestamp().'" '.
622
+			          'data-event-format="'.$this->calendar->date_format.'" '.
623
+			          'itemprop="startDate" content="'.$start->toIso8601String().'">'.
624
+			          date_i18n($this->calendar->date_format, $start->getTimestamp()).
625
+			          '</span> '.
626 626
 			          $time_start;
627 627
 
628
-			if ( $end instanceof Carbon ) {
628
+			if ($end instanceof Carbon) {
629 629
 
630
-				$end = ( $event->whole_day ? Carbon::createFromTimestamp( $end->getTimestamp() )->startOfDay()->subSeconds( 1 ) : $end );
630
+				$end = ($event->whole_day ? Carbon::createFromTimestamp($end->getTimestamp())->startOfDay()->subSeconds(1) : $end);
631 631
 
632
-				$output .= '-' .
633
-				           ' <span class="simcal-event-start simcal-event-end-date" ' .
634
-				           'data-event-start="' . $end->getTimestamp() . '" ' .
635
-				           'data-event-format="' . $this->calendar->date_format . '" ' .
636
-				           'itemprop="endDate" content="' . $end->toIso8601String() . '">' .
637
-				           date_i18n( $this->calendar->date_format, $end->getTimestamp() ) .
638
-				           '</span> ' .
632
+				$output .= '-'.
633
+				           ' <span class="simcal-event-start simcal-event-end-date" '.
634
+				           'data-event-start="'.$end->getTimestamp().'" '.
635
+				           'data-event-format="'.$this->calendar->date_format.'" '.
636
+				           'itemprop="endDate" content="'.$end->toIso8601String().'">'.
637
+				           date_i18n($this->calendar->date_format, $end->getTimestamp()).
638
+				           '</span> '.
639 639
 				           $time_end;
640 640
 			}
641 641
 
642 642
 		} else {
643 643
 
644
-			$time_end = ! empty( $time_start ) && ! empty( $time_end ) ? ' - ' . $time_end : '';
644
+			$time_end = ! empty($time_start) && ! empty($time_end) ? ' - '.$time_end : '';
645 645
 
646
-			$output = ' <span class="simcal-event-start simcal-event-start-date" ' .
647
-			          'data-event-start="' . $start->getTimestamp() . '" ' .
648
-			          'data-event-format="' . $this->calendar->date_format . '">' .
649
-			          date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
650
-			          '</span> ' .
651
-			          $time_start .
646
+			$output = ' <span class="simcal-event-start simcal-event-start-date" '.
647
+			          'data-event-start="'.$start->getTimestamp().'" '.
648
+			          'data-event-format="'.$this->calendar->date_format.'">'.
649
+			          date_i18n($this->calendar->date_format, $start->getTimestamp()).
650
+			          '</span> '.
651
+			          $time_start.
652 652
 			          $time_end;
653 653
 
654 654
 		}
655 655
 
656
-		return trim( $output );
656
+		return trim($output);
657 657
 	}
658 658
 
659 659
 	/**
@@ -668,49 +668,49 @@  discard block
 block discarded – undo
668 668
 	 *
669 669
 	 * @return string
670 670
 	 */
671
-	private function get_dt( $tag, Event $event, $attr ) {
671
+	private function get_dt($tag, Event $event, $attr) {
672 672
 
673
-		$bound = 0 === strpos( $tag, 'end' ) ? 'end' : 'start';
674
-		if ( ( 'end' == $bound ) && ( false === $event->end ) ) {
673
+		$bound = 0 === strpos($tag, 'end') ? 'end' : 'start';
674
+		if (('end' == $bound) && (false === $event->end)) {
675 675
 			return '';
676 676
 		}
677 677
 
678
-		$dt = $bound . '_dt';
679
-		if ( ! $event->$dt instanceof Carbon ) {
678
+		$dt = $bound.'_dt';
679
+		if ( ! $event->$dt instanceof Carbon) {
680 680
 			return '';
681 681
 		}
682
-		$event_dt = $event->$dt->setTimezone( $event->timezone );
682
+		$event_dt = $event->$dt->setTimezone($event->timezone);
683 683
 
684
-		$attr = array_merge( array(
684
+		$attr = array_merge(array(
685 685
 			'format'    => '',
686
-		), (array) shortcode_parse_atts( $attr ) );
686
+		), (array) shortcode_parse_atts($attr));
687 687
 
688
-		$format = ltrim( strstr( $tag, '-' ), '-' );
688
+		$format = ltrim(strstr($tag, '-'), '-');
689 689
 		$dt_format = '';
690
-		if ( ! empty( $attr['format'] ) ) {
691
-			$dt_format = esc_attr( wp_strip_all_tags( $attr['format'] ) );
692
-		} elseif ( 'date' == $format ) {
690
+		if ( ! empty($attr['format'])) {
691
+			$dt_format = esc_attr(wp_strip_all_tags($attr['format']));
692
+		} elseif ('date' == $format) {
693 693
 			$dt_format = $this->calendar->date_format;
694
-		} elseif ( 'time' == $format ) {
694
+		} elseif ('time' == $format) {
695 695
 			$dt_format = $this->calendar->time_format;
696 696
 		}
697 697
 
698
-		if ( 'human' == $format ) {
699
-			$value = human_time_diff( $event_dt->getTimestamp(), Carbon::now( $event->timezone )->getTimestamp() );
698
+		if ('human' == $format) {
699
+			$value = human_time_diff($event_dt->getTimestamp(), Carbon::now($event->timezone)->getTimestamp());
700 700
 		} else {
701 701
 
702
-			if ( $event->whole_day ) {
703
-				$value = date_i18n( $dt_format, $event_dt->getTimestamp() - 86400 );
702
+			if ($event->whole_day) {
703
+				$value = date_i18n($dt_format, $event_dt->getTimestamp() - 86400);
704 704
 			} else {
705
-				$value = date_i18n( $dt_format, $event_dt->getTimestamp() );
705
+				$value = date_i18n($dt_format, $event_dt->getTimestamp());
706 706
 			}
707 707
 		}
708 708
 
709
-		return '<span class="simcal-event-' . $bound . ' ' . 'simcal-event-' . $bound . '-' . $format . '"' .
710
-		       'data-event-' . $bound . '="' . $event_dt->getTimestamp() . '"' .
711
-		       'data-event-format="' . $dt_format . '"' .
712
-		       'itemprop="' . $bound . 'Date" content="' . $event_dt->toIso8601String() . '">' .
713
-		       $value .
709
+		return '<span class="simcal-event-'.$bound.' '.'simcal-event-'.$bound.'-'.$format.'"'.
710
+		       'data-event-'.$bound.'="'.$event_dt->getTimestamp().'"'.
711
+		       'data-event-format="'.$dt_format.'"'.
712
+		       'itemprop="'.$bound.'Date" content="'.$event_dt->toIso8601String().'">'.
713
+		       $value.
714 714
 		       '</span>';
715 715
 	}
716 716
 
@@ -727,23 +727,23 @@  discard block
 block discarded – undo
727 727
 	 *
728 728
 	 * @return string
729 729
 	 */
730
-	private function make_link( $tag, $url, $content, $attr ) {
730
+	private function make_link($tag, $url, $content, $attr) {
731 731
 
732
-		if ( empty( $url ) ) {
732
+		if (empty($url)) {
733 733
 			return '';
734 734
 		}
735 735
 
736
-		$text = empty( $content ) ? $url : $content;
736
+		$text = empty($content) ? $url : $content;
737 737
 
738
-		$attr = array_merge( array(
739
-			'autolink'  => false,   // Convert url to link anchor
740
-			'newwindow' => false,   // If autolink attribute is true, open link in new window
741
-		), (array) shortcode_parse_atts( $attr ) );
738
+		$attr = array_merge(array(
739
+			'autolink'  => false, // Convert url to link anchor
740
+			'newwindow' => false, // If autolink attribute is true, open link in new window
741
+		), (array) shortcode_parse_atts($attr));
742 742
 
743 743
 		$anchor = $tag != 'url' ? 'yes' : $attr['autolink'];
744 744
 		$target = $attr['newwindow'] !== false ? 'target="_blank"' : '';
745 745
 
746
-		return $anchor !== false ? ' <a href="' . esc_url( $url ) . '" ' . $target . '>' . $text . '</a>' : ' ' . $text;
746
+		return $anchor !== false ? ' <a href="'.esc_url($url).'" '.$target.'>'.$text.'</a>' : ' '.$text;
747 747
 	}
748 748
 
749 749
 	/**
@@ -756,20 +756,20 @@  discard block
 block discarded – undo
756 756
 	 *
757 757
 	 * @return string
758 758
 	 */
759
-	private function get_attachments( $attachments ) {
759
+	private function get_attachments($attachments) {
760 760
 
761
-		$html = '<ul class="simcal-attachments">' . "\n\t";
761
+		$html = '<ul class="simcal-attachments">'."\n\t";
762 762
 
763
-		foreach ( $attachments as $attachment ) {
763
+		foreach ($attachments as $attachment) {
764 764
 			$html .= '<li class="simcal-attachment">';
765
-			$html .= '<a href="' . $attachment['url'] . '" target="_blank">';
766
-			$html .= ! empty( $attachment['icon'] ) ? '<img src="' . $attachment['icon'] . '" />' : '';
767
-			$html .= '<span>' . $attachment['name'] . '</span>';
765
+			$html .= '<a href="'.$attachment['url'].'" target="_blank">';
766
+			$html .= ! empty($attachment['icon']) ? '<img src="'.$attachment['icon'].'" />' : '';
767
+			$html .= '<span>'.$attachment['name'].'</span>';
768 768
 			$html .= '</a>';
769
-			$html .= '</li>' . "\n";
769
+			$html .= '</li>'."\n";
770 770
 		}
771 771
 
772
-		$html .= '</ul>' . "\n";
772
+		$html .= '</ul>'."\n";
773 773
 
774 774
 		return $html;
775 775
 	}
@@ -785,41 +785,41 @@  discard block
 block discarded – undo
785 785
 	 *
786 786
 	 * @return string
787 787
 	 */
788
-	private function get_attendees( $attendees, $attr ) {
788
+	private function get_attendees($attendees, $attr) {
789 789
 
790
-		$attr = array_merge( array(
791
-			'photo'     => 'show',  // show/hide attendee photo
792
-			'email'     => 'hide',  // show/hide attendee email address
793
-			'rsvp'      => 'hide',  // show/hide rsvp response status
794
-			'response'  => '',      // filter attendees by rsvp response (yes/no/maybe)
795
-		), (array) shortcode_parse_atts( $attr ) );
790
+		$attr = array_merge(array(
791
+			'photo'     => 'show', // show/hide attendee photo
792
+			'email'     => 'hide', // show/hide attendee email address
793
+			'rsvp'      => 'hide', // show/hide rsvp response status
794
+			'response'  => '', // filter attendees by rsvp response (yes/no/maybe)
795
+		), (array) shortcode_parse_atts($attr));
796 796
 
797
-		$html = '<ul class="simcal-attendees" itemprop="attendees">' . "\n\t";
797
+		$html = '<ul class="simcal-attendees" itemprop="attendees">'."\n\t";
798 798
 
799 799
 		$known = 0;
800 800
 		$unknown = 0;
801 801
 
802
-		foreach ( $attendees as $attendee ) {
802
+		foreach ($attendees as $attendee) {
803 803
 
804
-			if ( 'yes' == $attr['response'] && 'yes' != $attendee['response'] ) {
804
+			if ('yes' == $attr['response'] && 'yes' != $attendee['response']) {
805 805
 				continue;
806
-			} elseif ( 'no' == $attr['response'] && 'no' != $attendee['response'] ) {
806
+			} elseif ('no' == $attr['response'] && 'no' != $attendee['response']) {
807 807
 				continue;
808
-			} elseif ( 'maybe' == $attr['response'] && ! in_array( $attendee['response'], array( 'yes', 'maybe' ) ) ) {
808
+			} elseif ('maybe' == $attr['response'] && ! in_array($attendee['response'], array('yes', 'maybe'))) {
809 809
 				continue;
810 810
 			}
811 811
 
812
-			if ( ! empty( $attendee['name'] ) ) {
812
+			if ( ! empty($attendee['name'])) {
813 813
 
814
-				$photo      = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="' . $attendee['photo'] . '" itemprop="image" />' : '';
815
-				$response   = 'hide' != $attr['rsvp'] ? $this->get_rsvp_response( $attendee['response'] ) : '';
816
-				$guest      = $photo . '<span itemprop="name">' . $attendee['name'] . $response . '</span>';
814
+				$photo      = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="'.$attendee['photo'].'" itemprop="image" />' : '';
815
+				$response   = 'hide' != $attr['rsvp'] ? $this->get_rsvp_response($attendee['response']) : '';
816
+				$guest      = $photo.'<span itemprop="name">'.$attendee['name'].$response.'</span>';
817 817
 
818
-				if ( ! empty( $attendee['email'] ) && ( 'show' == $attr['email'] ) ) {
819
-					$guest = sprintf( '<a href="mailto:' . $attendee['email'] . '" itemprop="email">%s</a>', $guest );
818
+				if ( ! empty($attendee['email']) && ('show' == $attr['email'])) {
819
+					$guest = sprintf('<a href="mailto:'.$attendee['email'].'" itemprop="email">%s</a>', $guest);
820 820
 				}
821 821
 
822
-				$html .= '<li class="simcal-attendee" itemprop="attendee" itemscope itemtype="http://schema.org/Person">' . $guest . '</li>' . "\n";
822
+				$html .= '<li class="simcal-attendee" itemprop="attendee" itemscope itemtype="http://schema.org/Person">'.$guest.'</li>'."\n";
823 823
 
824 824
 				$known++;
825 825
 
@@ -830,21 +830,21 @@  discard block
 block discarded – undo
830 830
 			}
831 831
 		}
832 832
 
833
-		if ( $unknown > 0 ) {
834
-			if ( $known > 0 ) {
833
+		if ($unknown > 0) {
834
+			if ($known > 0) {
835 835
 				/* translators: One more person attending the event. */
836
-				$others = sprintf( _n( '1 more attendee', '%s more attendees', $unknown, 'google-calendar-events' ), $unknown );
836
+				$others = sprintf(_n('1 more attendee', '%s more attendees', $unknown, 'google-calendar-events'), $unknown);
837 837
 			} else {
838 838
 				/* translators: One or more persons attending the event whose name is unknown. */
839
-				$others = sprintf( _n( '1 anonymous attendee', '%s anonymous attendees', $unknown, 'google-calendar-events' ), $unknown );
839
+				$others = sprintf(_n('1 anonymous attendee', '%s anonymous attendees', $unknown, 'google-calendar-events'), $unknown);
840 840
 			}
841
-			$photo = $attr['photo'] !== 'hide' ? get_avatar( '', 128 ) : '';
842
-			$html .= '<li class="simcal-attendee simcal-attendee-anonymous">' . $photo . '<span>' . $others . '</span></li>' . "\n";
843
-		} elseif ( $known === 0 ) {
844
-			$html .= '<li class="simcal-attendee">' . _x( 'No one yet', 'No one yet rsvp to attend the event.', 'google-calendar-events' ) . '</li>' . "\n";
841
+			$photo = $attr['photo'] !== 'hide' ? get_avatar('', 128) : '';
842
+			$html .= '<li class="simcal-attendee simcal-attendee-anonymous">'.$photo.'<span>'.$others.'</span></li>'."\n";
843
+		} elseif ($known === 0) {
844
+			$html .= '<li class="simcal-attendee">'._x('No one yet', 'No one yet rsvp to attend the event.', 'google-calendar-events').'</li>'."\n";
845 845
 		}
846 846
 
847
-		$html .= '</ul>' . "\n";
847
+		$html .= '</ul>'."\n";
848 848
 
849 849
 		return $html;
850 850
 	}
@@ -858,23 +858,23 @@  discard block
 block discarded – undo
858 858
 	 *
859 859
 	 * @return string
860 860
 	 */
861
-	private function get_rsvp_response( $response ) {
861
+	private function get_rsvp_response($response) {
862 862
 
863
-		if ( 'yes' == $response ) {
863
+		if ('yes' == $response) {
864 864
 			/* translators: Someone replied with 'yes' to a rsvp request. */
865
-			$rsvp = __( 'Attending', 'google-calendar-events' );
866
-		} elseif ( 'no' == $response ) {
865
+			$rsvp = __('Attending', 'google-calendar-events');
866
+		} elseif ('no' == $response) {
867 867
 			/* translators: Someone replied with 'no' to a rsvp request. */
868
-			$rsvp = __( 'Not attending', 'google-calendar-events' );
869
-		} elseif ( 'maybe' == $response ) {
868
+			$rsvp = __('Not attending', 'google-calendar-events');
869
+		} elseif ('maybe' == $response) {
870 870
 			/* translators: Someone replied with 'maybe' to a rsvp request. */
871
-			$rsvp = __( 'Maybe attending', 'google-calendar-events' );
871
+			$rsvp = __('Maybe attending', 'google-calendar-events');
872 872
 		} else {
873 873
 			/* translators: Someone did not send yet a rsvp confirmation to join an event. */
874
-			$rsvp = __( 'Response pending', 'google-calendar-events' );
874
+			$rsvp = __('Response pending', 'google-calendar-events');
875 875
 		}
876 876
 
877
-		return ' <small>(' . $rsvp . ')</small>';
877
+		return ' <small>('.$rsvp.')</small>';
878 878
 	}
879 879
 
880 880
 	/**
@@ -888,21 +888,21 @@  discard block
 block discarded – undo
888 888
 	 *
889 889
 	 * @return string
890 890
 	 */
891
-	private function get_organizer( $organizer, $attr ) {
891
+	private function get_organizer($organizer, $attr) {
892 892
 
893
-		$attr = array_merge( array(
894
-			'photo' => 'show',  // show/hide attendee photo
895
-			'email' => 'hide',  // show/hide attendee email address
896
-		), (array) shortcode_parse_atts( $attr ) );
893
+		$attr = array_merge(array(
894
+			'photo' => 'show', // show/hide attendee photo
895
+			'email' => 'hide', // show/hide attendee email address
896
+		), (array) shortcode_parse_atts($attr));
897 897
 
898
-		$photo           = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="' . $organizer['photo'] . '" itemprop="image"  />' : '';
899
-		$organizer_html  = $photo . '<span itemprop="name">' . $organizer['name'] . '</span>';
898
+		$photo           = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="'.$organizer['photo'].'" itemprop="image"  />' : '';
899
+		$organizer_html  = $photo.'<span itemprop="name">'.$organizer['name'].'</span>';
900 900
 
901
-		if ( ! empty( $organizer['email'] ) && ( 'show' == $attr['email'] ) ) {
902
-			$organizer_html = sprintf( '<a href="mailto:' . $organizer['email'] . '" itemprop="email">%s</a>', $organizer_html );
901
+		if ( ! empty($organizer['email']) && ('show' == $attr['email'])) {
902
+			$organizer_html = sprintf('<a href="mailto:'.$organizer['email'].'" itemprop="email">%s</a>', $organizer_html);
903 903
 		}
904 904
 
905
-		return '<div class="simcal-organizer" itemprop="organizer" itemscope itemtype="https://schema.org/Person">' . $organizer_html . '</div>';
905
+		return '<div class="simcal-organizer" itemprop="organizer" itemscope itemtype="https://schema.org/Person">'.$organizer_html.'</div>';
906 906
 	}
907 907
 
908 908
 	/**
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 		// This is largely borrowed on get_shortcode_regex() from WordPress Core.
928 928
 		// @see /wp-includes/shortcodes.php (with some modification)
929 929
 
930
-		$tagregexp = implode( '|', array_values( $this->tags ) );
930
+		$tagregexp = implode('|', array_values($this->tags));
931 931
 
932 932
 		return '/'
933 933
 		       . '\\['                              // Opening bracket
Please login to merge, or discard this patch.
includes/admin/metaboxes/settings.php 1 patch
Spacing   +269 added lines, -269 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 use SimpleCalendar\Abstracts\Feed;
12 12
 use SimpleCalendar\Abstracts\Field;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -31,40 +31,40 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @param \WP_Post $post
33 33
 	 */
34
-	public static function html( $post ) {
34
+	public static function html($post) {
35 35
 
36 36
 		// @see Meta_Boxes::save_meta_boxes()
37
-		wp_nonce_field( 'simcal_save_data', 'simcal_meta_nonce' );
37
+		wp_nonce_field('simcal_save_data', 'simcal_meta_nonce');
38 38
 
39 39
 		?>
40 40
 		<div class="simcal-panels-wrap">
41 41
 
42 42
 			<span class="simcal-box-handle">
43
-				<?php self::settings_handle( $post ); ?>
43
+				<?php self::settings_handle($post); ?>
44 44
 			</span>
45 45
 
46 46
 			<ul class="simcal-tabs">
47
-				<?php self::settings_tabs( $post ); ?>
48
-				<?php do_action( 'simcal_settings_meta_tabs' ); ?>
47
+				<?php self::settings_tabs($post); ?>
48
+				<?php do_action('simcal_settings_meta_tabs'); ?>
49 49
 			</ul>
50 50
 
51 51
 			<div class="simcal-panels">
52 52
 				<div id="events-settings-panel" class="simcal-panel">
53
-					<?php self::events_settings_panel( $post ); ?>
54
-					<?php do_action( 'simcal_settings_meta_events_panel', $post->ID ); ?>
53
+					<?php self::events_settings_panel($post); ?>
54
+					<?php do_action('simcal_settings_meta_events_panel', $post->ID); ?>
55 55
 				</div>
56 56
 				<div id="calendar-settings-panel" class="simcal-panel">
57
-					<?php do_action( 'simcal_settings_meta_calendar_panel', $post->ID ); ?>
58
-					<?php self::calendar_settings_panel( $post ); ?>
57
+					<?php do_action('simcal_settings_meta_calendar_panel', $post->ID); ?>
58
+					<?php self::calendar_settings_panel($post); ?>
59 59
 				</div>
60 60
 				<?php
61 61
 				// Hook for additional settings panels.
62
-				do_action( 'simcal_settings_meta_panels', $post->ID );
62
+				do_action('simcal_settings_meta_panels', $post->ID);
63 63
 				// Thus advanced panel is always the last one:
64 64
 				?>
65 65
 				<div id="advanced-settings-panel" class="simcal-panel">
66
-					<?php self::advanced_settings_panel( $post ) ?>
67
-					<?php do_action( 'simcal_settings_meta_advanced_panel', $post->ID ); ?>
66
+					<?php self::advanced_settings_panel($post) ?>
67
+					<?php do_action('simcal_settings_meta_advanced_panel', $post->ID); ?>
68 68
 				</div>
69 69
 			</div>
70 70
 
@@ -84,45 +84,45 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @param \WP_Post $post
86 86
 	 */
87
-	private static function settings_handle( $post ) {
87
+	private static function settings_handle($post) {
88 88
 
89 89
 		$feed_options = $calendar_options = $calendar_views = array();
90 90
 
91 91
 		$feed_types = simcal_get_feed_types();
92
-		foreach ( $feed_types as $feed_type ) {
92
+		foreach ($feed_types as $feed_type) {
93 93
 
94
-			$feed = simcal_get_feed( $feed_type );
94
+			$feed = simcal_get_feed($feed_type);
95 95
 
96
-			if ( $feed instanceof Feed ) {
97
-				$feed_options[ $feed_type ] = $feed->name;
96
+			if ($feed instanceof Feed) {
97
+				$feed_options[$feed_type] = $feed->name;
98 98
 			}
99 99
 		}
100 100
 
101 101
 		$calendar_types = simcal_get_calendar_types();
102
-		foreach ( $calendar_types as $calendar_type => $views ) {
102
+		foreach ($calendar_types as $calendar_type => $views) {
103 103
 
104
-			$calendar = simcal_get_calendar( $calendar_type );
104
+			$calendar = simcal_get_calendar($calendar_type);
105 105
 
106
-			if ( $calendar instanceof Calendar ) {
107
-				$calendar_options[ $calendar_type ] = $calendar->name;
108
-				$calendar_views[ $calendar_type ]   = $calendar->views;
106
+			if ($calendar instanceof Calendar) {
107
+				$calendar_options[$calendar_type] = $calendar->name;
108
+				$calendar_views[$calendar_type]   = $calendar->views;
109 109
 			}
110 110
 		}
111 111
 
112
-		if ( $feed_options ) {
112
+		if ($feed_options) {
113 113
 
114
-			if ( $feed_types = wp_get_object_terms( $post->ID, 'calendar_feed' ) ) {
115
-				$feed_type = sanitize_title( current( $feed_types )->name );
114
+			if ($feed_types = wp_get_object_terms($post->ID, 'calendar_feed')) {
115
+				$feed_type = sanitize_title(current($feed_types)->name);
116 116
 			} else {
117
-				$feed_type = apply_filters( 'simcal_default_feed_type', 'google' );
117
+				$feed_type = apply_filters('simcal_default_feed_type', 'google');
118 118
 			}
119 119
 
120 120
 			?>
121
-			<label for="_feed_type"><span><?php _e( 'Event Source', 'google-calendar-events' ); ?></span>
121
+			<label for="_feed_type"><span><?php _e('Event Source', 'google-calendar-events'); ?></span>
122 122
 				<select name="_feed_type" id="_feed_type">
123
-					<optgroup label="<?php _ex( 'Get events from', 'From which calendar source to load events from', 'google-calendar-events' ) ?>">
124
-						<?php foreach ( $feed_options as $feed => $name ) { ?>
125
-							<option value="<?php echo $feed; ?>" <?php selected( $feed, $feed_type, true ); ?>><?php echo $name; ?></option>
123
+					<optgroup label="<?php _ex('Get events from', 'From which calendar source to load events from', 'google-calendar-events') ?>">
124
+						<?php foreach ($feed_options as $feed => $name) { ?>
125
+							<option value="<?php echo $feed; ?>" <?php selected($feed, $feed_type, true); ?>><?php echo $name; ?></option>
126 126
 						<?php } ?>
127 127
 					</optgroup>
128 128
 				</select>
@@ -131,40 +131,40 @@  discard block
 block discarded – undo
131 131
 
132 132
 		}
133 133
 
134
-		if ( $calendar_options ) {
134
+		if ($calendar_options) {
135 135
 
136
-			if ( $calendar_types = wp_get_object_terms( $post->ID, 'calendar_type' ) ) {
137
-				$calendar_type = sanitize_title( current( $calendar_types )->name );
136
+			if ($calendar_types = wp_get_object_terms($post->ID, 'calendar_type')) {
137
+				$calendar_type = sanitize_title(current($calendar_types)->name);
138 138
 			} else {
139
-				$calendar_type = apply_filters( 'simcal_default_calendar_type', 'default-calendar' );
139
+				$calendar_type = apply_filters('simcal_default_calendar_type', 'default-calendar');
140 140
 			}
141 141
 
142 142
 			?>
143
-			<label for="_calendar_type"><span><?php _e( 'Calendar', 'google-calendar-events' ); ?></span>
143
+			<label for="_calendar_type"><span><?php _e('Calendar', 'google-calendar-events'); ?></span>
144 144
 				<select name="_calendar_type" id="_calendar_type">
145
-					<optgroup label="<?php _e( 'Calendar to use', 'google-calendar-events' ); ?>">
146
-						<?php foreach ( $calendar_options as $calendar => $name ) { ?>
147
-							<option value="<?php echo $calendar; ?>" <?php selected( $calendar, $calendar_type, true ); ?>><?php echo $name; ?></option>
145
+					<optgroup label="<?php _e('Calendar to use', 'google-calendar-events'); ?>">
146
+						<?php foreach ($calendar_options as $calendar => $name) { ?>
147
+							<option value="<?php echo $calendar; ?>" <?php selected($calendar, $calendar_type, true); ?>><?php echo $name; ?></option>
148 148
 						<?php } ?>
149 149
 					</optgroup>
150 150
 				</select>
151 151
 			</label>
152 152
 			<?php
153 153
 
154
-			if ( $calendar_views ) {
154
+			if ($calendar_views) {
155 155
 
156
-				$calendar_view = get_post_meta( $post->ID, '_calendar_view', true );
156
+				$calendar_view = get_post_meta($post->ID, '_calendar_view', true);
157 157
 
158
-				foreach ( $calendar_views as $calendar => $views ) {
158
+				foreach ($calendar_views as $calendar => $views) {
159 159
 
160
-					$calendar_type_view = isset( $calendar_view[ $calendar ] ) ? $calendar_view[ $calendar ] : '';
160
+					$calendar_type_view = isset($calendar_view[$calendar]) ? $calendar_view[$calendar] : '';
161 161
 
162 162
 					?>
163
-					<label for="_calendar_view_<?php echo $calendar; ?>"><span><?php _e( 'View', 'google-calendar-events' ); ?></span>
163
+					<label for="_calendar_view_<?php echo $calendar; ?>"><span><?php _e('View', 'google-calendar-events'); ?></span>
164 164
 						<select name="_calendar_view[<?php echo $calendar; ?>]" id="_calendar_view_<?php echo $calendar; ?>">
165
-							<optgroup label="<?php _e( 'View to display', 'google-calendar-events' ); ?>">
166
-								<?php foreach ( $views as $view => $name ) { ?>
167
-									<option value="<?php echo $view; ?>" <?php selected( $view, $calendar_type_view, true ); ?>><?php echo $name; ?></option>
165
+							<optgroup label="<?php _e('View to display', 'google-calendar-events'); ?>">
166
+								<?php foreach ($views as $view => $name) { ?>
167
+									<option value="<?php echo $view; ?>" <?php selected($view, $calendar_type_view, true); ?>><?php echo $name; ?></option>
168 168
 								<?php } ?>
169 169
 							</optgroup>
170 170
 						</select>
@@ -184,42 +184,42 @@  discard block
 block discarded – undo
184 184
 	 *
185 185
 	 * @param  \WP_Post $post
186 186
 	 */
187
-	private static function settings_tabs( $post ) {
187
+	private static function settings_tabs($post) {
188 188
 
189 189
 		// Hook to add more tabs.
190
-		$tabs = apply_filters( 'simcal_settings_meta_tabs_li', array(
190
+		$tabs = apply_filters('simcal_settings_meta_tabs_li', array(
191 191
 			'events' => array(
192
-				'label'   => __( 'Events', 'google-calendar-events' ),
192
+				'label'   => __('Events', 'google-calendar-events'),
193 193
 				'target'  => 'events-settings-panel',
194
-				'class'   => array( 'active' ),
194
+				'class'   => array('active'),
195 195
 				'icon'    => 'simcal-icon-event',
196 196
 			),
197 197
 			'calendar' => array(
198
-				'label'  => __( 'Appearance', 'google-calendar-events' ),
198
+				'label'  => __('Appearance', 'google-calendar-events'),
199 199
 				'target' => 'calendar-settings-panel',
200 200
 				'class'  => array(),
201 201
 				'icon'   => 'simcal-icon-calendar',
202 202
 			),
203
-		), $post->ID );
203
+		), $post->ID);
204 204
 
205 205
 		// Always keep advanced tab as the last one.
206 206
 		$tabs['advanced'] = array(
207
-			'label'   => __( 'Advanced', 'google-calendar-events' ),
207
+			'label'   => __('Advanced', 'google-calendar-events'),
208 208
 			'target'  => 'advanced-settings-panel',
209 209
 			'class'   => array(),
210 210
 			'icon'    => 'simcal-icon-settings',
211 211
 		);
212 212
 
213 213
 		// Output the tabs as list items.
214
-		foreach ( $tabs as $key => $tab ) {
214
+		foreach ($tabs as $key => $tab) {
215 215
 
216
-			if ( isset( $tab['target'] ) && isset( $tab['label'] ) ) {
216
+			if (isset($tab['target']) && isset($tab['label'])) {
217 217
 
218 218
 				$icon  = $tab['icon'] ? $tab['icon'] : 'simcal-icon-panel';
219 219
 				$class = $tab['class'] ? $tab['class'] : array();
220 220
 
221
-				echo '<li class="' . $key . '-settings ' . $key . '-tab ' . implode( ' ', $class ) . '" data-tab="' . $key . '">';
222
-				echo    '<a href="#' . $tab['target'] . '"><i class="' . $icon . '" ></i> <span>' . esc_html( $tab['label'] ) . '</span></a>';
221
+				echo '<li class="'.$key.'-settings '.$key.'-tab '.implode(' ', $class).'" data-tab="'.$key.'">';
222
+				echo    '<a href="#'.$tab['target'].'"><i class="'.$icon.'" ></i> <span>'.esc_html($tab['label']).'</span></a>';
223 223
 				echo '</li>';
224 224
 			}
225 225
 		}
@@ -233,22 +233,22 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @param  \WP_Post $post
235 235
 	 */
236
-	private static function events_settings_panel( $post ) {
236
+	private static function events_settings_panel($post) {
237 237
 
238 238
 		?>
239 239
 		<table>
240 240
 			<thead>
241
-				<tr><th colspan="2"><?php _e( 'Events setting', 'google-calendar-events' ); ?></th></tr>
241
+				<tr><th colspan="2"><?php _e('Events setting', 'google-calendar-events'); ?></th></tr>
242 242
 			</thead>
243 243
 			<tbody class="simcal-panel-section simcal-panel-section-events-range">
244 244
 				<tr class="simcal-panel-field">
245
-					<th><label for="_calendar_begins"><?php _e( 'Calendar start', 'google-calendar-events' ); ?></label></th>
245
+					<th><label for="_calendar_begins"><?php _e('Calendar start', 'google-calendar-events'); ?></label></th>
246 246
 					<td>
247 247
 						<?php
248 248
 
249
-						$calendar_begins = esc_attr( get_post_meta( $post->ID, '_calendar_begins', true ) );
250
-						$calendar_begins_nth = max( absint( get_post_meta( $post->ID, '_calendar_begins_nth', true ) ), 1 );
251
-						$calendar_begins_nth_show = in_array( $calendar_begins, array(
249
+						$calendar_begins = esc_attr(get_post_meta($post->ID, '_calendar_begins', true));
250
+						$calendar_begins_nth = max(absint(get_post_meta($post->ID, '_calendar_begins_nth', true)), 1);
251
+						$calendar_begins_nth_show = in_array($calendar_begins, array(
252 252
 							'days_before',
253 253
 							'days_after',
254 254
 							'weeks_before',
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
 							'months_after',
258 258
 							'years_before',
259 259
 							'years_after',
260
-						) );
260
+						));
261 261
 
262
-						simcal_print_field( array(
262
+						simcal_print_field(array(
263 263
 							'type'       => 'standard',
264 264
 							'subtype'    => 'number',
265 265
 							'name'       => '_calendar_begins_nth',
266 266
 							'id'         => '_calendar_begins_nth',
267
-							'value'      => strval( $calendar_begins_nth ),
267
+							'value'      => strval($calendar_begins_nth),
268 268
 							'attributes' => array(
269 269
 								'min' => '1',
270 270
 							),
@@ -272,97 +272,97 @@  discard block
 block discarded – undo
272 272
 								'simcal-field-inline',
273 273
 								'simcal-field-tiny',
274 274
 							),
275
-							'style'      => ! $calendar_begins_nth_show ? array( 'display' => 'none' ) : '',
276
-						) );
275
+							'style'      => ! $calendar_begins_nth_show ? array('display' => 'none') : '',
276
+						));
277 277
 
278 278
 						?>
279 279
 						<select name="_calendar_begins"
280 280
 						        id="_calendar_begins"
281 281
 						        class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
282
-							<optgroup label="<?php _e( 'Days range', 'google-calendar-events' ); ?>">
282
+							<optgroup label="<?php _e('Days range', 'google-calendar-events'); ?>">
283 283
 								<option value="today"
284 284
 								        data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
285
-								        <?php selected( 'today', $calendar_begins, true ); ?>><?php _e( 'Today', 'google-calendar-events' ); ?></option>
285
+								        <?php selected('today', $calendar_begins, true); ?>><?php _e('Today', 'google-calendar-events'); ?></option>
286 286
 								<option value="now"
287 287
 								        data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
288
-								        <?php selected( 'now', $calendar_begins, true ); ?>><?php _e( 'Now', 'google-calendar-events' ); ?></option>
288
+								        <?php selected('now', $calendar_begins, true); ?>><?php _e('Now', 'google-calendar-events'); ?></option>
289 289
 								<option value="days_before"
290 290
 								        data-hide-field="_calendar_begins_custom_date"
291
-								        data-show-field="_calendar_begins_nth" <?php selected( 'days_before', $calendar_begins, true ); ?>><?php _e( 'Day(s) before today', 'google-calendar-events' ); ?></option>
291
+								        data-show-field="_calendar_begins_nth" <?php selected('days_before', $calendar_begins, true); ?>><?php _e('Day(s) before today', 'google-calendar-events'); ?></option>
292 292
 								<option value="days_after"
293 293
 								        data-hide-field="_calendar_begins_custom_date"
294
-								        data-show-field="_calendar_begins_nth" <?php selected( 'days_after', $calendar_begins, true ); ?>><?php _e( 'Day(s) after today', 'google-calendar-events' ); ?></option>
294
+								        data-show-field="_calendar_begins_nth" <?php selected('days_after', $calendar_begins, true); ?>><?php _e('Day(s) after today', 'google-calendar-events'); ?></option>
295 295
 							</optgroup>
296
-							<optgroup label="<?php _e( 'Weeks range', 'google-calendar-events' ); ?>">
296
+							<optgroup label="<?php _e('Weeks range', 'google-calendar-events'); ?>">
297 297
 								<option value="this_week"
298 298
 								        data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
299
-								        <?php selected( 'this_week', $calendar_begins, true ); ?>><?php _e( 'This week', 'google-calendar-events' ); ?></option>
299
+								        <?php selected('this_week', $calendar_begins, true); ?>><?php _e('This week', 'google-calendar-events'); ?></option>
300 300
 								<option value="weeks_before"
301 301
 								        data-hide-field="_calendar_begins_custom_date"
302
-								        data-show-field="_calendar_begins_nth" <?php selected( 'weeks_before', $calendar_begins, true ); ?>><?php _e( 'Week(s) before current', 'google-calendar-events' ); ?></option>
302
+								        data-show-field="_calendar_begins_nth" <?php selected('weeks_before', $calendar_begins, true); ?>><?php _e('Week(s) before current', 'google-calendar-events'); ?></option>
303 303
 								<option value="weeks_after"
304 304
 								        data-hide-field="_calendar_begins_custom_date"
305
-								        data-show-field="_calendar_begins_nth" <?php selected( 'weeks_after', $calendar_begins, true ); ?>><?php _e( 'Week(s) after current', 'google-calendar-events' ); ?></option>
305
+								        data-show-field="_calendar_begins_nth" <?php selected('weeks_after', $calendar_begins, true); ?>><?php _e('Week(s) after current', 'google-calendar-events'); ?></option>
306 306
 							</optgroup>
307
-							<optgroup label="<?php _e( 'Months range', 'google-calendar-events' ); ?>">
307
+							<optgroup label="<?php _e('Months range', 'google-calendar-events'); ?>">
308 308
 								<option value="this_month"
309 309
 								        data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
310
-								        <?php selected( 'this_month', $calendar_begins, true ); ?>><?php _e( 'This month', 'google-calendar-events' ); ?></option>
310
+								        <?php selected('this_month', $calendar_begins, true); ?>><?php _e('This month', 'google-calendar-events'); ?></option>
311 311
 								<option value="months_before"
312 312
 								        data-hide-field="_calendar_begins_custom_date"
313
-								        data-show-field="_calendar_begins_nth" <?php selected( 'months_before', $calendar_begins, true ); ?>><?php _e( 'Month(s) before current', 'google-calendar-events' ); ?></option>
313
+								        data-show-field="_calendar_begins_nth" <?php selected('months_before', $calendar_begins, true); ?>><?php _e('Month(s) before current', 'google-calendar-events'); ?></option>
314 314
 								<option value="months_after"
315 315
 								        data-hide-field="_calendar_begins_custom_date"
316
-								        data-show-field="_calendar_begins_nth" <?php selected( 'months_after', $calendar_begins, true ); ?>><?php _e( 'Month(s) after current', 'google-calendar-events' ); ?></option>
316
+								        data-show-field="_calendar_begins_nth" <?php selected('months_after', $calendar_begins, true); ?>><?php _e('Month(s) after current', 'google-calendar-events'); ?></option>
317 317
 							</optgroup>
318
-							<optgroup label="<?php _e( 'Years range', 'google-calendar-events' ); ?>">
318
+							<optgroup label="<?php _e('Years range', 'google-calendar-events'); ?>">
319 319
 								<option value="this_year"
320 320
 								        data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
321
-								        <?php selected( 'this_year', $calendar_begins, true ); ?>><?php _e( 'This year', 'google-calendar-events' ); ?></option>
321
+								        <?php selected('this_year', $calendar_begins, true); ?>><?php _e('This year', 'google-calendar-events'); ?></option>
322 322
 								<option value="years_before"
323
-								        data-show-field="_calendar_begins_nth" <?php selected( 'years_before', $calendar_begins, true ); ?>><?php _e( 'Year(s) before current', 'google-calendar-events' ); ?></option>
323
+								        data-show-field="_calendar_begins_nth" <?php selected('years_before', $calendar_begins, true); ?>><?php _e('Year(s) before current', 'google-calendar-events'); ?></option>
324 324
 								<option value="years_after"
325 325
 								        data-hide-field="_calendar_begins_custom_date"
326
-								        data-show-field="_calendar_begins_nth" <?php selected( 'years_after', $calendar_begins, true ); ?>><?php _e( 'Year(s) after current', 'google-calendar-events' ); ?></option>
326
+								        data-show-field="_calendar_begins_nth" <?php selected('years_after', $calendar_begins, true); ?>><?php _e('Year(s) after current', 'google-calendar-events'); ?></option>
327 327
 							</optgroup>
328
-							<optgroup label="<?php _e( 'Other', 'google-calendar-events' ); ?>">
328
+							<optgroup label="<?php _e('Other', 'google-calendar-events'); ?>">
329 329
 								<option value="custom_date"
330 330
 								        data-hide-field="_calendar_begins_nth"
331
-								        data-show-field="_calendar_begins_custom_date" <?php selected( 'custom_date', $calendar_begins, true ); ?>><?php _e( 'Specific date', 'google-calendar-events' ); ?></option>
331
+								        data-show-field="_calendar_begins_custom_date" <?php selected('custom_date', $calendar_begins, true); ?>><?php _e('Specific date', 'google-calendar-events'); ?></option>
332 332
 							</optgroup>
333 333
 						</select>
334 334
 						<?php
335 335
 
336
-						simcal_print_field( array(
336
+						simcal_print_field(array(
337 337
 							'type'    => 'date-picker',
338 338
 							'name'    => '_calendar_begins_custom_date',
339 339
 							'id'      => '_calendar_begins_custom_date',
340
-							'value'   => get_post_meta( $post->ID, '_calendar_begins_custom_date', true ),
340
+							'value'   => get_post_meta($post->ID, '_calendar_begins_custom_date', true),
341 341
 							'class' => array(
342 342
 								'simcal-field-inline',
343 343
 							),
344
-							'style'   => 'custom_date' != $calendar_begins ? array( 'display' => 'none' ) : '',
345
-						) );
344
+							'style'   => 'custom_date' != $calendar_begins ? array('display' => 'none') : '',
345
+						));
346 346
 
347 347
 						?>
348 348
 						<i class="simcal-icon-help simcal-help-tip"
349
-						   data-tip="<?php _e( 'The calendar default opening date. It will automatically adapt based on the chosen calendar type.', 'google-calendar-events' ); ?>"></i>
349
+						   data-tip="<?php _e('The calendar default opening date. It will automatically adapt based on the chosen calendar type.', 'google-calendar-events'); ?>"></i>
350 350
 					</td>
351 351
 				</tr>
352 352
 				<tr class="simcal-panel-field">
353
-					<th><label for="_feed_earliest_event_date"><?php _e( 'Earliest event', 'google-calendar-events' ); ?></label></th>
353
+					<th><label for="_feed_earliest_event_date"><?php _e('Earliest event', 'google-calendar-events'); ?></label></th>
354 354
 					<td>
355 355
 						<?php
356 356
 
357
-						$earliest_event_saved = get_post_meta( $post->ID, '_feed_earliest_event_date', true );
358
-						$earliest_event = false == $earliest_event_saved ? 'months_before' : esc_attr( $earliest_event_saved );
357
+						$earliest_event_saved = get_post_meta($post->ID, '_feed_earliest_event_date', true);
358
+						$earliest_event = false == $earliest_event_saved ? 'months_before' : esc_attr($earliest_event_saved);
359 359
 
360
-						simcal_print_field( array(
360
+						simcal_print_field(array(
361 361
 							'type'       => 'standard',
362 362
 							'subtype'    => 'number',
363 363
 							'name'       => '_feed_earliest_event_date_range',
364 364
 							'id'         => '_feed_earliest_event_date_range',
365
-							'value'      => strval( max( absint( get_post_meta( $post->ID, '_feed_earliest_event_date_range', true ) ), 1 ) ),
365
+							'value'      => strval(max(absint(get_post_meta($post->ID, '_feed_earliest_event_date_range', true)), 1)),
366 366
 							'attributes' => array(
367 367
 								'min' => '1',
368 368
 							),
@@ -370,37 +370,37 @@  discard block
 block discarded – undo
370 370
 								'simcal-field-inline',
371 371
 								'simcal-field-tiny',
372 372
 							),
373
-							'style'      => ( 'now' != $earliest_event ) && ( 'today' != $earliest_event ) ? array( 'display' => 'none' ) : '',
374
-						) );
373
+							'style'      => ('now' != $earliest_event) && ('today' != $earliest_event) ? array('display' => 'none') : '',
374
+						));
375 375
 
376 376
 						?>
377 377
 						<select name="_feed_earliest_event_date"
378 378
 						        id="_feed_earliest_event_date"
379 379
 						        class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
380
-							<option value="calendar_start" data-hide-field="_feed_earliest_event_date_range" <?php selected( 'calendar_start', $earliest_event, true ); ?>><?php _e( 'Same as start date', 'google-calendar-events' ); ?></option>
381
-							<option value="days_before"    data-show-field="_feed_earliest_event_date_range" <?php selected( 'days_before', $earliest_event, true ); ?>><?php _e( 'Day(s) before start date', 'google-calendar-events' ); ?></option>
382
-							<option value="weeks_before"   data-show-field="_feed_earliest_event_date_range" <?php selected( 'weeks_before', $earliest_event, true ); ?>><?php _e( 'Week(s) before start date', 'google-calendar-events' ); ?></option>
383
-							<option value="months_before"  data-show-field="_feed_earliest_event_date_range" <?php selected( 'months_before', $earliest_event, true ); ?>><?php _e( 'Month(s) before start date', 'google-calendar-events' ); ?></option>
384
-							<option value="years_before"   data-show-field="_feed_earliest_event_date_range" <?php selected( 'years_before', $earliest_event, true ); ?>><?php _e( 'Year(s) before start date', 'google-calendar-events' ); ?></option>
380
+							<option value="calendar_start" data-hide-field="_feed_earliest_event_date_range" <?php selected('calendar_start', $earliest_event, true); ?>><?php _e('Same as start date', 'google-calendar-events'); ?></option>
381
+							<option value="days_before"    data-show-field="_feed_earliest_event_date_range" <?php selected('days_before', $earliest_event, true); ?>><?php _e('Day(s) before start date', 'google-calendar-events'); ?></option>
382
+							<option value="weeks_before"   data-show-field="_feed_earliest_event_date_range" <?php selected('weeks_before', $earliest_event, true); ?>><?php _e('Week(s) before start date', 'google-calendar-events'); ?></option>
383
+							<option value="months_before"  data-show-field="_feed_earliest_event_date_range" <?php selected('months_before', $earliest_event, true); ?>><?php _e('Month(s) before start date', 'google-calendar-events'); ?></option>
384
+							<option value="years_before"   data-show-field="_feed_earliest_event_date_range" <?php selected('years_before', $earliest_event, true); ?>><?php _e('Year(s) before start date', 'google-calendar-events'); ?></option>
385 385
 						</select>
386 386
 						<i class="simcal-icon-help simcal-help-tip"
387
-						   data-tip="<?php _e( 'Set the date for the earliest possible event to show in calendar. There will not be events before this date.', 'google-calendar-events' ); ?>"></i>
387
+						   data-tip="<?php _e('Set the date for the earliest possible event to show in calendar. There will not be events before this date.', 'google-calendar-events'); ?>"></i>
388 388
 					</td>
389 389
 				</tr>
390 390
 				<tr class="simcal-panel-field">
391
-					<th><label for="_feed_latest_event_date"><?php _e( 'Latest event', 'google-calendar-events' ); ?></label></th>
391
+					<th><label for="_feed_latest_event_date"><?php _e('Latest event', 'google-calendar-events'); ?></label></th>
392 392
 					<td>
393 393
 						<?php
394 394
 
395
-						$latest_event_saved = get_post_meta( $post->ID, '_feed_latest_event_date', true );
396
-						$latest_event = false == $latest_event_saved ? 'years_after' : esc_attr( $latest_event_saved );
395
+						$latest_event_saved = get_post_meta($post->ID, '_feed_latest_event_date', true);
396
+						$latest_event = false == $latest_event_saved ? 'years_after' : esc_attr($latest_event_saved);
397 397
 
398
-						simcal_print_field( array(
398
+						simcal_print_field(array(
399 399
 							'type'       => 'standard',
400 400
 							'subtype'    => 'number',
401 401
 							'name'       => '_feed_latest_event_date_range',
402 402
 							'id'         => '_feed_latest_event_date_range',
403
-							'value'      => strval( max( absint( get_post_meta( $post->ID, '_feed_latest_event_date_range', true ) ), 1 ) ),
403
+							'value'      => strval(max(absint(get_post_meta($post->ID, '_feed_latest_event_date_range', true)), 1)),
404 404
 							'attributes' => array(
405 405
 								'min' => '1',
406 406
 							),
@@ -408,21 +408,21 @@  discard block
 block discarded – undo
408 408
 								'simcal-field-inline',
409 409
 								'simcal-field-tiny',
410 410
 							),
411
-							'style'      => 'indefinite' != $latest_event ? array( 'display' => 'none' ) : '',
412
-						) );
411
+							'style'      => 'indefinite' != $latest_event ? array('display' => 'none') : '',
412
+						));
413 413
 
414 414
 						?>
415 415
 						<select name="_feed_latest_event_date"
416 416
 						        id="_feed_latest_event_date"
417 417
 						        class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
418
-							<option value="calendar_start" data-hide-field="_feed_latest_event_date_range" <?php selected( 'calendar_start', $earliest_event, true ); ?>><?php _e( 'Day end of start date', 'google-calendar-events' ); ?></option>
419
-							<option value="days_after"     data-show-field="_feed_latest_event_date_range" <?php selected( 'days_after', $latest_event, true ); ?>><?php _e( 'Day(s) after start date', 'google-calendar-events' ); ?></option>
420
-							<option value="weeks_after"    data-show-field="_feed_latest_event_date_range" <?php selected( 'weeks_after', $latest_event, true ); ?>><?php _e( 'Weeks(s) after start date', 'google-calendar-events' ); ?></option>
421
-							<option value="months_after"   data-show-field="_feed_latest_event_date_range" <?php selected( 'months_after', $latest_event, true ); ?>><?php _e( 'Month(s) after start date', 'google-calendar-events' ); ?></option>
422
-							<option value="years_after"    data-show-field="_feed_latest_event_date_range" <?php selected( 'years_after', $latest_event, true ); ?>><?php _e( 'Year(s) after start date', 'google-calendar-events' ); ?></option>
418
+							<option value="calendar_start" data-hide-field="_feed_latest_event_date_range" <?php selected('calendar_start', $earliest_event, true); ?>><?php _e('Day end of start date', 'google-calendar-events'); ?></option>
419
+							<option value="days_after"     data-show-field="_feed_latest_event_date_range" <?php selected('days_after', $latest_event, true); ?>><?php _e('Day(s) after start date', 'google-calendar-events'); ?></option>
420
+							<option value="weeks_after"    data-show-field="_feed_latest_event_date_range" <?php selected('weeks_after', $latest_event, true); ?>><?php _e('Weeks(s) after start date', 'google-calendar-events'); ?></option>
421
+							<option value="months_after"   data-show-field="_feed_latest_event_date_range" <?php selected('months_after', $latest_event, true); ?>><?php _e('Month(s) after start date', 'google-calendar-events'); ?></option>
422
+							<option value="years_after"    data-show-field="_feed_latest_event_date_range" <?php selected('years_after', $latest_event, true); ?>><?php _e('Year(s) after start date', 'google-calendar-events'); ?></option>
423 423
 						</select>
424 424
 						<i class="simcal-icon-help simcal-help-tip"
425
-						   data-tip="<?php _e( 'Set the date for the latest possible event to show on calendar. There will not be events after this date.', 'google-calendar-events' ); ?>"></i>
425
+						   data-tip="<?php _e('Set the date for the latest possible event to show on calendar. There will not be events after this date.', 'google-calendar-events'); ?>"></i>
426 426
 					</td>
427 427
 				</tr>
428 428
 			</tbody>
@@ -439,44 +439,44 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * @param  \WP_Post $post
441 441
 	 */
442
-	private static function calendar_settings_panel( $post ) {
442
+	private static function calendar_settings_panel($post) {
443 443
 
444 444
 		?>
445 445
 		<table>
446 446
 			<thead>
447
-				<tr><th colspan="2"><?php _e( 'Miscellaneous', 'google-calendar-events' ); ?></th></tr>
447
+				<tr><th colspan="2"><?php _e('Miscellaneous', 'google-calendar-events'); ?></th></tr>
448 448
 			</thead>
449 449
 			<tbody class="simcal-panel-section">
450 450
 				<tr class="simcal-panel-field">
451
-					<th><label for="_calendar_is_static"><?php _e( 'Static calendar', 'google-calendar-events' ); ?></label></th>
451
+					<th><label for="_calendar_is_static"><?php _e('Static calendar', 'google-calendar-events'); ?></label></th>
452 452
 					<td>
453 453
 						<?php
454 454
 
455
-						$fixed = get_post_meta( $post->ID, '_calendar_is_static', true );
455
+						$fixed = get_post_meta($post->ID, '_calendar_is_static', true);
456 456
 
457
-						simcal_print_field( array(
457
+						simcal_print_field(array(
458 458
 							'type'    => 'checkbox',
459 459
 							'name'    => '_calendar_is_static',
460 460
 							'id'      => '_calendar_is_static',
461
-							'tooltip' => __( 'Remove the navigation arrows and fix the calendar view to its initial state.', 'google-calendar-events' ),
461
+							'tooltip' => __('Remove the navigation arrows and fix the calendar view to its initial state.', 'google-calendar-events'),
462 462
 							'value'   => 'yes' == $fixed ? 'yes' : 'no',
463
-						) );
463
+						));
464 464
 
465 465
 						?>
466 466
 					</td>
467 467
 				</tr>
468 468
 				<tr class="simcal-panel-field">
469
-					<th><label for="_no_events_message"><?php _e( 'No events message', 'google-calendar-events' ); ?></label></th>
469
+					<th><label for="_no_events_message"><?php _e('No events message', 'google-calendar-events'); ?></label></th>
470 470
 					<td>
471 471
 						<?php
472 472
 
473
-						simcal_print_field( array(
473
+						simcal_print_field(array(
474 474
 							'type'    => 'textarea',
475 475
 							'name'    => '_no_events_message',
476 476
 							'id'      => '_no_events_message',
477
-							'tooltip' => __( 'Some calendars may display a message when no events are found. You can change the default message here.', 'google-calendar-events' ),
478
-							'value'   => get_post_meta( $post->ID, '_no_events_message', true ),
479
-						) );
477
+							'tooltip' => __('Some calendars may display a message when no events are found. You can change the default message here.', 'google-calendar-events'),
478
+							'value'   => get_post_meta($post->ID, '_no_events_message', true),
479
+						));
480 480
 
481 481
 						?>
482 482
 					</td>
@@ -495,23 +495,23 @@  discard block
 block discarded – undo
495 495
 	 *
496 496
 	 * @param  \WP_Post $post
497 497
 	 */
498
-	private static function advanced_settings_panel( $post ) {
498
+	private static function advanced_settings_panel($post) {
499 499
 
500 500
 		?>
501 501
 		<table>
502 502
 			<thead>
503
-				<tr><th colspan="2"><?php _e( 'Date and Time', 'google-calendar-events' ); ?></th></tr>
503
+				<tr><th colspan="2"><?php _e('Date and Time', 'google-calendar-events'); ?></th></tr>
504 504
 			</thead>
505 505
 			<tbody class="simcal-panel-section simcal-panel-datetime-formatting">
506 506
 				<tr class="simcal-panel-field">
507
-					<th><label for="_calendar_timezone_setting"><?php _e( 'Timezone', 'google-calendar-events' ); ?></label></th>
507
+					<th><label for="_calendar_timezone_setting"><?php _e('Timezone', 'google-calendar-events'); ?></label></th>
508 508
 					<td>
509 509
 						<?php
510 510
 
511 511
 						$timezone_wordpress = simcal_get_wp_timezone();
512 512
 						$timezone_default = $timezone_wordpress ? $timezone_wordpress : 'UTC';
513
-						$timezone_setting = esc_attr( get_post_meta( $post->ID, '_feed_timezone_setting', true ) );
514
-						$timezone = esc_attr( get_post_meta( $post->ID, '_feed_timezone', true ) );
513
+						$timezone_setting = esc_attr(get_post_meta($post->ID, '_feed_timezone_setting', true));
514
+						$timezone = esc_attr(get_post_meta($post->ID, '_feed_timezone', true));
515 515
 						$timezone = $timezone ? $timezone : $timezone_default;
516 516
 
517 517
 						?>
@@ -519,51 +519,51 @@  discard block
 block discarded – undo
519 519
 						        id="_feed_timezone_setting"
520 520
 						        class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-next"
521 521
 						        data-show-next-if-value="use_custom">
522
-							<option value="use_calendar" <?php selected( 'use_calendar', $timezone_setting, true ); ?>><?php _ex( 'Events source default', 'Use the calendar default setting', 'google-calendar-events' ); ?></option>
523
-							<option value="use_site" <?php selected( 'use_site', $timezone_setting, true ); ?>><?php printf( _x( 'Site default', 'Use this site default setting', 'google-calendar-events' ) . ' (%s)', $timezone_default ); ?></option>
524
-							<option value="use_custom" <?php selected( 'use_custom', $timezone_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
522
+							<option value="use_calendar" <?php selected('use_calendar', $timezone_setting, true); ?>><?php _ex('Events source default', 'Use the calendar default setting', 'google-calendar-events'); ?></option>
523
+							<option value="use_site" <?php selected('use_site', $timezone_setting, true); ?>><?php printf(_x('Site default', 'Use this site default setting', 'google-calendar-events').' (%s)', $timezone_default); ?></option>
524
+							<option value="use_custom" <?php selected('use_custom', $timezone_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
525 525
 						</select>
526 526
 						<select name="_feed_timezone"
527 527
 						        id="_feed_timezone"
528 528
 						        class="simcal-field simcal-field-select simcal-field-inline"
529 529
 							<?php echo 'use_custom' != $timezone_setting ? 'style="display: none;"' : ''; ?>>
530
-							<?php echo wp_timezone_choice( $timezone ); ?>
530
+							<?php echo wp_timezone_choice($timezone); ?>
531 531
 						</select>
532
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Using a different timezone may alter the date and time display of your calendar events. It is recommended to keep the calendar default timezone.', 'google-calendar-events' ); ?>"></i>
532
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('Using a different timezone may alter the date and time display of your calendar events. It is recommended to keep the calendar default timezone.', 'google-calendar-events'); ?>"></i>
533 533
 					</td>
534 534
 				</tr>
535 535
 				<tr class="simcal-panel-field">
536
-					<th><label for="_calendar_date_format_setting"><?php _e( 'Date format', 'google-calendar-events' ); ?></label></th>
536
+					<th><label for="_calendar_date_format_setting"><?php _e('Date format', 'google-calendar-events'); ?></label></th>
537 537
 					<td>
538 538
 						<?php
539 539
 
540
-						$date_format_setting = esc_attr( get_post_meta( $post->ID, '_calendar_date_format_setting', true ) );
541
-						$date_format_default = esc_attr( get_option( 'date_format' ) );
542
-						$date_format = esc_attr( get_post_meta( $post->ID, '_calendar_date_format', true ) );
543
-						$date_format_php = esc_attr( get_post_meta( $post->ID, '_calendar_date_format_php', true ) );
540
+						$date_format_setting = esc_attr(get_post_meta($post->ID, '_calendar_date_format_setting', true));
541
+						$date_format_default = esc_attr(get_option('date_format'));
542
+						$date_format = esc_attr(get_post_meta($post->ID, '_calendar_date_format', true));
543
+						$date_format_php = esc_attr(get_post_meta($post->ID, '_calendar_date_format_php', true));
544 544
 						$date_format_php = $date_format_php ? $date_format_php : $date_format_default;
545 545
 
546 546
 						?>
547 547
 						<select name="_calendar_date_format_setting"
548 548
 						        id="_calendar_date_format_setting"
549 549
 								class="simcal-field simcal-field-select simcal-field-show-other">
550
-							<option value="use_site" data-show-field="_calendar_date_format_default" <?php selected( 'use_site', $date_format_setting, true ); ?>><?php  _ex( 'Site default', 'Use this site default setting', 'google-calendar-events' ); ?></option>
551
-							<option value="use_custom" data-show-field="_calendar_date_format" <?php selected( 'use_custom', $date_format_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
552
-							<option value="use_custom_php" data-show-field="_calendar_date_format_php_field" <?php selected( 'use_custom_php', $date_format_setting, true ); ?>><?php _e( 'Custom (PHP format)', 'google-calendar-events' ); ?></option>
550
+							<option value="use_site" data-show-field="_calendar_date_format_default" <?php selected('use_site', $date_format_setting, true); ?>><?php  _ex('Site default', 'Use this site default setting', 'google-calendar-events'); ?></option>
551
+							<option value="use_custom" data-show-field="_calendar_date_format" <?php selected('use_custom', $date_format_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
552
+							<option value="use_custom_php" data-show-field="_calendar_date_format_php_field" <?php selected('use_custom_php', $date_format_setting, true); ?>><?php _e('Custom (PHP format)', 'google-calendar-events'); ?></option>
553 553
 						</select>
554
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'This option sets how calendars display event dates. It is recommended to keep your site default setting.', 'google-calendar-events' ); ?>"></i>
554
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('This option sets how calendars display event dates. It is recommended to keep your site default setting.', 'google-calendar-events'); ?>"></i>
555 555
 						<p id="_calendar_date_format_default" style="<?php echo $date_format_setting != 'use_site' ? 'display: none;' : ''; ?>">
556
-							<em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
557
-							<code><?php echo date_i18n( $date_format_default, time() ); ?></code>
556
+							<em><?php _e('Preview', 'google-calendar-events') ?>:</em>&nbsp;&nbsp;
557
+							<code><?php echo date_i18n($date_format_default, time()); ?></code>
558 558
 						</p>
559
-						<?php simcal_print_field( array(
559
+						<?php simcal_print_field(array(
560 560
 							'type'    => 'datetime-format',
561 561
 							'subtype' => 'date',
562 562
 							'name'    => '_calendar_date_format',
563 563
 							'id'      => '_calendar_date_format',
564 564
 							'value'   => $date_format,
565
-							'style'   => $date_format_setting != 'use_custom' ? array( 'display' => 'none' ) : '',
566
-						) ); ?>
565
+							'style'   => $date_format_setting != 'use_custom' ? array('display' => 'none') : '',
566
+						)); ?>
567 567
 						<div class="simcal-field-datetime-format-php" id="_calendar_date_format_php_field" style="<?php echo $date_format_setting != 'use_custom_php' ? 'display: none;' : ''; ?>">
568 568
 							<br>
569 569
 							<label for="_calendar_date_format_php">
@@ -572,70 +572,70 @@  discard block
 block discarded – undo
572 572
 								       id="_calendar_date_format_php"
573 573
 								       class="simcal-field simcal-field-text simcal-field-small"
574 574
 								       value="<?php echo $date_format_php; ?>" />
575
-								<?php printf( __( 'Enter a date format using %s values.', 'google-calendar-events' ), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>' ); ?>
575
+								<?php printf(__('Enter a date format using %s values.', 'google-calendar-events'), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>'); ?>
576 576
 							</label>
577 577
 							<p>
578
-								<em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
579
-								<code><?php echo date_i18n( $date_format_php, time() ); ?></code>
578
+								<em><?php _e('Preview', 'google-calendar-events') ?>:</em>&nbsp;&nbsp;
579
+								<code><?php echo date_i18n($date_format_php, time()); ?></code>
580 580
 							</p>
581 581
 						</div>
582 582
 					</td>
583 583
 				</tr>
584 584
 				<tr class="simcal-panel-field">
585
-					<th><label for="_calendar_datetime_separator"><?php _e( 'Separator', 'google-calendar-events' ); ?></label></th>
585
+					<th><label for="_calendar_datetime_separator"><?php _e('Separator', 'google-calendar-events'); ?></label></th>
586 586
 					<td>
587 587
 						<?php
588 588
 
589
-						$separator = get_post_meta( $post->ID, '_calendar_datetime_separator', true );
589
+						$separator = get_post_meta($post->ID, '_calendar_datetime_separator', true);
590 590
 						$separator = false == $separator ? '@' : $separator;
591 591
 
592
-						simcal_print_field( array(
592
+						simcal_print_field(array(
593 593
 							'type'    => 'standard',
594 594
 							'subtype' => 'text',
595 595
 							'name'    => '_calendar_datetime_separator',
596 596
 							'id'      => '_calendar_datetime_separator',
597 597
 							'value'   => $separator,
598
-							'tooltip' => __( 'Used to divide date and time when both are shown.', 'google-calendar-events' ),
598
+							'tooltip' => __('Used to divide date and time when both are shown.', 'google-calendar-events'),
599 599
 							'class'   => array(
600 600
 								'simcal-field-tiny',
601 601
 							),
602
-						) );
602
+						));
603 603
 
604 604
 						?>
605 605
 					</td>
606 606
 				</tr>
607 607
 				<tr class="simcal-panel-field">
608
-					<th><label for="_calendar_time_format_setting"><?php _e( 'Time format', 'google-calendar-events' ); ?></label></th>
608
+					<th><label for="_calendar_time_format_setting"><?php _e('Time format', 'google-calendar-events'); ?></label></th>
609 609
 					<td>
610 610
 						<?php
611 611
 
612
-						$time_format_setting = esc_attr( get_post_meta( $post->ID, '_calendar_time_format_setting', true ) );
613
-						$time_format_default = esc_attr( get_option( 'time_format' ) );
614
-						$time_format = esc_attr( get_post_meta( $post->ID, '_calendar_time_format', true ) );
615
-						$time_format_php = esc_attr( get_post_meta( $post->ID, '_calendar_time_format_php', true ) );
612
+						$time_format_setting = esc_attr(get_post_meta($post->ID, '_calendar_time_format_setting', true));
613
+						$time_format_default = esc_attr(get_option('time_format'));
614
+						$time_format = esc_attr(get_post_meta($post->ID, '_calendar_time_format', true));
615
+						$time_format_php = esc_attr(get_post_meta($post->ID, '_calendar_time_format_php', true));
616 616
 						$time_format_php = $time_format_php ? $time_format_php : $time_format_default;
617 617
 
618 618
 						?>
619 619
 						<select name="_calendar_time_format_setting"
620 620
 						        id="_calendar_time_format_setting"
621 621
 						        class="simcal-field simcal-field-select simcal-field-show-other">
622
-							<option value="use_site" data-show-field="_calendar_time_format_default" <?php selected( 'use_site', $time_format_setting, true ); ?>><?php _ex( 'Site default', 'Use this site default setting', 'google-calendar-events' ); ?></option>
623
-							<option value="use_custom" data-show-field="_calendar_time_format" <?php selected( 'use_custom', $time_format_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
624
-							<option value="use_custom_php" data-show-field="_calendar_time_format_php_field" <?php selected( 'use_custom_php', $time_format_setting, true ); ?>><?php _e( 'Custom (PHP format)', 'google-calendar-events' ); ?></option>
622
+							<option value="use_site" data-show-field="_calendar_time_format_default" <?php selected('use_site', $time_format_setting, true); ?>><?php _ex('Site default', 'Use this site default setting', 'google-calendar-events'); ?></option>
623
+							<option value="use_custom" data-show-field="_calendar_time_format" <?php selected('use_custom', $time_format_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
624
+							<option value="use_custom_php" data-show-field="_calendar_time_format_php_field" <?php selected('use_custom_php', $time_format_setting, true); ?>><?php _e('Custom (PHP format)', 'google-calendar-events'); ?></option>
625 625
 						</select>
626
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'This option sets how calendars display event times. It is recommended to keep your site default setting.', 'google-calendar-events' ); ?>"></i>
626
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('This option sets how calendars display event times. It is recommended to keep your site default setting.', 'google-calendar-events'); ?>"></i>
627 627
 						<p id="_calendar_time_format_default" style="<?php echo $time_format_setting != 'use_site' ? 'display: none;' : ''; ?>">
628
-							<em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
629
-							<code><?php echo date_i18n( $time_format_default, time() ); ?></code>
628
+							<em><?php _e('Preview', 'google-calendar-events') ?>:</em>&nbsp;&nbsp;
629
+							<code><?php echo date_i18n($time_format_default, time()); ?></code>
630 630
 						</p>
631
-						<?php simcal_print_field( array(
631
+						<?php simcal_print_field(array(
632 632
 							'type'    => 'datetime-format',
633 633
 							'subtype' => 'time',
634 634
 							'name'    => '_calendar_time_format',
635 635
 							'id'      => '_calendar_time_format',
636 636
 							'value'   => $time_format,
637
-							'style'   => $time_format_setting != 'use_custom' ? array( 'display' => 'none' ) : '',
638
-						) ); ?>
637
+							'style'   => $time_format_setting != 'use_custom' ? array('display' => 'none') : '',
638
+						)); ?>
639 639
 						<div class="simcal-field-datetime-format-php" id="_calendar_time_format_php_field" style="<?php echo $time_format_setting != 'use_custom_php' ? 'display: none;' : ''; ?>">
640 640
 							<br>
641 641
 							<label for="_calendar_date_format_php">
@@ -644,24 +644,24 @@  discard block
 block discarded – undo
644 644
 								       id="_calendar_time_format_php"
645 645
 								       class="simcal-field simcal-field-text simcal-field-small"
646 646
 								       value="<?php echo $time_format_php; ?>"/>
647
-								<?php printf( __( 'Enter a time format using %s values.', 'google-calendar-events' ), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>' ); ?>
647
+								<?php printf(__('Enter a time format using %s values.', 'google-calendar-events'), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>'); ?>
648 648
 							</label>
649 649
 							<p>
650
-								<em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
651
-								<code><?php echo date_i18n( $time_format_php, time() ); ?></code>
650
+								<em><?php _e('Preview', 'google-calendar-events') ?>:</em>&nbsp;&nbsp;
651
+								<code><?php echo date_i18n($time_format_php, time()); ?></code>
652 652
 							</p>
653 653
 						</div>
654 654
 					</td>
655 655
 				</tr>
656 656
 				<tr class="simcal-panel-field">
657
-					<th><label for="_calendar_week_starts_on_setting"><?php _e( 'Week starts on', 'google-calendar-events' ); ?></label></th>
657
+					<th><label for="_calendar_week_starts_on_setting"><?php _e('Week starts on', 'google-calendar-events'); ?></label></th>
658 658
 					<td>
659 659
 						<?php
660 660
 
661
-						$week_starts_setting = esc_attr( get_post_meta( $post->ID, '_calendar_week_starts_on_setting', true ) );
662
-						$week_starts_default = esc_attr( get_option( 'start_of_week' ) );
663
-						$week_starts = intval( get_post_meta( $post->ID, '_calendar_week_starts_on', true ) );
664
-						$week_starts = is_numeric( $week_starts ) ? strval( $week_starts ) : $week_starts_default;
661
+						$week_starts_setting = esc_attr(get_post_meta($post->ID, '_calendar_week_starts_on_setting', true));
662
+						$week_starts_default = esc_attr(get_option('start_of_week'));
663
+						$week_starts = intval(get_post_meta($post->ID, '_calendar_week_starts_on', true));
664
+						$week_starts = is_numeric($week_starts) ? strval($week_starts) : $week_starts_default;
665 665
 
666 666
 						?>
667 667
 						<select
@@ -669,39 +669,39 @@  discard block
 block discarded – undo
669 669
 							id="_calendar_week_starts_on_setting"
670 670
 							class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-next"
671 671
 							data-show-next-if-value="use_custom">
672
-							<option value="use_site" <?php selected( 'use_site', $week_starts_setting, true ); ?>><?php printf( _x( 'Site default', 'Use this site default setting', 'google-calendar-events' ) . ' (%s)', date_i18n( 'l', strtotime( "Sunday + $week_starts_default Days" ) ) ); ?></option>
673
-							<option value="use_custom" <?php selected( 'use_custom', $week_starts_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
672
+							<option value="use_site" <?php selected('use_site', $week_starts_setting, true); ?>><?php printf(_x('Site default', 'Use this site default setting', 'google-calendar-events').' (%s)', date_i18n('l', strtotime("Sunday + $week_starts_default Days"))); ?></option>
673
+							<option value="use_custom" <?php selected('use_custom', $week_starts_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
674 674
 						</select>
675 675
 						<select
676 676
 							name="_calendar_week_starts_on"
677 677
 							id="_calendar_week_starts_on"
678 678
 							class="simcal-field simcal-field-select simcal-field-inline"
679 679
 							<?php echo 'use_custom' != $week_starts_setting ? 'style="display: none;"' : ''; ?>>
680
-							<?php $day_names = simcal_get_calendar_names_i18n( 'day', 'full' ); ?>
681
-							<?php for ( $i = 0; $i <= 6; $i++ ) : ?>
682
-								<option value="<?php echo $i; ?>" <?php selected( $i, $week_starts, true ); ?>><?php echo $day_names[ $i ]; ?></option>
680
+							<?php $day_names = simcal_get_calendar_names_i18n('day', 'full'); ?>
681
+							<?php for ($i = 0; $i <= 6; $i++) : ?>
682
+								<option value="<?php echo $i; ?>" <?php selected($i, $week_starts, true); ?>><?php echo $day_names[$i]; ?></option>
683 683
 							<?php endfor; ?>
684 684
 						</select>
685
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Some calendars may use this setting to display the start of the week. It is recommended to keep the site default setting.', 'google-calendar-events' ); ?>"></i>
685
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('Some calendars may use this setting to display the start of the week. It is recommended to keep the site default setting.', 'google-calendar-events'); ?>"></i>
686 686
 					</td>
687 687
 				</tr>
688 688
 			</tbody>
689 689
 		</table>
690 690
 		<table>
691 691
 			<thead>
692
-				<tr><th colspan="2"><?php _e( 'Cache', 'google-calendar-events' ); ?></th></tr>
692
+				<tr><th colspan="2"><?php _e('Cache', 'google-calendar-events'); ?></th></tr>
693 693
 			</thead>
694 694
 			<tbody class="simcal-panel-section simcal-panel-section-cache">
695 695
 				<?php
696 696
 
697
-				$cache_freq = esc_attr( get_post_meta( $post->ID, '_feed_cache_user_amount', true ) );
698
-				$cache_unit = esc_attr( get_post_meta( $post->ID, '_feed_cache_user_unit', true ) );
697
+				$cache_freq = esc_attr(get_post_meta($post->ID, '_feed_cache_user_amount', true));
698
+				$cache_unit = esc_attr(get_post_meta($post->ID, '_feed_cache_user_unit', true));
699 699
 				$cache_freq = $cache_freq ? $cache_freq : '2';
700 700
 				$cache_unit = $cache_unit ? $cache_unit : '3600';
701 701
 
702 702
 				?>
703 703
 				<tr class="simcal-panel-field">
704
-					<th><label for="_feed_cache_user_amount"><?php _ex( 'Refresh interval', 'Cache maximum interval', 'google-calendar-events' ); ?></label></th>
704
+					<th><label for="_feed_cache_user_amount"><?php _ex('Refresh interval', 'Cache maximum interval', 'google-calendar-events'); ?></label></th>
705 705
 					<td>
706 706
 						<input type="number"
707 707
 						       name="_feed_cache_user_amount"
@@ -712,12 +712,12 @@  discard block
 block discarded – undo
712 712
 						<select name="_feed_cache_user_unit"
713 713
 						        id="_feed_cache_user_unit"
714 714
 						        class="simcal-field simcalfield-select simcal-field-inline">
715
-							<option value="60" <?php selected( '60', $cache_unit, true ); ?>><?php _e( 'Minute(s)', 'google-calendar-events' ); ?></option>
716
-							<option value="3600" <?php selected( '3600', $cache_unit, true ); ?>><?php _e( 'Hour(s)', 'google-calendar-events' ); ?></option>
717
-							<option value="86400" <?php selected( '86400', $cache_unit, true ); ?>><?php _e( 'Day(s)', 'google-calendar-events' ); ?></option>
718
-							<option value="604800" <?php selected( '604800', $cache_unit, true ); ?>><?php _e( 'Week(s)', 'google-calendar-events' ); ?></option>
715
+							<option value="60" <?php selected('60', $cache_unit, true); ?>><?php _e('Minute(s)', 'google-calendar-events'); ?></option>
716
+							<option value="3600" <?php selected('3600', $cache_unit, true); ?>><?php _e('Hour(s)', 'google-calendar-events'); ?></option>
717
+							<option value="86400" <?php selected('86400', $cache_unit, true); ?>><?php _e('Day(s)', 'google-calendar-events'); ?></option>
718
+							<option value="604800" <?php selected('604800', $cache_unit, true); ?>><?php _e('Week(s)', 'google-calendar-events'); ?></option>
719 719
 						</select>
720
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'If you add, edit or remove events in your calendar very often, you can set a lower interval to refresh the events displayed. Set a higher interval for best performance.', 'google-calendar-events' ); ?>"></i>
720
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('If you add, edit or remove events in your calendar very often, you can set a lower interval to refresh the events displayed. Set a higher interval for best performance.', 'google-calendar-events'); ?>"></i>
721 721
 					</td>
722 722
 				</tr>
723 723
 			</tbody>
@@ -736,21 +736,21 @@  discard block
 block discarded – undo
736 736
 	 *
737 737
 	 * @return void
738 738
 	 */
739
-	public static function print_panel_fields( $array, $post_id ) {
739
+	public static function print_panel_fields($array, $post_id) {
740 740
 
741
-		foreach ( $array as $section => $fields ) :
741
+		foreach ($array as $section => $fields) :
742 742
 
743
-			if ( $fields && is_array( $fields ) ) :
743
+			if ($fields && is_array($fields)) :
744 744
 
745 745
 				?>
746
-				<tbody class="simcal-panel-section simcal-panel-section-<?php echo esc_attr( $section ); ?>">
747
-					<?php foreach ( $fields as $key => $field ) :
746
+				<tbody class="simcal-panel-section simcal-panel-section-<?php echo esc_attr($section); ?>">
747
+					<?php foreach ($fields as $key => $field) :
748 748
 
749
-						$value            = get_post_meta( $post_id, $key, true );
750
-						$field['value']   = $value ? $value : ( isset( $field['default'] ) ? $field['default'] : '' );
751
-						$the_field = simcal_get_field( $field ); ?>
749
+						$value            = get_post_meta($post_id, $key, true);
750
+						$field['value']   = $value ? $value : (isset($field['default']) ? $field['default'] : '');
751
+						$the_field = simcal_get_field($field); ?>
752 752
 
753
-						<?php if ( $the_field instanceof Field ) : ?>
753
+						<?php if ($the_field instanceof Field) : ?>
754 754
 							<tr class="simcal-panel-field">
755 755
 								<th><label for="<?php echo $the_field->id ?>"><?php echo $the_field->title; ?></label></th>
756 756
 								<td><?php $the_field->html(); ?></td>
@@ -777,30 +777,30 @@  discard block
 block discarded – undo
777 777
 	 *
778 778
 	 * @return void
779 779
 	 */
780
-	public static function save( $post_id, $post ) {
780
+	public static function save($post_id, $post) {
781 781
 
782 782
 		/* ====================== *
783 783
 		 * Calendar type and view *
784 784
 		 * ====================== */
785 785
 
786 786
 		// Unlink existing terms for feed type and calendar type.
787
-		wp_delete_object_term_relationships( $post_id, array(
787
+		wp_delete_object_term_relationships($post_id, array(
788 788
 			'calendar_feed',
789 789
 			'calendar_type',
790
-		) );
790
+		));
791 791
 
792 792
 		// Set the feed type as term.
793
-		$feed_type = isset( $_POST['_feed_type'] ) ? sanitize_title( stripslashes( $_POST['_feed_type'] ) ) : apply_filters( 'simcal_default_feed_type', 'google' );
794
-		wp_set_object_terms( $post_id, $feed_type, 'calendar_feed' );
793
+		$feed_type = isset($_POST['_feed_type']) ? sanitize_title(stripslashes($_POST['_feed_type'])) : apply_filters('simcal_default_feed_type', 'google');
794
+		wp_set_object_terms($post_id, $feed_type, 'calendar_feed');
795 795
 
796 796
 		// Set the calendar type as a term.
797
-		$calendar_type = isset( $_POST['_calendar_type'] ) ? sanitize_title( stripslashes( $_POST['_calendar_type'] ) ) : apply_filters( 'simcal_default_calendar_type', 'default-calendar' );
798
-		wp_set_object_terms( $post_id, $calendar_type, 'calendar_type' );
797
+		$calendar_type = isset($_POST['_calendar_type']) ? sanitize_title(stripslashes($_POST['_calendar_type'])) : apply_filters('simcal_default_calendar_type', 'default-calendar');
798
+		wp_set_object_terms($post_id, $calendar_type, 'calendar_type');
799 799
 		// Set the calendar type view as post meta.
800
-		$calendar_view = isset( $_POST['_calendar_view'] ) ? $_POST['_calendar_view'] : '';
801
-		if ( $calendar_view && is_array( $calendar_view ) ) {
802
-			$views = array_map( 'sanitize_title', $calendar_view );
803
-			update_post_meta( $post_id, '_calendar_view', $views );
800
+		$calendar_view = isset($_POST['_calendar_view']) ? $_POST['_calendar_view'] : '';
801
+		if ($calendar_view && is_array($calendar_view)) {
802
+			$views = array_map('sanitize_title', $calendar_view);
803
+			update_post_meta($post_id, '_calendar_view', $views);
804 804
 		}
805 805
 
806 806
 		/* ===================== *
@@ -808,98 +808,98 @@  discard block
 block discarded – undo
808 808
 		 * ===================== */
809 809
 
810 810
 		// Calendar opening.
811
-		$calendar_begins = isset( $_POST['_calendar_begins'] ) ? sanitize_key( $_POST['_calendar_begins'] ) : 'this_month';
812
-		update_post_meta( $post_id, '_calendar_begins', $calendar_begins );
813
-		$calendar_begins_nth = isset( $_POST['_calendar_begins_nth'] ) ? absint( $_POST['_calendar_begins_nth'] ) : 2;
814
-		update_post_meta( $post_id, '_calendar_begins_nth', $calendar_begins_nth );
815
-		$calendar_begins_custom_date = isset( $_POST['_calendar_begins_custom_date'] ) ? sanitize_title( $_POST['_calendar_begins_custom_date'] ) : '';
816
-		update_post_meta( $post_id, '_calendar_begins_custom_date', $calendar_begins_custom_date );
811
+		$calendar_begins = isset($_POST['_calendar_begins']) ? sanitize_key($_POST['_calendar_begins']) : 'this_month';
812
+		update_post_meta($post_id, '_calendar_begins', $calendar_begins);
813
+		$calendar_begins_nth = isset($_POST['_calendar_begins_nth']) ? absint($_POST['_calendar_begins_nth']) : 2;
814
+		update_post_meta($post_id, '_calendar_begins_nth', $calendar_begins_nth);
815
+		$calendar_begins_custom_date = isset($_POST['_calendar_begins_custom_date']) ? sanitize_title($_POST['_calendar_begins_custom_date']) : '';
816
+		update_post_meta($post_id, '_calendar_begins_custom_date', $calendar_begins_custom_date);
817 817
 
818 818
 		// Feed earliest events date.
819
-		$earliest_events = isset( $_POST['_feed_earliest_event_date'] ) ? sanitize_key( $_POST['_feed_earliest_event_date'] ) : '';
820
-		update_post_meta( $post_id, '_feed_earliest_event_date', $earliest_events );
821
-		$earliest_events_range = isset( $_POST['_feed_earliest_event_date_range'] ) ? max( absint( $_POST['_feed_earliest_event_date_range'] ), 1 ) : 1;
822
-		update_post_meta( $post_id, '_feed_earliest_event_date_range', $earliest_events_range );
819
+		$earliest_events = isset($_POST['_feed_earliest_event_date']) ? sanitize_key($_POST['_feed_earliest_event_date']) : '';
820
+		update_post_meta($post_id, '_feed_earliest_event_date', $earliest_events);
821
+		$earliest_events_range = isset($_POST['_feed_earliest_event_date_range']) ? max(absint($_POST['_feed_earliest_event_date_range']), 1) : 1;
822
+		update_post_meta($post_id, '_feed_earliest_event_date_range', $earliest_events_range);
823 823
 
824 824
 		// Feed latest events date.
825
-		$latest_events = isset( $_POST['_feed_latest_event_date'] ) ? sanitize_key( $_POST['_feed_latest_event_date'] ) : '';
826
-		update_post_meta( $post_id, '_feed_latest_event_date', $latest_events );
827
-		$latest_events_range = isset( $_POST['_feed_latest_event_date_range'] ) ? max( absint( $_POST['_feed_latest_event_date_range'] ), 1 ) : 1;
828
-		update_post_meta( $post_id, '_feed_latest_event_date_range', $latest_events_range );
825
+		$latest_events = isset($_POST['_feed_latest_event_date']) ? sanitize_key($_POST['_feed_latest_event_date']) : '';
826
+		update_post_meta($post_id, '_feed_latest_event_date', $latest_events);
827
+		$latest_events_range = isset($_POST['_feed_latest_event_date_range']) ? max(absint($_POST['_feed_latest_event_date_range']), 1) : 1;
828
+		update_post_meta($post_id, '_feed_latest_event_date_range', $latest_events_range);
829 829
 
830 830
 		/* ======================= *
831 831
 		 * Calendar settings panel *
832 832
 		 * ======================= */
833 833
 
834 834
 		// Static calendar.
835
-		$static = isset( $_POST['_calendar_is_static'] ) ? 'yes' : 'no';
836
-		update_post_meta( $post_id, '_calendar_is_static', $static );
835
+		$static = isset($_POST['_calendar_is_static']) ? 'yes' : 'no';
836
+		update_post_meta($post_id, '_calendar_is_static', $static);
837 837
 
838 838
 		// No events message.
839
-		$message = isset( $_POST['_no_events_message'] ) ? wp_kses_post( $_POST['_no_events_message'] ) : '';
840
-		update_post_meta( $post_id, '_no_events_message', $message );
839
+		$message = isset($_POST['_no_events_message']) ? wp_kses_post($_POST['_no_events_message']) : '';
840
+		update_post_meta($post_id, '_no_events_message', $message);
841 841
 
842 842
 		/* ======================= *
843 843
 		 * Advanced settings panel *
844 844
 		 * ======================= */
845 845
 
846 846
 		// Timezone.
847
-		$feed_timezone_setting = isset( $_POST['_feed_timezone_setting'] ) ? sanitize_key( $_POST['_feed_timezone_setting'] ) : 'use_calendar';
848
-		update_post_meta( $post_id, '_feed_timezone_setting', $feed_timezone_setting );
847
+		$feed_timezone_setting = isset($_POST['_feed_timezone_setting']) ? sanitize_key($_POST['_feed_timezone_setting']) : 'use_calendar';
848
+		update_post_meta($post_id, '_feed_timezone_setting', $feed_timezone_setting);
849 849
 		$default_timezone = simcal_get_wp_timezone();
850 850
 		$feed_timezone = $default_timezone ? $default_timezone : 'UTC';
851
-		$feed_timezone = isset( $_POST['_feed_timezone'] ) ? sanitize_text_field( $_POST['_feed_timezone'] ) : $feed_timezone;
852
-		update_post_meta( $post_id, '_feed_timezone', $feed_timezone );
851
+		$feed_timezone = isset($_POST['_feed_timezone']) ? sanitize_text_field($_POST['_feed_timezone']) : $feed_timezone;
852
+		update_post_meta($post_id, '_feed_timezone', $feed_timezone);
853 853
 
854 854
 		// Date format.
855
-		$date_format_setting = isset( $_POST['_calendar_date_format_setting'] ) ? sanitize_key( $_POST['_calendar_date_format_setting'] ) : 'use_site';
856
-		update_post_meta( $post_id, '_calendar_date_format_setting', $date_format_setting );
857
-		$date_format = isset( $_POST['_calendar_date_format'] ) ? sanitize_text_field( trim( $_POST['_calendar_date_format'] ) ) : get_option( 'date_format' );
858
-		update_post_meta( $post_id, '_calendar_date_format', $date_format );
859
-		$date_format_php = isset( $_POST['_calendar_date_format_php'] ) ? sanitize_text_field( trim( $_POST['_calendar_date_format_php'] ) ) : get_option( 'date_format' );
860
-		update_post_meta( $post_id, '_calendar_date_format_php', $date_format_php );
855
+		$date_format_setting = isset($_POST['_calendar_date_format_setting']) ? sanitize_key($_POST['_calendar_date_format_setting']) : 'use_site';
856
+		update_post_meta($post_id, '_calendar_date_format_setting', $date_format_setting);
857
+		$date_format = isset($_POST['_calendar_date_format']) ? sanitize_text_field(trim($_POST['_calendar_date_format'])) : get_option('date_format');
858
+		update_post_meta($post_id, '_calendar_date_format', $date_format);
859
+		$date_format_php = isset($_POST['_calendar_date_format_php']) ? sanitize_text_field(trim($_POST['_calendar_date_format_php'])) : get_option('date_format');
860
+		update_post_meta($post_id, '_calendar_date_format_php', $date_format_php);
861 861
 
862 862
 		// Time format.
863
-		$time_format_setting = isset( $_POST['_calendar_time_format_setting'] ) ? sanitize_key( $_POST['_calendar_time_format_setting'] ) : 'use_site';
864
-		update_post_meta( $post_id, '_calendar_time_format_setting', $time_format_setting );
865
-		$time_format = isset( $_POST['_calendar_time_format'] ) ? sanitize_text_field( trim( $_POST['_calendar_time_format'] ) ) : get_option( 'time_format' );
866
-		update_post_meta( $post_id, '_calendar_time_format', $time_format );
867
-		$time_format_php = isset( $_POST['_calendar_time_format_php'] ) ? sanitize_text_field( trim( $_POST['_calendar_time_format_php'] ) ) : get_option( 'time_format' );
868
-		update_post_meta( $post_id, '_calendar_time_format_php', $time_format_php );
863
+		$time_format_setting = isset($_POST['_calendar_time_format_setting']) ? sanitize_key($_POST['_calendar_time_format_setting']) : 'use_site';
864
+		update_post_meta($post_id, '_calendar_time_format_setting', $time_format_setting);
865
+		$time_format = isset($_POST['_calendar_time_format']) ? sanitize_text_field(trim($_POST['_calendar_time_format'])) : get_option('time_format');
866
+		update_post_meta($post_id, '_calendar_time_format', $time_format);
867
+		$time_format_php = isset($_POST['_calendar_time_format_php']) ? sanitize_text_field(trim($_POST['_calendar_time_format_php'])) : get_option('time_format');
868
+		update_post_meta($post_id, '_calendar_time_format_php', $time_format_php);
869 869
 
870 870
 		// Date-time separator.
871
-		$datetime_separator = isset( $_POST['_calendar_datetime_separator'] ) ? sanitize_text_field( $_POST['_calendar_datetime_separator'] ) : ' ';
872
-		update_post_meta( $post_id, '_calendar_datetime_separator', $datetime_separator );
871
+		$datetime_separator = isset($_POST['_calendar_datetime_separator']) ? sanitize_text_field($_POST['_calendar_datetime_separator']) : ' ';
872
+		update_post_meta($post_id, '_calendar_datetime_separator', $datetime_separator);
873 873
 
874 874
 		// Week start.
875
-		$week_start_setting = isset( $_POST['_calendar_week_starts_on_setting'] ) ? sanitize_key( $_POST['_calendar_week_starts_on_setting'] ) : 'use_site';
876
-		update_post_meta( $post_id, '_calendar_week_starts_on_setting', $week_start_setting );
877
-		$week_start = isset( $_POST['_calendar_week_starts_on'] ) ? intval( $_POST['_calendar_week_starts_on'] ) : get_option( 'start_of_week' );
878
-		update_post_meta( $post_id, '_calendar_week_starts_on', $week_start );
875
+		$week_start_setting = isset($_POST['_calendar_week_starts_on_setting']) ? sanitize_key($_POST['_calendar_week_starts_on_setting']) : 'use_site';
876
+		update_post_meta($post_id, '_calendar_week_starts_on_setting', $week_start_setting);
877
+		$week_start = isset($_POST['_calendar_week_starts_on']) ? intval($_POST['_calendar_week_starts_on']) : get_option('start_of_week');
878
+		update_post_meta($post_id, '_calendar_week_starts_on', $week_start);
879 879
 
880 880
 		// Cache interval.
881 881
 		$cache = 7200;
882
-		if ( isset( $_POST['_feed_cache_user_amount'] ) && isset( $_POST['_feed_cache_user_unit'] ) ) {
883
-			$amount = is_numeric( $_POST['_feed_cache_user_amount'] ) ? absint( $_POST['_feed_cache_user_amount'] ) : 1;
884
-			$unit   = is_numeric( $_POST['_feed_cache_user_unit'] ) ? absint( $_POST['_feed_cache_user_unit'] ) : 3600;
885
-			update_post_meta( $post_id, '_feed_cache_user_amount', $amount );
886
-			update_post_meta( $post_id, '_feed_cache_user_unit', $unit );
882
+		if (isset($_POST['_feed_cache_user_amount']) && isset($_POST['_feed_cache_user_unit'])) {
883
+			$amount = is_numeric($_POST['_feed_cache_user_amount']) ? absint($_POST['_feed_cache_user_amount']) : 1;
884
+			$unit   = is_numeric($_POST['_feed_cache_user_unit']) ? absint($_POST['_feed_cache_user_unit']) : 3600;
885
+			update_post_meta($post_id, '_feed_cache_user_amount', $amount);
886
+			update_post_meta($post_id, '_feed_cache_user_unit', $unit);
887 887
 			$cache  = $amount * $unit;
888 888
 		}
889
-		update_post_meta( $post_id, '_feed_cache', $cache );
889
+		update_post_meta($post_id, '_feed_cache', $cache);
890 890
 
891 891
 		/* ============= *
892 892
 		 * Miscellaneous *
893 893
 		 * ============= */
894 894
 
895 895
 		// Update version.
896
-		update_post_meta( $post_id, '_calendar_version', SIMPLE_CALENDAR_VERSION );
896
+		update_post_meta($post_id, '_calendar_version', SIMPLE_CALENDAR_VERSION);
897 897
 
898 898
 		// Action hook.
899
-		do_action( 'simcal_process_settings_meta', $post_id );
899
+		do_action('simcal_process_settings_meta', $post_id);
900 900
 
901 901
 		// Clear cache.
902
-		simcal_delete_feed_transients( $post_id );
902
+		simcal_delete_feed_transients($post_id);
903 903
 	}
904 904
 
905 905
 }
Please login to merge, or discard this patch.