Completed
Push — master ( 61887c...f18ca1 )
by
unknown
06:25
created
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.
includes/abstracts/calendar.php 1 patch
Spacing   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 use SimpleCalendar\Events\Event_Builder;
12 12
 use SimpleCalendar\Events\Events;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 	 * @param int|object|\WP_Post|Calendar $calendar
235 235
 	 * @param string $view
236 236
 	 */
237
-	public function __construct( $calendar, $view = '' ) {
237
+	public function __construct($calendar, $view = '') {
238 238
 
239 239
 		// Set the post object.
240
-		$this->set_post_object( $calendar );
240
+		$this->set_post_object($calendar);
241 241
 
242
-		if ( ! is_null( $this->post ) ) {
242
+		if ( ! is_null($this->post)) {
243 243
 
244 244
 			// Set calendar type and events source.
245 245
 			$this->set_taxonomies();
@@ -256,23 +256,23 @@  discard block
 block discarded – undo
256 256
 			$this->set_events_template();
257 257
 
258 258
 			// Get events source data.
259
-			$feed = simcal_get_feed( $this );
260
-			if ( $feed instanceof Feed ) {
261
-				if ( ! empty( $feed->events ) ) {
262
-					if ( is_array( $feed->events ) ) {
263
-						$this->set_events( $feed->events );
264
-						if ( 'use_calendar' == get_post_meta( $this->id, '_feed_timezone_setting', true ) ) {
259
+			$feed = simcal_get_feed($this);
260
+			if ($feed instanceof Feed) {
261
+				if ( ! empty($feed->events)) {
262
+					if (is_array($feed->events)) {
263
+						$this->set_events($feed->events);
264
+						if ('use_calendar' == get_post_meta($this->id, '_feed_timezone_setting', true)) {
265 265
 							$this->timezone = $feed->timezone;
266 266
 							$this->set_start();
267 267
 						}
268
-					} elseif ( is_string( $feed->events ) ) {
268
+					} elseif (is_string($feed->events)) {
269 269
 						$this->errors[] = $feed->events;
270 270
 					}
271 271
 				}
272 272
 			}
273 273
 
274 274
 			// Set general purpose timestamps.
275
-			$now = Carbon::now( $this->timezone );
275
+			$now = Carbon::now($this->timezone);
276 276
 			$this->now    = $now->getTimestamp();
277 277
 			$this->today  = $now->startOfDay()->getTimestamp();
278 278
 			$this->offset = $now->getOffset();
@@ -283,26 +283,26 @@  discard block
 block discarded – undo
283 283
 			$this->set_datetime_separator();
284 284
 
285 285
 			// Set earliest and latest event timestamps.
286
-			if ( $this->events && is_array( $this->events ) ) {
287
-				$this->earliest_event = intval( current( array_keys( $this->events ) ) );
288
-				$this->latest_event   = intval( key( array_slice( $this->events, -1, 1, true ) ) );
286
+			if ($this->events && is_array($this->events)) {
287
+				$this->earliest_event = intval(current(array_keys($this->events)));
288
+				$this->latest_event   = intval(key(array_slice($this->events, -1, 1, true)));
289 289
 			}
290 290
 
291 291
 			// Set calendar end.
292 292
 			$this->set_end();
293 293
 
294 294
 			// Set view.
295
-			if ( ! $view ) {
295
+			if ( ! $view) {
296 296
 
297
-				$calendar_view = get_post_meta( $this->id, '_calendar_view', true );
298
-				$calendar_view = isset( $calendar_view[ $this->type ] ) ? $calendar_view[ $this->type ] : '';
297
+				$calendar_view = get_post_meta($this->id, '_calendar_view', true);
298
+				$calendar_view = isset($calendar_view[$this->type]) ? $calendar_view[$this->type] : '';
299 299
 
300
-				$view = esc_attr( $calendar_view );
300
+				$view = esc_attr($calendar_view);
301 301
 			}
302 302
 		}
303 303
 
304 304
 		// Get view.
305
-		$this->view = $this->get_view( $view );
305
+		$this->view = $this->get_view($view);
306 306
 	}
307 307
 
308 308
 	/**
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @return bool
316 316
 	 */
317
-	public function __isset( $key ) {
318
-		return metadata_exists( 'post', $this->id, '_' . $key );
317
+	public function __isset($key) {
318
+		return metadata_exists('post', $this->id, '_'.$key);
319 319
 	}
320 320
 
321 321
 	/**
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @return mixed
329 329
 	 */
330
-	public function __get( $key ) {
331
-		$value = get_post_meta( $this->id, '_' . $key, true );
332
-		if ( ! empty( $value ) ) {
330
+	public function __get($key) {
331
+		$value = get_post_meta($this->id, '_'.$key, true);
332
+		if ( ! empty($value)) {
333 333
 			$this->$key = $value;
334 334
 		}
335 335
 		return $value;
@@ -342,17 +342,17 @@  discard block
 block discarded – undo
342 342
 	 *
343 343
 	 * @param int|object|\WP_Post|Calendar $calendar
344 344
 	 */
345
-	public function set_post_object( $calendar ) {
346
-		if ( is_numeric( $calendar ) ) {
347
-			$this->id   = absint( $calendar );
348
-			$this->post = get_post( $this->id );
349
-		} elseif ( $calendar instanceof Calendar ) {
350
-			$this->id   = absint( $calendar->id );
345
+	public function set_post_object($calendar) {
346
+		if (is_numeric($calendar)) {
347
+			$this->id   = absint($calendar);
348
+			$this->post = get_post($this->id);
349
+		} elseif ($calendar instanceof Calendar) {
350
+			$this->id   = absint($calendar->id);
351 351
 			$this->post = $calendar->post;
352
-		} elseif ( $calendar instanceof \WP_Post ) {
353
-			$this->id   = absint( $calendar->ID );
352
+		} elseif ($calendar instanceof \WP_Post) {
353
+			$this->id   = absint($calendar->ID);
354 354
 			$this->post = $calendar;
355
-		} elseif ( isset( $calendar->id ) && isset( $calendar->post ) ) {
355
+		} elseif (isset($calendar->id) && isset($calendar->post)) {
356 356
 			$this->id   = $calendar->id;
357 357
 			$this->post = $calendar->post;
358 358
 		}
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 	 * @return string
367 367
 	 */
368 368
 	public function get_title() {
369
-		$title = isset( $this->post->post_title ) ? $this->post->post_title : '';
370
-		return apply_filters( 'simcal_calendar_title', $title );
369
+		$title = isset($this->post->post_title) ? $this->post->post_title : '';
370
+		return apply_filters('simcal_calendar_title', $title);
371 371
 	}
372 372
 
373 373
 	/**
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 	 */
390 390
 	protected function set_taxonomies() {
391 391
 		// Set calendar type.
392
-		if ( $type = wp_get_object_terms( $this->id, 'calendar_type' ) ) {
393
-			$this->type = sanitize_title( current( $type )->name );
392
+		if ($type = wp_get_object_terms($this->id, 'calendar_type')) {
393
+			$this->type = sanitize_title(current($type)->name);
394 394
 		} else {
395
-			$this->type = apply_filters( 'simcal_calendar_default_type', 'default-calendar' );
395
+			$this->type = apply_filters('simcal_calendar_default_type', 'default-calendar');
396 396
 		}
397 397
 		// Set feed type.
398
-		if ( $feed_type = wp_get_object_terms( $this->id, 'calendar_feed' ) ) {
399
-			$this->feed = sanitize_title( current( $feed_type )->name );
398
+		if ($feed_type = wp_get_object_terms($this->id, 'calendar_feed')) {
399
+			$this->feed = sanitize_title(current($feed_type)->name);
400 400
 		} else {
401
-			$this->feed = apply_filters( 'simcal_calendar_default_feed', 'google' );
401
+			$this->feed = apply_filters('simcal_calendar_default_feed', 'google');
402 402
 		}
403 403
 	}
404 404
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @return Events
411 411
 	 */
412 412
 	public function get_events() {
413
-		return new Events( $this->events, $this->timezone );
413
+		return new Events($this->events, $this->timezone);
414 414
 	}
415 415
 
416 416
 	/**
@@ -420,14 +420,14 @@  discard block
 block discarded – undo
420 420
 	 *
421 421
 	 * @param array $array
422 422
 	 */
423
-	public function set_events( array $array ) {
423
+	public function set_events(array $array) {
424 424
 
425 425
 		$events = array();
426 426
 
427
-		if ( ! empty( $array ) ) {
428
-			foreach ( $array as $tz => $e ) {
429
-				foreach ( $e as $event ) {
430
-					$events[ $tz ][] = $event instanceof Event ? $event : new Event( $event );
427
+		if ( ! empty($array)) {
428
+			foreach ($array as $tz => $e) {
429
+				foreach ($e as $event) {
430
+					$events[$tz][] = $event instanceof Event ? $event : new Event($event);
431 431
 				}
432 432
 			}
433 433
 		}
@@ -444,24 +444,24 @@  discard block
 block discarded – undo
444 444
 	 *
445 445
 	 * @return string
446 446
 	 */
447
-	public function set_events_template( $template = '' ) {
448
-		if ( empty( $template ) ) {
449
-			$template = isset( $this->post->post_content ) ? $this->post->post_content : '';
447
+	public function set_events_template($template = '') {
448
+		if (empty($template)) {
449
+			$template = isset($this->post->post_content) ? $this->post->post_content : '';
450 450
 		}
451 451
 
452 452
 		// TODO: Removed wpautop() call.
453 453
 
454
-		$event_formatting = get_post_meta( $this->id, '_event_formatting', true );
454
+		$event_formatting = get_post_meta($this->id, '_event_formatting', true);
455 455
 
456
-		switch( $event_formatting ) {
456
+		switch ($event_formatting) {
457 457
 			case 'none':
458
-				$this->events_template =  wp_kses_post( trim( $template ) );
458
+				$this->events_template = wp_kses_post(trim($template));
459 459
 				break;
460 460
 			case 'no_linebreaks':
461
-				$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), false );
461
+				$this->events_template = wpautop(wp_kses_post(trim($template)), false);
462 462
 				break;
463 463
 			default:
464
-				$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), true );
464
+				$this->events_template = wpautop(wp_kses_post(trim($template)), true);
465 465
 		}
466 466
 
467 467
 		//$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), true );
@@ -474,37 +474,37 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @param string $tz Timezone.
476 476
 	 */
477
-	public function set_timezone( $tz = '' ) {
477
+	public function set_timezone($tz = '') {
478 478
 
479
-		$site_tz = esc_attr( simcal_get_wp_timezone() );
479
+		$site_tz = esc_attr(simcal_get_wp_timezone());
480 480
 
481
-		if ( $this->feed === 'grouped-calendars' ) {
481
+		if ($this->feed === 'grouped-calendars') {
482 482
 			$this->timezone = $site_tz;
483 483
 			return;
484 484
 		}
485 485
 
486
-		if ( empty( $tz ) ) {
486
+		if (empty($tz)) {
487 487
 
488
-			$timezone_setting = get_post_meta( $this->id, '_feed_timezone_setting', true );
488
+			$timezone_setting = get_post_meta($this->id, '_feed_timezone_setting', true);
489 489
 
490
-			if ( 'use_site' == $timezone_setting ) {
490
+			if ('use_site' == $timezone_setting) {
491 491
 				$tz = $site_tz;
492
-			} elseif ( 'use_custom' == $timezone_setting ) {
493
-				$custom_timezone = esc_attr( get_post_meta( $this->id, '_feed_timezone', true ) );
492
+			} elseif ('use_custom' == $timezone_setting) {
493
+				$custom_timezone = esc_attr(get_post_meta($this->id, '_feed_timezone', true));
494 494
 				// One may be using a non standard timezone in GMT (UTC) offset format.
495
-				if ( ( strpos( $custom_timezone, 'UTC+' ) === 0 ) || ( strpos( $custom_timezone, 'UTC-' ) === 0 ) ) {
496
-					$tz = simcal_get_timezone_from_gmt_offset( substr( $custom_timezone, 3 ) );
495
+				if ((strpos($custom_timezone, 'UTC+') === 0) || (strpos($custom_timezone, 'UTC-') === 0)) {
496
+					$tz = simcal_get_timezone_from_gmt_offset(substr($custom_timezone, 3));
497 497
 				} else {
498
-					$tz = ! empty( $custom_timezone ) ? $custom_timezone : 'UTC';
498
+					$tz = ! empty($custom_timezone) ? $custom_timezone : 'UTC';
499 499
 				}
500 500
 			}
501 501
 
502
-			$this->timezone = empty( $tz ) ? 'UTC' : $tz;
502
+			$this->timezone = empty($tz) ? 'UTC' : $tz;
503 503
 			return;
504 504
 		}
505 505
 
506 506
 		$this->site_timezone = $site_tz;
507
-		$this->timezone = simcal_esc_timezone( $tz, $this->timezone );
507
+		$this->timezone = simcal_esc_timezone($tz, $this->timezone);
508 508
 	}
509 509
 
510 510
 	/**
@@ -514,20 +514,20 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @param string $format PHP datetime format.
516 516
 	 */
517
-	public function set_date_format( $format = '' ) {
517
+	public function set_date_format($format = '') {
518 518
 
519 519
 		$date_format_custom = $date_format_default = $format;
520 520
 
521
-		if ( empty( $date_format_custom ) ) {
521
+		if (empty($date_format_custom)) {
522 522
 
523
-			$date_format_option  = esc_attr( get_post_meta( $this->id, '_calendar_date_format_setting', true ) );
524
-			$date_format_default = esc_attr( get_option( 'date_format' ) );
523
+			$date_format_option  = esc_attr(get_post_meta($this->id, '_calendar_date_format_setting', true));
524
+			$date_format_default = esc_attr(get_option('date_format'));
525 525
 			$date_format_custom  = '';
526 526
 
527
-			if ( 'use_custom' == $date_format_option ) {
528
-				$date_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_date_format', true ) );
529
-			} elseif ( 'use_custom_php' == $date_format_option ) {
530
-				$date_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_date_format_php', true ) );
527
+			if ('use_custom' == $date_format_option) {
528
+				$date_format_custom = esc_attr(get_post_meta($this->id, '_calendar_date_format', true));
529
+			} elseif ('use_custom_php' == $date_format_option) {
530
+				$date_format_custom = esc_attr(get_post_meta($this->id, '_calendar_date_format_php', true));
531 531
 			}
532 532
 		}
533 533
 
@@ -541,20 +541,20 @@  discard block
 block discarded – undo
541 541
 	 *
542 542
 	 * @param string $format PHP datetime format.
543 543
 	 */
544
-	public function set_time_format( $format = '' ) {
544
+	public function set_time_format($format = '') {
545 545
 
546 546
 		$time_format_custom = $time_format_default = $format;
547 547
 
548
-		if ( empty( $time_format_custom ) ) {
548
+		if (empty($time_format_custom)) {
549 549
 
550
-			$time_format_option  = esc_attr( get_post_meta( $this->id, '_calendar_time_format_setting', true ) );
551
-			$time_format_default = esc_attr( get_option( 'time_format' ) );
550
+			$time_format_option  = esc_attr(get_post_meta($this->id, '_calendar_time_format_setting', true));
551
+			$time_format_default = esc_attr(get_option('time_format'));
552 552
 			$time_format_custom  = '';
553 553
 
554
-			if ( 'use_custom' == $time_format_option ) {
555
-				$time_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_time_format', true ) );
556
-			} elseif ( 'use_custom_php' == $time_format_option ) {
557
-				$time_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_time_format_php', true ) );
554
+			if ('use_custom' == $time_format_option) {
555
+				$time_format_custom = esc_attr(get_post_meta($this->id, '_calendar_time_format', true));
556
+			} elseif ('use_custom_php' == $time_format_option) {
557
+				$time_format_custom = esc_attr(get_post_meta($this->id, '_calendar_time_format_php', true));
558 558
 			}
559 559
 		}
560 560
 
@@ -568,13 +568,13 @@  discard block
 block discarded – undo
568 568
 	 *
569 569
 	 * @param string $separator A UTF8 character used as separator.
570 570
 	 */
571
-	public function set_datetime_separator( $separator = '' ) {
571
+	public function set_datetime_separator($separator = '') {
572 572
 
573
-		if ( empty( $separator ) ) {
574
-			$separator = get_post_meta( $this->id, '_calendar_datetime_separator', true );
573
+		if (empty($separator)) {
574
+			$separator = get_post_meta($this->id, '_calendar_datetime_separator', true);
575 575
 		}
576 576
 
577
-		$this->datetime_separator = esc_attr( $separator );
577
+		$this->datetime_separator = esc_attr($separator);
578 578
 	}
579 579
 
580 580
 	/**
@@ -584,18 +584,18 @@  discard block
 block discarded – undo
584 584
 	 *
585 585
 	 * @param int $weekday From 0 (Sunday) to 6 (Friday).
586 586
 	 */
587
-	public function set_start_of_week( $weekday = -1 ) {
587
+	public function set_start_of_week($weekday = -1) {
588 588
 
589
-		$week_starts = is_int( $weekday ) ? $weekday : -1;
589
+		$week_starts = is_int($weekday) ? $weekday : -1;
590 590
 
591
-		if ( $week_starts < 0 || $week_starts > 6 ) {
591
+		if ($week_starts < 0 || $week_starts > 6) {
592 592
 
593
-			$week_starts_setting = get_post_meta( $this->id, '_calendar_week_starts_on_setting', true );
594
-			$week_starts         = intval( get_option( 'start_of_week' ) );
593
+			$week_starts_setting = get_post_meta($this->id, '_calendar_week_starts_on_setting', true);
594
+			$week_starts         = intval(get_option('start_of_week'));
595 595
 
596
-			if ( 'use_custom' == $week_starts_setting ) {
597
-				$week_starts_on = get_post_meta( $this->id, '_calendar_week_starts_on', true );
598
-				$week_starts    = is_numeric( $week_starts_on ) ? intval( $week_starts_on ) : $week_starts;
596
+			if ('use_custom' == $week_starts_setting) {
597
+				$week_starts_on = get_post_meta($this->id, '_calendar_week_starts_on', true);
598
+				$week_starts    = is_numeric($week_starts_on) ? intval($week_starts_on) : $week_starts;
599 599
 			}
600 600
 		}
601 601
 
@@ -609,51 +609,51 @@  discard block
 block discarded – undo
609 609
 	 *
610 610
 	 * @param int $timestamp
611 611
 	 */
612
-	public function set_start( $timestamp = 0 ) {
612
+	public function set_start($timestamp = 0) {
613 613
 
614
-		if ( is_int( $timestamp ) && $timestamp !== 0 ) {
614
+		if (is_int($timestamp) && $timestamp !== 0) {
615 615
 			$this->start = $timestamp;
616 616
 			return;
617 617
 		}
618 618
 
619
-		$start_dt = Carbon::now( $this->timezone );
619
+		$start_dt = Carbon::now($this->timezone);
620 620
 
621
-		$calendar_begins = esc_attr( get_post_meta( $this->id, '_calendar_begins', true ) );
622
-		$nth = max( absint( get_post_meta( $this->id, '_calendar_begins_nth', true ) ), 1 );
621
+		$calendar_begins = esc_attr(get_post_meta($this->id, '_calendar_begins', true));
622
+		$nth = max(absint(get_post_meta($this->id, '_calendar_begins_nth', true)), 1);
623 623
 
624
-		if ( 'today' == $calendar_begins ) {
625
-			$start_dt = Carbon::today( $this->timezone );
626
-		} elseif ( 'days_before' == $calendar_begins ) {
627
-			$start_dt = Carbon::today( $this->timezone )->subDays( $nth );
628
-		} elseif ( 'days_after' == $calendar_begins ) {
629
-			$start_dt = Carbon::today( $this->timezone )->addDays( $nth );
630
-		} elseif ( 'this_week' == $calendar_begins ) {
631
-			$week = new Carbon( 'now', $this->timezone );
632
-			$week->setWeekStartsAt( $this->week_starts );
624
+		if ('today' == $calendar_begins) {
625
+			$start_dt = Carbon::today($this->timezone);
626
+		} elseif ('days_before' == $calendar_begins) {
627
+			$start_dt = Carbon::today($this->timezone)->subDays($nth);
628
+		} elseif ('days_after' == $calendar_begins) {
629
+			$start_dt = Carbon::today($this->timezone)->addDays($nth);
630
+		} elseif ('this_week' == $calendar_begins) {
631
+			$week = new Carbon('now', $this->timezone);
632
+			$week->setWeekStartsAt($this->week_starts);
633 633
 			$start_dt = $week->startOfWeek();
634
-		} elseif ( 'weeks_before' == $calendar_begins ) {
635
-			$week = new Carbon( 'now', $this->timezone );
636
-			$week->setWeekStartsAt( $this->week_starts );
637
-			$start_dt = $week->startOfWeek()->subWeeks( $nth );
638
-		} elseif ( 'weeks_after' == $calendar_begins ) {
639
-			$week = new Carbon( 'now', $this->timezone );
640
-			$week->setWeekStartsAt( $this->week_starts );
641
-			$start_dt = $week->startOfWeek()->addWeeks( $nth );
642
-		} elseif ( 'this_month' == $calendar_begins ) {
643
-			$start_dt = Carbon::today( $this->timezone )->startOfMonth();
644
-		} elseif ( 'months_before' == $calendar_begins ) {
645
-			$start_dt = Carbon::today( $this->timezone )->subMonths( $nth )->startOfMonth();
646
-		} elseif ( 'months_after' == $calendar_begins ) {
647
-			$start_dt = Carbon::today( $this->timezone )->addMonths( $nth )->startOfMonth();
648
-		} elseif ( 'this_year' == $calendar_begins ) {
649
-			$start_dt = Carbon::today( $this->timezone )->startOfYear()->addHour();
650
-		} elseif ( 'years_before' == $calendar_begins ) {
651
-			$start_dt = Carbon::today( $this->timezone )->subYears( $nth )->startOfYear();
652
-		} elseif ( 'years_after' == $calendar_begins ) {
653
-			$start_dt = Carbon::today( $this->timezone )->addYears( $nth )->startOfYear();
654
-		} elseif ( 'custom_date' == $calendar_begins ) {
655
-			if ( $date = get_post_meta( $this->id, '_calendar_begins_custom_date', true ) ) {
656
-				$start_dt = Carbon::createFromFormat( 'Y-m-d', esc_attr( $date ), $this->timezone )->setTimezone( $this->timezone )->startOfDay();
634
+		} elseif ('weeks_before' == $calendar_begins) {
635
+			$week = new Carbon('now', $this->timezone);
636
+			$week->setWeekStartsAt($this->week_starts);
637
+			$start_dt = $week->startOfWeek()->subWeeks($nth);
638
+		} elseif ('weeks_after' == $calendar_begins) {
639
+			$week = new Carbon('now', $this->timezone);
640
+			$week->setWeekStartsAt($this->week_starts);
641
+			$start_dt = $week->startOfWeek()->addWeeks($nth);
642
+		} elseif ('this_month' == $calendar_begins) {
643
+			$start_dt = Carbon::today($this->timezone)->startOfMonth();
644
+		} elseif ('months_before' == $calendar_begins) {
645
+			$start_dt = Carbon::today($this->timezone)->subMonths($nth)->startOfMonth();
646
+		} elseif ('months_after' == $calendar_begins) {
647
+			$start_dt = Carbon::today($this->timezone)->addMonths($nth)->startOfMonth();
648
+		} elseif ('this_year' == $calendar_begins) {
649
+			$start_dt = Carbon::today($this->timezone)->startOfYear()->addHour();
650
+		} elseif ('years_before' == $calendar_begins) {
651
+			$start_dt = Carbon::today($this->timezone)->subYears($nth)->startOfYear();
652
+		} elseif ('years_after' == $calendar_begins) {
653
+			$start_dt = Carbon::today($this->timezone)->addYears($nth)->startOfYear();
654
+		} elseif ('custom_date' == $calendar_begins) {
655
+			if ($date = get_post_meta($this->id, '_calendar_begins_custom_date', true)) {
656
+				$start_dt = Carbon::createFromFormat('Y-m-d', esc_attr($date), $this->timezone)->setTimezone($this->timezone)->startOfDay();
657 657
 			}
658 658
 		}
659 659
 
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
 	 *
668 668
 	 * @param int $timestamp
669 669
 	 */
670
-	public function set_end( $timestamp = 0 ) {
671
-		$latest = is_int( $timestamp ) && $timestamp !== 0 ? $timestamp : $this->latest_event;
670
+	public function set_end($timestamp = 0) {
671
+		$latest = is_int($timestamp) && $timestamp !== 0 ? $timestamp : $this->latest_event;
672 672
 		$this->end = $latest > $this->start ? $latest : $this->start;
673 673
 	}
674 674
 
@@ -679,14 +679,14 @@  discard block
 block discarded – undo
679 679
 	 *
680 680
 	 * @param string|bool $static
681 681
 	 */
682
-	public function set_static( $static = '' ) {
682
+	public function set_static($static = '') {
683 683
 
684
-		if ( ! empty( $static ) && is_bool( $static ) ) {
684
+		if ( ! empty($static) && is_bool($static)) {
685 685
 			$this->static = $static;
686 686
 			return;
687 687
 		}
688 688
 
689
-		if ( 'yes' == get_post_meta( $this->id, '_calendar_is_static', true ) ) {
689
+		if ('yes' == get_post_meta($this->id, '_calendar_is_static', true)) {
690 690
 			$this->static = true;
691 691
 			return;
692 692
 		}
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 	 *
715 715
 	 * @return Calendar_View
716 716
 	 */
717
-	abstract public function get_view( $view = '' );
717
+	abstract public function get_view($view = '');
718 718
 
719 719
 	/**
720 720
 	 * Get event HTML parsed by template.
@@ -726,11 +726,11 @@  discard block
 block discarded – undo
726 726
 	 *
727 727
 	 * @return string
728 728
 	 */
729
-	public function get_event_html( Event $event, $template = '' ) {
730
-		$event_builder = new Event_Builder( $event, $this );
729
+	public function get_event_html(Event $event, $template = '') {
730
+		$event_builder = new Event_Builder($event, $this);
731 731
 		// Use the event template to parse tags; if empty, fallback to calendar post content.
732
-		$template = empty( $template ) ? ( empty( $event->template ) ? $this->events_template : $event->template ) : $template;
733
-		return $event_builder->parse_event_template_tags( $template );
732
+		$template = empty($template) ? (empty($event->template) ? $this->events_template : $event->template) : $template;
733
+		return $event_builder->parse_event_template_tags($template);
734 734
 	}
735 735
 
736 736
 	/**
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 	 *
743 743
 	 * @return string
744 744
 	 */
745
-	public function get_add_to_gcal_url( Event $event ) {
745
+	public function get_add_to_gcal_url(Event $event) {
746 746
 		$base_url = 'https://calendar.google.com/calendar/render';
747 747
 		// Was https://www.google.com/calendar/render
748 748
 
@@ -750,30 +750,30 @@  discard block
 block discarded – undo
750 750
 		// &dates=20160504T110000/20160504T170000
751 751
 		// No "Z"s tacked on to preserve source timezone.
752 752
 		// All day events remove time component, but need to add a full day to show up correctly.
753
-		$is_all_day     = ( true == $event->whole_day );
753
+		$is_all_day     = (true == $event->whole_day);
754 754
 		$gcal_dt_format = $is_all_day ? 'Ymd' : 'Ymd\THi00';
755
-		$gcal_begin_dt  = $event->start_dt->format( $gcal_dt_format );
755
+		$gcal_begin_dt  = $event->start_dt->format($gcal_dt_format);
756 756
 		$end_dt_raw     = $is_all_day ? $event->end_dt->addDay() : $event->end_dt;
757
-		$gcal_end_dt    = $end_dt_raw->format( $gcal_dt_format );
758
-		$gcal_dt_string = $gcal_begin_dt . '/' . $gcal_end_dt;
757
+		$gcal_end_dt    = $end_dt_raw->format($gcal_dt_format);
758
+		$gcal_dt_string = $gcal_begin_dt.'/'.$gcal_end_dt;
759 759
 
760 760
 		// "details" (description) should work even when blank.
761 761
 		// "location" (address) should work with an address, just a name or blank.
762 762
 		$params = array(
763 763
 			'action'   => 'TEMPLATE',
764
-			'text'     => urlencode( strip_tags( $event->title ) ),
764
+			'text'     => urlencode(strip_tags($event->title)),
765 765
 			'dates'    => $gcal_dt_string,
766
-			'details'  => urlencode( $event->description ),
767
-			'location' => urlencode( $event->start_location['address'] ),
766
+			'details'  => urlencode($event->description),
767
+			'location' => urlencode($event->start_location['address']),
768 768
 			'trp'      => 'false',
769 769
 		);
770 770
 
771 771
 		// "ctz" (timezone) arg should be included unless all-day OR 'UTC'.
772
-		if ( ! $is_all_day && ( 'UTC' !== $event->timezone ) ) {
773
-			$params['ctz'] = urlencode( $event->timezone );
772
+		if ( ! $is_all_day && ('UTC' !== $event->timezone)) {
773
+			$params['ctz'] = urlencode($event->timezone);
774 774
 		}
775 775
 
776
-		$url = add_query_arg( $params, $base_url );
776
+		$url = add_query_arg($params, $base_url);
777 777
 
778 778
 		return $url;
779 779
 	}
@@ -785,56 +785,56 @@  discard block
 block discarded – undo
785 785
 	 *
786 786
 	 * @param string $view The calendar view to display.
787 787
 	 */
788
-	public function html( $view = '' ) {
788
+	public function html($view = '') {
789 789
 
790
-		$view = empty( $view ) ? $this->view : $this->get_view( $view );
790
+		$view = empty($view) ? $this->view : $this->get_view($view);
791 791
 
792
-		if ( $view instanceof Calendar_View ) {
792
+		if ($view instanceof Calendar_View) {
793 793
 
794
-			if ( ! empty( $this->errors ) ) {
794
+			if ( ! empty($this->errors)) {
795 795
 
796
-				if ( current_user_can( 'manage_options' )  ) {
796
+				if (current_user_can('manage_options')) {
797 797
 					echo '<pre><code>';
798
-					foreach ( $this->errors as $error ) { echo $error; }
798
+					foreach ($this->errors as $error) { echo $error; }
799 799
 					echo '</code></pre>';
800 800
 				}
801 801
 
802 802
 			} else {
803 803
 
804 804
 				// Get a CSS class from the class name of the calendar view (minus namespace part).
805
-				$view_name  = implode( '-', array_map( 'lcfirst', explode( '_', strtolower( get_class( $view ) ) ) ) );
806
-				$view_class = substr( $view_name, strrpos( $view_name, '\\' ) + 1 );
805
+				$view_name  = implode('-', array_map('lcfirst', explode('_', strtolower(get_class($view)))));
806
+				$view_class = substr($view_name, strrpos($view_name, '\\') + 1);
807 807
 
808
-				$calendar_class = trim( implode( ' simcal-', apply_filters( 'simcal_calendar_class', array(
808
+				$calendar_class = trim(implode(' simcal-', apply_filters('simcal_calendar_class', array(
809 809
 					'simcal-calendar',
810 810
 					$this->type,
811 811
 					$view_class,
812
-				), $this->id ) ) );
813
-
814
-				echo '<div class="' . $calendar_class . '" '
815
-									. 'data-calendar-id="'    . $this->id . '" '
816
-									. 'data-timezone="'       . $this->timezone . '" '
817
-									. 'data-offset="'         . $this->offset . '" '
818
-									. 'data-week-start="'     . $this->week_starts . '" '
819
-									. 'data-calendar-start="' . $this->start .'" '
820
-									. 'data-calendar-end="'   . $this->end . '" '
821
-									. 'data-events-first="'   . $this->earliest_event .'" '
822
-									. 'data-events-last="'    . $this->latest_event . '"'
812
+				), $this->id)));
813
+
814
+				echo '<div class="'.$calendar_class.'" '
815
+									. 'data-calendar-id="'.$this->id.'" '
816
+									. 'data-timezone="'.$this->timezone.'" '
817
+									. 'data-offset="'.$this->offset.'" '
818
+									. 'data-week-start="'.$this->week_starts.'" '
819
+									. 'data-calendar-start="'.$this->start.'" '
820
+									. 'data-calendar-end="'.$this->end.'" '
821
+									. 'data-events-first="'.$this->earliest_event.'" '
822
+									. 'data-events-last="'.$this->latest_event.'"'
823 823
 									. '>';
824 824
 
825
-				do_action( 'simcal_calendar_html_before', $this->id );
825
+				do_action('simcal_calendar_html_before', $this->id);
826 826
 
827 827
 				$view->html();
828 828
 
829
-				do_action( 'simcal_calendar_html_after', $this->id );
829
+				do_action('simcal_calendar_html_after', $this->id);
830 830
 
831 831
 				//$settings = get_option( 'simple-calendar_settings_calendars' );
832
-				$poweredby = get_post_meta( $this->id, '_poweredby', true );
832
+				$poweredby = get_post_meta($this->id, '_poweredby', true);
833 833
 
834
-				if ( 'yes' == $poweredby ) {
834
+				if ('yes' == $poweredby) {
835 835
 					$align = is_rtl() ? 'left' : 'right';
836
-					echo '<small class="simcal-powered simcal-align-' . $align .'">' .
837
-					     sprintf( __( 'Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events' ), simcal_get_url( 'home' ) ) .
836
+					echo '<small class="simcal-powered simcal-align-'.$align.'">'.
837
+					     sprintf(__('Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events'), simcal_get_url('home')).
838 838
 					     '</small>';
839 839
 				}
840 840
 
Please login to merge, or discard this patch.
includes/admin/pages/system-status.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -337,9 +337,9 @@
 block discarded – undo
337 337
 
338 338
 		if ( version_compare( PHP_VERSION, '7.0', '<' ) ) {
339 339
 			$php = '<mark>' . PHP_VERSION . ' - ' .
340
-			       __( 'WordPress.org recommends upgrading to PHP 7 or higher for better security.', 'google-calendar-events' ) .
341
-			       ' <a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'Read more.', 'google-calendar-events' ) . '</a>' .
342
-		           '</mark>';
340
+				   __( 'WordPress.org recommends upgrading to PHP 7 or higher for better security.', 'google-calendar-events' ) .
341
+				   ' <a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'Read more.', 'google-calendar-events' ) . '</a>' .
342
+				   '</mark>';
343 343
 		} else {
344 344
 			$php = '<mark class="ok">' . PHP_VERSION . '</mark>';
345 345
 		}
Please login to merge, or discard this patch.
Spacing   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Admin_Page;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$this->id           = $tab = 'system-status';
32 32
 		$this->option_group = $page = 'tools';
33
-		$this->label        = __( 'System Report', 'google-calendar-events' );
33
+		$this->label        = __('System Report', 'google-calendar-events');
34 34
 		$this->description  = '';
35 35
 		$this->sections     = $this->add_sections();
36 36
 		$this->fields       = $this->add_fields();
37 37
 
38 38
 		// Disable the submit button for this page.
39
-		add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } );
39
+		add_filter('simcal_admin_page_'.$page.'_'.$tab.'_submit', function() { return false; } );
40 40
 
41 41
 		// Add html.
42
-		add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( $this, 'html' ) );
42
+		add_action('simcal_admin_page_'.$page.'_'.$tab.'_end', array($this, 'html'));
43 43
 	}
44 44
 
45 45
 	/**
@@ -51,37 +51,37 @@  discard block
 block discarded – undo
51 51
 
52 52
 		?>
53 53
 		<div id="simcal-system-status-report">
54
-			<p><?php _e( 'Please copy and paste this information when contacting support:', 'google-calendar-events' ); ?> </p>
54
+			<p><?php _e('Please copy and paste this information when contacting support:', 'google-calendar-events'); ?> </p>
55 55
 			<textarea readonly="readonly" onclick="this.select();"></textarea>
56
-			<p><?php _e( 'You can also download your information as a text file to attach, or simply view it below.', 'google-calendar-events' ); ?></p>
57
-			<p><a href="#" id="simcal-system-status-report-download" class="button button-primary"><?php _e( 'Download System Report', 'google-calendar-events' ); ?></a></p>
56
+			<p><?php _e('You can also download your information as a text file to attach, or simply view it below.', 'google-calendar-events'); ?></p>
57
+			<p><a href="#" id="simcal-system-status-report-download" class="button button-primary"><?php _e('Download System Report', 'google-calendar-events'); ?></a></p>
58 58
 		</div>
59 59
 		<hr>
60 60
 		<?php
61 61
 
62 62
 		global $wpdb;
63
-		$wp_version = get_bloginfo( 'version' );
63
+		$wp_version = get_bloginfo('version');
64 64
 
65 65
 		$sections = array();
66 66
 		$panels   = array(
67 67
 			'wordpress' => array(
68
-				'label'  => __( 'WordPress Installation', 'google-calendar-events' ),
68
+				'label'  => __('WordPress Installation', 'google-calendar-events'),
69 69
 				'export' => 'WordPress Installation',
70 70
 			),
71 71
 			'theme'     => array(
72
-				'label'  => __( 'Active Theme', 'google-calendar-events' ),
72
+				'label'  => __('Active Theme', 'google-calendar-events'),
73 73
 				'export' => 'Active Theme',
74 74
 			),
75 75
 			'plugins'   => array(
76
-				'label'  => __( 'Active Plugins', 'google-calendar-events' ),
76
+				'label'  => __('Active Plugins', 'google-calendar-events'),
77 77
 				'export' => 'Active Plugins',
78 78
 			),
79 79
 			'server'    => array(
80
-				'label'  => __( 'Server Environment', 'google-calendar-events' ),
80
+				'label'  => __('Server Environment', 'google-calendar-events'),
81 81
 				'export' => 'Server Environment',
82 82
 			),
83 83
 			'client'    => array(
84
-				'label'  => __( 'Client Information', 'google-calendar-events' ),
84
+				'label'  => __('Client Information', 'google-calendar-events'),
85 85
 				'export' => 'Client Information',
86 86
 			)
87 87
 		);
@@ -98,68 +98,68 @@  discard block
 block discarded – undo
98 98
 		 * ======================
99 99
 		 */
100 100
 
101
-		$debug_mode = $script_debug = __( 'No', 'google-calendar-events' );
102
-		if ( defined( 'WP_DEBUG' ) ) {
103
-			$debug_mode = true === WP_DEBUG ? __( 'Yes', 'google-calendar-events' ) : $debug_mode;
101
+		$debug_mode = $script_debug = __('No', 'google-calendar-events');
102
+		if (defined('WP_DEBUG')) {
103
+			$debug_mode = true === WP_DEBUG ? __('Yes', 'google-calendar-events') : $debug_mode;
104 104
 		}
105
-		if ( defined( 'SCRIPT_DEBUG' ) ) {
106
-			$script_debug = true === SCRIPT_DEBUG ? __( 'Yes', 'google-calendar-events' ) : $script_debug;
105
+		if (defined('SCRIPT_DEBUG')) {
106
+			$script_debug = true === SCRIPT_DEBUG ? __('Yes', 'google-calendar-events') : $script_debug;
107 107
 		}
108 108
 
109
-		$memory = $this->let_to_num( WP_MEMORY_LIMIT );
110
-		$memory_export = size_format( $memory );
111
-		if ( $memory < 67108864 ) {
112
-			$memory = '<mark class="error">' . sprintf( __( '%1$s - It is recomendend to set memory to at least 64MB. See: <a href="%2$s" target="_blank">Increasing memory allocated to PHP</a>', 'google-calendar-events' ), $memory_export, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>';
109
+		$memory = $this->let_to_num(WP_MEMORY_LIMIT);
110
+		$memory_export = size_format($memory);
111
+		if ($memory < 67108864) {
112
+			$memory = '<mark class="error">'.sprintf(__('%1$s - It is recomendend to set memory to at least 64MB. See: <a href="%2$s" target="_blank">Increasing memory allocated to PHP</a>', 'google-calendar-events'), $memory_export, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP').'</mark>';
113 113
 		} else {
114
-			$memory = '<mark class="ok">' . $memory_export . '</mark>';
114
+			$memory = '<mark class="ok">'.$memory_export.'</mark>';
115 115
 		}
116 116
 
117
-		$permalinks = get_option( 'permalink_structure' );
118
-		$permalinks = empty( $permalinks ) ? '/?' : $permalinks;
117
+		$permalinks = get_option('permalink_structure');
118
+		$permalinks = empty($permalinks) ? '/?' : $permalinks;
119 119
 
120 120
 		$is_multisite = is_multisite();
121 121
 
122 122
 		$sections['wordpress'] = array(
123 123
 			'name'          => array(
124
-				'label'  => __( 'Site Name', 'google-calendar-events' ),
124
+				'label'  => __('Site Name', 'google-calendar-events'),
125 125
 				'label_export' => 'Site Name',
126
-				'result' => get_bloginfo( 'name' ),
126
+				'result' => get_bloginfo('name'),
127 127
 			),
128 128
 			'home_url'      => array(
129
-				'label'  => __( 'Home URL', 'google-calendar-events' ),
129
+				'label'  => __('Home URL', 'google-calendar-events'),
130 130
 				'label_export' => 'Home URL',
131 131
 				'result' => home_url(),
132 132
 			),
133 133
 			'site_url'      => array(
134
-				'label'  => __( 'Site URL', 'google-calendar-events' ),
134
+				'label'  => __('Site URL', 'google-calendar-events'),
135 135
 				'label_export' => 'Site URL',
136 136
 				'result' => site_url(),
137 137
 			),
138 138
 			'version'       => array(
139
-				'label'  => __( 'Version', 'google-calendar-events' ),
139
+				'label'  => __('Version', 'google-calendar-events'),
140 140
 				'label_export' => 'Version',
141 141
 				'result' => $wp_version,
142 142
 			),
143 143
 			'locale'        => array(
144
-				'label'  => __( 'Locale', 'google-calendar-events' ),
144
+				'label'  => __('Locale', 'google-calendar-events'),
145 145
 				'label_export' => 'Locale',
146 146
 				'result' => get_locale(),
147 147
 			),
148 148
 			'wp_timezone'   => array(
149
-				'label'  => __( 'Timezone', 'google-calendar-events' ),
149
+				'label'  => __('Timezone', 'google-calendar-events'),
150 150
 				'label_export' => 'Timezone',
151 151
 				'result' => simcal_get_wp_timezone(),
152 152
 			),
153 153
 			'multisite'     => array(
154
-				'label'  => __( 'Multisite', 'google-calendar-events' ),
154
+				'label'  => __('Multisite', 'google-calendar-events'),
155 155
 				'label_export' => 'Multisite',
156
-				'result' => $is_multisite ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
156
+				'result' => $is_multisite ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
157 157
 				'result_export' => $is_multisite ? 'Yes' : 'No'
158 158
 			),
159 159
 			'permalink'     => array(
160
-				'label'  => __( 'Permalinks', 'google-calendar-events' ),
160
+				'label'  => __('Permalinks', 'google-calendar-events'),
161 161
 				'label_export' => 'Permalinks',
162
-				'result' => '<code>' . $permalinks . '</code>',
162
+				'result' => '<code>'.$permalinks.'</code>',
163 163
 				'result_export' => $permalinks,
164 164
 			),
165 165
 			'memory_limit'  => array(
@@ -182,86 +182,86 @@  discard block
 block discarded – undo
182 182
 		 * ============
183 183
 		 */
184 184
 
185
-		include_once ABSPATH . 'wp-admin/includes/theme-install.php';
185
+		include_once ABSPATH.'wp-admin/includes/theme-install.php';
186 186
 
187
-		if ( version_compare( $wp_version, '3.4', '<' ) ) {
188
-			$active_theme  = get_theme_data( get_stylesheet_directory() . '/style.css' );
189
-			$theme_name    = '<a href="' . $active_theme['URI'] . '" target="_blank">' . $active_theme['Name'] . '</a>';
187
+		if (version_compare($wp_version, '3.4', '<')) {
188
+			$active_theme  = get_theme_data(get_stylesheet_directory().'/style.css');
189
+			$theme_name    = '<a href="'.$active_theme['URI'].'" target="_blank">'.$active_theme['Name'].'</a>';
190 190
 			$theme_version = $active_theme['Version'];
191
-			$theme_author  = '<a href="' . $active_theme['AuthorURI'] . '" target="_blank">' . $active_theme['Author'] . '</a>';
192
-			$theme_export  = $active_theme['Name'] . ' - ' . $theme_version;
191
+			$theme_author  = '<a href="'.$active_theme['AuthorURI'].'" target="_blank">'.$active_theme['Author'].'</a>';
192
+			$theme_export  = $active_theme['Name'].' - '.$theme_version;
193 193
 		} else {
194 194
 			$active_theme  = wp_get_theme();
195
-			$theme_name    = '<a href="' . $active_theme->ThemeURI . '" target="_blank">' . $active_theme->Name . '</a>';
195
+			$theme_name    = '<a href="'.$active_theme->ThemeURI.'" target="_blank">'.$active_theme->Name.'</a>';
196 196
 			$theme_version = $active_theme->Version;
197 197
 			$theme_author  = $active_theme->Author;
198
-			$theme_export  = $active_theme->Name . ' - ' . $theme_version;
198
+			$theme_export  = $active_theme->Name.' - '.$theme_version;
199 199
 		}
200 200
 
201 201
 		$theme_update_version = $theme_version;
202 202
 
203
-		$api = themes_api( 'theme_information', array(
203
+		$api = themes_api('theme_information', array(
204 204
 			'slug'   => get_template(),
205
-			'fields' => array( 'sections' => false, 'tags' => false ),
206
-		) );
207
-		if ( $api && ! is_wp_error( $api ) ) {
205
+			'fields' => array('sections' => false, 'tags' => false),
206
+		));
207
+		if ($api && ! is_wp_error($api)) {
208 208
 			$theme_update_version = $api->version;
209 209
 		}
210 210
 
211
-		if ( version_compare( $theme_version, $theme_update_version, '<' ) ) {
212
-			$theme_version = '<mark class="error">' . $theme_version . ' (' . sprintf( __( '%s is available', 'google-calendar-events' ), esc_html( $theme_update_version ) ) . ')</mark>';
211
+		if (version_compare($theme_version, $theme_update_version, '<')) {
212
+			$theme_version = '<mark class="error">'.$theme_version.' ('.sprintf(__('%s is available', 'google-calendar-events'), esc_html($theme_update_version)).')</mark>';
213 213
 		} else {
214
-			$theme_version = '<mark class="ok">' . $theme_version . '</mark>';
214
+			$theme_version = '<mark class="ok">'.$theme_version.'</mark>';
215 215
 		}
216 216
 
217 217
 		$theme  = '<dl>';
218
-		$theme .= '<dt>' . __( 'Name', 'google-calendar-events' ) . '</dt>';
219
-		$theme .= '<dd>' . $theme_name . '</dd>';
220
-		$theme .= '<dt>' . __( 'Author', 'google-calendar-events' ) . '</dt>';
221
-		$theme .= '<dd>' . $theme_author . '</dd>';
222
-		$theme .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>';
223
-		$theme .= '<dd>' . $theme_version . '</dd>';
218
+		$theme .= '<dt>'.__('Name', 'google-calendar-events').'</dt>';
219
+		$theme .= '<dd>'.$theme_name.'</dd>';
220
+		$theme .= '<dt>'.__('Author', 'google-calendar-events').'</dt>';
221
+		$theme .= '<dd>'.$theme_author.'</dd>';
222
+		$theme .= '<dt>'.__('Version', 'google-calendar-events').'</dt>';
223
+		$theme .= '<dd>'.$theme_version.'</dd>';
224 224
 		$theme .= '</dl>';
225 225
 
226 226
 		$is_child_theme = is_child_theme();
227 227
 		$parent_theme = $parent_theme_export = '-';
228 228
 
229
-		if ( $is_child_theme ) {
230
-			if ( version_compare( $wp_version, '3.4', '<' ) ) {
229
+		if ($is_child_theme) {
230
+			if (version_compare($wp_version, '3.4', '<')) {
231 231
 
232 232
 				$parent_theme = $parent_theme_export = $active_theme['Template'];
233 233
 
234 234
 			} else {
235 235
 
236
-				$parent = wp_get_theme( $active_theme->Template );
236
+				$parent = wp_get_theme($active_theme->Template);
237 237
 				$parent_theme  = '<dl>';
238
-				$parent_theme .= '<dt>' . __( 'Name', 'google-calendar-events' ) .    '</dt>';
239
-				$parent_theme .= '<dd>' . $parent->Name .          '</dd>';
240
-				$parent_theme .= '<dt>' . __( 'Author', 'google-calendar-events' ) .  '</dt>';
241
-				$parent_theme .= '<dd>' . $parent->Author .        '</dd>';
242
-				$parent_theme .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>';
243
-				$parent_theme .= '<dd>' . $parent->Version .       '</dd>';
238
+				$parent_theme .= '<dt>'.__('Name', 'google-calendar-events').'</dt>';
239
+				$parent_theme .= '<dd>'.$parent->Name.'</dd>';
240
+				$parent_theme .= '<dt>'.__('Author', 'google-calendar-events').'</dt>';
241
+				$parent_theme .= '<dd>'.$parent->Author.'</dd>';
242
+				$parent_theme .= '<dt>'.__('Version', 'google-calendar-events').'</dt>';
243
+				$parent_theme .= '<dd>'.$parent->Version.'</dd>';
244 244
 				$parent_theme .= '</dl>';
245 245
 
246
-				$parent_theme_export = strip_tags( $parent->Name ) . ' - ' .  $parent->Version;
246
+				$parent_theme_export = strip_tags($parent->Name).' - '.$parent->Version;
247 247
 			}
248 248
 		}
249 249
 
250 250
 		$sections['theme'] = array(
251 251
 			'theme'    => array(
252
-				'label'  => __( 'Theme Information', 'google-calendar-events' ),
252
+				'label'  => __('Theme Information', 'google-calendar-events'),
253 253
 				'label_export' => 'Theme',
254 254
 				'result' => $theme,
255 255
 				'result_export' => $theme_export,
256 256
 			),
257 257
 			'theme_child'   => array(
258
-				'label'  => __( 'Child Theme', 'google-calendar-events' ),
258
+				'label'  => __('Child Theme', 'google-calendar-events'),
259 259
 				'label_export' => 'Child Theme',
260
-				'result' => $is_child_theme ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
260
+				'result' => $is_child_theme ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
261 261
 				'result_export' => $is_child_theme ? 'Yes' : 'No',
262 262
 			),
263 263
 			'theme_parent'   => array(
264
-				'label'  => __( 'Parent Theme', 'google-calendar-events' ),
264
+				'label'  => __('Parent Theme', 'google-calendar-events'),
265 265
 				'label_export' => 'Parent Theme',
266 266
 				'result' => $parent_theme,
267 267
 				'result_export' => $parent_theme_export,
@@ -273,61 +273,61 @@  discard block
 block discarded – undo
273 273
 		 * ==============
274 274
 		 */
275 275
 
276
-		include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
276
+		include_once ABSPATH.'wp-admin/includes/plugin-install.php';
277 277
 
278
-		$active_plugins = (array) get_option( 'active_plugins', array() );
279
-		if ( is_multisite() ) {
280
-			$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
278
+		$active_plugins = (array) get_option('active_plugins', array());
279
+		if (is_multisite()) {
280
+			$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
281 281
 		}
282 282
 
283
-		foreach ( $active_plugins as $plugin ) {
283
+		foreach ($active_plugins as $plugin) {
284 284
 
285
-			$plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
285
+			$plugin_data = @get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin);
286 286
 
287
-			if ( ! empty( $plugin_data['Name'] ) ) {
287
+			if ( ! empty($plugin_data['Name'])) {
288 288
 
289 289
 				$plugin_name    = $plugin_data['Title'];
290 290
 				$plugin_author  = $plugin_data['Author'];
291 291
 				$plugin_version = $plugin_update_version = $plugin_data['Version'];
292 292
 
293 293
 				// Afraid that querying many plugins may risk a timeout.
294
-				if ( count( $active_plugins ) <= 10 ) {
295
-					$api = plugins_api( 'plugin_information', array(
294
+				if (count($active_plugins) <= 10) {
295
+					$api = plugins_api('plugin_information', array(
296 296
 						'slug'   => $plugin_data['Name'],
297 297
 						'fields' => array(
298 298
 							'version' => true,
299 299
 						),
300
-					) );
301
-					if ( $api && ! is_wp_error( $api ) ) {
302
-						if ( ! empty( $api->version ) ) {
300
+					));
301
+					if ($api && ! is_wp_error($api)) {
302
+						if ( ! empty($api->version)) {
303 303
 							$plugin_update_version = $api->version;
304
-							if ( version_compare( $plugin_version, $plugin_update_version, '<' ) ) {
305
-								$plugin_version = '<mark class="error">' . $plugin_version . ' (' . sprintf( __( '%s is available', 'google-calendar-events' ), esc_html( $plugin_update_version ) ) . ')</mark>';
304
+							if (version_compare($plugin_version, $plugin_update_version, '<')) {
305
+								$plugin_version = '<mark class="error">'.$plugin_version.' ('.sprintf(__('%s is available', 'google-calendar-events'), esc_html($plugin_update_version)).')</mark>';
306 306
 							} else {
307
-								$plugin_version = '<mark class="ok">' . $plugin_version . '</mark>';
307
+								$plugin_version = '<mark class="ok">'.$plugin_version.'</mark>';
308 308
 							}
309 309
 						}
310 310
 					}
311 311
 				}
312 312
 
313 313
 				$plugin  = '<dl>';
314
-				$plugin .= '<dt>' . __( 'Author', 'google-calendar-events' ) .  '</dt>';
315
-				$plugin .= '<dd>' . $plugin_author .         '</dd>';
316
-				$plugin .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>';
317
-				$plugin .= '<dd>' . $plugin_version .        '</dd>';
314
+				$plugin .= '<dt>'.__('Author', 'google-calendar-events').'</dt>';
315
+				$plugin .= '<dd>'.$plugin_author.'</dd>';
316
+				$plugin .= '<dt>'.__('Version', 'google-calendar-events').'</dt>';
317
+				$plugin .= '<dd>'.$plugin_version.'</dd>';
318 318
 				$plugin .= '</dl>';
319 319
 
320
-				$sections['plugins'][ sanitize_key( strip_tags( $plugin_name ) ) ] = array(
320
+				$sections['plugins'][sanitize_key(strip_tags($plugin_name))] = array(
321 321
 					'label'  => $plugin_name,
322
-					'label_export' => strip_tags( $plugin_data['Title'] ),
322
+					'label_export' => strip_tags($plugin_data['Title']),
323 323
 					'result' => $plugin,
324 324
 					'result_export' => $plugin_data['Version'],
325 325
 				);
326 326
 			}
327 327
 		}
328 328
 
329
-		if ( isset( $sections['plugins'] ) ) {
330
-			rsort( $sections['plugins'] );
329
+		if (isset($sections['plugins'])) {
330
+			rsort($sections['plugins']);
331 331
 		}
332 332
 
333 333
 		/**
@@ -335,54 +335,54 @@  discard block
 block discarded – undo
335 335
 		 * ==================
336 336
 		 */
337 337
 
338
-		if ( version_compare( PHP_VERSION, '7.0', '<' ) ) {
339
-			$php = '<mark>' . PHP_VERSION . ' - ' .
340
-			       __( 'WordPress.org recommends upgrading to PHP 7 or higher for better security.', 'google-calendar-events' ) .
341
-			       ' <a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'Read more.', 'google-calendar-events' ) . '</a>' .
338
+		if (version_compare(PHP_VERSION, '7.0', '<')) {
339
+			$php = '<mark>'.PHP_VERSION.' - '.
340
+			       __('WordPress.org recommends upgrading to PHP 7 or higher for better security.', 'google-calendar-events').
341
+			       ' <a href="https://wordpress.org/about/requirements/" target="_blank">'.__('Read more.', 'google-calendar-events').'</a>'.
342 342
 		           '</mark>';
343 343
 		} else {
344
-			$php = '<mark class="ok">' . PHP_VERSION . '</mark>';
344
+			$php = '<mark class="ok">'.PHP_VERSION.'</mark>';
345 345
 		}
346 346
 
347
-		if ( $wpdb->use_mysqli ) {
348
-			$mysql = @mysqli_get_server_info( $wpdb->dbh );
347
+		if ($wpdb->use_mysqli) {
348
+			$mysql = @mysqli_get_server_info($wpdb->dbh);
349 349
 		} else {
350
-			$mysql = '<mark class="error">' . __( 'Cannot connect to MySQL database.', 'google-calendar-events' ) . '</mark>';
350
+			$mysql = '<mark class="error">'.__('Cannot connect to MySQL database.', 'google-calendar-events').'</mark>';
351 351
 		}
352 352
 
353 353
 		$host = $_SERVER['SERVER_SOFTWARE'];
354
-		if ( defined( 'WPE_APIKEY' ) ) {
354
+		if (defined('WPE_APIKEY')) {
355 355
 			$host .= ' (WP Engine)';
356
-		} elseif ( defined( 'PAGELYBIN' ) ) {
356
+		} elseif (defined('PAGELYBIN')) {
357 357
 			$host .= ' (Pagely)';
358 358
 		}
359 359
 
360 360
 		$default_timezone = $server_timezone_export = date_default_timezone_get();
361
-		if ( 'UTC' !== $default_timezone ) {
362
-			$server_timezone = '<mark class="error">' . sprintf( __( 'Server default timezone is %s - it should be UTC', 'google-calendar-events' ), $default_timezone ) . '</mark>';
361
+		if ('UTC' !== $default_timezone) {
362
+			$server_timezone = '<mark class="error">'.sprintf(__('Server default timezone is %s - it should be UTC', 'google-calendar-events'), $default_timezone).'</mark>';
363 363
 		} else {
364 364
 			$server_timezone = '<mark class="ok">UTC</mark>';
365 365
 		}
366 366
 
367 367
 		// WP Remote POST test.
368
-		$response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array(
368
+		$response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array(
369 369
 			'timeout'    => 60,
370 370
 			'body'       => array(
371 371
 				'cmd'    => '_notify-validate',
372 372
 			),
373
-		) );
374
-		if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
373
+		));
374
+		if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
375 375
 			$wp_post_export = 'Yes';
376
-			$wp_post = '<mark class="ok">' . __( 'Yes', 'google-calendar-events' ) . '</mark>';
376
+			$wp_post = '<mark class="ok">'.__('Yes', 'google-calendar-events').'</mark>';
377 377
 		} else {
378 378
 			$wp_post_export = 'No';
379
-			$wp_post = '<mark class="error">' . __( 'No', 'google-calendar-events' );
380
-			if ( is_wp_error( $response ) ) {
381
-				$error = ' (' . $response->get_error_message() . ')';
379
+			$wp_post = '<mark class="error">'.__('No', 'google-calendar-events');
380
+			if (is_wp_error($response)) {
381
+				$error = ' ('.$response->get_error_message().')';
382 382
 				$wp_post .= $error;
383 383
 				$wp_post_export .= $error;
384 384
 			} else {
385
-				$error = ' (' . $response['response']['code'] . ')';
385
+				$error = ' ('.$response['response']['code'].')';
386 386
 				$wp_post .= $error;
387 387
 				$wp_post_export .= $error;
388 388
 			}
@@ -390,65 +390,65 @@  discard block
 block discarded – undo
390 390
 		}
391 391
 
392 392
 		// WP Remote GET test.
393
-		$response = wp_safe_remote_get( get_home_url( '/?p=1' ) );
394
-		if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
393
+		$response = wp_safe_remote_get(get_home_url('/?p=1'));
394
+		if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
395 395
 			$wp_get_export = 'Yes';
396
-			$wp_get = '<mark class="ok">' . __( 'Yes', 'google-calendar-events' ) . '</mark>';
396
+			$wp_get = '<mark class="ok">'.__('Yes', 'google-calendar-events').'</mark>';
397 397
 		} else {
398 398
 			$wp_get_export = 'No';
399
-			$wp_get = '<mark class="error">' . __( 'No', 'google-calendar-events' );
400
-			if ( is_wp_error( $response ) ) {
401
-				$error = ' (' . $response->get_error_message() . ')';
399
+			$wp_get = '<mark class="error">'.__('No', 'google-calendar-events');
400
+			if (is_wp_error($response)) {
401
+				$error = ' ('.$response->get_error_message().')';
402 402
 				$wp_get .= $error;
403 403
 				$wp_get_export .= $error;
404 404
 			} else {
405
-				$error = ' (' . $response['response']['code'] . ')';
405
+				$error = ' ('.$response['response']['code'].')';
406 406
 				$wp_get .= $error;
407 407
 				$wp_get_export .= $error;
408 408
 			}
409 409
 			$wp_get .= '</mark>';
410 410
 		}
411 411
 
412
-		$php_memory_limit        = ini_get( 'memory_limit' );
413
-		$php_max_upload_filesize = ini_get( 'upload_max_filesize' );
414
-		$php_post_max_size       = ini_get( 'post_max_size' );
415
-		$php_max_execution_time  = ini_get( 'max_execution_time' );
416
-		$php_max_input_vars      = ini_get( 'max_input_vars' );
412
+		$php_memory_limit        = ini_get('memory_limit');
413
+		$php_max_upload_filesize = ini_get('upload_max_filesize');
414
+		$php_post_max_size       = ini_get('post_max_size');
415
+		$php_max_execution_time  = ini_get('max_execution_time');
416
+		$php_max_input_vars      = ini_get('max_input_vars');
417 417
 
418 418
 		$curl_info = '';
419 419
 
420
-		if ( function_exists( 'curl_version' ) ) {
420
+		if (function_exists('curl_version')) {
421 421
 			$curl_info = curl_version();
422 422
 		}
423 423
 
424 424
 		$sections['server'] = array(
425 425
 			'host'                => array(
426
-				'label'  => __( 'Web Server', 'google-calendar-events' ),
426
+				'label'  => __('Web Server', 'google-calendar-events'),
427 427
 				'label_export' => 'Web Server',
428 428
 				'result' => $host,
429 429
 			),
430 430
 			'php_version'         => array(
431
-				'label'  => __( 'PHP Version', 'google-calendar-events' ),
431
+				'label'  => __('PHP Version', 'google-calendar-events'),
432 432
 				'label_export' => 'PHP Version',
433 433
 				'result' => $php,
434 434
 				'result_export' => PHP_VERSION,
435 435
 			),
436 436
 			'mysql_version'       => array(
437
-				'label'  => __( 'MySQL Version', 'google-calendar-events' ),
437
+				'label'  => __('MySQL Version', 'google-calendar-events'),
438 438
 				'label_export' => 'MySQL Version',
439
-				'result' => version_compare( $mysql, '5.5', '>' ) ? '<mark class="ok">' . $mysql . '</mark>' : $mysql,
439
+				'result' => version_compare($mysql, '5.5', '>') ? '<mark class="ok">'.$mysql.'</mark>' : $mysql,
440 440
 				'result_export' => $mysql,
441 441
 			),
442 442
 			'server_timezone'     => array(
443
-				'label'  => __( 'Server Timezone', 'google-calendar-events' ),
443
+				'label'  => __('Server Timezone', 'google-calendar-events'),
444 444
 				'label_export' => 'Server Timezone',
445 445
 				'result' => $server_timezone,
446 446
 				'result_export' => $server_timezone_export,
447 447
 			),
448 448
 			'display_errors'      => array(
449 449
 				'label'  => 'Display Errors',
450
-				'result' => ( ini_get( 'display_errors' ) ) ? __( 'Yes', 'google-calendar-events' ) . ' (' . ini_get( 'display_errors' ) . ')' : '-',
451
-				'result_export' => ( ini_get( 'display_errors' ) ) ? 'Yes' : 'No',
450
+				'result' => (ini_get('display_errors')) ? __('Yes', 'google-calendar-events').' ('.ini_get('display_errors').')' : '-',
451
+				'result_export' => (ini_get('display_errors')) ? 'Yes' : 'No',
452 452
 			),
453 453
 			'php_memory_limit'    => array(
454 454
 				'label'  => 'Memory Limit',
@@ -472,23 +472,23 @@  discard block
 block discarded – undo
472 472
 			),
473 473
 			'fsockopen'           => array(
474 474
 				'label'  => 'fsockopen',
475
-				'result' => function_exists( 'fsockopen' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
476
-				'result_export' => function_exists( 'fsockopen' ) ? 'Yes' : 'No',
475
+				'result' => function_exists('fsockopen') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
476
+				'result_export' => function_exists('fsockopen') ? 'Yes' : 'No',
477 477
 			),
478 478
 			'curl_init'           => array(
479 479
 				'label'         => 'cURL',
480
-				'result'        => ! empty( $curl_info ) ? $curl_info['version'] . ', ' . $curl_info['ssl_version'] : __( 'No version found.', 'google-calendar-events' ),
481
-				'result_export' => ! empty( $curl_info ) ? $curl_info['version'] . ', ' . $curl_info['ssl_version'] : 'No version found.',
480
+				'result'        => ! empty($curl_info) ? $curl_info['version'].', '.$curl_info['ssl_version'] : __('No version found.', 'google-calendar-events'),
481
+				'result_export' => ! empty($curl_info) ? $curl_info['version'].', '.$curl_info['ssl_version'] : 'No version found.',
482 482
 			),
483 483
 			'soap'                => array(
484 484
 				'label'  => 'SOAP',
485
-				'result' => class_exists( 'SoapClient' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
486
-				'result_export' => class_exists( 'SoapClient' ) ? 'Yes' : 'No',
485
+				'result' => class_exists('SoapClient') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
486
+				'result_export' => class_exists('SoapClient') ? 'Yes' : 'No',
487 487
 			),
488 488
 			'suhosin'             => array(
489 489
 				'label'  => 'SUHOSIN',
490
-				'result' => extension_loaded( 'suhosin' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
491
-				'result_export' => extension_loaded( 'suhosin' ) ? 'Yes' : 'No',
490
+				'result' => extension_loaded('suhosin') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
491
+				'result_export' => extension_loaded('suhosin') ? 'Yes' : 'No',
492 492
 			),
493 493
 			'wp_remote_post'      => array(
494 494
 				'label'  => 'WP Remote POST',
@@ -510,26 +510,26 @@  discard block
 block discarded – undo
510 510
 		$user_client = new \SimpleCalendar\Browser();
511 511
 
512 512
 		$browser  = '<dl>';
513
-		$browser .= '<dt>' . __( 'Name:', 'google-calendar-events' ) .         '</dt>';
514
-		$browser .= '<dd>' . $user_client->getBrowser() .   '</dd>';
515
-		$browser .= '<dt>' . __( 'Version:', 'google-calendar-events' ) .      '</dt>';
516
-		$browser .= '<dd>' . $user_client->getVersion() .   '</dd>';
517
-		$browser .= '<dt>' . __( 'User Agent:', 'google-calendar-events' ) .   '</dt>';
518
-		$browser .= '<dd>' . $user_client->getUserAgent() . '</dd>';
519
-		$browser .= '<dt>' . __( 'Platform:', 'google-calendar-events' ) .     '</dt>';
520
-		$browser .= '<dd>' . $user_client->getPlatform() .  '</dd>';
513
+		$browser .= '<dt>'.__('Name:', 'google-calendar-events').'</dt>';
514
+		$browser .= '<dd>'.$user_client->getBrowser().'</dd>';
515
+		$browser .= '<dt>'.__('Version:', 'google-calendar-events').'</dt>';
516
+		$browser .= '<dd>'.$user_client->getVersion().'</dd>';
517
+		$browser .= '<dt>'.__('User Agent:', 'google-calendar-events').'</dt>';
518
+		$browser .= '<dd>'.$user_client->getUserAgent().'</dd>';
519
+		$browser .= '<dt>'.__('Platform:', 'google-calendar-events').'</dt>';
520
+		$browser .= '<dd>'.$user_client->getPlatform().'</dd>';
521 521
 		$browser .= '</dl>';
522 522
 
523
-		$browser_export = $user_client->getBrowser() . ' ' . $user_client->getVersion() . ' (' . $user_client->getPlatform() . ')';
523
+		$browser_export = $user_client->getBrowser().' '.$user_client->getVersion().' ('.$user_client->getPlatform().')';
524 524
 
525 525
 		$sections['client'] = array(
526 526
 			'user_ip' => array(
527
-				'label'  => __( 'IP Address', 'google-calendar-events' ),
527
+				'label'  => __('IP Address', 'google-calendar-events'),
528 528
 				'label_export' => 'IP Address',
529 529
 				'result' => $_SERVER['SERVER_ADDR'],
530 530
 			),
531 531
 			'browser' => array(
532
-				'label'  => __( 'Browser', 'google-calendar-events' ),
532
+				'label'  => __('Browser', 'google-calendar-events'),
533 533
 				'result' => $browser,
534 534
 				'result_export' => $browser_export,
535 535
 			)
@@ -540,12 +540,12 @@  discard block
 block discarded – undo
540 540
 		 * ============
541 541
 		 */
542 542
 
543
-		$panels   = apply_filters( 'simcal_system_status_report_panels', $panels );
544
-		$sections = apply_filters( 'simcal_system_status_report_sections', $sections );
543
+		$panels   = apply_filters('simcal_system_status_report_panels', $panels);
544
+		$sections = apply_filters('simcal_system_status_report_sections', $sections);
545 545
 
546
-		foreach ( $panels as $panel => $v ) :
546
+		foreach ($panels as $panel => $v) :
547 547
 
548
-			if ( isset( $sections[ $panel ] ) ) :
548
+			if (isset($sections[$panel])) :
549 549
 
550 550
 				?>
551 551
 				<table class="widefat simcal-system-status-report-panel">
@@ -555,15 +555,15 @@  discard block
 block discarded – undo
555 555
 						</tr>
556 556
 					</thead>
557 557
 					<tbody>
558
-						<?php foreach ( $sections[ $panel ] as $row => $cell ) : ?>
558
+						<?php foreach ($sections[$panel] as $row => $cell) : ?>
559 559
 							<tr>
560 560
 								<?php
561
-								$label_export  = isset( $cell['label_export']  ) ? $cell['label_export']  : $cell['label'];
562
-								$result_export = isset( $cell['result_export'] ) ? $cell['result_export'] : $cell['result'];
561
+								$label_export  = isset($cell['label_export']) ? $cell['label_export'] : $cell['label'];
562
+								$result_export = isset($cell['result_export']) ? $cell['result_export'] : $cell['result'];
563 563
 								?>
564
-								<td class="tooltip"><?php echo isset( $cell['tooltip'] ) ? ' <i class="simcal-icon-help simcal-help-tip" data-tip="' . $cell['tooltip'] . '"></i> ' : ''; ?></td>
565
-								<td class="label" data-export="<?php echo trim( $label_export ); ?>"><?php echo $cell['label']; ?></td>
566
-								<td class="result" data-export="<?php echo trim( $result_export ); ?>"><?php echo $cell['result']; ?></td>
564
+								<td class="tooltip"><?php echo isset($cell['tooltip']) ? ' <i class="simcal-icon-help simcal-help-tip" data-tip="'.$cell['tooltip'].'"></i> ' : ''; ?></td>
565
+								<td class="label" data-export="<?php echo trim($label_export); ?>"><?php echo $cell['label']; ?></td>
566
+								<td class="result" data-export="<?php echo trim($result_export); ?>"><?php echo $cell['result']; ?></td>
567 567
 							</tr>
568 568
 						<?php endforeach; ?>
569 569
 					</tbody>
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 			jQuery( '#simcal-system-status-report-download' ).on( 'click', function() {
642 642
 				var file = new Blob( [ report ], { type: 'text/plain' } );
643 643
 				jQuery( this ).attr( 'href', URL.createObjectURL( file ) );
644
-				jQuery( this ).attr( 'download', '<?php echo sanitize_title( str_replace( array( 'http://', 'https://' ), '', get_bloginfo( 'url' ) ) . '-system-report-' . date( 'Y-m-d', time() ) ); ?>' );
644
+				jQuery( this ).attr( 'download', '<?php echo sanitize_title(str_replace(array('http://', 'https://'), '', get_bloginfo('url')).'-system-report-'.date('Y-m-d', time())); ?>' );
645 645
 			} );
646 646
 
647 647
 		</script>
@@ -661,13 +661,13 @@  discard block
 block discarded – undo
661 661
 	 *
662 662
 	 * @return int|double|string
663 663
 	 */
664
-	private function let_to_num( $size ) {
664
+	private function let_to_num($size) {
665 665
 
666
-		$l   = substr( $size, -1 );
667
-		$ret = substr( $size, 0, -1 );
666
+		$l   = substr($size, -1);
667
+		$ret = substr($size, 0, -1);
668 668
 
669 669
 		// Note: do not insert break or default in this switch loop.
670
-		switch ( strtoupper( $l ) ) {
670
+		switch (strtoupper($l)) {
671 671
 			case 'P':
672 672
 				$ret *= 1024;
673 673
 				// no break
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 				$ret *= 1024;
682 682
 				// no break
683 683
 			case 'K':
684
-				$ret *= 1024;;
684
+				$ret *= 1024; ;
685 685
 				// no break
686 686
 		}
687 687
 
Please login to merge, or discard this patch.