Completed
Push — master ( 61887c...f18ca1 )
by
unknown
06:25
created
includes/events/event.php 1 patch
Spacing   +77 added lines, -77 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
 
@@ -239,35 +239,35 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @param array $event
241 241
 	 */
242
-	public function __construct( array $event ) {
242
+	public function __construct(array $event) {
243 243
 
244 244
 		/* ================= *
245 245
 		 * Event Identifiers *
246 246
 		 * ================= */
247 247
 
248 248
 		// Event unique id.
249
-		if ( ! empty( $event['uid'] ) ) {
250
-			$this->uid = esc_attr( $event['uid'] );
249
+		if ( ! empty($event['uid'])) {
250
+			$this->uid = esc_attr($event['uid']);
251 251
 		}
252 252
 
253 253
 		// iCal ID
254
-		if ( ! empty( $event['ical_id'] ) ) {
255
-			$this->ical_id = esc_attr( $event['ical_id'] );
254
+		if ( ! empty($event['ical_id'])) {
255
+			$this->ical_id = esc_attr($event['ical_id']);
256 256
 		}
257 257
 
258 258
 		// Event source.
259
-		if ( ! empty( $event['source'] ) ) {
260
-			$this->source = esc_attr( $event['source'] );
259
+		if ( ! empty($event['source'])) {
260
+			$this->source = esc_attr($event['source']);
261 261
 		}
262 262
 
263 263
 		// Event parent calendar id.
264
-		if ( ! empty( $event['calendar'] ) ) {
265
-			$this->calendar = max( intval( $event['calendar'] ), 0 );
264
+		if ( ! empty($event['calendar'])) {
265
+			$this->calendar = max(intval($event['calendar']), 0);
266 266
 		}
267 267
 
268 268
 		// Event parent calendar timezone.
269
-		if ( ! empty( $event['timezone'] ) ) {
270
-			$this->timezone = esc_attr( $event['timezone'] );
269
+		if ( ! empty($event['timezone'])) {
270
+			$this->timezone = esc_attr($event['timezone']);
271 271
 		}
272 272
 
273 273
 		/* ============= *
@@ -275,23 +275,23 @@  discard block
 block discarded – undo
275 275
 		 * ============= */
276 276
 
277 277
 		// Event title.
278
-		if ( ! empty( $event['title'] ) ) {
279
-			$this->title = esc_html( $event['title'] );
278
+		if ( ! empty($event['title'])) {
279
+			$this->title = esc_html($event['title']);
280 280
 		}
281 281
 
282 282
 		// Event description.
283
-		if ( ! empty( $event['description'] ) ) {
284
-			$this->description = wp_kses_post( $event['description'] );
283
+		if ( ! empty($event['description'])) {
284
+			$this->description = wp_kses_post($event['description']);
285 285
 		}
286 286
 
287 287
 		// Event link URL.
288
-		if ( ! empty( $event['link'] ) ) {
289
-			$this->link = esc_url_raw( $event['link'] );
288
+		if ( ! empty($event['link'])) {
289
+			$this->link = esc_url_raw($event['link']);
290 290
 		}
291 291
 
292 292
 		// Event visibility.
293
-		if ( ! empty( $event['visibility'] ) ) {
294
-			$this->visibility = esc_attr( $event['visibility'] );
293
+		if ( ! empty($event['visibility'])) {
294
+			$this->visibility = esc_attr($event['visibility']);
295 295
 			$this->public = $this->visibility == 'public' ? true : false;
296 296
 		}
297 297
 
@@ -299,34 +299,34 @@  discard block
 block discarded – undo
299 299
 		 * Event Start *
300 300
 		 * =========== */
301 301
 
302
-		if ( ! empty( $event['start'] ) ) {
303
-			$this->start = is_numeric( $event['start'] ) ? intval( $event['start'] ) : 0;
304
-			if ( ! empty( $event['start_utc'] ) ) {
305
-				$this->start_utc = is_numeric( $event['start_utc'] ) ? intval( $event['start_utc'] ) : 0;
302
+		if ( ! empty($event['start'])) {
303
+			$this->start = is_numeric($event['start']) ? intval($event['start']) : 0;
304
+			if ( ! empty($event['start_utc'])) {
305
+				$this->start_utc = is_numeric($event['start_utc']) ? intval($event['start_utc']) : 0;
306 306
 			}
307
-			if ( ! empty( $event['start_timezone'] ) ) {
308
-				$this->start_timezone = esc_attr( $event['start_timezone'] );
307
+			if ( ! empty($event['start_timezone'])) {
308
+				$this->start_timezone = esc_attr($event['start_timezone']);
309 309
 			}
310
-			$this->start_dt = Carbon::createFromTimestamp( $this->start, $this->start_timezone );
311
-			$start_location = isset( $event['start_location'] ) ? $event['start_location'] : '';
312
-			$this->start_location = $this->esc_location( $start_location );
310
+			$this->start_dt = Carbon::createFromTimestamp($this->start, $this->start_timezone);
311
+			$start_location = isset($event['start_location']) ? $event['start_location'] : '';
312
+			$this->start_location = $this->esc_location($start_location);
313 313
 		}
314 314
 
315 315
 		/* ========= *
316 316
 		 * Event End *
317 317
 		 * ========= */
318 318
 
319
-		if ( ! empty( $event['end'] ) ) {
320
-			$this->end = is_numeric( $event['end'] ) ? intval( $event['end'] ): false;
321
-			if ( ! empty( $event['end_utc'] ) ) {
322
-				$this->end_utc = is_numeric( $event['end_utc'] ) ? intval( $event['end_utc'] ) : false;
319
+		if ( ! empty($event['end'])) {
320
+			$this->end = is_numeric($event['end']) ? intval($event['end']) : false;
321
+			if ( ! empty($event['end_utc'])) {
322
+				$this->end_utc = is_numeric($event['end_utc']) ? intval($event['end_utc']) : false;
323 323
 			}
324
-			if ( ! empty( $event['end_timezone'] ) ) {
325
-				$this->end_timezone = esc_attr( $event['end_timezone'] );
324
+			if ( ! empty($event['end_timezone'])) {
325
+				$this->end_timezone = esc_attr($event['end_timezone']);
326 326
 			}
327
-			$this->end_dt = Carbon::createFromTimestamp( $this->end, $this->end_timezone );
328
-			$end_location = isset( $event['end_location'] ) ? $event['end_location'] : '';
329
-			$this->end_location = $this->esc_location( $end_location );
327
+			$this->end_dt = Carbon::createFromTimestamp($this->end, $this->end_timezone);
328
+			$end_location = isset($event['end_location']) ? $event['end_location'] : '';
329
+			$this->end_location = $this->esc_location($end_location);
330 330
 		}
331 331
 
332 332
 		/* ================== *
@@ -334,18 +334,18 @@  discard block
 block discarded – undo
334 334
 		 * ================== */
335 335
 
336 336
 		// Whole day event.
337
-		if ( ! empty( $event['whole_day'] ) ) {
338
-			$this->whole_day = true === $event['whole_day'] ? true: false;
337
+		if ( ! empty($event['whole_day'])) {
338
+			$this->whole_day = true === $event['whole_day'] ? true : false;
339 339
 		}
340 340
 
341 341
 		// Multi day event.
342
-		if ( ! empty( $event['multiple_days'] ) ) {
343
-			$this->multiple_days = max( absint( $event['multiple_days'] ), 1 );
342
+		if ( ! empty($event['multiple_days'])) {
343
+			$this->multiple_days = max(absint($event['multiple_days']), 1);
344 344
 		}
345 345
 
346 346
 		// Event recurrence.
347
-		if ( isset( $event['recurrence'] ) ) {
348
-			$this->recurrence = ! empty( $event['recurrence'] ) ? $event['recurrence'] : false;
347
+		if (isset($event['recurrence'])) {
348
+			$this->recurrence = ! empty($event['recurrence']) ? $event['recurrence'] : false;
349 349
 		}
350 350
 
351 351
 		/* ========== *
@@ -353,18 +353,18 @@  discard block
 block discarded – undo
353 353
 		 * ========== */
354 354
 
355 355
 		// Event has venue(s).
356
-		if ( $this->start_location['venue'] || $this->end_location['venue'] ) {
356
+		if ($this->start_location['venue'] || $this->end_location['venue']) {
357 357
 			$this->venue = true;
358 358
 		}
359 359
 
360 360
 		// Event meta.
361
-		if ( ! empty( $event['meta'] ) ) {
362
-			$this->meta = is_array( $event['meta'] ) ? $event['meta'] : array();
361
+		if ( ! empty($event['meta'])) {
362
+			$this->meta = is_array($event['meta']) ? $event['meta'] : array();
363 363
 		}
364 364
 
365 365
 		// Event template.
366
-		if ( ! empty( $event['template'] ) ) {
367
-			$this->template = wp_kses_post( $event['template'] );
366
+		if ( ! empty($event['template'])) {
367
+			$this->template = wp_kses_post($event['template']);
368 368
 		}
369 369
 
370 370
 	}
@@ -379,27 +379,27 @@  discard block
 block discarded – undo
379 379
 	 *
380 380
 	 * @return array
381 381
 	 */
382
-	private function esc_location( $var = '' ) {
382
+	private function esc_location($var = '') {
383 383
 
384 384
 		$location = array();
385 385
 
386
-		if ( is_string( $var ) ) {
386
+		if (is_string($var)) {
387 387
 			$var = array(
388 388
 				'name'    => $var,
389 389
 				'address' => $var,
390 390
 			);
391
-		} elseif ( is_bool( $var ) || is_null( $var ) ) {
391
+		} elseif (is_bool($var) || is_null($var)) {
392 392
 			$var = array();
393 393
 		} else {
394 394
 			$var = (array) $var;
395 395
 		}
396 396
 
397
-		$location['name']    = isset( $var['name'] )    ? esc_attr( strip_tags( $var['name'] ) ) : '';
398
-		$location['address'] = isset( $var['address'] ) ? esc_attr( strip_tags( $var['address'] ) ) : '';
399
-		$location['lat']     = isset( $var['lat'] )     ? $this->esc_coordinate( $var['lat'] ) : 0;
400
-		$location['lng']     = isset( $var['lng'] )     ? $this->esc_coordinate( $var['lng'] ) : 0;
397
+		$location['name']    = isset($var['name']) ? esc_attr(strip_tags($var['name'])) : '';
398
+		$location['address'] = isset($var['address']) ? esc_attr(strip_tags($var['address'])) : '';
399
+		$location['lat']     = isset($var['lat']) ? $this->esc_coordinate($var['lat']) : 0;
400
+		$location['lng']     = isset($var['lng']) ? $this->esc_coordinate($var['lng']) : 0;
401 401
 
402
-		if ( ! empty( $location['name'] ) || ! empty( $location['address'] ) ) {
402
+		if ( ! empty($location['name']) || ! empty($location['address'])) {
403 403
 			$location['venue'] = true;
404 404
 		} else {
405 405
 			$location['venue'] = false;
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	 *
419 419
 	 * @return int|float
420 420
 	 */
421
-	private function esc_coordinate( $latlng = 0 ) {
422
-		return is_numeric( $latlng ) ? floatval( $latlng ) : 0;
421
+	private function esc_coordinate($latlng = 0) {
422
+		return is_numeric($latlng) ? floatval($latlng) : 0;
423 423
 	}
424 424
 
425 425
 	/**
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
 	 *
433 433
 	 * @return bool
434 434
 	 */
435
-	public function set_timezone( $tz ) {
436
-		if ( in_array( $tz, timezone_identifiers_list() ) ) {
435
+	public function set_timezone($tz) {
436
+		if (in_array($tz, timezone_identifiers_list())) {
437 437
 			$this->timezone = $tz;
438 438
 			return true;
439 439
 		}
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 * @return bool
460 460
 	 */
461 461
 	public function starts_today() {
462
-		return $this->start_dt->setTimezone( $this->timezone )->isToday();
462
+		return $this->start_dt->setTimezone($this->timezone)->isToday();
463 463
 	}
464 464
 
465 465
 	/**
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	 * @return bool
471 471
 	 */
472 472
 	public function ends_today() {
473
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isToday() : true;
473
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isToday() : true;
474 474
 	}
475 475
 
476 476
 	/**
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 	 * @return bool
482 482
 	 */
483 483
 	public function starts_tomorrow() {
484
-		return $this->start_dt->setTimezone( $this->timezone )->isTomorrow();
484
+		return $this->start_dt->setTimezone($this->timezone)->isTomorrow();
485 485
 	}
486 486
 
487 487
 	/**
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 	 * @return bool
493 493
 	 */
494 494
 	public function ends_tomorrow() {
495
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isTomorrow() : false;
495
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isTomorrow() : false;
496 496
 	}
497 497
 
498 498
 	/**
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	 * @return bool
504 504
 	 */
505 505
 	public function started_yesterday() {
506
-		return $this->start_dt->setTimezone( $this->timezone )->isYesterday();
506
+		return $this->start_dt->setTimezone($this->timezone)->isYesterday();
507 507
 	}
508 508
 
509 509
 	/**
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 	 * @return bool
515 515
 	 */
516 516
 	public function ended_yesterday() {
517
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isYesterday() : false;
517
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isYesterday() : false;
518 518
 	}
519 519
 
520 520
 	/**
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 	 * @return bool
526 526
 	 */
527 527
 	public function starts_future() {
528
-		return $this->start_dt->setTimezone( $this->timezone )->isFuture();
528
+		return $this->start_dt->setTimezone($this->timezone)->isFuture();
529 529
 	}
530 530
 
531 531
 	/**
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	 * @return bool
537 537
 	 */
538 538
 	public function ends_future() {
539
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isFuture() : false;
539
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isFuture() : false;
540 540
 	}
541 541
 
542 542
 	/**
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	 * @return bool
548 548
 	 */
549 549
 	public function started_past() {
550
-		return $this->start_dt->setTimezone( $this->timezone )->isPast();
550
+		return $this->start_dt->setTimezone($this->timezone)->isPast();
551 551
 	}
552 552
 
553 553
 	/**
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	 * @return bool
559 559
 	 */
560 560
 	public function ended_past() {
561
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isPast() : false;
561
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isPast() : false;
562 562
 	}
563 563
 
564 564
 	/**
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
 	 *
571 571
 	 * @return string
572 572
 	 */
573
-	public function get_color( $default = '' ) {
574
-		if ( isset( $this->meta['color'] ) ) {
575
-			return ! empty( $this->meta['color'] ) ? esc_attr( $this->meta['color'] ) : $default;
573
+	public function get_color($default = '') {
574
+		if (isset($this->meta['color'])) {
575
+			return ! empty($this->meta['color']) ? esc_attr($this->meta['color']) : $default;
576 576
 		}
577 577
 		return $default;
578 578
 	}
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 	 * @return array
586 586
 	 */
587 587
 	public function get_attachments() {
588
-		return isset( $this->meta['attachments'] ) ? $this->meta['attachments'] : array();
588
+		return isset($this->meta['attachments']) ? $this->meta['attachments'] : array();
589 589
 	}
590 590
 
591 591
 	/**
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	 * @return array
597 597
 	 */
598 598
 	public function get_attendees() {
599
-		return isset( $this->meta['attendees'] ) ? $this->meta['attendees'] : array();
599
+		return isset($this->meta['attendees']) ? $this->meta['attendees'] : array();
600 600
 	}
601 601
 
602 602
 	/**
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	 * @return array
608 608
 	 */
609 609
 	public function get_organizer() {
610
-		return isset( $this->meta['organizer'] ) ? $this->meta['organizer'] : array();
610
+		return isset($this->meta['organizer']) ? $this->meta['organizer'] : array();
611 611
 	}
612 612
 
613 613
 }
Please login to merge, or discard this patch.
includes/admin/meta-boxes.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Admin\Metaboxes as Metabox;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 
47
-		$settings = get_option( 'simple-calendar_settings_calendars' );
48
-		if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
47
+		$settings = get_option('simple-calendar_settings_calendars');
48
+		if (isset($settings['general']['attach_calendars_posts'])) {
49 49
 			$this->post_types = $settings['general']['attach_calendars_posts'];
50 50
 		}
51 51
 
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 		new Metabox\Upgrade_To_Premium();
56 56
 		//new Metabox\Newsletter();
57 57
 
58
-		do_action( 'simcal_load_meta_boxes' );
58
+		do_action('simcal_load_meta_boxes');
59 59
 
60 60
 		// Add meta boxes.
61
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 30 );
61
+		add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 30);
62 62
 
63 63
 		// Process meta boxes.
64
-		add_action( 'simcal_save_settings_meta','\SimpleCalendar\Admin\Metaboxes\Settings::save', 10, 2 );
65
-		add_action( 'simcal_save_attach_calendar_meta','\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::save', 10, 2 );
64
+		add_action('simcal_save_settings_meta', '\SimpleCalendar\Admin\Metaboxes\Settings::save', 10, 2);
65
+		add_action('simcal_save_attach_calendar_meta', '\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::save', 10, 2);
66 66
 
67 67
 		// Save meta boxes data.
68
-		add_action( 'save_post', array( $this, 'save_meta_boxes' ), 1, 2 );
68
+		add_action('save_post', array($this, 'save_meta_boxes'), 1, 2);
69 69
 
70 70
 		// Uncomment this for debugging $_POST while saving a meta box.
71 71
 		// add_action( 'save_post', function() { echo '<pre>'; print_r( $_POST ); echo '</pre>'; die(); } );
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
 
81 81
 		add_meta_box(
82 82
 			'simcal-calendar-settings',
83
-			__( 'Calendar Settings', 'google-calendar-events' ),
83
+			__('Calendar Settings', 'google-calendar-events'),
84 84
 			'\SimpleCalendar\Admin\Metaboxes\Settings::html',
85 85
 			'calendar',
86 86
 			'normal',
87 87
 			'core'
88 88
 		);
89 89
 
90
-		$addons = apply_filters( 'simcal_installed_addons', array() );
91
-		if ( empty( $addons ) ) {
90
+		$addons = apply_filters('simcal_installed_addons', array());
91
+		if (empty($addons)) {
92 92
 
93 93
 			// Premium add-on feature list and upsell.
94 94
 			add_meta_box(
95 95
 				'simcal-upgrade',
96
-				__( 'Looking for more?', 'google-calendar-events' ),
96
+				__('Looking for more?', 'google-calendar-events'),
97 97
 				'\SimpleCalendar\Admin\Metaboxes\Upgrade_To_Premium::html',
98 98
 				'calendar',
99 99
 				'side',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
 		add_meta_box(
117 117
 			'simcal-get-shortcode',
118
-			__( 'Calendar Shortcode', 'google-calendar-events' ),
118
+			__('Calendar Shortcode', 'google-calendar-events'),
119 119
 			'\SimpleCalendar\Admin\Metaboxes\Get_Shortcode::html',
120 120
 			'calendar',
121 121
 			'side',
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
 		);
124 124
 
125 125
 		// Add meta box if there are calendars.
126
-		if ( ( true == simcal_get_calendars() ) && ! empty( $this->post_types ) ) {
127
-			foreach ( $this->post_types as $post_type ) {
126
+		if ((true == simcal_get_calendars()) && ! empty($this->post_types)) {
127
+			foreach ($this->post_types as $post_type) {
128 128
 				add_meta_box(
129 129
 					'simcal-attach-calendar',
130
-					__( 'Attach Calendar', 'google-calendar-events' ),
130
+					__('Attach Calendar', 'google-calendar-events'),
131 131
 					'\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::html',
132 132
 					$post_type,
133 133
 					'side',
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			}
137 137
 		}
138 138
 
139
-		do_action( 'simcal_add_meta_boxes' );
139
+		do_action('simcal_add_meta_boxes');
140 140
 	}
141 141
 
142 142
 	/**
@@ -149,30 +149,30 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @return void
151 151
 	 */
152
-	public function save_meta_boxes( $post_id, $post ) {
152
+	public function save_meta_boxes($post_id, $post) {
153 153
 
154 154
 		// $post_id and $post are required.
155
-		if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) {
155
+		if (empty($post_id) || empty($post) || self::$saved_meta_boxes) {
156 156
 			return;
157 157
 		}
158 158
 
159 159
 		// Don't save meta boxes for revisions or autosaves.
160
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
160
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
161 161
 			return;
162 162
 		}
163 163
 
164 164
 		// Check the nonce.
165
-		if ( empty( $_POST['simcal_meta_nonce'] ) || ! wp_verify_nonce( $_POST['simcal_meta_nonce'], 'simcal_save_data' ) ) {
165
+		if (empty($_POST['simcal_meta_nonce']) || ! wp_verify_nonce($_POST['simcal_meta_nonce'], 'simcal_save_data')) {
166 166
 			return;
167 167
 		}
168 168
 
169 169
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
170
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
170
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
171 171
 			return;
172 172
 		}
173 173
 
174 174
 		// Check user has permission to edit
175
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
175
+		if ( ! current_user_can('edit_post', $post_id)) {
176 176
 			return;
177 177
 		}
178 178
 
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
 		self::$saved_meta_boxes = true;
186 186
 
187 187
 		// Check the post type.
188
-		if ( 'calendar' == $post->post_type ) {
189
-			do_action( 'simcal_save_settings_meta', $post_id, $post );
190
-		} elseif ( in_array( $post->post_type, $this->post_types ) ) {
191
-			do_action( 'simcal_save_attach_calendar_meta', $post_id, $post );
188
+		if ('calendar' == $post->post_type) {
189
+			do_action('simcal_save_settings_meta', $post_id, $post);
190
+		} elseif (in_array($post->post_type, $this->post_types)) {
191
+			do_action('simcal_save_attach_calendar_meta', $post_id, $post);
192 192
 		}
193 193
 
194
-		do_action( 'simcal_save_meta_boxes', $post_id, $post );
194
+		do_action('simcal_save_meta_boxes', $post_id, $post);
195 195
 	}
196 196
 
197 197
 }
Please login to merge, or discard this patch.
includes/admin/metaboxes/upgrade-to-premium.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Meta_Box;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param \WP_Post $post
28 28
 	 */
29
-	public static function html( $post ) {
29
+	public static function html($post) {
30 30
 		simcal_newsletter_signup();
31 31
 	}
32 32
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param int      $post_id
39 39
 	 * @param \WP_Post $post
40 40
 	 */
41
-	public static function save( $post_id, $post ) {
41
+	public static function save($post_id, $post) {
42 42
 		// This meta box has no persistent settings.
43 43
 	}
44 44
 
Please login to merge, or discard this patch.
includes/functions/admin.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @package SimpleCalendar/Admin/Functions
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return null|\SimpleCalendar\Abstracts\Admin_Page
34 34
  */
35
-function simcal_get_admin_page( $page ) {
35
+function simcal_get_admin_page($page) {
36 36
 	$objects = \SimpleCalendar\plugin()->objects;
37
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_admin_page( $page ) : null;
37
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_admin_page($page) : null;
38 38
 }
39 39
 
40 40
 /**
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
  *
48 48
  * @return null|\SimpleCalendar\Abstracts\Field
49 49
  */
50
-function simcal_get_field( $args, $name = '' ) {
50
+function simcal_get_field($args, $name = '') {
51 51
 	$objects = \SimpleCalendar\plugin()->objects;
52
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_field( $args, $name ) : null;
52
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_field($args, $name) : null;
53 53
 }
54 54
 
55 55
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return void
64 64
  */
65
-function simcal_print_field( $args, $name = '' ) {
65
+function simcal_print_field($args, $name = '') {
66 66
 
67
-	$field = simcal_get_field( $args, $name );
67
+	$field = simcal_get_field($args, $name);
68 68
 
69
-	if ( $field instanceof \SimpleCalendar\Abstracts\Field ) {
69
+	if ($field instanceof \SimpleCalendar\Abstracts\Field) {
70 70
 		$field->html();
71 71
 	}
72 72
 }
@@ -84,33 +84,33 @@  discard block
 block discarded – undo
84 84
  *
85 85
  * @return array|string Sanitized variable
86 86
  */
87
-function simcal_sanitize_input( $var, $func = 'sanitize_text_field'  ) {
87
+function simcal_sanitize_input($var, $func = 'sanitize_text_field') {
88 88
 
89
-	if ( is_null( $var ) ) {
89
+	if (is_null($var)) {
90 90
 		return '';
91 91
 	}
92 92
 
93
-	if ( is_bool( $var ) ) {
94
-		if ( $var === true ) {
93
+	if (is_bool($var)) {
94
+		if ($var === true) {
95 95
 			return 'yes';
96 96
 		} else {
97 97
 			return 'no';
98 98
 		}
99 99
 	}
100 100
 
101
-	if ( is_string( $var ) || is_numeric( $var ) ) {
102
-		$func = is_string( $func ) && function_exists( $func ) ? $func : 'sanitize_text_field';
103
-		return call_user_func( $func, trim( strval( $var ) ) );
101
+	if (is_string($var) || is_numeric($var)) {
102
+		$func = is_string($func) && function_exists($func) ? $func : 'sanitize_text_field';
103
+		return call_user_func($func, trim(strval($var)));
104 104
 	}
105 105
 
106
-	if ( is_object( $var ) ) {
106
+	if (is_object($var)) {
107 107
 		$var = (array) $var;
108 108
 	}
109 109
 
110
-	if ( is_array( $var ) ) {
110
+	if (is_array($var)) {
111 111
 		$array = array();
112
-		foreach ( $var as $k => $v ) {
113
-			$array[ $k ] = simcal_sanitize_input( $v );
112
+		foreach ($var as $k => $v) {
113
+			$array[$k] = simcal_sanitize_input($v);
114 114
 		}
115 115
 		return $array;
116 116
 	}
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
  */
129 129
 function simcal_is_admin_screen() {
130 130
 
131
-	$view = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
131
+	$view = function_exists('get_current_screen') ? get_current_screen() : false;
132 132
 
133
-	if ( $view instanceof WP_Screen ) {
133
+	if ($view instanceof WP_Screen) {
134 134
 
135 135
 		// Screens used by this plugin.
136 136
 		$screens = array(
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'dashboard_page_simple-calendar_credits',
146 146
 			'dashboard_page_simple-calendar_translators',
147 147
 		);
148
-		if ( in_array( $view->id, $screens ) ) {
148
+		if (in_array($view->id, $screens)) {
149 149
 			return $view->id;
150 150
 		}
151 151
 	}
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
  *
165 165
  * @return \SimpleCalendar\Admin\Updater
166 166
  */
167
-function simcal_addon_updater( $_api_url, $_plugin_file, $_api_data = null ) {
168
-	return new \SimpleCalendar\Admin\Updater( $_api_url, $_plugin_file, $_api_data );
167
+function simcal_addon_updater($_api_url, $_plugin_file, $_api_data = null) {
168
+	return new \SimpleCalendar\Admin\Updater($_api_url, $_plugin_file, $_api_data);
169 169
 }
170 170
 
171 171
 /**
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return null|string
179 179
  */
180
-function simcal_get_license_key( $addon ) {
181
-	$licenses = get_option( 'simple-calendar_settings_licenses', array() );
182
-	if ( isset( $licenses['keys'][ $addon ] ) ) {
183
-		return empty( $licenses['keys'][ $addon ] ) ? null : $licenses['keys'][ $addon ];
180
+function simcal_get_license_key($addon) {
181
+	$licenses = get_option('simple-calendar_settings_licenses', array());
182
+	if (isset($licenses['keys'][$addon])) {
183
+		return empty($licenses['keys'][$addon]) ? null : $licenses['keys'][$addon];
184 184
 	}
185 185
 	return null;
186 186
 }
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
  *
197 197
  * @return array|string
198 198
  */
199
-function simcal_get_license_status( $addon = null ) {
200
-	$licenses = get_option( 'simple-calendar_licenses_status', array() );
201
-	return isset( $licenses[ $addon ] ) ? $licenses[ $addon ] : $licenses;
199
+function simcal_get_license_status($addon = null) {
200
+	$licenses = get_option('simple-calendar_licenses_status', array());
201
+	return isset($licenses[$addon]) ? $licenses[$addon] : $licenses;
202 202
 }
203 203
 
204 204
 /**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
  * @since 3.0.0
220 220
  */
221 221
 function simcal_delete_admin_notices() {
222
-	delete_option( 'simple-calendar_admin_notices' );
222
+	delete_option('simple-calendar_admin_notices');
223 223
 }
224 224
 
225 225
 /**
@@ -231,22 +231,22 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @return void
233 233
  */
234
-function simcal_print_shortcode_tip( $post_id ) {
234
+function simcal_print_shortcode_tip($post_id) {
235 235
 
236 236
 	$browser = new \SimpleCalendar\Browser();
237
-	if ( $browser::PLATFORM_APPLE == $browser->getPlatform() ) {
237
+	if ($browser::PLATFORM_APPLE == $browser->getPlatform()) {
238 238
 		$cmd = '&#8984;&#43;C';
239 239
 	} else {
240 240
 		$cmd = 'Ctrl&#43;C';
241 241
 	}
242 242
 
243
-	$shortcut  = sprintf( __( 'Press %s to copy.', 'google-calendar-events' ), $cmd );
244
-	$shortcode = sprintf( '[calendar id="%s"]', $post_id );
243
+	$shortcut  = sprintf(__('Press %s to copy.', 'google-calendar-events'), $cmd);
244
+	$shortcode = sprintf('[calendar id="%s"]', $post_id);
245 245
 
246
-	echo "<input readonly='readonly' " .
247
-				"class='simcal-shortcode simcal-calendar-shortcode simcal-shortcode-tip' " .
248
-				"title='" . $shortcut . "' " .
249
-				"onclick='this.select();' value='" . $shortcode . "' />";
246
+	echo "<input readonly='readonly' ".
247
+				"class='simcal-shortcode simcal-calendar-shortcode simcal-shortcode-tip' ".
248
+				"title='".$shortcut."' ".
249
+				"onclick='this.select();' value='".$shortcode."' />";
250 250
 }
251 251
 
252 252
 /**
@@ -261,20 +261,20 @@  discard block
 block discarded – undo
261 261
  *
262 262
  * @return  string  $url        Full Google Analytics campaign URL
263 263
  */
264
-function simcal_ga_campaign_url( $base_url, $campaign, $content, $raw = false ) {
264
+function simcal_ga_campaign_url($base_url, $campaign, $content, $raw = false) {
265 265
 
266
-	$url = add_query_arg( array(
266
+	$url = add_query_arg(array(
267 267
 		'utm_source'   => 'inside-plugin',
268 268
 		'utm_medium'   => 'link',
269 269
 		'utm_campaign' => $campaign, // i.e. 'core-plugin', 'gcal-pro'
270 270
 		'utm_content'  => $content // i.e. 'sidebar-link', 'settings-link'
271
-	), $base_url );
271
+	), $base_url);
272 272
 
273
-	if ( $raw ) {
274
-		return esc_url_raw( $url );
273
+	if ($raw) {
274
+		return esc_url_raw($url);
275 275
 	}
276 276
 
277
-	return esc_url( $url );
277
+	return esc_url($url);
278 278
 }
279 279
 
280 280
 /**
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
  */
287 287
 function simcal_newsletter_signup() {
288 288
 
289
-	if ( $screen = simcal_is_admin_screen() ) {
289
+	if ($screen = simcal_is_admin_screen()) {
290 290
 
291 291
 		global $current_user;
292 292
 		wp_get_current_user();
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 		<div id="simcal-drip" class="<?php echo $screen; ?>">
298 298
 			<div class="signup">
299 299
 				<p>
300
-					<?php _e( "Enter your name and email and we'll send you a coupon code for <strong>20% off</strong> all Pro Add-on purchases.", 'google-calendar-events' ); ?>
300
+					<?php _e("Enter your name and email and we'll send you a coupon code for <strong>20% off</strong> all Pro Add-on purchases.", 'google-calendar-events'); ?>
301 301
 				</p>
302 302
 
303 303
 				<p>
304
-					<label for="simcal-drip-field-email"><?php _e( 'Your Email', 'google-calendar-events' ); ?></label><br />
304
+					<label for="simcal-drip-field-email"><?php _e('Your Email', 'google-calendar-events'); ?></label><br />
305 305
 					<input type="email"
306 306
 					       id="simcal-drip-field-email"
307 307
 					       name="fields[email]"
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				</p>
310 310
 
311 311
 				<p>
312
-					<label for="simcal-drip-field-first_name"><?php _e( 'First Name', 'google-calendar-events' ); ?></label><br />
312
+					<label for="simcal-drip-field-first_name"><?php _e('First Name', 'google-calendar-events'); ?></label><br />
313 313
 					<input type="text"
314 314
 					       id="simcal-drip-field-first_name"
315 315
 					       name="fields[first_name]"
@@ -318,17 +318,17 @@  discard block
 block discarded – undo
318 318
 				<p class="textright">
319 319
 					<a href="#"
320 320
 					   id="simcal-drip-signup"
321
-					   class="button button-primary"><?php _e( 'Send me the coupon', 'google-calendar-events' ); ?></a>
321
+					   class="button button-primary"><?php _e('Send me the coupon', 'google-calendar-events'); ?></a>
322 322
 				</p>
323 323
 				<div class="textright">
324
-					<em><?php _e( 'No spam. Unsubscribe anytime.', 'google-calendar-events' ); ?></em>
324
+					<em><?php _e('No spam. Unsubscribe anytime.', 'google-calendar-events'); ?></em>
325 325
 					<br/>
326
-					<a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'sidebar-link' ); ?>"
327
-					   target="_blank"><?php _e( 'Just take me the add-ons', 'google-calendar-events' ); ?></a>
326
+					<a href="<?php echo simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'sidebar-link'); ?>"
327
+					   target="_blank"><?php _e('Just take me the add-ons', 'google-calendar-events'); ?></a>
328 328
 				</div>
329 329
 			</div>
330 330
 			<div class="thank-you" style="display: none;">
331
-				<?php _e( 'Thank you!', 'google-calendar-events' ); ?>
331
+				<?php _e('Thank you!', 'google-calendar-events'); ?>
332 332
 			</div>
333 333
 			<div class="clear">
334 334
 			</div>
@@ -347,29 +347,29 @@  discard block
 block discarded – undo
347 347
  */
348 348
 function simcal_upgrade_to_premium() {
349 349
 
350
-	if ( $screen = simcal_is_admin_screen() ) {
350
+	if ($screen = simcal_is_admin_screen()) {
351 351
 		?>
352 352
 		<div class="main">
353 353
 			<p class="heading centered">
354
-				<?php _e( 'Some of the features included with our premium add-ons', 'google-calendar-events' ); ?>
354
+				<?php _e('Some of the features included with our premium add-ons', 'google-calendar-events'); ?>
355 355
 			</p>
356 356
 
357 357
 			<ul>
358
-				<li><div class="dashicons dashicons-yes"></div> <?php _e( 'Display color coded events', 'google-calendar-events' ); ?></li>
359
-				<li><div class="dashicons dashicons-yes"></div> <?php _e( 'Show week & day views', 'google-calendar-events' ); ?></li>
360
-				<li><div class="dashicons dashicons-yes"></div> <?php _e( 'Fast view switching', 'google-calendar-events' ); ?></li>
361
-				<li><div class="dashicons dashicons-yes"></div> <?php _e( 'Event titles & start times in grid', 'google-calendar-events' ); ?></li>
362
-				<li><div class="dashicons dashicons-yes"></div> <?php _e( 'Limit event display times', 'google-calendar-events' ); ?></li>
363
-				<li><div class="dashicons dashicons-yes"></div> <?php _e( 'Display private calendar events', 'google-calendar-events' ); ?></li>
364
-				<li><div class="dashicons dashicons-yes"></div> <?php _e( 'Show attendees & RSVP status', 'google-calendar-events' ); ?></li>
365
-				<li><div class="dashicons dashicons-yes"></div> <?php _e( 'Display attachments', 'google-calendar-events' ); ?></li>
366
-				<li><div class="dashicons dashicons-yes"></div> <?php _e( 'Priority email support', 'google-calendar-events' ); ?></li>
358
+				<li><div class="dashicons dashicons-yes"></div> <?php _e('Display color coded events', 'google-calendar-events'); ?></li>
359
+				<li><div class="dashicons dashicons-yes"></div> <?php _e('Show week & day views', 'google-calendar-events'); ?></li>
360
+				<li><div class="dashicons dashicons-yes"></div> <?php _e('Fast view switching', 'google-calendar-events'); ?></li>
361
+				<li><div class="dashicons dashicons-yes"></div> <?php _e('Event titles & start times in grid', 'google-calendar-events'); ?></li>
362
+				<li><div class="dashicons dashicons-yes"></div> <?php _e('Limit event display times', 'google-calendar-events'); ?></li>
363
+				<li><div class="dashicons dashicons-yes"></div> <?php _e('Display private calendar events', 'google-calendar-events'); ?></li>
364
+				<li><div class="dashicons dashicons-yes"></div> <?php _e('Show attendees & RSVP status', 'google-calendar-events'); ?></li>
365
+				<li><div class="dashicons dashicons-yes"></div> <?php _e('Display attachments', 'google-calendar-events'); ?></li>
366
+				<li><div class="dashicons dashicons-yes"></div> <?php _e('Priority email support', 'google-calendar-events'); ?></li>
367 367
 			</ul>
368 368
 
369 369
 			<div class="centered">
370
-				<a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'sidebar-link' ); ?>"
370
+				<a href="<?php echo simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'sidebar-link'); ?>"
371 371
 				   class="button-primary button-large" target="_blank">
372
-					<?php _e( 'Upgrade to Premium Now', 'google-calendar-events' ); ?></a>
372
+					<?php _e('Upgrade to Premium Now', 'google-calendar-events'); ?></a>
373 373
 			</div>
374 374
 		</div>
375 375
 		<?php
Please login to merge, or discard this patch.
includes/calendars/admin/default-calendar-admin.php 1 patch
Spacing   +112 added lines, -112 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,47 +76,47 @@  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
 
88 88
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
89
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Event Bubbles', 'google-calendar-events' ); ?></label></th>
89
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Event Bubbles', 'google-calendar-events'); ?></label></th>
90 90
 				<td>
91 91
 					<?php
92 92
 
93
-					$bubbles = get_post_meta( $post_id, '_default_calendar_event_bubble_trigger', true );
93
+					$bubbles = get_post_meta($post_id, '_default_calendar_event_bubble_trigger', true);
94 94
 
95
-					simcal_print_field( array(
95
+					simcal_print_field(array(
96 96
 						'type'    => 'radio',
97 97
 						'inline'  => 'inline',
98 98
 						'name'    => '_default_calendar_event_bubble_trigger',
99 99
 						'id'      => '_default_calendar_event_bubble_trigger',
100
-						'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' ),
100
+						'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'),
101 101
 						'value'   => $bubbles ? $bubbles : 'hover',
102 102
 						'default' => 'hover',
103 103
 						'options' => array(
104
-							'click' => __( 'Click', 'google-calendar-events' ),
105
-							'hover' => __( 'Hover', 'google-calendar-events' ),
104
+							'click' => __('Click', 'google-calendar-events'),
105
+							'hover' => __('Hover', 'google-calendar-events'),
106 106
 						),
107
-					) );
107
+					));
108 108
 
109 109
 					?>
110 110
 				</td>
111 111
 			</tr>
112 112
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
113
-				<th><label for="_default_calendar_trim_titles"><?php _e( 'Trim Event Titles', 'google-calendar-events' ); ?></label></th>
113
+				<th><label for="_default_calendar_trim_titles"><?php _e('Trim Event Titles', 'google-calendar-events'); ?></label></th>
114 114
 				<td>
115 115
 					<?php
116 116
 
117
-					$trim = get_post_meta( $post_id, '_default_calendar_trim_titles', true );
117
+					$trim = get_post_meta($post_id, '_default_calendar_trim_titles', true);
118 118
 
119
-					simcal_print_field( array(
119
+					simcal_print_field(array(
120 120
 						'type'        => 'checkbox',
121 121
 						'name'        => '_default_calendar_trim_titles',
122 122
 						'id'          => '_default_calendar_trim_titles',
@@ -127,34 +127,34 @@  discard block
 block discarded – undo
127 127
 						'attributes'  => array(
128 128
 							'data-show-next-if-value' => 'yes',
129 129
 						),
130
-					) );
130
+					));
131 131
 
132
-					simcal_print_field( array(
132
+					simcal_print_field(array(
133 133
 						'type'       => 'standard',
134 134
 						'subtype'    => 'number',
135 135
 						'name'       => '_default_calendar_trim_titles_chars',
136 136
 						'id'         => '_default_calendar_trim_titles_chars',
137
-						'tooltip'    => __( 'Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events' ),
137
+						'tooltip'    => __('Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events'),
138 138
 						'class'      => array(
139 139
 							'simcal-field-tiny',
140 140
 						),
141
-						'value'      => 'yes' == $trim ? strval( max( absint( get_post_meta( $post_id, '_default_calendar_trim_titles_chars', true ) ), 1 ) ) : '20',
141
+						'value'      => 'yes' == $trim ? strval(max(absint(get_post_meta($post_id, '_default_calendar_trim_titles_chars', true)), 1)) : '20',
142 142
 						'attributes' => array(
143 143
 							'min'     => '1',
144 144
 						),
145
-					) );
145
+					));
146 146
 
147 147
 					?>
148 148
 				</td>
149 149
 			</tr>
150 150
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
151
-				<th><label for="_default_calendar_list_grouped_span"><?php _e( 'Span', 'google-calendar-events' ); ?></label></th>
151
+				<th><label for="_default_calendar_list_grouped_span"><?php _e('Span', 'google-calendar-events'); ?></label></th>
152 152
 				<td>
153 153
 					<?php
154 154
 
155
-					$list_span = max( absint( get_post_meta( $post_id, '_default_calendar_list_range_span', true ) ), 1 );
155
+					$list_span = max(absint(get_post_meta($post_id, '_default_calendar_list_range_span', true)), 1);
156 156
 
157
-					simcal_print_field( array(
157
+					simcal_print_field(array(
158 158
 						'type'    => 'standard',
159 159
 						'subtype' => 'number',
160 160
 						'name'    => '_default_calendar_list_range_span',
@@ -163,78 +163,78 @@  discard block
 block discarded – undo
163 163
 							'simcal-field-tiny',
164 164
 							'simcal-field-inline',
165 165
 						),
166
-						'value'   => strval( $list_span ),
166
+						'value'   => strval($list_span),
167 167
 						'attributes'  => array(
168 168
 							'min' => '1',
169 169
 						),
170
-					) );
170
+					));
171 171
 
172
-					$list_type = get_post_meta( $post_id, '_default_calendar_list_range_type', true );
172
+					$list_type = get_post_meta($post_id, '_default_calendar_list_range_type', true);
173 173
 
174
-					simcal_print_field( array(
174
+					simcal_print_field(array(
175 175
 						'type'    => 'select',
176 176
 						'name'    => '_default_calendar_list_range_type',
177 177
 						'id'      => '_default_calendar_list_range_type',
178
-						'tooltip' => __( 'Range of events to show on each calendar page.', 'google-calendar-events' ),
178
+						'tooltip' => __('Range of events to show on each calendar page.', 'google-calendar-events'),
179 179
 						'class'   => array(
180 180
 							'simcal-field-inline',
181 181
 						),
182 182
 						'value'   => $list_type,
183 183
 						'options' => array(
184
-							'monthly' => __( 'Month(s)', 'google-calendar-events' ),
185
-							'weekly'  => __( 'Week(s)', 'google-calendar-events' ),
186
-							'daily'   => __( 'Day(s)', 'google-calendar-events' ),
187
-							'events'  => __( 'Event(s)', 'google-calendar-events' ),
184
+							'monthly' => __('Month(s)', 'google-calendar-events'),
185
+							'weekly'  => __('Week(s)', 'google-calendar-events'),
186
+							'daily'   => __('Day(s)', 'google-calendar-events'),
187
+							'events'  => __('Event(s)', 'google-calendar-events'),
188 188
 						),
189
-					) );
189
+					));
190 190
 
191 191
 					?>
192 192
 				</td>
193 193
 			</tr>
194 194
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
195
-				<th><label for="_default_calendar_list_header"><?php _e( 'Hide Header', 'google-calendar-events' ); ?></label></th>
195
+				<th><label for="_default_calendar_list_header"><?php _e('Hide Header', 'google-calendar-events'); ?></label></th>
196 196
 				<td>
197 197
 					<?php
198 198
 
199
-					$header = get_post_meta( $post_id, '_default_calendar_list_header', true );
199
+					$header = get_post_meta($post_id, '_default_calendar_list_header', true);
200 200
 
201
-					simcal_print_field( array(
201
+					simcal_print_field(array(
202 202
 						'type'    => 'checkbox',
203 203
 						'name'    => '_default_calendar_list_header',
204 204
 						'id'      => '_default_calendar_list_header',
205
-						'tooltip' => __( 'You can use this to hide the month header for this calendar.', 'google-calendar-events' ),
205
+						'tooltip' => __('You can use this to hide the month header for this calendar.', 'google-calendar-events'),
206 206
 						'value'   => 'yes' == $header ? 'yes' : 'no',
207
-					) );
207
+					));
208 208
 
209 209
 					?>
210 210
 				</td>
211 211
 			</tr>
212 212
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
213
-				<th><label for="_default_calendar_compact_list"><?php _e( 'Compact List', 'google-calendar-events' ); ?></label></th>
213
+				<th><label for="_default_calendar_compact_list"><?php _e('Compact List', 'google-calendar-events'); ?></label></th>
214 214
 				<td>
215 215
 					<?php
216 216
 
217
-					$compact = get_post_meta( $post_id, '_default_calendar_compact_list', true );
217
+					$compact = get_post_meta($post_id, '_default_calendar_compact_list', true);
218 218
 
219
-					simcal_print_field( array(
219
+					simcal_print_field(array(
220 220
 						'type'    => 'checkbox',
221 221
 						'name'    => '_default_calendar_compact_list',
222 222
 						'id'      => '_default_calendar_compact_list',
223
-						'tooltip' => __( 'Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events' ),
223
+						'tooltip' => __('Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events'),
224 224
 						'value'   => 'yes' == $compact ? 'yes' : 'no',
225
-					) );
225
+					));
226 226
 
227 227
 					?>
228 228
 				</td>
229 229
 			</tr>
230 230
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list"  style="display: none;">
231
-				<th><label for="_default_calendar_limit_visible_events"><?php _e( 'Limit Visible Events', 'google-calendar-events' ); ?></label></th>
231
+				<th><label for="_default_calendar_limit_visible_events"><?php _e('Limit Visible Events', 'google-calendar-events'); ?></label></th>
232 232
 				<td>
233 233
 					<?php
234 234
 
235
-					$limit = get_post_meta( $post_id, '_default_calendar_limit_visible_events', true );
235
+					$limit = get_post_meta($post_id, '_default_calendar_limit_visible_events', true);
236 236
 
237
-					simcal_print_field( array(
237
+					simcal_print_field(array(
238 238
 						'type'        => 'checkbox',
239 239
 						'name'        => '_default_calendar_limit_visible_events',
240 240
 						'id'          => '_default_calendar_limit_visible_events',
@@ -245,17 +245,17 @@  discard block
 block discarded – undo
245 245
 						'attributes'  => array(
246 246
 							'data-show-next-if-value' => 'yes',
247 247
 						)
248
-					) );
248
+					));
249 249
 
250
-					$visible_events = absint( get_post_meta( $post_id, '_default_calendar_visible_events', true ) );
250
+					$visible_events = absint(get_post_meta($post_id, '_default_calendar_visible_events', true));
251 251
 					$visible_events = $visible_events > 0 ? $visible_events : 3;
252 252
 
253
-					simcal_print_field( array(
253
+					simcal_print_field(array(
254 254
 						'type'       => 'standard',
255 255
 						'subtype'    => 'number',
256 256
 						'name'       => '_default_calendar_visible_events',
257 257
 						'id'         => '_default_calendar_visible_events',
258
-						'tooltip'    => __( 'Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events' ),
258
+						'tooltip'    => __('Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events'),
259 259
 						'class'      => array(
260 260
 							'simcal-field-tiny',
261 261
 						),
@@ -263,39 +263,39 @@  discard block
 block discarded – undo
263 263
 						'attributes' => array(
264 264
 							'min'     => '1',
265 265
 						)
266
-					) );
266
+					));
267 267
 
268 268
 					?>
269 269
 				</td>
270 270
 			</tr>
271 271
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
272
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Expand Multi-day Events', 'google-calendar-events' ); ?></label></th>
272
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Expand Multi-day Events', 'google-calendar-events'); ?></label></th>
273 273
 				<td>
274 274
 					<?php
275 275
 
276
-					$post_meta = get_post_meta( $post_id );
276
+					$post_meta = get_post_meta($post_id);
277 277
 
278
-					if ( ! is_array( $post_meta ) && ! empty( $post_meta ) ) {
278
+					if ( ! is_array($post_meta) && ! empty($post_meta)) {
279 279
 						$multi_day_value = 'current_day_only';
280 280
 					} else {
281
-						$multi_day_value = get_post_meta( $post_id, '_default_calendar_expand_multi_day_events', true );
281
+						$multi_day_value = get_post_meta($post_id, '_default_calendar_expand_multi_day_events', true);
282 282
 					}
283 283
 
284
-					simcal_print_field( array(
284
+					simcal_print_field(array(
285 285
 						'type'    => 'select',
286 286
 						'name'    => '_default_calendar_expand_multi_day_events',
287 287
 						'id'      => '_default_calendar_expand_multi_day_events',
288
-						'tooltip' => __( 'For events spanning multiple days, you can display them on each day of the event, ' .
289
-						                 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
290
-						                 'Third option applies to list views only.', 'google-calendar-events' ),
288
+						'tooltip' => __('For events spanning multiple days, you can display them on each day of the event, '.
289
+						                 'only on the first day of the event, or on all days of the event, but only up to the current day. '.
290
+						                 'Third option applies to list views only.', 'google-calendar-events'),
291 291
 						'value'   => $multi_day_value,
292 292
 						'options' => array(
293
-							'yes'              => __( 'Yes, display on all days of event', 'google-calendar-events' ),
294
-							'no'               => __( 'No, display only on first day of event', 'google-calendar-events' ),
295
-							'current_day_only' => __( 'No, display on all days of event up to current day (list view only)', 'google-calendar-events' ),
293
+							'yes'              => __('Yes, display on all days of event', 'google-calendar-events'),
294
+							'no'               => __('No, display only on first day of event', 'google-calendar-events'),
295
+							'current_day_only' => __('No, display on all days of event up to current day (list view only)', 'google-calendar-events'),
296 296
 						),
297 297
 						'default' => 'yes',
298
-					) );
298
+					));
299 299
 
300 300
 					?>
301 301
 				</td>
@@ -304,72 +304,72 @@  discard block
 block discarded – undo
304 304
 			<?php
305 305
 
306 306
 			// TODO Defaults repeated here and in process_meta(). Need to consolidate at some point.
307
-			$settings                   = get_option( 'simple-calendar_settings_calendars' );
308
-			$default_theme              = isset( $settings['default-calendar']['theme'] ) ? $settings['default-calendar']['theme'] : 'light';
309
-			$default_today_color        = isset( $settings['default-calendar']['today_color'] ) ? $settings['default-calendar']['today_color'] : '#1e73be';
310
-			$default_days_events_color  = isset( $settings['default-calendar']['days_events_color'] ) ? $settings['default-calendar']['days_events_color'] : '#000000';
307
+			$settings                   = get_option('simple-calendar_settings_calendars');
308
+			$default_theme              = isset($settings['default-calendar']['theme']) ? $settings['default-calendar']['theme'] : 'light';
309
+			$default_today_color        = isset($settings['default-calendar']['today_color']) ? $settings['default-calendar']['today_color'] : '#1e73be';
310
+			$default_days_events_color  = isset($settings['default-calendar']['days_events_color']) ? $settings['default-calendar']['days_events_color'] : '#000000';
311 311
 
312 312
 			?>
313 313
 			<tbody class="simcal-panel-section">
314 314
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
315
-				<th><label for="_default_calendar_style_theme"><?php _e( 'Theme', 'google-calendar-events' ); ?></label></th>
315
+				<th><label for="_default_calendar_style_theme"><?php _e('Theme', 'google-calendar-events'); ?></label></th>
316 316
 				<td>
317 317
 					<?php
318 318
 
319
-					$saved = get_post_meta( $post_id, '_default_calendar_style_theme', true );
319
+					$saved = get_post_meta($post_id, '_default_calendar_style_theme', true);
320 320
 					$value = ! $saved ? $default_theme : $saved;
321 321
 
322
-					simcal_print_field( array(
322
+					simcal_print_field(array(
323 323
 						'type'    => 'select',
324 324
 						'name'    => '_default_calendar_style_theme',
325 325
 						'id'      => '_default_calendar_style_theme',
326 326
 						'value'   => $value,
327
-						'tooltip' => __( 'Choose a calendar theme to match your site theme.', 'google-calendar-events' ),
327
+						'tooltip' => __('Choose a calendar theme to match your site theme.', 'google-calendar-events'),
328 328
 						'options' => array(
329
-							'light' => __( 'Light', 'google-calendar-events' ),
330
-							'dark' => __( 'Dark', 'google-calendar-events' ),
329
+							'light' => __('Light', 'google-calendar-events'),
330
+							'dark' => __('Dark', 'google-calendar-events'),
331 331
 						),
332
-					) );
332
+					));
333 333
 
334 334
 					?>
335 335
 				</td>
336 336
 			</tr>
337 337
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
338
-				<th><label for="_default_calendar_style_today"><?php _e( 'Today', 'google-calendar-events' ); ?></label></th>
338
+				<th><label for="_default_calendar_style_today"><?php _e('Today', 'google-calendar-events'); ?></label></th>
339 339
 				<td>
340 340
 					<?php
341 341
 
342
-					$saved = get_post_meta( $post_id, '_default_calendar_style_today', true );
342
+					$saved = get_post_meta($post_id, '_default_calendar_style_today', true);
343 343
 					$value = ! $saved ? $default_today_color : $saved;
344 344
 
345
-					simcal_print_field( array(
345
+					simcal_print_field(array(
346 346
 						'type'    => 'standard',
347 347
 						'subtype' => 'color-picker',
348 348
 						'name'    => '_default_calendar_style_today',
349 349
 						'id'      => '_default_calendar_style_today',
350 350
 						'value'   => $value,
351
-						'tooltip' => __( "This option will set the background color for today's date. It will change the day number background and the border around the current day.", 'google-calendar-events' ),
352
-					) );
351
+						'tooltip' => __("This option will set the background color for today's date. It will change the day number background and the border around the current day.", 'google-calendar-events'),
352
+					));
353 353
 
354 354
 					?>
355 355
 				</td>
356 356
 			</tr>
357 357
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
358
-				<th><label for="_default_calendar_style_days_events"><?php _e( 'Days with Events', 'google-calendar-events' ); ?></label></th>
358
+				<th><label for="_default_calendar_style_days_events"><?php _e('Days with Events', 'google-calendar-events'); ?></label></th>
359 359
 				<td>
360 360
 					<?php
361 361
 
362
-					$saved = get_post_meta( $post_id, '_default_calendar_style_days_events', true );
362
+					$saved = get_post_meta($post_id, '_default_calendar_style_days_events', true);
363 363
 					$value = ! $saved ? $default_days_events_color : $saved;
364 364
 
365
-					simcal_print_field( array(
365
+					simcal_print_field(array(
366 366
 						'type'    => 'standard',
367 367
 						'subtype' => 'color-picker',
368 368
 						'name'    => '_default_calendar_style_days_events',
369 369
 						'id'      => '_default_calendar_style_days_events',
370 370
 						'value'   => $value,
371
-						'tooltip' => __( 'This setting will modify the day number background for any days that have events on them.', 'google-calendar-events' ),
372
-					) );
371
+						'tooltip' => __('This setting will modify the day number background for any days that have events on them.', 'google-calendar-events'),
372
+					));
373 373
 
374 374
 					?>
375 375
 				</td>
@@ -391,55 +391,55 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @param int $post_id
393 393
 	 */
394
-	public function process_meta( $post_id ) {
394
+	public function process_meta($post_id) {
395 395
 
396 396
 		// Theme.
397
-		$theme = isset( $_POST['_default_calendar_style_theme'] ) ? sanitize_key( $_POST['_default_calendar_style_theme'] ) : 'light';
398
-		update_post_meta( $post_id, '_default_calendar_style_theme', $theme );
397
+		$theme = isset($_POST['_default_calendar_style_theme']) ? sanitize_key($_POST['_default_calendar_style_theme']) : 'light';
398
+		update_post_meta($post_id, '_default_calendar_style_theme', $theme);
399 399
 
400 400
 		// Today color.
401
-		$today_color = isset( $_POST['_default_calendar_style_today'] ) ? sanitize_text_field( $_POST['_default_calendar_style_today'] ) : '#1e73be';
402
-		update_post_meta( $post_id, '_default_calendar_style_today', $today_color );
401
+		$today_color = isset($_POST['_default_calendar_style_today']) ? sanitize_text_field($_POST['_default_calendar_style_today']) : '#1e73be';
402
+		update_post_meta($post_id, '_default_calendar_style_today', $today_color);
403 403
 
404 404
 		// Days with events color.
405
-		$days_events_color = isset( $_POST['_default_calendar_style_days_events'] ) ? sanitize_text_field( $_POST['_default_calendar_style_days_events'] ) : '#000000';
406
-		update_post_meta( $post_id, '_default_calendar_style_days_events', $days_events_color );
405
+		$days_events_color = isset($_POST['_default_calendar_style_days_events']) ? sanitize_text_field($_POST['_default_calendar_style_days_events']) : '#000000';
406
+		update_post_meta($post_id, '_default_calendar_style_days_events', $days_events_color);
407 407
 
408 408
 		// List range span.
409
-		$span = isset( $_POST['_default_calendar_list_range_span'] ) ? max( absint( $_POST['_default_calendar_list_range_span'] ), 1 ) : 1;
410
-		update_post_meta( $post_id, '_default_calendar_list_range_span', $span );
409
+		$span = isset($_POST['_default_calendar_list_range_span']) ? max(absint($_POST['_default_calendar_list_range_span']), 1) : 1;
410
+		update_post_meta($post_id, '_default_calendar_list_range_span', $span);
411 411
 
412 412
 		// List range type.
413
-		$group = isset( $_POST['_default_calendar_list_range_type'] ) ? sanitize_key( $_POST['_default_calendar_list_range_type'] ) : 'monthly';
414
-		update_post_meta( $post_id, '_default_calendar_list_range_type', $group );
413
+		$group = isset($_POST['_default_calendar_list_range_type']) ? sanitize_key($_POST['_default_calendar_list_range_type']) : 'monthly';
414
+		update_post_meta($post_id, '_default_calendar_list_range_type', $group);
415 415
 
416 416
 		// Hide header.
417
-		$header = isset( $_POST['_default_calendar_list_header'] ) ? 'yes' : 'no';
418
-		update_post_meta( $post_id, '_default_calendar_list_header', $header );
417
+		$header = isset($_POST['_default_calendar_list_header']) ? 'yes' : 'no';
418
+		update_post_meta($post_id, '_default_calendar_list_header', $header);
419 419
 
420 420
 		// Compact list.
421
-		$compact = isset( $_POST['_default_calendar_compact_list'] ) ? 'yes' : 'no';
422
-		update_post_meta( $post_id, '_default_calendar_compact_list', $compact );
421
+		$compact = isset($_POST['_default_calendar_compact_list']) ? 'yes' : 'no';
422
+		update_post_meta($post_id, '_default_calendar_compact_list', $compact);
423 423
 
424 424
 		// Limit number of initially visible daily events.
425
-		$limit = isset( $_POST['_default_calendar_limit_visible_events'] ) ? 'yes' : 'no';
426
-		update_post_meta( $post_id, '_default_calendar_limit_visible_events', $limit );
427
-		$number = isset( $_POST['_default_calendar_visible_events'] ) ? absint( $_POST['_default_calendar_visible_events'] ) : 3;
428
-		update_post_meta( $post_id, '_default_calendar_visible_events', $number );
425
+		$limit = isset($_POST['_default_calendar_limit_visible_events']) ? 'yes' : 'no';
426
+		update_post_meta($post_id, '_default_calendar_limit_visible_events', $limit);
427
+		$number = isset($_POST['_default_calendar_visible_events']) ? absint($_POST['_default_calendar_visible_events']) : 3;
428
+		update_post_meta($post_id, '_default_calendar_visible_events', $number);
429 429
 
430 430
 		// Grid event bubbles action.
431
-		$bubbles = isset( $_POST['_default_calendar_event_bubble_trigger'] ) ? esc_attr( $_POST['_default_calendar_event_bubble_trigger'] ) : 'hover';
432
-		update_post_meta( $post_id, '_default_calendar_event_bubble_trigger', $bubbles );
431
+		$bubbles = isset($_POST['_default_calendar_event_bubble_trigger']) ? esc_attr($_POST['_default_calendar_event_bubble_trigger']) : 'hover';
432
+		update_post_meta($post_id, '_default_calendar_event_bubble_trigger', $bubbles);
433 433
 
434 434
 		// Trim event titles characters length.
435
-		$trim = isset( $_POST['_default_calendar_trim_titles'] ) ? 'yes' : 'no';
436
-		update_post_meta( $post_id, '_default_calendar_trim_titles', $trim );
437
-		$chars = isset( $_POST['_default_calendar_trim_titles_chars'] ) ? max( absint( $_POST['_default_calendar_trim_titles_chars'] ), 1 ) : 20;
438
-		update_post_meta( $post_id, '_default_calendar_trim_titles_chars', $chars );
435
+		$trim = isset($_POST['_default_calendar_trim_titles']) ? 'yes' : 'no';
436
+		update_post_meta($post_id, '_default_calendar_trim_titles', $trim);
437
+		$chars = isset($_POST['_default_calendar_trim_titles_chars']) ? max(absint($_POST['_default_calendar_trim_titles_chars']), 1) : 20;
438
+		update_post_meta($post_id, '_default_calendar_trim_titles_chars', $chars);
439 439
 
440 440
 		// Expand multiple day events on each day.
441
-		$multi_day = isset( $_POST['_default_calendar_expand_multi_day_events'] ) && ! empty( $_POST['_default_calendar_expand_multi_day_events'] ) ? sanitize_key( $_POST['_default_calendar_expand_multi_day_events'] ) : 'yes';
442
-		update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', $multi_day );
441
+		$multi_day = isset($_POST['_default_calendar_expand_multi_day_events']) && ! empty($_POST['_default_calendar_expand_multi_day_events']) ? sanitize_key($_POST['_default_calendar_expand_multi_day_events']) : 'yes';
442
+		update_post_meta($post_id, '_default_calendar_expand_multi_day_events', $multi_day);
443 443
 
444 444
 	}
445 445
 
Please login to merge, or discard this patch.
includes/calendars/default-calendar.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Calendars\Views;
14 14
 use SimpleCalendar\Events\Event;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -105,36 +105,36 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @param int|object|\WP_Post|Calendar $calendar
107 107
 	 */
108
-	public function __construct( $calendar ) {
108
+	public function __construct($calendar) {
109 109
 
110 110
 		$this->type  = 'default-calendar';
111
-		$this->name  = __( 'Default', 'google-calendar-events' );
112
-		$this->views = apply_filters( 'simcal_default_calendar_views', array(
113
-			'grid' => __( 'Grid', 'google-calendar-events' ),
114
-			'list' => __( 'List', 'google-calendar-events' ),
115
-		) );
111
+		$this->name  = __('Default', 'google-calendar-events');
112
+		$this->views = apply_filters('simcal_default_calendar_views', array(
113
+			'grid' => __('Grid', 'google-calendar-events'),
114
+			'list' => __('List', 'google-calendar-events'),
115
+		));
116 116
 
117
-		parent::__construct( $calendar );
117
+		parent::__construct($calendar);
118 118
 
119
-		if ( ! is_null( $this->post ) ) {
119
+		if ( ! is_null($this->post)) {
120 120
 
121
-			$this->set_properties( $this->view->get_type() );
121
+			$this->set_properties($this->view->get_type());
122 122
 
123 123
 			$id    = $this->id;
124 124
 			$theme = $this->theme;
125 125
 
126
-			add_filter( 'simcal_calendar_class', function ( $class, $post_id ) use ( $theme, $id ) {
127
-				if ( in_array( 'default-calendar', $class ) && $post_id === $id ) {
128
-					array_push( $class, 'default-calendar-' . $theme );
126
+			add_filter('simcal_calendar_class', function($class, $post_id) use ($theme, $id) {
127
+				if (in_array('default-calendar', $class) && $post_id === $id) {
128
+					array_push($class, 'default-calendar-'.$theme);
129 129
 				}
130 130
 
131 131
 				return $class;
132
-			}, 10, 2 );
132
+			}, 10, 2);
133 133
 
134 134
 		}
135 135
 
136 136
 		// Calendar settings handling.
137
-		if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
137
+		if (is_admin() && ! defined('DOING_AJAX')) {
138 138
 			$admin          = new Default_Calendar_Admin();
139 139
 			$this->settings = $admin->settings_fields();
140 140
 		}
@@ -148,49 +148,49 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @param  $view
150 150
 	 */
151
-	private function set_properties( $view ) {
151
+	private function set_properties($view) {
152 152
 
153 153
 		// Set styles.
154
-		if ( 'dark' == get_post_meta( $this->id, '_default_calendar_style_theme', true ) ) {
154
+		if ('dark' == get_post_meta($this->id, '_default_calendar_style_theme', true)) {
155 155
 			$this->theme = 'dark';
156 156
 		}
157
-		if ( $today_color = get_post_meta( $this->id, '_default_calendar_style_today', true ) ) {
158
-			$this->today_color = esc_attr( $today_color );
157
+		if ($today_color = get_post_meta($this->id, '_default_calendar_style_today', true)) {
158
+			$this->today_color = esc_attr($today_color);
159 159
 		}
160
-		if ( $day_events_color = get_post_meta( $this->id, '_default_calendar_style_days_events', true ) ) {
161
-			$this->days_events_color = esc_attr( $day_events_color );
160
+		if ($day_events_color = get_post_meta($this->id, '_default_calendar_style_days_events', true)) {
161
+			$this->days_events_color = esc_attr($day_events_color);
162 162
 		}
163 163
 
164 164
 		// Hide too many events.
165
-		if ( 'yes' == get_post_meta( $this->id, '_default_calendar_limit_visible_events', true ) ) {
166
-			$this->events_limit = absint( get_post_meta( $this->id, '_default_calendar_visible_events', true ) );
165
+		if ('yes' == get_post_meta($this->id, '_default_calendar_limit_visible_events', true)) {
166
+			$this->events_limit = absint(get_post_meta($this->id, '_default_calendar_visible_events', true));
167 167
 		}
168 168
 
169 169
 		// Expand multiple day events.
170
-		if ( 'yes' == get_post_meta( $this->id, '_default_calendar_expand_multi_day_events', true ) || ( 'list' == $view && 'current_day_only' == get_post_meta( $this->id, '_default_calendar_expand_multi_day_events', true ) ) ) {
170
+		if ('yes' == get_post_meta($this->id, '_default_calendar_expand_multi_day_events', true) || ('list' == $view && 'current_day_only' == get_post_meta($this->id, '_default_calendar_expand_multi_day_events', true))) {
171 171
 			$this->events = $this->expand_multiple_days_events();
172 172
 		}
173 173
 
174
-		if ( 'grid' == $view ) {
174
+		if ('grid' == $view) {
175 175
 
176 176
 			// Use hover to open event bubbles.
177
-			if ( 'hover' == get_post_meta( $this->id, '_default_calendar_event_bubble_trigger', true ) ) {
177
+			if ('hover' == get_post_meta($this->id, '_default_calendar_event_bubble_trigger', true)) {
178 178
 				$this->event_bubble_trigger = 'hover';
179 179
 			}
180 180
 
181 181
 			// Trim long event titles.
182
-			if ( 'yes' == get_post_meta( $this->id, '_default_calendar_trim_titles', true ) ) {
183
-				$this->trim_titles = max( absint( get_post_meta( $this->id, '_default_calendar_trim_titles_chars', true ) ), 1 );
182
+			if ('yes' == get_post_meta($this->id, '_default_calendar_trim_titles', true)) {
183
+				$this->trim_titles = max(absint(get_post_meta($this->id, '_default_calendar_trim_titles_chars', true)), 1);
184 184
 			}
185 185
 
186 186
 		} else {
187 187
 
188 188
 			// List range.
189
-			$this->group_type = esc_attr( get_post_meta( $this->id, '_default_calendar_list_range_type', true ) );
190
-			$this->group_span = max( absint( get_post_meta( $this->id, '_default_calendar_list_range_span', true ) ), 1 );
189
+			$this->group_type = esc_attr(get_post_meta($this->id, '_default_calendar_list_range_type', true));
190
+			$this->group_span = max(absint(get_post_meta($this->id, '_default_calendar_list_range_span', true)), 1);
191 191
 
192 192
 			// Make the list look more compact.
193
-			if ( 'yes' == get_post_meta( $this->id, '_default_calendar_compact_list', true ) ) {
193
+			if ('yes' == get_post_meta($this->id, '_default_calendar_compact_list', true)) {
194 194
 				$this->compact_list = true;
195 195
 			}
196 196
 
@@ -211,19 +211,19 @@  discard block
 block discarded – undo
211 211
 		$old_events = $this->events;
212 212
 		$new_events = array();
213 213
 
214
-		if ( ! empty( $old_events ) ) {
214
+		if ( ! empty($old_events)) {
215 215
 
216
-			foreach ( $old_events as $events ) {
217
-				foreach ( $events as $event ) {
218
-					if ( $event instanceof Event ) {
219
-						if ( false !== $event->multiple_days ) {
216
+			foreach ($old_events as $events) {
217
+				foreach ($events as $event) {
218
+					if ($event instanceof Event) {
219
+						if (false !== $event->multiple_days) {
220 220
 							$days = $event->multiple_days;
221 221
 
222
-							if ( $days > 0 ) {
222
+							if ($days > 0) {
223 223
 
224
-								for ( $d = 1; $d <= $days; $d++ ) {
225
-									$current_day_ts = $event->start + ( $d * DAY_IN_SECONDS - 1 );
226
-									$new_events[ intval( $current_day_ts ) ][] = $event;
224
+								for ($d = 1; $d <= $days; $d++) {
225
+									$current_day_ts = $event->start + ($d * DAY_IN_SECONDS - 1);
226
+									$new_events[intval($current_day_ts)][] = $event;
227 227
 								}
228 228
 							}
229 229
 						}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		}
236 236
 
237 237
 		$events = $old_events + $new_events;
238
-		ksort( $events, SORT_NUMERIC );
238
+		ksort($events, SORT_NUMERIC);
239 239
 
240 240
 		return $events;
241 241
 	}
@@ -251,16 +251,16 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @return null|Calendar_View
253 253
 	 */
254
-	public function get_view( $view = '' ) {
254
+	public function get_view($view = '') {
255 255
 
256
-		$view = ! empty( $view ) ? $view : 'grid';
256
+		$view = ! empty($view) ? $view : 'grid';
257 257
 
258
-		do_action( 'simcal_calendar_get_view', $this->type, $view );
258
+		do_action('simcal_calendar_get_view', $this->type, $view);
259 259
 
260
-		if ( 'grid' == $view ) {
261
-			return new Views\Default_Calendar_Grid( $this );
262
-		} elseif ( 'list' == $view ) {
263
-			return new Views\Default_Calendar_List( $this );
260
+		if ('grid' == $view) {
261
+			return new Views\Default_Calendar_Grid($this);
262
+		} elseif ('list' == $view) {
263
+			return new Views\Default_Calendar_List($this);
264 264
 		}
265 265
 
266 266
 		return null;
Please login to merge, or discard this patch.
includes/calendars/views/default-calendar-list.php 1 patch
Spacing   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Calendars\Default_Calendar;
14 14
 use SimpleCalendar\Events\Event;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @param string|Calendar $calendar
77 77
 	 */
78
-	public function __construct( $calendar = '' ) {
78
+	public function __construct($calendar = '') {
79 79
 		$this->calendar = $calendar;
80 80
 	}
81 81
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return string
110 110
 	 */
111 111
 	public function get_name() {
112
-		return __( 'List', 'google-calendar-events' );
112
+		return __('List', 'google-calendar-events');
113 113
 	}
114 114
 
115 115
 	/**
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * @since 3.0.0
119 119
 	 */
120 120
 	public function add_ajax_actions() {
121
-		add_action( 'wp_ajax_simcal_default_calendar_draw_list', array( $this, 'draw_list_ajax' ) );
122
-		add_action( 'wp_ajax_nopriv_simcal_default_calendar_draw_list', array( $this, 'draw_list_ajax' ) );
121
+		add_action('wp_ajax_simcal_default_calendar_draw_list', array($this, 'draw_list_ajax'));
122
+		add_action('wp_ajax_nopriv_simcal_default_calendar_draw_list', array($this, 'draw_list_ajax'));
123 123
 	}
124 124
 
125 125
 	/**
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return array
135 135
 	 */
136
-	public function scripts( $min = '' ) {
136
+	public function scripts($min = '') {
137 137
 		return array(
138 138
 			'simcal-qtip' => array(
139
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/qtip' . $min . '.js',
140
-				'deps'      => array( 'jquery' ),
139
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/qtip'.$min.'.js',
140
+				'deps'      => array('jquery'),
141 141
 				'in_footer' => true,
142 142
 			),
143 143
 			'simcal-default-calendar' => array(
144
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
144
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
145 145
 				'deps'      => array(
146 146
 					'jquery',
147 147
 					'simcal-qtip',
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return array
167 167
 	 */
168
-	public function styles( $min = '' ) {
168
+	public function styles($min = '') {
169 169
 		return array(
170 170
 			'simcal-default-calendar-list' => array(
171
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
171
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
172 172
 				'media' => 'all',
173 173
 			),
174 174
 		);
@@ -183,49 +183,49 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$calendar = $this->calendar;
185 185
 
186
-		if ( $calendar instanceof Default_Calendar ) {
186
+		if ($calendar instanceof Default_Calendar) {
187 187
 
188
-			$disabled = $calendar->static === true || empty( $calendar->events ) ? ' disabled="disabled"' : '';
188
+			$disabled = $calendar->static === true || empty($calendar->events) ? ' disabled="disabled"' : '';
189 189
 
190 190
 
191
-			$hide_header = get_post_meta( $this->calendar->id, '_default_calendar_list_header', true ) == 'yes' ? true : false;
192
-			$static_calendar = get_post_meta( $this->calendar->id, '_calendar_is_static', true ) == 'yes' ? true : false;
191
+			$hide_header = get_post_meta($this->calendar->id, '_default_calendar_list_header', true) == 'yes' ? true : false;
192
+			$static_calendar = get_post_meta($this->calendar->id, '_calendar_is_static', true) == 'yes' ? true : false;
193 193
 
194 194
 			$header_class = '';
195 195
 			$compact_list_class = $calendar->compact_list ? 'simcal-calendar-list-compact' : '';
196 196
 
197
-			edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id );
197
+			edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id);
198 198
 
199
-			echo '<div class="simcal-calendar-list ' . $compact_list_class . '">';
199
+			echo '<div class="simcal-calendar-list '.$compact_list_class.'">';
200 200
 
201
-			if ( ! $hide_header && ! $static_calendar ) {
202
-				echo '<nav class="simcal-calendar-head">' . "\n";
201
+			if ( ! $hide_header && ! $static_calendar) {
202
+				echo '<nav class="simcal-calendar-head">'."\n";
203 203
 
204
-				echo "\t" . '<div class="simcal-nav">' . "\n";
205
-				echo "\t\t" . '<button class="simcal-nav-button simcal-prev" title="' . __('Previous', 'google-calendar-events') . '"' . $disabled . '>' . "\n";
206
-				echo "\t\t\t" . '<i class="simcal-icon-left"></i>' . "\n";
207
-				echo "\t\t" . '</button>' . "\n";
208
-				echo "\t" . '</div>' . "\n";
204
+				echo "\t".'<div class="simcal-nav">'."\n";
205
+				echo "\t\t".'<button class="simcal-nav-button simcal-prev" title="'.__('Previous', 'google-calendar-events').'"'.$disabled.'>'."\n";
206
+				echo "\t\t\t".'<i class="simcal-icon-left"></i>'."\n";
207
+				echo "\t\t".'</button>'."\n";
208
+				echo "\t".'</div>'."\n";
209 209
 
210
-				if ( $hide_header ) {
210
+				if ($hide_header) {
211 211
 					$header_class = 'simcal-hide-header';
212 212
 				}
213 213
 
214 214
 
215
-				echo "\t" . '<div class="simcal-nav simcal-current ' . $header_class . '" data-calendar-current="' . $calendar->start . '">' . "\n";
216
-				echo "\t\t" . '<h3 class="simcal-current-label"> </h3>' . "\n";
217
-				echo "\t" . '</div>' . "\n";
215
+				echo "\t".'<div class="simcal-nav simcal-current '.$header_class.'" data-calendar-current="'.$calendar->start.'">'."\n";
216
+				echo "\t\t".'<h3 class="simcal-current-label"> </h3>'."\n";
217
+				echo "\t".'</div>'."\n";
218 218
 
219
-				echo "\t" . '<div class="simcal-nav">';
220
-				echo "\t\t" . '<button class="simcal-nav-button simcal-next" title="' . __('Next', 'google-calendar-events') . '"' . $disabled . '>';
221
-				echo "\t\t\t" . '<i class="simcal-icon-right"></i>' . "\n";
222
-				echo "\t\t" . '</button>' . "\n";
223
-				echo "\t" . '</div>' . "\n";
219
+				echo "\t".'<div class="simcal-nav">';
220
+				echo "\t\t".'<button class="simcal-nav-button simcal-next" title="'.__('Next', 'google-calendar-events').'"'.$disabled.'>';
221
+				echo "\t\t\t".'<i class="simcal-icon-right"></i>'."\n";
222
+				echo "\t\t".'</button>'."\n";
223
+				echo "\t".'</div>'."\n";
224 224
 
225
-				echo '</nav>' . "\n";
225
+				echo '</nav>'."\n";
226 226
 			}
227 227
 
228
-			echo $this->draw_list( $calendar->start );
228
+			echo $this->draw_list($calendar->start);
229 229
 
230 230
 			echo '<div class="simcal-ajax-loader simcal-spinner-top" style="display: none;"><i class="simcal-icon-spinner simcal-icon-spin"></i></div>';
231 231
 
@@ -245,92 +245,92 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @return array
247 247
 	 */
248
-	private function get_events( $timestamp ) {
248
+	private function get_events($timestamp) {
249 249
 
250 250
 		$calendar = $this->calendar;
251 251
 
252
-		if ( ! $calendar->group_type || ! $calendar->group_span ) {
252
+		if ( ! $calendar->group_type || ! $calendar->group_span) {
253 253
 			return array();
254 254
 		}
255 255
 
256 256
 		// Need to pass in timezone here to get beginning of day.
257
-		$current = Carbon::createFromTimestamp( $timestamp, $calendar->timezone );
257
+		$current = Carbon::createFromTimestamp($timestamp, $calendar->timezone);
258 258
 		$prev = clone $current;
259 259
 		$next = clone $current;
260 260
 
261 261
 		$this->start = $timestamp;
262 262
 
263
-		$interval = $span = max( absint( $calendar->group_span ), 1 );
264
-
265
-		if ( 'monthly' == $calendar->group_type ) {
266
-			$this->prev = $prev->subMonths( $span )->getTimestamp();
267
-			$this->next = $next->addMonths( $span )->getTimestamp();
268
-		} elseif ( 'weekly' == $calendar->group_type ) {
269
-			$week = new Carbon( $calendar->timezone );
270
-			$week->setTimestamp( $timestamp );
271
-			$week->setWeekStartsAt( $calendar->week_starts );
272
-			$this->prev = $prev->subWeeks( $span )->getTimestamp();
273
-			$this->next = $next->addWeeks( $span )->getTimestamp();
274
-		} elseif ( 'daily' == $calendar->group_type ) {
275
-			$this->prev = $prev->subDays( $span )->getTimestamp();
276
-			$this->next = $next->addDays( $span )->getTimestamp();
263
+		$interval = $span = max(absint($calendar->group_span), 1);
264
+
265
+		if ('monthly' == $calendar->group_type) {
266
+			$this->prev = $prev->subMonths($span)->getTimestamp();
267
+			$this->next = $next->addMonths($span)->getTimestamp();
268
+		} elseif ('weekly' == $calendar->group_type) {
269
+			$week = new Carbon($calendar->timezone);
270
+			$week->setTimestamp($timestamp);
271
+			$week->setWeekStartsAt($calendar->week_starts);
272
+			$this->prev = $prev->subWeeks($span)->getTimestamp();
273
+			$this->next = $next->addWeeks($span)->getTimestamp();
274
+		} elseif ('daily' == $calendar->group_type) {
275
+			$this->prev = $prev->subDays($span)->getTimestamp();
276
+			$this->next = $next->addDays($span)->getTimestamp();
277 277
 		}
278 278
 
279 279
 		$events = $calendar->events;
280 280
 		$daily_events = $paged_events = $flattened_events = array();
281 281
 
282
-		if ( 'events' != $calendar->group_type ) {
282
+		if ('events' != $calendar->group_type) {
283 283
 
284
-			$this->end   = $this->next - 1;
284
+			$this->end = $this->next - 1;
285 285
 
286
-			$timestamps   = array_keys( $events );
287
-			$lower_bound  = array_filter( $timestamps,  array( $this, 'filter_events_before' ) );
288
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after'  ) );
286
+			$timestamps   = array_keys($events);
287
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
288
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
289 289
 
290
-			if ( is_array( $higher_bound ) && !empty( $higher_bound ) ) {
291
-				$filtered = array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) );
292
-				foreach ( $filtered as $timestamp => $events ) {
293
-					$paged_events[ intval( $timestamp ) ] = $events;
290
+			if (is_array($higher_bound) && ! empty($higher_bound)) {
291
+				$filtered = array_intersect_key($events, array_combine($higher_bound, $higher_bound));
292
+				foreach ($filtered as $timestamp => $events) {
293
+					$paged_events[intval($timestamp)] = $events;
294 294
 				}
295 295
 			}
296 296
 
297 297
 		} else {
298 298
 
299
-			foreach ( $events as $timestamp => $e ) {
299
+			foreach ($events as $timestamp => $e) {
300 300
 				$second = 0;
301
-				foreach ( $e as $event ) {
302
-					$flattened_events[ intval( $timestamp + $second ) ][] = $event;
301
+				foreach ($e as $event) {
302
+					$flattened_events[intval($timestamp + $second)][] = $event;
303 303
 					$second++;
304 304
 				}
305 305
 			}
306 306
 
307
-			ksort( $flattened_events, SORT_NUMERIC );
307
+			ksort($flattened_events, SORT_NUMERIC);
308 308
 
309
-			$keys  = array_keys( $flattened_events );
309
+			$keys = array_keys($flattened_events);
310 310
 			$current = 0;
311
-			foreach ( $keys as $timestamp ) {
312
-				if ( $timestamp < $this->start ) {
311
+			foreach ($keys as $timestamp) {
312
+				if ($timestamp < $this->start) {
313 313
 					$current++;
314 314
 				}
315 315
 			}
316 316
 
317
-			$paged_events = array_slice( $flattened_events, $current, $interval, true );
317
+			$paged_events = array_slice($flattened_events, $current, $interval, true);
318 318
 
319
-			$events_end = isset( $keys[ $current + $interval ] ) ? $keys[ $current + $interval ] : $calendar->end;
319
+			$events_end = isset($keys[$current + $interval]) ? $keys[$current + $interval] : $calendar->end;
320 320
 			$this->end  = $events_end > $calendar->end ? $calendar->end : $events_end;
321 321
 
322
-			$this->prev = isset( $keys[ $current - $interval ] ) ? $keys[ $current - $interval ] : $calendar->earliest_event;
323
-			$this->next = isset( $keys[ $current + $interval ] ) ? $keys[ $current + $interval ] : $this->end;
322
+			$this->prev = isset($keys[$current - $interval]) ? $keys[$current - $interval] : $calendar->earliest_event;
323
+			$this->next = isset($keys[$current + $interval]) ? $keys[$current + $interval] : $this->end;
324 324
 
325 325
 		}
326 326
 
327 327
 		// Put resulting events in an associative array, with Ymd date as key for easy retrieval in calendar days loop.
328 328
 
329
-		foreach ( $paged_events as $timestamp => $events ) {
329
+		foreach ($paged_events as $timestamp => $events) {
330 330
 
331 331
 			// TODO First $paged_events item timestamp 1 second off? Plus or minus?
332 332
 
333
-			if ( $timestamp <= $this->end ) {
333
+			if ($timestamp <= $this->end) {
334 334
 
335 335
 				// TODO Could go back to using Carbon to be consistent.
336 336
 				// $date is off by a couple hours for dates in multi-day event, but not for first event.
@@ -349,34 +349,34 @@  discard block
 block discarded – undo
349 349
 
350 350
 				// Using native PHP 5.3+ (not Carbon) here.
351 351
 				// Offset value after first day same behavior as Carbon above still.
352
-				$dtz = new \DateTimeZone( $calendar->timezone );
352
+				$dtz = new \DateTimeZone($calendar->timezone);
353 353
 
354
-				$date = \DateTime::createFromFormat( 'U', $timestamp );
354
+				$date = \DateTime::createFromFormat('U', $timestamp);
355 355
 
356 356
 				// Doesn't seem to make a difference omitting timezone.
357 357
 				//$date = \DateTime::createFromFormat( 'U', $timestamp, $dtz );
358 358
 
359 359
 				// Add offset to timestamp to get correct date.
360 360
 				// TODO Need to add +1 second also?
361
-				$offset = $dtz->getOffset( $date );
361
+				$offset = $dtz->getOffset($date);
362 362
 				$date_offset = clone $date;
363
-				$date_offset->add( \DateInterval::createFromDateString( $offset . ' seconds' ) );
363
+				$date_offset->add(\DateInterval::createFromDateString($offset.' seconds'));
364 364
 
365 365
 				// TODO Multiple day events will be off if part-way through there's daylight savings.
366 366
 
367
-				$dateYmd = $date_offset->format( 'Ymd' );
368
-				$daily_events[ intval( $dateYmd ) ][] = $events;
367
+				$dateYmd = $date_offset->format('Ymd');
368
+				$daily_events[intval($dateYmd)][] = $events;
369 369
 			}
370 370
 		}
371 371
 
372
-		ksort( $daily_events, SORT_NUMERIC );
372
+		ksort($daily_events, SORT_NUMERIC);
373 373
 
374
-		if ( ! empty( $paged_events ) ) {
375
-			$first_event       = array_slice( $paged_events, 0, 1, true );
376
-			$first_event       = array_pop( $first_event );
374
+		if ( ! empty($paged_events)) {
375
+			$first_event       = array_slice($paged_events, 0, 1, true);
376
+			$first_event       = array_pop($first_event);
377 377
 			$this->first_event = $first_event[0]->start;
378 378
 
379
-			$last_event       = array_pop( $paged_events );
379
+			$last_event       = array_pop($paged_events);
380 380
 			$this->last_event = $last_event[0]->start;
381 381
 		}
382 382
 
@@ -396,84 +396,84 @@  discard block
 block discarded – undo
396 396
 	private function get_heading() {
397 397
 
398 398
 		$calendar = $this->calendar;
399
-		$start = Carbon::createFromTimestamp( $calendar->start, $calendar->timezone );
400
-		$end = Carbon::createFromTimestamp( $this->end, $calendar->timezone );
399
+		$start = Carbon::createFromTimestamp($calendar->start, $calendar->timezone);
400
+		$end = Carbon::createFromTimestamp($this->end, $calendar->timezone);
401 401
 		$date_format = $this->calendar->date_format;
402
-		$date_order  = simcal_get_date_format_order( $date_format );
402
+		$date_order  = simcal_get_date_format_order($date_format);
403 403
 
404
-		if ( $this->first_event !== 0 ) {
405
-			$start = Carbon::createFromTimestamp( $this->first_event, $calendar->timezone );
404
+		if ($this->first_event !== 0) {
405
+			$start = Carbon::createFromTimestamp($this->first_event, $calendar->timezone);
406 406
 		}
407 407
 
408
-		if ( $this->last_event !== 0 ) {
409
-			$end = Carbon::createFromTimestamp( $this->last_event, $calendar->timezone );
408
+		if ($this->last_event !== 0) {
409
+			$end = Carbon::createFromTimestamp($this->last_event, $calendar->timezone);
410 410
 		}
411 411
 
412
-		$st = strtotime( $start->toDateTimeString() );
413
-		$et = strtotime( $end->toDateTimeString() );
412
+		$st = strtotime($start->toDateTimeString());
413
+		$et = strtotime($end->toDateTimeString());
414 414
 
415 415
 		// TODO Is logic here causing the weird "29 Oct, 2016" format when navigating?
416 416
 
417
-		if ( ( $start->day == $end->day ) && ( $start->month == $end->month ) && ( $start->year == $end->year ) ) {
417
+		if (($start->day == $end->day) && ($start->month == $end->month) && ($start->year == $end->year)) {
418 418
 			// Start and end on the same day.
419 419
 			// e.g. 1 February 2020
420
-			$large = $small = date_i18n( $calendar->date_format , $st );
421
-			if ( ( $date_order['d'] !== false ) && ( $date_order['m'] !== false ) ) {
422
-				if ( $date_order['m'] > $date_order['d'] ) {
423
-					if ( $date_order['y'] !== false && $date_order['y'] > $date_order['m'] ) {
424
-						$small = date_i18n( 'Y, d M', $st );
420
+			$large = $small = date_i18n($calendar->date_format, $st);
421
+			if (($date_order['d'] !== false) && ($date_order['m'] !== false)) {
422
+				if ($date_order['m'] > $date_order['d']) {
423
+					if ($date_order['y'] !== false && $date_order['y'] > $date_order['m']) {
424
+						$small = date_i18n('Y, d M', $st);
425 425
 					} else {
426
-						$small = date_i18n( 'd M Y', $st );
426
+						$small = date_i18n('d M Y', $st);
427 427
 					}
428 428
 				} else {
429
-					if ( $date_order['y'] !== false && $date_order['y'] > $date_order['m'] ) {
430
-						$small = date_i18n( 'Y, M d', $st );
429
+					if ($date_order['y'] !== false && $date_order['y'] > $date_order['m']) {
430
+						$small = date_i18n('Y, M d', $st);
431 431
 					} else {
432
-						$small = date_i18n( 'M d Y', $st );
432
+						$small = date_i18n('M d Y', $st);
433 433
 					}
434 434
 				}
435 435
 			}
436
-		} elseif ( ( $start->month == $end->month ) && ( $start->year == $end->year ) ) {
436
+		} elseif (($start->month == $end->month) && ($start->year == $end->year)) {
437 437
 			// Start and end days on the same month.
438 438
 			// e.g. August 2020
439
-			if ( $date_order['y'] === false ) {
439
+			if ($date_order['y'] === false) {
440 440
 				// August.
441
-				$large = $small = date_i18n( 'F', $st );
441
+				$large = $small = date_i18n('F', $st);
442 442
 			} else {
443
-				if ( $date_order['y'] < $date_order['m'] ) {
443
+				if ($date_order['y'] < $date_order['m']) {
444 444
 					// 2020 August.
445
-					$large = date_i18n( 'Y F', $st );
446
-					$small = date_i18n( 'Y M', $st );
445
+					$large = date_i18n('Y F', $st);
446
+					$small = date_i18n('Y M', $st);
447 447
 				} else {
448 448
 					// August 2020.
449
-					$large = date_i18n( 'F Y', $st );
450
-					$small = date_i18n( 'M Y', $st );
449
+					$large = date_i18n('F Y', $st);
450
+					$small = date_i18n('M Y', $st);
451 451
 				}
452 452
 			}
453
-		} elseif ( $start->year == $end->year ) {
453
+		} elseif ($start->year == $end->year) {
454 454
 			// Start and end days on months of the same year.
455 455
 			// e.g. August - September 2020
456
-			if ( $date_order['y'] === false ) {
456
+			if ($date_order['y'] === false) {
457 457
 				// August - September.
458
-				$large = date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et );
459
-				$small = date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et );
458
+				$large = date_i18n('F', $st).' - '.date_i18n('F', $et);
459
+				$small = date_i18n('M', $st).' - '.date_i18n('M', $et);
460 460
 			} else {
461
-				if ( $date_order['y'] < $date_order['m'] ) {
461
+				if ($date_order['y'] < $date_order['m']) {
462 462
 					// 2020, August - September.
463
-					$large  = $small = date( 'Y', $st ) . ', ';
464
-					$large .= date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et );
465
-					$small .= date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et );
463
+					$large  = $small = date('Y', $st).', ';
464
+					$large .= date_i18n('F', $st).' - '.date_i18n('F', $et);
465
+					$small .= date_i18n('M', $st).' - '.date_i18n('M', $et);
466 466
 				} else {
467 467
 					// August - September, 2020.
468
-					$large  = date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et ) . ', ';
469
-					$small  = date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et ) . ' ';
470
-					$year   = date( 'Y', $st );
468
+					$large  = date_i18n('F', $st).' - '.date_i18n('F', $et).', ';
469
+					$small  = date_i18n('M', $st).' - '.date_i18n('M', $et).' ';
470
+					$year   = date('Y', $st);
471 471
 					$large .= $year;
472 472
 					$small .= $year;
473 473
 				}
474 474
 			}
475 475
 		} else {
476
-			$large = $small = date( 'Y', $st ) . ' - ' . date( 'Y', $et );
476
+			$large = $small = date('Y', $st).' - '.date('Y', $et);
477 477
 		}
478 478
 
479 479
 		return array(
@@ -495,43 +495,43 @@  discard block
 block discarded – undo
495 495
 	 *
496 496
 	 * @return string
497 497
 	 */
498
-	private function draw_list( $timestamp, $id = 0 ) {
498
+	private function draw_list($timestamp, $id = 0) {
499 499
 
500 500
 		$calendar = $this->calendar;
501 501
 
502
-		if ( empty( $calendar ) ) {
503
-			$calendar = $this->calendar = simcal_get_calendar( intval( $id ) );
504
-			if ( ! $calendar instanceof Default_Calendar ) {
502
+		if (empty($calendar)) {
503
+			$calendar = $this->calendar = simcal_get_calendar(intval($id));
504
+			if ( ! $calendar instanceof Default_Calendar) {
505 505
 				return '';
506 506
 			}
507 507
 		}
508 508
 
509 509
 		$now = $calendar->now;
510
-		$current_events = $this->get_events( $timestamp );
510
+		$current_events = $this->get_events($timestamp);
511 511
 		$format = $calendar->date_format;
512 512
 
513 513
 		ob_start();
514 514
 
515 515
 		// Draw the events.
516 516
 
517
-		$block_tag = $calendar->compact_list && ! empty( $current_events ) ? 'div' : 'dl';
517
+		$block_tag = $calendar->compact_list && ! empty($current_events) ? 'div' : 'dl';
518 518
 
519 519
 		$data_heading = '';
520 520
 		$heading = $this->get_heading();
521
-		foreach ( $heading as $k => $v ) {
522
-			$data_heading .= ' data-heading-' . $k . '="' . $v . '"';
521
+		foreach ($heading as $k => $v) {
522
+			$data_heading .= ' data-heading-'.$k.'="'.$v.'"';
523 523
 		}
524 524
 
525
-		echo '<' . $block_tag . ' class="simcal-events-list-container"' .
526
-			' data-prev="' . $this->prev . '"' .
527
-			' data-next="' . $this->next . '"' .
528
-			$data_heading . '>';
525
+		echo '<'.$block_tag.' class="simcal-events-list-container"'.
526
+			' data-prev="'.$this->prev.'"'.
527
+			' data-next="'.$this->next.'"'.
528
+			$data_heading.'>';
529 529
 
530
-		if ( ! empty( $current_events ) && is_array( $current_events ) ) :
530
+		if ( ! empty($current_events) && is_array($current_events)) :
531 531
 
532 532
 			$last_event = null;
533 533
 
534
-			foreach ( $current_events as $ymd => $events ) :
534
+			foreach ($current_events as $ymd => $events) :
535 535
 
536 536
 				// This is where we can find out if an event is a multi-day event and if it needs to be shown.
537 537
 				// Since this is for list view we are showing the event on the day viewed if it is part of that day even when
@@ -539,20 +539,20 @@  discard block
 block discarded – undo
539 539
 
540 540
 				$first_event = $events[0][0];
541 541
 
542
-				if ( isset( $first_event->multiple_days ) && $first_event->multiple_days > 0 ) {
542
+				if (isset($first_event->multiple_days) && $first_event->multiple_days > 0) {
543 543
 
544
-					if ( 'current_day_only' == get_post_meta( $calendar->id, '_default_calendar_expand_multi_day_events', true ) ) {
544
+					if ('current_day_only' == get_post_meta($calendar->id, '_default_calendar_expand_multi_day_events', true)) {
545 545
 
546
-						$year  = substr( $ymd, 0, 4 );
547
-						$month = substr( $ymd, 4, 2 );
548
-						$day   = substr( $ymd, 6, 2 );
546
+						$year  = substr($ymd, 0, 4);
547
+						$month = substr($ymd, 4, 2);
548
+						$day   = substr($ymd, 6, 2);
549 549
 
550
-						$temp_date = Carbon::createFromDate( $year, $month, $day );
550
+						$temp_date = Carbon::createFromDate($year, $month, $day);
551 551
 
552
-						if ( ! ( $temp_date < Carbon::now()->endOfDay() ) ) {
552
+						if ( ! ($temp_date < Carbon::now()->endOfDay())) {
553 553
 
554 554
 							// Break here only if event already shown once.
555
-							if ( $last_event == $first_event ) {
555
+							if ($last_event == $first_event) {
556 556
 								continue;
557 557
 							} else {
558 558
 								// Save event as "last" for next time through, then break.
@@ -563,139 +563,139 @@  discard block
 block discarded – undo
563 563
 				}
564 564
 
565 565
 				// Add offset offset for list view day headings.
566
-				$day_date = Carbon::createFromFormat( 'Ymd', $ymd, $calendar->timezone );
566
+				$day_date = Carbon::createFromFormat('Ymd', $ymd, $calendar->timezone);
567 567
 				$day_date_offset = clone $day_date;
568
-				$day_date_offset->addSeconds( $day_date->offset );
568
+				$day_date_offset->addSeconds($day_date->offset);
569 569
 				$day_date_ts_offset = $day_date_offset->timestamp;
570 570
 
571
-				if ( ! $calendar->compact_list ) {
572
-					if ( $day_date_offset->isToday() ) {
573
-						$the_color = new Color( $calendar->today_color );
571
+				if ( ! $calendar->compact_list) {
572
+					if ($day_date_offset->isToday()) {
573
+						$the_color = new Color($calendar->today_color);
574 574
 					} else {
575
-						$the_color = new Color( $calendar->days_events_color );
575
+						$the_color = new Color($calendar->days_events_color);
576 576
 					}
577 577
 
578
-					$bg_color     = '#' . $the_color->getHex();
578
+					$bg_color     = '#'.$the_color->getHex();
579 579
 					$color        = $the_color->isDark() ? '#ffffff' : '#000000';
580
-					$border_style = ' style="border-bottom: 1px solid ' . $bg_color . ';" ';
581
-					$bg_style     = ' style="background-color: ' . $bg_color . '; color: ' . $color . ';"';
580
+					$border_style = ' style="border-bottom: 1px solid '.$bg_color.';" ';
581
+					$bg_style     = ' style="background-color: '.$bg_color.'; color: '.$color.';"';
582 582
 
583
-					echo "\t" . '<dt class="simcal-day-label"' . $border_style . '>';
584
-					echo '<span' . $bg_style . '>';
583
+					echo "\t".'<dt class="simcal-day-label"'.$border_style.'>';
584
+					echo '<span'.$bg_style.'>';
585 585
 
586
-					echo $format ? '<span class="simcal-date-format" data-date-format="' . $format . '">' . date_i18n( $format, $day_date_ts_offset, strtotime( $day_date_offset->toDateTimeString() ) ) . '</span> ' : ' ';
586
+					echo $format ? '<span class="simcal-date-format" data-date-format="'.$format.'">'.date_i18n($format, $day_date_ts_offset, strtotime($day_date_offset->toDateTimeString())).'</span> ' : ' ';
587 587
 
588 588
 					echo '</span>';
589
-					echo '</dt>' . "\n";
589
+					echo '</dt>'."\n";
590 590
 				}
591 591
 
592
-				$list_events = '<ul class="simcal-events">' . "\n";
592
+				$list_events = '<ul class="simcal-events">'."\n";
593 593
 
594 594
 				$calendar_classes = array();
595 595
 
596 596
 				// Add day of week number to CSS class.
597
-				$day_classes = 'simcal-weekday-' . date( 'w', $day_date_ts_offset );
597
+				$day_classes = 'simcal-weekday-'.date('w', $day_date_ts_offset);
598 598
 
599 599
 				// Is this the present, the past or the future, Doc?
600
-				if ( $timestamp <= $now && $timestamp >= $now ) {
600
+				if ($timestamp <= $now && $timestamp >= $now) {
601 601
 					$day_classes .= ' simcal-today simcal-present simcal-day';
602
-				} elseif ( $timestamp < $now ) {
602
+				} elseif ($timestamp < $now) {
603 603
 					$day_classes .= ' simcal-past simcal-day';
604
-				} elseif ( $this->end > $now ) {
604
+				} elseif ($this->end > $now) {
605 605
 					$day_classes .= ' simcal-future simcal-day';
606 606
 				}
607 607
 
608 608
 				$count = 0;
609 609
 
610
-				foreach ( $events as $day_events ) :
611
-					foreach ( $day_events as $event ) :
610
+				foreach ($events as $day_events) :
611
+					foreach ($day_events as $event) :
612 612
 
613
-						if ( $event instanceof Event ) :
613
+						if ($event instanceof Event) :
614 614
 
615 615
 							$event_classes = $event_visibility = '';
616 616
 
617
-							$calendar_class     = 'simcal-events-calendar-' . strval( $event->calendar );
617
+							$calendar_class     = 'simcal-events-calendar-'.strval($event->calendar);
618 618
 							$calendar_classes[] = $calendar_class;
619 619
 
620 620
 							$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
621 621
 							$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
622 622
 
623
-							$event_classes .= 'simcal-event ' . $recurring . $has_location . $calendar_class;
623
+							$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class;
624 624
 
625 625
 							// Toggle some events visibility if more than optional limit.
626
-							if ( ( $calendar->events_limit > - 1 ) && ( $count >= $calendar->events_limit ) ) :
626
+							if (($calendar->events_limit > - 1) && ($count >= $calendar->events_limit)) :
627 627
 								$event_classes .= ' simcal-event-toggled';
628 628
 								$event_visibility = ' style="display: none"';
629 629
 							endif;
630 630
 
631 631
 							$event_color = $event->get_color();
632
-							if ( ! empty( $event_color ) ) {
632
+							if ( ! empty($event_color)) {
633 633
 								$side = is_rtl() ? 'right' : 'left';
634
-								$event_color = ' style="border-' . $side . ': 4px solid ' . $event_color . '; padding-' . $side . ': 8px;"';
634
+								$event_color = ' style="border-'.$side.': 4px solid '.$event_color.'; padding-'.$side.': 8px;"';
635 635
 							}
636 636
 
637
-							$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . $event_color . ' itemscope itemtype="http://schema.org/Event" data-start="' . esc_attr( $event->start ) . '">' . "\n";
638
-							$list_events .= "\t\t" . '<div class="simcal-event-details">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
639
-							$list_events .= "\t" . '</li>' . "\n";
637
+							$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.$event_color.' itemscope itemtype="http://schema.org/Event" data-start="'.esc_attr($event->start).'">'."\n";
638
+							$list_events .= "\t\t".'<div class="simcal-event-details">'.$calendar->get_event_html($event).'</div>'."\n";
639
+							$list_events .= "\t".'</li>'."\n";
640 640
 
641
-							$count ++;
641
+							$count++;
642 642
 
643 643
 							// Event falls within today.
644
-							if ( ( $this->end <= $now ) && ( $this->start >= $now ) ) :
644
+							if (($this->end <= $now) && ($this->start >= $now)) :
645 645
 								$day_classes .= ' simcal-today-has-events';
646 646
 							endif;
647
-							$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
647
+							$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
648 648
 
649
-							if ( $calendar_classes ) :
650
-								$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
649
+							if ($calendar_classes) :
650
+								$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
651 651
 							endif;
652 652
 
653 653
 						endif;
654 654
 					endforeach;
655 655
 				endforeach;
656 656
 
657
-				$list_events .= '</ul>' . "\n";
657
+				$list_events .= '</ul>'."\n";
658 658
 
659 659
 				// If events visibility is limited, print the button toggle.
660
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
660
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
661 661
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
662 662
 				endif;
663 663
 
664 664
 				// Print final list of events for the current day.
665 665
 				$tag = $calendar->compact_list ? 'div' : 'dd';
666
-				echo '<'  . $tag . ' class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
667
-				echo "\t" . $list_events . "\n";
668
-				echo '</' . $tag . '>' . "\n";
666
+				echo '<'.$tag.' class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
667
+				echo "\t".$list_events."\n";
668
+				echo '</'.$tag.'>'."\n";
669 669
 
670 670
 			endforeach;
671 671
 
672 672
 		else :
673 673
 
674
-			echo "\t" . '<p>';
674
+			echo "\t".'<p>';
675 675
 
676
-			$message = get_post_meta( $calendar->id, '_no_events_message', true );
676
+			$message = get_post_meta($calendar->id, '_no_events_message', true);
677 677
 
678
-			if ( 'events' == $calendar->group_type ) {
679
-				echo ! empty( $message ) ? $message : __( 'There are no upcoming events.', 'google-calendar-events' );
678
+			if ('events' == $calendar->group_type) {
679
+				echo ! empty($message) ? $message : __('There are no upcoming events.', 'google-calendar-events');
680 680
 			} else {
681
-				if ( ! empty( $message ) ) {
681
+				if ( ! empty($message)) {
682 682
 					echo $message;
683 683
 				} else {
684
-					$from = Carbon::createFromTimestamp( $this->start, $calendar->timezone )->getTimestamp();
685
-					$to = Carbon::createFromTimestamp( $this->end, $calendar->timezone )->getTimestamp();
686
-					echo apply_filters( 'simcal_no_events_message', sprintf(
687
-						__( 'Nothing from %1$s to %2$s.', 'google-calendar-events' ),
688
-						date_i18n( $calendar->date_format, $from ),
689
-						date_i18n( $calendar->date_format, $to )
690
-					), $calendar->id, $from, $to );
684
+					$from = Carbon::createFromTimestamp($this->start, $calendar->timezone)->getTimestamp();
685
+					$to = Carbon::createFromTimestamp($this->end, $calendar->timezone)->getTimestamp();
686
+					echo apply_filters('simcal_no_events_message', sprintf(
687
+						__('Nothing from %1$s to %2$s.', 'google-calendar-events'),
688
+						date_i18n($calendar->date_format, $from),
689
+						date_i18n($calendar->date_format, $to)
690
+					), $calendar->id, $from, $to);
691 691
 				}
692 692
 			}
693 693
 
694
-			echo "\t" . '</p>' . "\n";
694
+			echo "\t".'</p>'."\n";
695 695
 
696 696
 		endif;
697 697
 
698
-		echo '</' . $block_tag . '>';
698
+		echo '</'.$block_tag.'>';
699 699
 
700 700
 		return ob_get_clean();
701 701
 	}
@@ -707,16 +707,16 @@  discard block
 block discarded – undo
707 707
 	 */
708 708
 	public function draw_list_ajax() {
709 709
 
710
-		if ( isset( $_POST['ts'] ) && isset( $_POST['id'] ) ) {
710
+		if (isset($_POST['ts']) && isset($_POST['id'])) {
711 711
 
712
-			$ts = absint( $_POST['ts'] );
713
-			$id = absint( $_POST['id'] );
712
+			$ts = absint($_POST['ts']);
713
+			$id = absint($_POST['id']);
714 714
 
715
-			wp_send_json_success( $this->draw_list( $ts, $id ) );
715
+			wp_send_json_success($this->draw_list($ts, $id));
716 716
 
717 717
 		} else {
718 718
 
719
-			wp_send_json_error( 'Missing arguments in default calendar list ajax request.' );
719
+			wp_send_json_error('Missing arguments in default calendar list ajax request.');
720 720
 
721 721
 		}
722 722
 	}
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
 	 *
732 732
 	 * @return bool
733 733
 	 */
734
-	private function filter_events_before( $event ) {
735
-		return intval( $event ) >= intval( $this->start );
734
+	private function filter_events_before($event) {
735
+		return intval($event) >= intval($this->start);
736 736
 	}
737 737
 
738 738
 	/**
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
 	 *
746 746
 	 * @return bool
747 747
 	 */
748
-	private function filter_events_after( $event ) {
749
-		return intval( $event ) < intval( $this->end );
748
+	private function filter_events_after($event) {
749
+		return intval($event) < intval($this->end);
750 750
 	}
751 751
 
752 752
 }
Please login to merge, or discard this patch.
includes/calendars/views/default-calendar-grid.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Events\Event;
14 14
 use SimpleCalendar\Calendars\Default_Calendar;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @param string|Calendar $calendar
57 57
 	 */
58
-	public function __construct( $calendar = '' ) {
58
+	public function __construct($calendar = '') {
59 59
 		$this->calendar = $calendar;
60 60
 	}
61 61
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return string
90 90
 	 */
91 91
 	public function get_name() {
92
-		return __( 'Grid', 'google-calendar-events' );
92
+		return __('Grid', 'google-calendar-events');
93 93
 	}
94 94
 
95 95
 	/**
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @since 3.0.0
99 99
 	 */
100 100
 	public function add_ajax_actions() {
101
-		add_action( 'wp_ajax_simcal_default_calendar_draw_grid', array( $this, 'draw_grid_ajax' ) );
102
-		add_action( 'wp_ajax_nopriv_simcal_default_calendar_draw_grid', array( $this, 'draw_grid_ajax' ) );
101
+		add_action('wp_ajax_simcal_default_calendar_draw_grid', array($this, 'draw_grid_ajax'));
102
+		add_action('wp_ajax_nopriv_simcal_default_calendar_draw_grid', array($this, 'draw_grid_ajax'));
103 103
 	}
104 104
 
105 105
 	/**
@@ -113,25 +113,25 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return array
115 115
 	 */
116
-	public function scripts( $min = '' ) {
116
+	public function scripts($min = '') {
117 117
 		return array(
118 118
 			'simcal-qtip' => array(
119
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/jquery.qtip' . $min . '.js',
120
-				'deps'      => array( 'jquery' ),
119
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/jquery.qtip'.$min.'.js',
120
+				'deps'      => array('jquery'),
121 121
 				'in_footer' => true,
122 122
 			),
123 123
 			'simcal-fullcal-moment' => array(
124
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/moment' . $min . '.js',
125
-				'deps'      => array( 'jquery' ),
124
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/moment'.$min.'.js',
125
+				'deps'      => array('jquery'),
126 126
 				'in_footer' => true,
127 127
 			),
128 128
 			'simcal-moment-timezone' => array(
129
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/moment-timezone-with-data' . $min . '.js',
130
-				'deps'      => array( 'jquery' ),
129
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/moment-timezone-with-data'.$min.'.js',
130
+				'deps'      => array('jquery'),
131 131
 				'in_footer' => true,
132 132
 			),
133 133
 			'simcal-default-calendar' => array(
134
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
134
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
135 135
 				'deps'      => array(
136 136
 					'jquery',
137 137
 					'simcal-qtip',
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @return array
159 159
 	 */
160
-	public function styles( $min = '' ) {
160
+	public function styles($min = '') {
161 161
 		return array(
162 162
 			'simcal-qtip' => array(
163
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/vendor/jquery.qtip' . $min . '.css',
163
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/vendor/jquery.qtip'.$min.'.css',
164 164
 				'media' => 'all',
165 165
 			),
166 166
 			'simcal-default-calendar-grid' => array(
167
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-grid' . $min . '.css',
167
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-grid'.$min.'.css',
168 168
 				'deps'  => array(
169 169
 					'simcal-qtip',
170 170
 				),
171 171
 				'media' => 'all',
172 172
 			),
173 173
 			'simcal-default-calendar-list' => array(
174
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
174
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
175 175
 				'deps'  => array(
176 176
 					'simcal-qtip',
177 177
 				),
@@ -189,22 +189,22 @@  discard block
 block discarded – undo
189 189
 
190 190
 		$calendar = $this->calendar;
191 191
 
192
-		if ( $calendar instanceof Default_Calendar ) {
192
+		if ($calendar instanceof Default_Calendar) {
193 193
 
194 194
 			?>
195 195
 
196
-			<?php edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id ); ?>
196
+			<?php edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id); ?>
197 197
 
198 198
 			<table class="simcal-calendar-grid"
199 199
 			       data-event-bubble-trigger="<?php echo $calendar->event_bubble_trigger; ?>">
200 200
 				<thead class="simcal-calendar-head">
201 201
 					<tr>
202
-						<?php if ( ! $calendar->static ) { ?>
203
-							<th class="simcal-nav simcal-prev-wrapper" colspan="<?php echo apply_filters( 'simcal_prev_cols', '1' ); ?>">
204
-								<button class="simcal-nav-button simcal-month-nav simcal-prev" title="<?php _e( 'Previous Month', 'google-calendar-events' ); ?>"><i class="simcal-icon-left"></i></button>
202
+						<?php if ( ! $calendar->static) { ?>
203
+							<th class="simcal-nav simcal-prev-wrapper" colspan="<?php echo apply_filters('simcal_prev_cols', '1'); ?>">
204
+								<button class="simcal-nav-button simcal-month-nav simcal-prev" title="<?php _e('Previous Month', 'google-calendar-events'); ?>"><i class="simcal-icon-left"></i></button>
205 205
 							</th>
206 206
 						<?php } ?>
207
-						<th colspan="<?php echo apply_filters( 'simcal_current_cols', $calendar->static ? '7' : '5' ); ?>"
207
+						<th colspan="<?php echo apply_filters('simcal_current_cols', $calendar->static ? '7' : '5'); ?>"
208 208
 						    class="simcal-nav simcal-current"
209 209
 						    data-calendar-current="<?php echo $calendar->start; ?>">
210 210
 							<?php
@@ -213,26 +213,26 @@  discard block
 block discarded – undo
213 213
 
214 214
 							// Display month and year according to user date format preference.
215 215
 
216
-							$year_pos  = strcspn( $calendar->date_format, 'Y y' );
217
-							$month_pos = strcspn( $calendar->date_format, 'F M m n' );
216
+							$year_pos  = strcspn($calendar->date_format, 'Y y');
217
+							$month_pos = strcspn($calendar->date_format, 'F M m n');
218 218
 
219
-							$current = array( 'month' => 'F', 'year' => 'Y' );
219
+							$current = array('month' => 'F', 'year' => 'Y');
220 220
 
221
-							if ( $year_pos < $month_pos ) {
222
-								$current = array_reverse( $current );
221
+							if ($year_pos < $month_pos) {
222
+								$current = array_reverse($current);
223 223
 							}
224 224
 
225
-							foreach ( $current as $k => $v ) {
226
-								echo ' <span class="simcal-current-' . $k , '">' . date_i18n( $v, $calendar->start ) . '</span> ';
225
+							foreach ($current as $k => $v) {
226
+								echo ' <span class="simcal-current-'.$k, '">'.date_i18n($v, $calendar->start).'</span> ';
227 227
 							}
228 228
 
229 229
 							echo '</h3>';
230 230
 
231 231
 							?>
232 232
 						</th>
233
-						<?php if ( ! $calendar->static ) { ?>
234
-							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters( 'simcal_next_cols', '1' ); ?>">
235
-								<button class="simcal-nav-button simcal-month-nav simcal-next" title="<?php _e( 'Next Month', 'google-calendar-events' ); ?>"><i class="simcal-icon-right"></i></button>
233
+						<?php if ( ! $calendar->static) { ?>
234
+							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters('simcal_next_cols', '1'); ?>">
235
+								<button class="simcal-nav-button simcal-month-nav simcal-next" title="<?php _e('Next Month', 'google-calendar-events'); ?>"><i class="simcal-icon-right"></i></button>
236 236
 							</th>
237 237
 						<?php } ?>
238 238
 					</tr>
@@ -242,28 +242,28 @@  discard block
 block discarded – undo
242 242
 						// Print day names in short or long form for different viewport sizes.
243 243
 
244 244
 						$week_starts     = $calendar->week_starts;
245
-						$week_days_short = simcal_get_calendar_names_i18n( 'day', 'short' );
246
-						$week_days_full  = simcal_get_calendar_names_i18n( 'day', 'full' );
245
+						$week_days_short = simcal_get_calendar_names_i18n('day', 'short');
246
+						$week_days_full  = simcal_get_calendar_names_i18n('day', 'full');
247 247
 
248
-						for ( $i = $week_starts; $i <= 6; $i ++ ) :
248
+						for ($i = $week_starts; $i <= 6; $i++) :
249 249
 
250 250
 							?>
251 251
 							<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
252
-								data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
253
-							    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
254
-							    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
252
+								data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
253
+							    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
254
+							    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
255 255
 							<?php
256 256
 
257 257
 						endfor;
258 258
 
259
-						if ( $week_starts !== 0 ) :
260
-							for ( $i = 0; $i < $week_starts; $i ++ ) :
259
+						if ($week_starts !== 0) :
260
+							for ($i = 0; $i < $week_starts; $i++) :
261 261
 
262 262
 								?>
263 263
 								<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
264
-								    data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
265
-								    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
266
-								    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
264
+								    data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
265
+								    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
266
+								    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
267 267
 								<?php
268 268
 
269 269
 							endfor;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 					</tr>
274 274
 				</thead>
275 275
 
276
-				<?php echo $this->draw_month( date( 'n', $calendar->start ), date( 'Y', $calendar->start ) ); ?>
276
+				<?php echo $this->draw_month(date('n', $calendar->start), date('Y', $calendar->start)); ?>
277 277
 
278 278
 			</table>
279 279
 
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @return string
301 301
 	 */
302
-	private function draw_month( $month, $year, $id = 0 ) {
302
+	private function draw_month($month, $year, $id = 0) {
303 303
 
304 304
 		$calendar = $this->calendar;
305
-		if ( empty( $calendar ) ) {
306
-			$calendar = simcal_get_calendar( intval( $id ) );
307
-			if ( ! $calendar ) {
305
+		if (empty($calendar)) {
306
+			$calendar = simcal_get_calendar(intval($id));
307
+			if ( ! $calendar) {
308 308
 				return '';
309 309
 			}
310 310
 		}
@@ -313,68 +313,68 @@  discard block
 block discarded – undo
313 313
 
314 314
 		// Variables to cycle days in current month and find today in calendar.
315 315
 		$now         = $calendar->now;
316
-		$current     = Carbon::create( $year, $month, 1, 0, 0, 0, $calendar->timezone );
316
+		$current     = Carbon::create($year, $month, 1, 0, 0, 0, $calendar->timezone);
317 317
 		$current_min = $current->getTimestamp();
318 318
 		$current_max = $current->endOfDay()->getTimestamp();
319 319
 
320 320
 		// Calendar grid variables.
321 321
 		$week_starts   = $calendar->week_starts;
322
-		$week_of_year  = $current->weekOfYear;   // Relative count of the week number of the year.
323
-		$month_starts  = $current->dayOfWeek;    // Day upon which the month starts.
324
-		$days_in_month = $current->daysInMonth;  // Number of days in the given month.
322
+		$week_of_year  = $current->weekOfYear; // Relative count of the week number of the year.
323
+		$month_starts  = $current->dayOfWeek; // Day upon which the month starts.
324
+		$days_in_month = $current->daysInMonth; // Number of days in the given month.
325 325
 
326 326
 		// Set current month events timestamp boundaries.
327 327
 		$this->start = $current_min;
328 328
 		$this->end   = $current->endOfMonth()->getTimestamp();
329 329
 
330 330
 		// Get daily events for this month.
331
-		if ( $events && is_array( $events ) ) {
331
+		if ($events && is_array($events)) {
332 332
 
333 333
 			// Filter events within the boundaries previously set above.
334
-			$timestamps   = array_keys( $events );
335
-			$lower_bound  = array_filter( $timestamps, array( $this, 'filter_events_before' ) );
336
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after' ) );
337
-			$filtered     = ( is_array( $events ) && is_array( $higher_bound) ) && ! empty( $events ) && ! empty( $higher_bound ) ? array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) ) : array();
334
+			$timestamps   = array_keys($events);
335
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
336
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
337
+			$filtered     = (is_array($events) && is_array($higher_bound)) && ! empty($events) && ! empty($higher_bound) ? array_intersect_key($events, array_combine($higher_bound, $higher_bound)) : array();
338 338
 
339 339
 			// Put resulting events in an associative array, with day of the month as key for easy retrieval in calendar days loop.
340 340
 			$day_events = array();
341
-			foreach ( $filtered as $timestamp => $events_in_day ) {
342
-				foreach ( $events_in_day as $event ) {
343
-					if ( $event instanceof Event ){
344
-						$day = intval( Carbon::createFromTimestamp( $timestamp, $calendar->timezone )->endOfDay()->day );
345
-						$day_events[ $day ][] = $event;
341
+			foreach ($filtered as $timestamp => $events_in_day) {
342
+				foreach ($events_in_day as $event) {
343
+					if ($event instanceof Event) {
344
+						$day = intval(Carbon::createFromTimestamp($timestamp, $calendar->timezone)->endOfDay()->day);
345
+						$day_events[$day][] = $event;
346 346
 					}
347 347
 				}
348 348
 			}
349 349
 
350
-			ksort( $day_events, SORT_NUMERIC );
350
+			ksort($day_events, SORT_NUMERIC);
351 351
 		}
352 352
 
353 353
 		ob_start();
354 354
 
355
-		echo '<tbody class="simcal-month simcal-month-' . $month . '">' . "\n";
356
-		echo "\t" . '<tr class="simcal-week simcal-week-' . $week_of_year . '">';
355
+		echo '<tbody class="simcal-month simcal-month-'.$month.'">'."\n";
356
+		echo "\t".'<tr class="simcal-week simcal-week-'.$week_of_year.'">';
357 357
 
358 358
 		$days_in_row = 0;
359 359
 		// Week may start on an arbitrary day (sun, 0 - sat, 6).
360 360
 		$week_day = $week_starts;
361 361
 
362 362
 		// This fixes a possible bug when a month starts by Sunday (0).
363
-		if ( 0 !== $week_starts ) {
363
+		if (0 !== $week_starts) {
364 364
 			$b = $month_starts === 0 ? 7 : $month_starts;
365 365
 		} else {
366 366
 			$b = $month_starts;
367 367
 		}
368 368
 
369 369
 		// Void days in first week.
370
-		for ( $a = $week_starts; $a < $b; $a++ ) :
370
+		for ($a = $week_starts; $a < $b; $a++) :
371 371
 
372
-			$last_void_day_class = ( $a === ( $b - 1 ) ) ? 'simcal-day-void-last' : '';
372
+			$last_void_day_class = ($a === ($b - 1)) ? 'simcal-day-void-last' : '';
373 373
 
374
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
374
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
375 375
 
376 376
 			// Reset day of the week count (sun, 0 - sat, 6).
377
-			if ( $week_day === 6 ) {
377
+			if ($week_day === 6) {
378 378
 				$week_day = -1;
379 379
 			}
380 380
 			$week_day++;
@@ -384,97 +384,97 @@  discard block
 block discarded – undo
384 384
 		endfor;
385 385
 
386 386
 		// Actual days of the month.
387
-		for ( $day = 1; $day <= $days_in_month; $day++ ) :
387
+		for ($day = 1; $day <= $days_in_month; $day++) :
388 388
 
389 389
 			$count = 0;
390 390
 			$calendar_classes = array();
391
-			$day_classes = 'simcal-day-' . $day . ' simcal-weekday-' . $week_day;
391
+			$day_classes = 'simcal-day-'.$day.' simcal-weekday-'.$week_day;
392 392
 
393 393
 			$border_style = $bg_color = $color = '';
394 394
 
395 395
 			// Is this the present, the past or the future, Doc?
396
-			if ( $current_min <= $now && $current_max >= $now ) {
396
+			if ($current_min <= $now && $current_max >= $now) {
397 397
 				$day_classes .= ' simcal-today simcal-present simcal-day';
398
-				$the_color = new Color( $calendar->today_color );
399
-				$bg_color = '#' . $the_color->getHex();
398
+				$the_color = new Color($calendar->today_color);
399
+				$bg_color = '#'.$the_color->getHex();
400 400
 				$color = $the_color->isDark() ? '#ffffff' : '#000000';
401
-				$border_style = ' style="border: 1px solid ' . $bg_color . ';"';
402
-			} elseif ( $current_max < $now ) {
401
+				$border_style = ' style="border: 1px solid '.$bg_color.';"';
402
+			} elseif ($current_max < $now) {
403 403
 				$day_classes .= ' simcal-past simcal-day';
404
-			} elseif ( $current_min > $now ) {
404
+			} elseif ($current_min > $now) {
405 405
 				$day_classes .= ' simcal-future simcal-day';
406 406
 			}
407 407
 
408 408
 			// Print events for the current day in loop, if found any.
409
-			if ( isset( $day_events[ $day ] ) ) :
409
+			if (isset($day_events[$day])) :
410 410
 
411 411
 				$bullet_colors = array();
412 412
 
413 413
 				$list_events = '<ul class="simcal-events">';
414 414
 
415
-				foreach ( $day_events[ $day ] as $event ) :
415
+				foreach ($day_events[$day] as $event) :
416 416
 
417 417
 					$event_classes = $event_visibility = '';
418 418
 
419
-					if ( $event instanceof Event ) :
419
+					if ($event instanceof Event) :
420 420
 
421 421
 						// Store the calendar id where the event belongs (useful in grouped calendar feeds)
422
-						$calendar_class  = 'simcal-events-calendar-' . strval( $event->calendar );
423
-						$calendar_classes[] = $calendar_class ;
422
+						$calendar_class = 'simcal-events-calendar-'.strval($event->calendar);
423
+						$calendar_classes[] = $calendar_class;
424 424
 
425 425
 						$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
426 426
 						$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
427 427
 
428
-						$event_classes  .= 'simcal-event ' . $recurring . $has_location . $calendar_class . ' simcal-tooltip';
428
+						$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class.' simcal-tooltip';
429 429
 
430 430
 						// Toggle some events visibility if more than optional limit.
431
-						if ( ( $calendar->events_limit > -1 )  && ( $count >= $calendar->events_limit ) ) :
431
+						if (($calendar->events_limit > -1) && ($count >= $calendar->events_limit)) :
432 432
 							$event_classes    .= ' simcal-event-toggled';
433 433
 							$event_visibility  = ' style="display: none"';
434 434
 						endif;
435 435
 
436 436
 						// Event title in list.
437
-						$title = ! empty( $event->title ) ? trim( $event->title ) : __( 'Event', 'google-calendar-events' );
438
-						if ( $calendar->trim_titles >= 1 ) {
439
-							$title = strlen( $title ) > $calendar->trim_titles ? mb_substr( $title, 0, $calendar->trim_titles ) . '&hellip;' : $title;
437
+						$title = ! empty($event->title) ? trim($event->title) : __('Event', 'google-calendar-events');
438
+						if ($calendar->trim_titles >= 1) {
439
+							$title = strlen($title) > $calendar->trim_titles ? mb_substr($title, 0, $calendar->trim_titles).'&hellip;' : $title;
440 440
 						}
441 441
 
442 442
 						// Event color.
443 443
 						$bullet = '';
444 444
 						//$bullet_color = '#000';
445 445
 						$event_color = $event->get_color();
446
-						if ( ! empty( $event_color ) ) {
447
-							$bullet = '<span style="color: ' . $event_color . ';">&#9632;</span> ';
446
+						if ( ! empty($event_color)) {
447
+							$bullet = '<span style="color: '.$event_color.';">&#9632;</span> ';
448 448
 							$bullet_colors[] = $event_color;
449 449
 						} else {
450 450
 							$bullet_colors[] = '#000';
451 451
 						}
452 452
 
453 453
 						// Event contents.
454
-						$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . ' itemscope itemtype="http://schema.org/Event">' . "\n";
455
-						$list_events .= "\t\t" . '<span class="simcal-event-title">' . $bullet . $title . '</span>' . "\n";
456
-						$list_events .= "\t\t" . '<div class="simcal-event-details simcal-tooltip-content" style="display: none;">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
457
-						$list_events .= "\t" . '</li>' . "\n";
454
+						$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.' itemscope itemtype="http://schema.org/Event">'."\n";
455
+						$list_events .= "\t\t".'<span class="simcal-event-title">'.$bullet.$title.'</span>'."\n";
456
+						$list_events .= "\t\t".'<div class="simcal-event-details simcal-tooltip-content" style="display: none;">'.$calendar->get_event_html($event).'</div>'."\n";
457
+						$list_events .= "\t".'</li>'."\n";
458 458
 
459
-						$count ++;
459
+						$count++;
460 460
 
461 461
 					endif;
462 462
 
463 463
 				endforeach;
464 464
 
465
-				if ( ( $current_min <= $now ) && ( $current_max >= $now ) ) {
465
+				if (($current_min <= $now) && ($current_max >= $now)) {
466 466
 					$day_classes .= ' simcal-today-has-events';
467 467
 				}
468
-				$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
468
+				$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
469 469
 
470
-				if ( $calendar_classes ) {
471
-					$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
470
+				if ($calendar_classes) {
471
+					$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
472 472
 				}
473 473
 
474
-				$list_events .= '</ul>' . "\n";
474
+				$list_events .= '</ul>'."\n";
475 475
 
476 476
 				// Optional button to toggle hidden events in list.
477
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
477
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
478 478
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
479 479
 				endif;
480 480
 
@@ -486,49 +486,49 @@  discard block
 block discarded – undo
486 486
 			endif;
487 487
 
488 488
 			// The actual days with numbers and events in each row cell.
489
-			echo '<td class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
490
-
491
-			if ( $color ) {
492
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
493
-			} elseif ( $count > 0 ) {
494
-				$the_color = new Color( $calendar->days_events_color );
495
-				$color = ! $color ? ( $the_color->isDark() ? '#ffffff' : '#000000' ) : $color;
496
-				$bg_color = ! $bg_color ? '#' . $the_color->getHex() : $bg_color;
497
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
489
+			echo '<td class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
490
+
491
+			if ($color) {
492
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
493
+			} elseif ($count > 0) {
494
+				$the_color = new Color($calendar->days_events_color);
495
+				$color = ! $color ? ($the_color->isDark() ? '#ffffff' : '#000000') : $color;
496
+				$bg_color = ! $bg_color ? '#'.$the_color->getHex() : $bg_color;
497
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
498 498
 			} else {
499 499
 				$day_style = '';
500 500
 			}
501 501
 
502
-			echo "\t" . '<div' . $border_style . '>' . "\n";
503
-			echo "\t\t" . '<span class="simcal-day-label simcal-day-number"' . $day_style . '>' . $day . '</span>' . "\n";
504
-			echo "\t\t" . $list_events . "\n";
502
+			echo "\t".'<div'.$border_style.'>'."\n";
503
+			echo "\t\t".'<span class="simcal-day-label simcal-day-number"'.$day_style.'>'.$day.'</span>'."\n";
504
+			echo "\t\t".$list_events."\n";
505 505
 			echo "\t\t";
506 506
 			echo '<span class="simcal-events-dots" style="display: none;">';
507 507
 
508 508
 			// Event bullets for calendar mobile mode.
509
-			for( $i = 0; $i < $count; $i++ ) {
510
-				echo '<b style="color: ' . $bullet_colors[ $i ] . ';"> &bull; </b>';
509
+			for ($i = 0; $i < $count; $i++) {
510
+				echo '<b style="color: '.$bullet_colors[$i].';"> &bull; </b>';
511 511
 			}
512 512
 
513
-			echo '</span>' . "\n";
514
-			echo "\t" . '</div>' . "\n";
515
-			echo '</td>' . "\n";
513
+			echo '</span>'."\n";
514
+			echo "\t".'</div>'."\n";
515
+			echo '</td>'."\n";
516 516
 
517 517
 			// Reset day of the week count (sun, 0 - sat, 6).
518
-			if ( $week_day === 6 ) {
518
+			if ($week_day === 6) {
519 519
 				$week_day = - 1;
520 520
 			}
521 521
 			$week_day++;
522 522
 
523 523
 			// Reset count of days for this row (0-6).
524
-			if ( $days_in_row === 6 ) :
524
+			if ($days_in_row === 6) :
525 525
 
526 526
 				// Close the week row.
527 527
 				echo '</tr>';
528 528
 
529 529
 				// Open a new week row.
530
-				if ( $day < $days_in_month ) {
531
-					echo '<tr class="simcal-week simcal-week-' . $week_of_year++ . '">' . "\n";
530
+				if ($day < $days_in_month) {
531
+					echo '<tr class="simcal-week simcal-week-'.$week_of_year++.'">'."\n";
532 532
 				}
533 533
 
534 534
 				$days_in_row = -1;
@@ -537,25 +537,25 @@  discard block
 block discarded – undo
537 537
 
538 538
 			$days_in_row++;
539 539
 
540
-			$current_min = Carbon::createFromTimestamp( $current_min, $calendar->timezone )->addDay()->getTimestamp();
541
-			$current_max = Carbon::createFromTimestamp( $current_max, $calendar->timezone )->addDay()->getTimestamp();
540
+			$current_min = Carbon::createFromTimestamp($current_min, $calendar->timezone)->addDay()->getTimestamp();
541
+			$current_max = Carbon::createFromTimestamp($current_max, $calendar->timezone)->addDay()->getTimestamp();
542 542
 
543 543
 		endfor;
544 544
 
545 545
 		// Void days at the end of the month.
546
-		$remainder_days = ( 6 - $days_in_row );
546
+		$remainder_days = (6 - $days_in_row);
547 547
 
548
-		for ( $i = 0; $i <= $remainder_days; $i ++ ) {
548
+		for ($i = 0; $i <= $remainder_days; $i++) {
549 549
 
550
-			$last_void_day_class = ( $i == $remainder_days ) ? 'simcal-day-void-last' : '';
550
+			$last_void_day_class = ($i == $remainder_days) ? 'simcal-day-void-last' : '';
551 551
 
552
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
552
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
553 553
 
554 554
 			$week_day++;
555 555
 		}
556 556
 
557
-		echo "\t" . '</tr>' . "\n";
558
-		echo '</tbody>' . "\n";
557
+		echo "\t".'</tr>'."\n";
558
+		echo '</tbody>'."\n";
559 559
 
560 560
 		return ob_get_clean();
561 561
 	}
@@ -567,17 +567,17 @@  discard block
 block discarded – undo
567 567
 	 */
568 568
 	public function draw_grid_ajax() {
569 569
 
570
-		if ( isset( $_POST['month'] ) && isset( $_POST['year'] ) && isset( $_POST['id'] ) ) {
570
+		if (isset($_POST['month']) && isset($_POST['year']) && isset($_POST['id'])) {
571 571
 
572
-			$month = absint( $_POST['month'] );
573
-			$year  = absint( $_POST['year'] );
574
-			$id    = absint( $_POST['id'] );
572
+			$month = absint($_POST['month']);
573
+			$year  = absint($_POST['year']);
574
+			$id    = absint($_POST['id']);
575 575
 
576
-			wp_send_json_success( $this->draw_month( $month, $year, $id ) );
576
+			wp_send_json_success($this->draw_month($month, $year, $id));
577 577
 
578 578
 		} else {
579 579
 
580
-			wp_send_json_error( 'Missing arguments in default calendar grid ajax request.' );
580
+			wp_send_json_error('Missing arguments in default calendar grid ajax request.');
581 581
 
582 582
 		}
583 583
 
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
 	 *
594 594
 	 * @return bool
595 595
 	 */
596
-	private function filter_events_before( $event ) {
597
-		return intval( $event ) >= intval( $this->start );
596
+	private function filter_events_before($event) {
597
+		return intval($event) >= intval($this->start);
598 598
 	}
599 599
 
600 600
 	/**
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 	 *
608 608
 	 * @return bool
609 609
 	 */
610
-	private function filter_events_after( $event ) {
611
-		return intval( $event ) < intval( $this->end );
610
+	private function filter_events_after($event) {
611
+		return intval($event) < intval($this->end);
612 612
 	}
613 613
 
614 614
 }
Please login to merge, or discard this patch.
includes/events/event-builder.php 1 patch
Spacing   +241 added lines, -241 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();
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return array
69 69
 	 */
70 70
 	public function get_content_tags() {
71
-		return array_merge( array(
71
+		return array_merge(array(
72 72
 
73 73
 			/* ============ *
74 74
 			 * Content Tags *
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			'if-not-end-location',
220 220
 			// Does the event has NOT an end location?
221 221
 
222
-		), (array) $this->add_custom_event_tags() );
222
+		), (array) $this->add_custom_event_tags());
223 223
 	}
224 224
 
225 225
 	/**
@@ -231,16 +231,16 @@  discard block
 block discarded – undo
231 231
 	 *
232 232
 	 * @return string
233 233
 	 */
234
-	public function parse_event_template_tags( $template_tags = '' ) {
234
+	public function parse_event_template_tags($template_tags = '') {
235 235
 
236 236
 		// Process tags.
237
-		$result = preg_replace_callback( $this->get_regex(), array( $this, 'process_event_content' ), $template_tags );
237
+		$result = preg_replace_callback($this->get_regex(), array($this, 'process_event_content'), $template_tags);
238 238
 
239 239
 		// Removes extra consecutive <br> tags.
240 240
 		// TODO: Doesn't seem to work but going to remove it to allow multiple <br> tags in the editor
241 241
 		/*return preg_replace( '#(<br *//*?>\s*)+#i', '<br />', trim( $result ) );*/
242 242
 
243
-		return do_shortcode( trim( $result ) );
243
+		return do_shortcode(trim($result));
244 244
 	}
245 245
 
246 246
 	/**
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return string
254 254
 	 */
255
-	public function process_event_content( $match ) {
255
+	public function process_event_content($match) {
256 256
 
257
-		if ( $match[1] == '[' && $match[6] == ']' ) {
258
-			return substr( $match[0], 1, -1 );
257
+		if ($match[1] == '[' && $match[6] == ']') {
258
+			return substr($match[0], 1, -1);
259 259
 		}
260 260
 
261 261
 		$tag     = $match[2]; // Tag name without square brackets.
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 		$calendar = $this->calendar;
268 268
 		$event    = $this->event;
269 269
 
270
-		if ( ( $calendar instanceof Calendar ) && ( $event instanceof Event ) ) {
270
+		if (($calendar instanceof Calendar) && ($event instanceof Event)) {
271 271
 
272
-			switch ( $tag ) {
272
+			switch ($tag) {
273 273
 
274 274
 				/* ============ *
275 275
 				 * Content Tags *
@@ -277,13 +277,13 @@  discard block
 block discarded – undo
277 277
 
278 278
 				case 'title' :
279 279
 				case 'event-title' :
280
-					return $this->get_title( $event->title, $attr );
280
+					return $this->get_title($event->title, $attr);
281 281
 
282 282
 				case 'description' :
283
-					return $this->get_description( $event->description, $attr );
283
+					return $this->get_description($event->description, $attr);
284 284
 
285 285
 				case 'when' :
286
-					return $this->get_when( $event );
286
+					return $this->get_when($event);
287 287
 
288 288
 				case 'end-date' :
289 289
 				case 'end-custom' :
@@ -293,58 +293,58 @@  discard block
 block discarded – undo
293 293
 				case 'start-date' :
294 294
 				case 'start-human' :
295 295
 				case 'start-time' :
296
-					return $this->get_dt( $tag, $event, $attr );
296
+					return $this->get_dt($tag, $event, $attr);
297 297
 
298 298
 				case 'length' :
299 299
 				case 'duration' :
300
-					if ( false !== $event->end ) {
300
+					if (false !== $event->end) {
301 301
 						$duration = $event->start - $event->end;
302
-						$value    = human_time_diff( $event->start, $event->end );
302
+						$value    = human_time_diff($event->start, $event->end);
303 303
 					} else {
304 304
 						$duration = '-1';
305
-						$value    = __( 'No end time', 'google-calendar-events' );
305
+						$value    = __('No end time', 'google-calendar-events');
306 306
 					}
307 307
 
308
-					return ' <span class="simcal-event-duration" data-event-duration="' . $duration . '">' . $value . '</span>';
308
+					return ' <span class="simcal-event-duration" data-event-duration="'.$duration.'">'.$value.'</span>';
309 309
 
310 310
 				case 'location' :
311 311
 				case 'start-location' :
312 312
 				case 'end-location' :
313
-					$location       = ( 'end-location' == $tag ) ? $event->end_location['address'] : $event->start_location['address'];
314
-					$location_class = ( 'end-location' == $tag ) ? 'end' : 'start';
313
+					$location       = ('end-location' == $tag) ? $event->end_location['address'] : $event->start_location['address'];
314
+					$location_class = ('end-location' == $tag) ? 'end' : 'start';
315 315
 
316 316
 					// location, location.name, location.address (type PostalAddress) all required for schema data.
317 317
 					// Need to use event name where location data doesn't exist.
318 318
 					// Since we have 1 location field, use it as the name and address.
319 319
 					// If the location is blank, use the event title as the name and address.
320 320
 					// Wrap with wp_strip_all_tags().
321
-					$meta_location_name_and_address = empty( $location ) ? wp_strip_all_tags( $event->title ) : wp_strip_all_tags( $location );
321
+					$meta_location_name_and_address = empty($location) ? wp_strip_all_tags($event->title) : wp_strip_all_tags($location);
322 322
 
323
-					return ' <span class="simcal-event-address simcal-event-' . $location_class . '-location" itemprop="location" itemscope itemtype="http://schema.org/Place">' . '<meta itemprop="name" content="' . $meta_location_name_and_address . '" />' . '<meta itemprop="address" content="' . $meta_location_name_and_address . '" />' . wp_strip_all_tags( $location ) . '</span>';
323
+					return ' <span class="simcal-event-address simcal-event-'.$location_class.'-location" itemprop="location" itemscope itemtype="http://schema.org/Place">'.'<meta itemprop="name" content="'.$meta_location_name_and_address.'" />'.'<meta itemprop="address" content="'.$meta_location_name_and_address.'" />'.wp_strip_all_tags($location).'</span>';
324 324
 
325 325
 				case 'start-location-link':
326 326
 				case 'end-location-link' :
327 327
 				case 'maps-link' :
328
-					$location = ( 'end-location-link' == $tag ) ? $event->end_location['address'] : $event->start_location['address'];
329
-					if ( ! empty( $location ) ) {
330
-						$url = '//maps.google.com?q=' . urlencode( $location );
328
+					$location = ('end-location-link' == $tag) ? $event->end_location['address'] : $event->start_location['address'];
329
+					if ( ! empty($location)) {
330
+						$url = '//maps.google.com?q='.urlencode($location);
331 331
 
332
-						return $this->make_link( $tag, $url, $calendar->get_event_html( $event, $partial ), $attr );
332
+						return $this->make_link($tag, $url, $calendar->get_event_html($event, $partial), $attr);
333 333
 					}
334 334
 					break;
335 335
 
336 336
 				case 'link' :
337 337
 				case 'url' :
338
-					$content = ( 'link' == $tag ) ? $calendar->get_event_html( $event, $partial ) : '';
338
+					$content = ('link' == $tag) ? $calendar->get_event_html($event, $partial) : '';
339 339
 
340
-					return $this->make_link( $tag, $event->link, $content, $attr );
340
+					return $this->make_link($tag, $event->link, $content, $attr);
341 341
 
342 342
 				case 'add-to-gcal-link';
343
-					$content = ( 'add-to-gcal-link' == $tag ) ? $calendar->get_event_html( $event, $partial ) : '';
344
-					if ( ! empty( $content ) ) {
345
-						$url = $calendar->get_add_to_gcal_url( $event );
343
+					$content = ('add-to-gcal-link' == $tag) ? $calendar->get_event_html($event, $partial) : '';
344
+					if ( ! empty($content)) {
345
+						$url = $calendar->get_add_to_gcal_url($event);
346 346
 
347
-						return $this->make_link( $tag, $url, $content, $attr );
347
+						return $this->make_link($tag, $url, $content, $attr);
348 348
 					}
349 349
 					break;
350 350
 
@@ -371,22 +371,22 @@  discard block
 block discarded – undo
371 371
 
372 372
 				case 'attachments' :
373 373
 					$attachments = $event->get_attachments();
374
-					if ( ! empty( $attachments ) ) {
375
-						return $this->get_attachments( $attachments );
374
+					if ( ! empty($attachments)) {
375
+						return $this->get_attachments($attachments);
376 376
 					}
377 377
 					break;
378 378
 
379 379
 				case 'attendees' :
380 380
 					$attendees = $event->get_attendees();
381
-					if ( ! empty( $attendees ) ) {
382
-						return $this->get_attendees( $attendees, $attr );
381
+					if ( ! empty($attendees)) {
382
+						return $this->get_attendees($attendees, $attr);
383 383
 					}
384 384
 					break;
385 385
 
386 386
 				case 'organizer' :
387 387
 					$organizer = $event->get_organizer();
388
-					if ( ! empty( $organizer ) ) {
389
-						return $this->get_organizer( $organizer, $attr );
388
+					if ( ! empty($organizer)) {
389
+						return $this->get_organizer($organizer, $attr);
390 390
 					}
391 391
 					break;
392 392
 
@@ -395,35 +395,35 @@  discard block
 block discarded – undo
395 395
 				 * ================ */
396 396
 
397 397
 				case 'if-title':
398
-					if ( ! empty( $event->title ) ) {
399
-						return $calendar->get_event_html( $event, $partial );
398
+					if ( ! empty($event->title)) {
399
+						return $calendar->get_event_html($event, $partial);
400 400
 					}
401 401
 					break;
402 402
 
403 403
 				case 'if-description':
404
-					if ( ! empty( $event->description ) ) {
405
-						return $calendar->get_event_html( $event, $partial );
404
+					if ( ! empty($event->description)) {
405
+						return $calendar->get_event_html($event, $partial);
406 406
 					}
407 407
 					break;
408 408
 
409 409
 				case 'if-now' :
410 410
 				case 'if-not-now' :
411 411
 
412
-					$start_dt = $event->start_dt->setTimezone( $calendar->timezone );
412
+					$start_dt = $event->start_dt->setTimezone($calendar->timezone);
413 413
 					$start    = $start_dt->getTimestamp();
414 414
 
415
-					if ( $event->end_dt instanceof Carbon ) {
416
-						$end = $event->end_dt->setTimezone( $calendar->timezone )->getTimestamp();
415
+					if ($event->end_dt instanceof Carbon) {
416
+						$end = $event->end_dt->setTimezone($calendar->timezone)->getTimestamp();
417 417
 					} else {
418 418
 						return '';
419 419
 					}
420 420
 
421
-					$now = ( $start <= $calendar->now ) && ( $end >= $calendar->now );
421
+					$now = ($start <= $calendar->now) && ($end >= $calendar->now);
422 422
 
423
-					if ( ( 'if-now' == $tag ) && $now ) {
424
-						return $calendar->get_event_html( $event, $partial );
425
-					} elseif ( ( 'if-not-now' == $tag ) && ( false == $now ) ) {
426
-						return $calendar->get_event_html( $event, $partial );
423
+					if (('if-now' == $tag) && $now) {
424
+						return $calendar->get_event_html($event, $partial);
425
+					} elseif (('if-not-now' == $tag) && (false == $now)) {
426
+						return $calendar->get_event_html($event, $partial);
427 427
 					}
428 428
 
429 429
 					break;
@@ -431,15 +431,15 @@  discard block
 block discarded – undo
431 431
 				case 'if-started' :
432 432
 				case 'if-not-started' :
433 433
 
434
-					$start = $event->start_dt->setTimezone( $calendar->timezone )->getTimestamp();
434
+					$start = $event->start_dt->setTimezone($calendar->timezone)->getTimestamp();
435 435
 
436
-					if ( 'if-started' == $tag ) {
437
-						if ( $start < $calendar->now ) {
438
-							return $calendar->get_event_html( $event, $partial );
436
+					if ('if-started' == $tag) {
437
+						if ($start < $calendar->now) {
438
+							return $calendar->get_event_html($event, $partial);
439 439
 						}
440
-					} elseif ( 'if-not-started' == $tag ) {
441
-						if ( $start > $calendar->now ) {
442
-							return $calendar->get_event_html( $event, $partial );
440
+					} elseif ('if-not-started' == $tag) {
441
+						if ($start > $calendar->now) {
442
+							return $calendar->get_event_html($event, $partial);
443 443
 						}
444 444
 					}
445 445
 
@@ -448,17 +448,17 @@  discard block
 block discarded – undo
448 448
 				case 'if-ended' :
449 449
 				case 'if-not-ended' :
450 450
 
451
-					if ( false !== $event->end ) {
451
+					if (false !== $event->end) {
452 452
 
453
-						$end = $event->end_dt->setTimezone( $calendar->timezone )->getTimestamp();
453
+						$end = $event->end_dt->setTimezone($calendar->timezone)->getTimestamp();
454 454
 
455
-						if ( 'if-ended' == $tag ) {
456
-							if ( $end < $calendar->now ) {
457
-								return $calendar->get_event_html( $event, $partial );
455
+						if ('if-ended' == $tag) {
456
+							if ($end < $calendar->now) {
457
+								return $calendar->get_event_html($event, $partial);
458 458
 							}
459
-						} elseif ( 'if-not-ended' == $tag ) {
460
-							if ( $end > $calendar->now ) {
461
-								return $calendar->get_event_html( $event, $partial );
459
+						} elseif ('if-not-ended' == $tag) {
460
+							if ($end > $calendar->now) {
461
+								return $calendar->get_event_html($event, $partial);
462 462
 							}
463 463
 						}
464 464
 
@@ -468,29 +468,29 @@  discard block
 block discarded – undo
468 468
 
469 469
 				case 'if-today' :
470 470
 				case 'if-not-today' :
471
-					$start_dt   = $event->start_dt->setTimezone( $calendar->timezone );
471
+					$start_dt   = $event->start_dt->setTimezone($calendar->timezone);
472 472
 					$startOfDay = $start_dt->startOfDay()->getTimestamp();
473 473
 					$endOfDay   = $start_dt->endOfDay()->getTimestamp();
474 474
 
475
-					$today = ( $startOfDay <= $calendar->now ) && ( $calendar->now <= $endOfDay );
475
+					$today = ($startOfDay <= $calendar->now) && ($calendar->now <= $endOfDay);
476 476
 
477
-					if ( ( 'if-today' == $tag ) && $today ) {
478
-						return $calendar->get_event_html( $event, $partial );
479
-					} elseif ( ( 'if-not-today' == $tag ) && ( false == $today ) ) {
480
-						return $calendar->get_event_html( $event, $partial );
477
+					if (('if-today' == $tag) && $today) {
478
+						return $calendar->get_event_html($event, $partial);
479
+					} elseif (('if-not-today' == $tag) && (false == $today)) {
480
+						return $calendar->get_event_html($event, $partial);
481 481
 					}
482 482
 
483 483
 					break;
484 484
 
485 485
 				case 'if-end-time' :
486
-					if ( false !== $event->end ) {
487
-						return $calendar->get_event_html( $event, $partial );
486
+					if (false !== $event->end) {
487
+						return $calendar->get_event_html($event, $partial);
488 488
 					}
489 489
 					break;
490 490
 
491 491
 				case 'if-no-end-time' :
492
-					if ( false === $event->end ) {
493
-						return $calendar->get_event_html( $event, $partial );
492
+					if (false === $event->end) {
493
+						return $calendar->get_event_html($event, $partial);
494 494
 					}
495 495
 					break;
496 496
 
@@ -498,62 +498,62 @@  discard block
 block discarded – undo
498 498
 				case 'if-whole-day' :
499 499
 				case 'if-not-all-day' :
500 500
 				case 'if-not-whole-day' :
501
-					$bool = strstr( $tag, 'not' ) ? false : true;
502
-					if ( $bool === $event->whole_day ) {
503
-						return $calendar->get_event_html( $event, $partial );
501
+					$bool = strstr($tag, 'not') ? false : true;
502
+					if ($bool === $event->whole_day) {
503
+						return $calendar->get_event_html($event, $partial);
504 504
 					}
505 505
 					break;
506 506
 
507 507
 				case 'if-recurring' :
508
-					if ( ! empty( $event->recurrence ) ) {
509
-						return $calendar->get_event_html( $event, $partial );
508
+					if ( ! empty($event->recurrence)) {
509
+						return $calendar->get_event_html($event, $partial);
510 510
 					}
511 511
 					break;
512 512
 
513 513
 				case 'if-not-recurring' :
514
-					if ( false === $event->recurrence ) {
515
-						return $calendar->get_event_html( $event, $partial );
514
+					if (false === $event->recurrence) {
515
+						return $calendar->get_event_html($event, $partial);
516 516
 					}
517 517
 					break;
518 518
 
519 519
 				case 'if-multi-day' :
520
-					if ( false !== $event->multiple_days ) {
521
-						return $calendar->get_event_html( $event, $partial );
520
+					if (false !== $event->multiple_days) {
521
+						return $calendar->get_event_html($event, $partial);
522 522
 					}
523 523
 					break;
524 524
 
525 525
 				case 'if-single-day' :
526
-					if ( false === $event->multiple_days ) {
527
-						return $calendar->get_event_html( $event, $partial );
526
+					if (false === $event->multiple_days) {
527
+						return $calendar->get_event_html($event, $partial);
528 528
 					}
529 529
 					break;
530 530
 
531 531
 				case 'if-location' :
532 532
 				case 'if-start-location' :
533
-					if ( ! empty( $event->start_location['address'] ) ) {
534
-						return $calendar->get_event_html( $event, $partial );
533
+					if ( ! empty($event->start_location['address'])) {
534
+						return $calendar->get_event_html($event, $partial);
535 535
 					}
536 536
 
537 537
 					return false;
538 538
 
539 539
 				case 'if-not-location' :
540 540
 				case 'if-not-start-location' :
541
-					if ( empty( $event->start_location['address'] ) ) {
542
-						return $calendar->get_event_html( $event, $partial );
541
+					if (empty($event->start_location['address'])) {
542
+						return $calendar->get_event_html($event, $partial);
543 543
 					}
544 544
 
545 545
 					return '';
546 546
 
547 547
 				case 'if-not-end-location' :
548
-					if ( empty( $event->end_location['address'] ) ) {
549
-						return $calendar->get_event_html( $event, $partial );
548
+					if (empty($event->end_location['address'])) {
549
+						return $calendar->get_event_html($event, $partial);
550 550
 					}
551 551
 
552 552
 					return '';
553 553
 
554 554
 				case 'if-end-location' :
555
-					if ( ! empty( $event->end_location['address'] ) ) {
556
-						return $calendar->get_event_html( $event, $partial );
555
+					if ( ! empty($event->end_location['address'])) {
556
+						return $calendar->get_event_html($event, $partial);
557 557
 					}
558 558
 
559 559
 					return '';
@@ -563,12 +563,12 @@  discard block
 block discarded – undo
563 563
 				 * ======= */
564 564
 
565 565
 				default :
566
-					$resultCustom = $this->do_custom_event_tag( $tag, $partial, $attr, $event );
567
-					if ( $resultCustom != "" ) {
566
+					$resultCustom = $this->do_custom_event_tag($tag, $partial, $attr, $event);
567
+					if ($resultCustom != "") {
568 568
 						return $resultCustom;
569 569
 					}
570 570
 
571
-					return wp_kses_post( $before . $partial . $after );
571
+					return wp_kses_post($before.$partial.$after);
572 572
 			}
573 573
 		}
574 574
 
@@ -586,14 +586,14 @@  discard block
 block discarded – undo
586 586
 	 *
587 587
 	 * @return string
588 588
 	 */
589
-	private function limit_words( $text, $limit ) {
589
+	private function limit_words($text, $limit) {
590 590
 
591
-		$limit = max( absint( $limit ), 0 );
591
+		$limit = max(absint($limit), 0);
592 592
 
593
-		if ( $limit > 0 && ( str_word_count( $text, 0 ) > $limit ) ) {
594
-			$words = str_word_count( $text, 2 );
595
-			$pos   = array_keys( $words );
596
-			$text  = trim( substr( $text, 0, $pos[ $limit ] ) ) . '&hellip;';
593
+		if ($limit > 0 && (str_word_count($text, 0) > $limit)) {
594
+			$words = str_word_count($text, 2);
595
+			$pos   = array_keys($words);
596
+			$text  = trim(substr($text, 0, $pos[$limit])).'&hellip;';
597 597
 		}
598 598
 
599 599
 		return $text;
@@ -610,26 +610,26 @@  discard block
 block discarded – undo
610 610
 	 *
611 611
 	 * @return string
612 612
 	 */
613
-	private function get_title( $title, $attr ) {
613
+	private function get_title($title, $attr) {
614 614
 
615
-		if ( empty( $title ) ) {
615
+		if (empty($title)) {
616 616
 			return '';
617 617
 		}
618 618
 
619
-		$attr = array_merge( array(
620
-			'html'  => '',  // Parse HTML
621
-			'limit' => 0,   // Trim length to amount of words
622
-		), (array) shortcode_parse_atts( $attr ) );
619
+		$attr = array_merge(array(
620
+			'html'  => '', // Parse HTML
621
+			'limit' => 0, // Trim length to amount of words
622
+		), (array) shortcode_parse_atts($attr));
623 623
 
624
-		if ( ! empty( $attr['html'] ) ) {
625
-			$title = wp_kses_post( $title );
624
+		if ( ! empty($attr['html'])) {
625
+			$title = wp_kses_post($title);
626 626
 			$tag   = 'div';
627 627
 		} else {
628
-			$title = $this->limit_words( $title, $attr['limit'] );
628
+			$title = $this->limit_words($title, $attr['limit']);
629 629
 			$tag   = 'span';
630 630
 		}
631 631
 
632
-		return '<' . $tag . ' class="simcal-event-title" itemprop="name">' . $title . '</' . $tag . '>';
632
+		return '<'.$tag.' class="simcal-event-title" itemprop="name">'.$title.'</'.$tag.'>';
633 633
 	}
634 634
 
635 635
 	/**
@@ -643,18 +643,18 @@  discard block
 block discarded – undo
643 643
 	 *
644 644
 	 * @return string
645 645
 	 */
646
-	private function get_description( $description, $attr ) {
646
+	private function get_description($description, $attr) {
647 647
 
648
-		if ( empty( $description ) ) {
648
+		if (empty($description)) {
649 649
 			return '';
650 650
 		}
651 651
 
652
-		$attr = array_merge( array(
653
-			'limit'    => 0,       // Trim length to number of words
654
-			'html'     => 'no',    // Parse HTML content
655
-			'markdown' => 'no',    // Parse Markdown content
656
-			'autolink' => 'no',    // Automatically convert plaintext URIs to anchors
657
-		), (array) shortcode_parse_atts( $attr ) );
652
+		$attr = array_merge(array(
653
+			'limit'    => 0, // Trim length to number of words
654
+			'html'     => 'no', // Parse HTML content
655
+			'markdown' => 'no', // Parse Markdown content
656
+			'autolink' => 'no', // Automatically convert plaintext URIs to anchors
657
+		), (array) shortcode_parse_atts($attr));
658 658
 
659 659
 		$allow_html = 'no' != $attr['html'] ? true : false;
660 660
 		$allow_md   = 'no' != $attr['markdown'] ? true : false;
@@ -662,23 +662,23 @@  discard block
 block discarded – undo
662 662
 		$html = '<div class="simcal-event-description" itemprop="description">';
663 663
 
664 664
 		// Markdown and HTML don't play well together, use one or the other in the same tag.
665
-		if ( $allow_html || $allow_md ) {
666
-			if ( $allow_html ) {
667
-				$description = wp_kses_post( $description );
668
-			} elseif ( $allow_md ) {
665
+		if ($allow_html || $allow_md) {
666
+			if ($allow_html) {
667
+				$description = wp_kses_post($description);
668
+			} elseif ($allow_md) {
669 669
 				$markdown    = new \Parsedown();
670
-				$description = $markdown->text( wp_strip_all_tags( $description ) );
670
+				$description = $markdown->text(wp_strip_all_tags($description));
671 671
 			}
672 672
 		} else {
673
-			$description = wpautop( $description );
673
+			$description = wpautop($description);
674 674
 		}
675 675
 
676
-		$description = $this->limit_words( $description, $attr['limit'] );
676
+		$description = $this->limit_words($description, $attr['limit']);
677 677
 
678
-		$html .= $description . '</div>';
678
+		$html .= $description.'</div>';
679 679
 
680
-		if ( 'no' != $attr['autolink'] ) {
681
-			$html = ' ' . make_clickable( $html );
680
+		if ('no' != $attr['autolink']) {
681
+			$html = ' '.make_clickable($html);
682 682
 		}
683 683
 
684 684
 		return $html;
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 	 *
695 695
 	 * @return string
696 696
 	 */
697
-	private function get_when( Event $event ) {
697
+	private function get_when(Event $event) {
698 698
 
699 699
 		$start = $event->start_dt;
700 700
 		$end   = $event->end_dt;
@@ -702,41 +702,41 @@  discard block
 block discarded – undo
702 702
 		$time_start = '';
703 703
 		$time_end   = '';
704 704
 		$start_ts   = $start->timestamp;
705
-		$end_ts     = ! is_null( $end ) ? $end->timestamp : null;
705
+		$end_ts     = ! is_null($end) ? $end->timestamp : null;
706 706
 		$start_iso  = $start->toIso8601String();
707
-		$end_iso    = ! is_null( $end ) ? $end->toIso8601String() : null;;
707
+		$end_iso    = ! is_null($end) ? $end->toIso8601String() : null; ;
708 708
 
709
-		if ( ! $event->whole_day ) {
709
+		if ( ! $event->whole_day) {
710 710
 
711
-			$time_start = $this->calendar->datetime_separator . ' <span class="simcal-event-start simcal-event-start-time" ' . 'data-event-start="' . $start_ts . '" ' . 'data-event-format="' . $this->calendar->time_format . '" ' . 'itemprop="startDate" content="' . $start_iso . '">' . date_i18n( $this->calendar->time_format, strtotime( $start->toDateTimeString() ) ) . '</span> ';
711
+			$time_start = $this->calendar->datetime_separator.' <span class="simcal-event-start simcal-event-start-time" '.'data-event-start="'.$start_ts.'" '.'data-event-format="'.$this->calendar->time_format.'" '.'itemprop="startDate" content="'.$start_iso.'">'.date_i18n($this->calendar->time_format, strtotime($start->toDateTimeString())).'</span> ';
712 712
 
713
-			if ( $end instanceof Carbon ) {
713
+			if ($end instanceof Carbon) {
714 714
 
715
-				$time_end = ' <span class="simcal-event-end simcal-event-end-time" ' . 'data-event-end="' . $end_ts . '" ' . 'data-event-format="' . $this->calendar->time_format . '" ' . 'itemprop="endDate" content="' . $end_iso . '">' . date_i18n( $this->calendar->time_format, strtotime( $end->toDateTimeString() ) ) . '</span> ';
715
+				$time_end = ' <span class="simcal-event-end simcal-event-end-time" '.'data-event-end="'.$end_ts.'" '.'data-event-format="'.$this->calendar->time_format.'" '.'itemprop="endDate" content="'.$end_iso.'">'.date_i18n($this->calendar->time_format, strtotime($end->toDateTimeString())).'</span> ';
716 716
 
717 717
 			}
718 718
 
719 719
 		}
720 720
 
721
-		if ( $event->multiple_days ) {
721
+		if ($event->multiple_days) {
722 722
 
723
-			$output = ' <span class="simcal-event-start simcal-event-start-date" ' . 'data-event-start="' . $start_ts . '" ' . 'data-event-format="' . $this->calendar->date_format . '" ' . 'itemprop="startDate" content="' . $start_iso . '">' . date_i18n( $this->calendar->date_format, strtotime( $start->toDateTimeString() ) ) . '</span> ' . $time_start;
723
+			$output = ' <span class="simcal-event-start simcal-event-start-date" '.'data-event-start="'.$start_ts.'" '.'data-event-format="'.$this->calendar->date_format.'" '.'itemprop="startDate" content="'.$start_iso.'">'.date_i18n($this->calendar->date_format, strtotime($start->toDateTimeString())).'</span> '.$time_start;
724 724
 
725
-			if ( $end instanceof Carbon ) {
725
+			if ($end instanceof Carbon) {
726 726
 
727
-				$output .= '-' . ' <span class="simcal-event-start simcal-event-end-date" ' . 'data-event-start="' . $end_ts . '" ' . 'data-event-format="' . $this->calendar->date_format . '" ' . 'itemprop="endDate" content="' . $end_iso . '">' . date_i18n( $this->calendar->date_format, strtotime( $end->toDateTimeString() ) ) . '</span> ' . $time_end;
727
+				$output .= '-'.' <span class="simcal-event-start simcal-event-end-date" '.'data-event-start="'.$end_ts.'" '.'data-event-format="'.$this->calendar->date_format.'" '.'itemprop="endDate" content="'.$end_iso.'">'.date_i18n($this->calendar->date_format, strtotime($end->toDateTimeString())).'</span> '.$time_end;
728 728
 			}
729 729
 
730 730
 		} else {
731 731
 
732
-			$time_end = ! empty( $time_start ) && ! empty( $time_end ) ? ' - ' . $time_end : '';
732
+			$time_end = ! empty($time_start) && ! empty($time_end) ? ' - '.$time_end : '';
733 733
 
734 734
 			// All-day events also need startDate for schema data.
735
-			$output = ' <span class="simcal-event-start simcal-event-start-date" ' . 'data-event-start="' . $start_ts . '" ' . 'data-event-format="' . $this->calendar->date_format . '" ' . 'itemprop="startDate" content="' . $start_iso . '">' . date_i18n( $this->calendar->date_format, strtotime( $start->toDateTimeString() ) ) . '</span> ' . $time_start . $time_end;
735
+			$output = ' <span class="simcal-event-start simcal-event-start-date" '.'data-event-start="'.$start_ts.'" '.'data-event-format="'.$this->calendar->date_format.'" '.'itemprop="startDate" content="'.$start_iso.'">'.date_i18n($this->calendar->date_format, strtotime($start->toDateTimeString())).'</span> '.$time_start.$time_end;
736 736
 
737 737
 		}
738 738
 
739
-		return trim( $output );
739
+		return trim($output);
740 740
 	}
741 741
 
742 742
 	/**
@@ -751,52 +751,52 @@  discard block
 block discarded – undo
751 751
 	 *
752 752
 	 * @return string
753 753
 	 */
754
-	private function get_dt( $tag, Event $event, $attr ) {
754
+	private function get_dt($tag, Event $event, $attr) {
755 755
 
756
-		$bound = 0 === strpos( $tag, 'end' ) ? 'end' : 'start';
756
+		$bound = 0 === strpos($tag, 'end') ? 'end' : 'start';
757 757
 
758
-		if ( ( 'end' == $bound ) && ( false === $event->end ) ) {
758
+		if (('end' == $bound) && (false === $event->end)) {
759 759
 			return '';
760 760
 		}
761 761
 
762
-		$dt = $bound . '_dt';
762
+		$dt = $bound.'_dt';
763 763
 
764
-		if ( ! $event->$dt instanceof Carbon ) {
764
+		if ( ! $event->$dt instanceof Carbon) {
765 765
 			return '';
766 766
 		}
767 767
 
768 768
 		$event_dt = $event->$dt;
769 769
 
770
-		$attr = array_merge( array(
770
+		$attr = array_merge(array(
771 771
 			'format' => '',
772
-		), (array) shortcode_parse_atts( $attr ) );
772
+		), (array) shortcode_parse_atts($attr));
773 773
 
774
-		$format    = ltrim( strstr( $tag, '-' ), '-' );
774
+		$format    = ltrim(strstr($tag, '-'), '-');
775 775
 		$dt_format = '';
776 776
 
777
-		if ( ! empty( $attr['format'] ) ) {
778
-			$dt_format = esc_attr( wp_strip_all_tags( $attr['format'] ) );
779
-		} elseif ( 'date' == $format ) {
777
+		if ( ! empty($attr['format'])) {
778
+			$dt_format = esc_attr(wp_strip_all_tags($attr['format']));
779
+		} elseif ('date' == $format) {
780 780
 			$dt_format = $this->calendar->date_format;
781
-		} elseif ( 'time' == $format ) {
781
+		} elseif ('time' == $format) {
782 782
 			$dt_format = $this->calendar->time_format;
783 783
 		}
784 784
 
785 785
 		$dt_ts = $event_dt->timestamp;
786 786
 
787
-		if ( 'human' == $format ) {
788
-			$value = human_time_diff( $dt_ts, Carbon::now( $event->timezone )->getTimestamp() );
787
+		if ('human' == $format) {
788
+			$value = human_time_diff($dt_ts, Carbon::now($event->timezone)->getTimestamp());
789 789
 
790
-			if ( $dt_ts < Carbon::now( $event->timezone )->getTimestamp() ) {
791
-				$value .= ' ' . _x( 'ago', 'human date event builder code modifier', 'google-calendar-events' );
790
+			if ($dt_ts < Carbon::now($event->timezone)->getTimestamp()) {
791
+				$value .= ' '._x('ago', 'human date event builder code modifier', 'google-calendar-events');
792 792
 			} else {
793
-				$value .= ' ' . _x( 'from now', 'human date event builder code modifier', 'google-calendar-events' );
793
+				$value .= ' '._x('from now', 'human date event builder code modifier', 'google-calendar-events');
794 794
 			}
795 795
 		} else {
796
-			$value = date_i18n( $dt_format, strtotime( $event_dt->toDateTimeString() ) );
796
+			$value = date_i18n($dt_format, strtotime($event_dt->toDateTimeString()));
797 797
 		}
798 798
 
799
-		return '<span class="simcal-event-' . $bound . ' ' . 'simcal-event-' . $bound . '-' . $format . '" ' . 'data-event-' . $bound . '="' . $dt_ts . '" ' . 'data-event-format="' . $dt_format . '" ' . 'itemprop="' . $bound . 'Date" content="' . $event_dt->toIso8601String() . '">' . $value . '</span>';
799
+		return '<span class="simcal-event-'.$bound.' '.'simcal-event-'.$bound.'-'.$format.'" '.'data-event-'.$bound.'="'.$dt_ts.'" '.'data-event-format="'.$dt_format.'" '.'itemprop="'.$bound.'Date" content="'.$event_dt->toIso8601String().'">'.$value.'</span>';
800 800
 	}
801 801
 
802 802
 	/**
@@ -812,23 +812,23 @@  discard block
 block discarded – undo
812 812
 	 *
813 813
 	 * @return string
814 814
 	 */
815
-	private function make_link( $tag, $url, $content, $attr ) {
815
+	private function make_link($tag, $url, $content, $attr) {
816 816
 
817
-		if ( empty( $url ) ) {
817
+		if (empty($url)) {
818 818
 			return '';
819 819
 		}
820 820
 
821
-		$text = empty( $content ) ? $url : $content;
821
+		$text = empty($content) ? $url : $content;
822 822
 
823
-		$attr = array_merge( array(
824
-			'autolink'  => false,   // Convert url to link anchor
825
-			'newwindow' => false,   // If autolink attribute is true, open link in new window
826
-		), (array) shortcode_parse_atts( $attr ) );
823
+		$attr = array_merge(array(
824
+			'autolink'  => false, // Convert url to link anchor
825
+			'newwindow' => false, // If autolink attribute is true, open link in new window
826
+		), (array) shortcode_parse_atts($attr));
827 827
 
828 828
 		$anchor = $tag != 'url' ? 'yes' : $attr['autolink'];
829 829
 		$target = $attr['newwindow'] !== false ? 'target="_blank"' : '';
830 830
 
831
-		return $anchor !== false ? ' <a href="' . esc_url( $url ) . '" ' . $target . '>' . $text . '</a>' : ' ' . $text;
831
+		return $anchor !== false ? ' <a href="'.esc_url($url).'" '.$target.'>'.$text.'</a>' : ' '.$text;
832 832
 	}
833 833
 
834 834
 	/**
@@ -841,20 +841,20 @@  discard block
 block discarded – undo
841 841
 	 *
842 842
 	 * @return string
843 843
 	 */
844
-	private function get_attachments( $attachments ) {
844
+	private function get_attachments($attachments) {
845 845
 
846
-		$html = '<ul class="simcal-attachments">' . "\n\t";
846
+		$html = '<ul class="simcal-attachments">'."\n\t";
847 847
 
848
-		foreach ( $attachments as $attachment ) {
848
+		foreach ($attachments as $attachment) {
849 849
 			$html .= '<li class="simcal-attachment">';
850
-			$html .= '<a href="' . $attachment['url'] . '" target="_blank">';
851
-			$html .= ! empty( $attachment['icon'] ) ? '<img src="' . $attachment['icon'] . '" />' : '';
852
-			$html .= '<span>' . $attachment['name'] . '</span>';
850
+			$html .= '<a href="'.$attachment['url'].'" target="_blank">';
851
+			$html .= ! empty($attachment['icon']) ? '<img src="'.$attachment['icon'].'" />' : '';
852
+			$html .= '<span>'.$attachment['name'].'</span>';
853 853
 			$html .= '</a>';
854
-			$html .= '</li>' . "\n";
854
+			$html .= '</li>'."\n";
855 855
 		}
856 856
 
857
-		$html .= '</ul>' . "\n";
857
+		$html .= '</ul>'."\n";
858 858
 
859 859
 		return $html;
860 860
 	}
@@ -870,41 +870,41 @@  discard block
 block discarded – undo
870 870
 	 *
871 871
 	 * @return string
872 872
 	 */
873
-	private function get_attendees( $attendees, $attr ) {
873
+	private function get_attendees($attendees, $attr) {
874 874
 
875
-		$attr = array_merge( array(
876
-			'photo'    => 'show',  // show/hide attendee photo
877
-			'email'    => 'hide',  // show/hide attendee email address
878
-			'rsvp'     => 'hide',  // show/hide rsvp response status
879
-			'response' => '',      // filter attendees by rsvp response (yes/no/maybe)
880
-		), (array) shortcode_parse_atts( $attr ) );
875
+		$attr = array_merge(array(
876
+			'photo'    => 'show', // show/hide attendee photo
877
+			'email'    => 'hide', // show/hide attendee email address
878
+			'rsvp'     => 'hide', // show/hide rsvp response status
879
+			'response' => '', // filter attendees by rsvp response (yes/no/maybe)
880
+		), (array) shortcode_parse_atts($attr));
881 881
 
882
-		$html = '<ul class="simcal-attendees" itemprop="attendees">' . "\n\t";
882
+		$html = '<ul class="simcal-attendees" itemprop="attendees">'."\n\t";
883 883
 
884 884
 		$known   = 0;
885 885
 		$unknown = 0;
886 886
 
887
-		foreach ( $attendees as $attendee ) {
887
+		foreach ($attendees as $attendee) {
888 888
 
889
-			if ( 'yes' == $attr['response'] && 'yes' != $attendee['response'] ) {
889
+			if ('yes' == $attr['response'] && 'yes' != $attendee['response']) {
890 890
 				continue;
891
-			} elseif ( 'no' == $attr['response'] && 'no' != $attendee['response'] ) {
891
+			} elseif ('no' == $attr['response'] && 'no' != $attendee['response']) {
892 892
 				continue;
893
-			} elseif ( 'maybe' == $attr['response'] && ! in_array( $attendee['response'], array( 'yes', 'maybe' ) ) ) {
893
+			} elseif ('maybe' == $attr['response'] && ! in_array($attendee['response'], array('yes', 'maybe'))) {
894 894
 				continue;
895 895
 			}
896 896
 
897
-			if ( ! empty( $attendee['name'] ) ) {
897
+			if ( ! empty($attendee['name'])) {
898 898
 
899
-				$photo    = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="' . $attendee['photo'] . '" itemprop="image" />' : '';
900
-				$response = 'hide' != $attr['rsvp'] ? $this->get_rsvp_response( $attendee['response'] ) : '';
901
-				$guest    = $photo . '<span itemprop="name">' . $attendee['name'] . $response . '</span>';
899
+				$photo    = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="'.$attendee['photo'].'" itemprop="image" />' : '';
900
+				$response = 'hide' != $attr['rsvp'] ? $this->get_rsvp_response($attendee['response']) : '';
901
+				$guest    = $photo.'<span itemprop="name">'.$attendee['name'].$response.'</span>';
902 902
 
903
-				if ( ! empty( $attendee['email'] ) && ( 'show' == $attr['email'] ) ) {
904
-					$guest = sprintf( '<a href="mailto:' . $attendee['email'] . '" itemprop="email">%s</a>', $guest );
903
+				if ( ! empty($attendee['email']) && ('show' == $attr['email'])) {
904
+					$guest = sprintf('<a href="mailto:'.$attendee['email'].'" itemprop="email">%s</a>', $guest);
905 905
 				}
906 906
 
907
-				$html .= '<li class="simcal-attendee" itemprop="attendee" itemscope itemtype="http://schema.org/Person">' . $guest . '</li>' . "\n";
907
+				$html .= '<li class="simcal-attendee" itemprop="attendee" itemscope itemtype="http://schema.org/Person">'.$guest.'</li>'."\n";
908 908
 
909 909
 				$known++;
910 910
 
@@ -915,21 +915,21 @@  discard block
 block discarded – undo
915 915
 			}
916 916
 		}
917 917
 
918
-		if ( $unknown > 0 ) {
919
-			if ( $known > 0 ) {
918
+		if ($unknown > 0) {
919
+			if ($known > 0) {
920 920
 				/* translators: One more person attending the event. */
921
-				$others = sprintf( _n( '1 more attendee', '%s more attendees', $unknown, 'google-calendar-events' ), $unknown );
921
+				$others = sprintf(_n('1 more attendee', '%s more attendees', $unknown, 'google-calendar-events'), $unknown);
922 922
 			} else {
923 923
 				/* translators: One or more persons attending the event whose name is unknown. */
924
-				$others = sprintf( _n( '1 anonymous attendee', '%s anonymous attendees', $unknown, 'google-calendar-events' ), $unknown );
924
+				$others = sprintf(_n('1 anonymous attendee', '%s anonymous attendees', $unknown, 'google-calendar-events'), $unknown);
925 925
 			}
926
-			$photo = $attr['photo'] !== 'hide' ? get_avatar( '', 128 ) : '';
927
-			$html .= '<li class="simcal-attendee simcal-attendee-anonymous">' . $photo . '<span>' . $others . '</span></li>' . "\n";
928
-		} elseif ( $known === 0 ) {
929
-			$html .= '<li class="simcal-attendee">' . _x( 'No one yet', 'No one yet rsvp to attend the event.', 'google-calendar-events' ) . '</li>' . "\n";
926
+			$photo = $attr['photo'] !== 'hide' ? get_avatar('', 128) : '';
927
+			$html .= '<li class="simcal-attendee simcal-attendee-anonymous">'.$photo.'<span>'.$others.'</span></li>'."\n";
928
+		} elseif ($known === 0) {
929
+			$html .= '<li class="simcal-attendee">'._x('No one yet', 'No one yet rsvp to attend the event.', 'google-calendar-events').'</li>'."\n";
930 930
 		}
931 931
 
932
-		$html .= '</ul>' . "\n";
932
+		$html .= '</ul>'."\n";
933 933
 
934 934
 		return $html;
935 935
 	}
@@ -943,23 +943,23 @@  discard block
 block discarded – undo
943 943
 	 *
944 944
 	 * @return string
945 945
 	 */
946
-	private function get_rsvp_response( $response ) {
946
+	private function get_rsvp_response($response) {
947 947
 
948
-		if ( 'yes' == $response ) {
948
+		if ('yes' == $response) {
949 949
 			/* translators: Someone replied with 'yes' to a rsvp request. */
950
-			$rsvp = __( 'Attending', 'google-calendar-events' );
951
-		} elseif ( 'no' == $response ) {
950
+			$rsvp = __('Attending', 'google-calendar-events');
951
+		} elseif ('no' == $response) {
952 952
 			/* translators: Someone replied with 'no' to a rsvp request. */
953
-			$rsvp = __( 'Not attending', 'google-calendar-events' );
954
-		} elseif ( 'maybe' == $response ) {
953
+			$rsvp = __('Not attending', 'google-calendar-events');
954
+		} elseif ('maybe' == $response) {
955 955
 			/* translators: Someone replied with 'maybe' to a rsvp request. */
956
-			$rsvp = __( 'Maybe attending', 'google-calendar-events' );
956
+			$rsvp = __('Maybe attending', 'google-calendar-events');
957 957
 		} else {
958 958
 			/* translators: Someone did not send yet a rsvp confirmation to join an event. */
959
-			$rsvp = __( 'Response pending', 'google-calendar-events' );
959
+			$rsvp = __('Response pending', 'google-calendar-events');
960 960
 		}
961 961
 
962
-		return ' <small>(' . $rsvp . ')</small>';
962
+		return ' <small>('.$rsvp.')</small>';
963 963
 	}
964 964
 
965 965
 	/**
@@ -973,21 +973,21 @@  discard block
 block discarded – undo
973 973
 	 *
974 974
 	 * @return string
975 975
 	 */
976
-	private function get_organizer( $organizer, $attr ) {
976
+	private function get_organizer($organizer, $attr) {
977 977
 
978
-		$attr = array_merge( array(
979
-			'photo' => 'show',  // show/hide attendee photo
980
-			'email' => 'hide',  // show/hide attendee email address
981
-		), (array) shortcode_parse_atts( $attr ) );
978
+		$attr = array_merge(array(
979
+			'photo' => 'show', // show/hide attendee photo
980
+			'email' => 'hide', // show/hide attendee email address
981
+		), (array) shortcode_parse_atts($attr));
982 982
 
983
-		$photo          = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="' . $organizer['photo'] . '" itemprop="image"  />' : '';
984
-		$organizer_html = $photo . '<span itemprop="name">' . $organizer['name'] . '</span>';
983
+		$photo          = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="'.$organizer['photo'].'" itemprop="image"  />' : '';
984
+		$organizer_html = $photo.'<span itemprop="name">'.$organizer['name'].'</span>';
985 985
 
986
-		if ( ! empty( $organizer['email'] ) && ( 'show' == $attr['email'] ) ) {
987
-			$organizer_html = sprintf( '<a href="mailto:' . $organizer['email'] . '" itemprop="email">%s</a>', $organizer_html );
986
+		if ( ! empty($organizer['email']) && ('show' == $attr['email'])) {
987
+			$organizer_html = sprintf('<a href="mailto:'.$organizer['email'].'" itemprop="email">%s</a>', $organizer_html);
988 988
 		}
989 989
 
990
-		return '<div class="simcal-organizer" itemprop="organizer" itemscope itemtype="https://schema.org/Person">' . $organizer_html . '</div>';
990
+		return '<div class="simcal-organizer" itemprop="organizer" itemscope itemtype="https://schema.org/Person">'.$organizer_html.'</div>';
991 991
 	}
992 992
 
993 993
 	/**
@@ -1012,38 +1012,38 @@  discard block
 block discarded – undo
1012 1012
 		// This is largely borrowed on get_shortcode_regex() from WordPress Core.
1013 1013
 		// @see /wp-includes/shortcodes.php (with some modification)
1014 1014
 
1015
-		$tagregexp = implode( '|', array_values( $this->tags ) );
1015
+		$tagregexp = implode('|', array_values($this->tags));
1016 1016
 
1017
-		return '/' . '\\['                              // Opening bracket
1017
+		return '/'.'\\['                              // Opening bracket
1018 1018
 		       . '(\\[?)'                           // 1: Optional second opening bracket for escaping tags: [[tag]]
1019 1019
 		       . "($tagregexp)"                     // 2: Tag name
1020 1020
 		       . '(?![\\w-])'                       // Not followed by word character or hyphen
1021 1021
 		       . '('                                // 3: Unroll the loop: Inside the opening tag
1022 1022
 		       . '[^\\]\\/]*'                   // Not a closing bracket or forward slash
1023
-		       . '(?:' . '\\/(?!\\])'               // A forward slash not followed by a closing bracket
1023
+		       . '(?:'.'\\/(?!\\])'               // A forward slash not followed by a closing bracket
1024 1024
 		       . '[^\\]\\/]*'               // Not a closing bracket or forward slash
1025
-		       . ')*?' . ')' . '(?:' . '(\\/)'                        // 4: Self closing tag ...
1025
+		       . ')*?'.')'.'(?:'.'(\\/)'                        // 4: Self closing tag ...
1026 1026
 		       . '\\]'                          // ... and closing bracket
1027
-		       . '|' . '\\]'                          // Closing bracket
1028
-		       . '(?:' . '('                        // 5: Unroll the loop: Optionally, anything between the opening and closing tags
1027
+		       . '|'.'\\]'                          // Closing bracket
1028
+		       . '(?:'.'('                        // 5: Unroll the loop: Optionally, anything between the opening and closing tags
1029 1029
 		       . '[^\\[]*+'             // Not an opening bracket
1030
-		       . '(?:' . '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing tag
1030
+		       . '(?:'.'\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing tag
1031 1031
 		       . '[^\\[]*+'         // Not an opening bracket
1032
-		       . ')*+' . ')' . '\\[\\/\\2\\]'             // Closing tag
1033
-		       . ')?' . ')' . '(\\]?)'                           // 6: Optional second closing bracket for escaping tags: [[tag]]
1032
+		       . ')*+'.')'.'\\[\\/\\2\\]'             // Closing tag
1033
+		       . ')?'.')'.'(\\]?)'                           // 6: Optional second closing bracket for escaping tags: [[tag]]
1034 1034
 		       . '/s';
1035 1035
 	}
1036 1036
 
1037 1037
 	//allow other plugins to register own event tags
1038 1038
 	private function add_custom_event_tags() {
1039
-		$array = apply_filters( 'simcal_event_tags_add_custom', array() );
1039
+		$array = apply_filters('simcal_event_tags_add_custom', array());
1040 1040
 
1041 1041
 		return $array;
1042 1042
 	}
1043 1043
 
1044 1044
 	//allow other plugins to replace own (registered) event tags with their value
1045
-	private function do_custom_event_tag( $tag, $partial, $attr, $event ) {
1046
-		$returnvalue = apply_filters( 'simcal_event_tags_do_custom', "", $tag, $partial, $attr, $event );
1045
+	private function do_custom_event_tag($tag, $partial, $attr, $event) {
1046
+		$returnvalue = apply_filters('simcal_event_tags_do_custom', "", $tag, $partial, $attr, $event);
1047 1047
 
1048 1048
 		return $returnvalue;
1049 1049
 	}
Please login to merge, or discard this patch.