Completed
Push — master ( a3f83c...72dfec )
by
unknown
03:19
created
includes/events/event-builder.php 1 patch
Spacing   +235 added lines, -235 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 *
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			'if-not-end-location',
215 215
 			// Does the event has NOT an end location?
216 216
 
217
-		), (array) $this->add_custom_event_tags() );
217
+		), (array) $this->add_custom_event_tags());
218 218
 	}
219 219
 
220 220
 	/**
@@ -226,16 +226,16 @@  discard block
 block discarded – undo
226 226
 	 *
227 227
 	 * @return string
228 228
 	 */
229
-	public function parse_event_template_tags( $template_tags = '' ) {
229
+	public function parse_event_template_tags($template_tags = '') {
230 230
 
231 231
 		// Process tags.
232
-		$result = preg_replace_callback( $this->get_regex(), array( $this, 'process_event_content' ), $template_tags );
232
+		$result = preg_replace_callback($this->get_regex(), array($this, 'process_event_content'), $template_tags);
233 233
 
234 234
 		// Removes extra consecutive <br> tags.
235 235
 		// TODO: Doesn't seem to work but going to remove it to allow multiple <br> tags in the editor
236 236
 		/*return preg_replace( '#(<br *//*?>\s*)+#i', '<br />', trim( $result ) );*/
237 237
 
238
-		return do_shortcode( trim( $result ) );
238
+		return do_shortcode(trim($result));
239 239
 	}
240 240
 
241 241
 	/**
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 	 *
248 248
 	 * @return string
249 249
 	 */
250
-	public function process_event_content( $match ) {
250
+	public function process_event_content($match) {
251 251
 
252
-		if ( $match[1] == '[' && $match[6] == ']' ) {
253
-			return substr( $match[0], 1, -1 );
252
+		if ($match[1] == '[' && $match[6] == ']') {
253
+			return substr($match[0], 1, -1);
254 254
 		}
255 255
 
256 256
 		$tag     = $match[2]; // Tag name without square brackets.
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 		$calendar = $this->calendar;
263 263
 		$event    = $this->event;
264 264
 
265
-		if ( ( $calendar instanceof Calendar ) && ( $event instanceof Event ) ) {
265
+		if (($calendar instanceof Calendar) && ($event instanceof Event)) {
266 266
 
267
-			switch ( $tag ) {
267
+			switch ($tag) {
268 268
 
269 269
 				/* ============ *
270 270
 				 * Content Tags *
@@ -272,13 +272,13 @@  discard block
 block discarded – undo
272 272
 
273 273
 				case 'title' :
274 274
 				case 'event-title' :
275
-					return $this->get_title( $event->title, $attr );
275
+					return $this->get_title($event->title, $attr);
276 276
 
277 277
 				case 'description' :
278
-					return $this->get_description( $event->description, $attr );
278
+					return $this->get_description($event->description, $attr);
279 279
 
280 280
 				case 'when' :
281
-					return $this->get_when( $event );
281
+					return $this->get_when($event);
282 282
 
283 283
 				case 'end-date' :
284 284
 				case 'end-custom' :
@@ -288,58 +288,58 @@  discard block
 block discarded – undo
288 288
 				case 'start-date' :
289 289
 				case 'start-human' :
290 290
 				case 'start-time' :
291
-					return $this->get_dt( $tag, $event, $attr );
291
+					return $this->get_dt($tag, $event, $attr);
292 292
 
293 293
 				case 'length' :
294 294
 				case 'duration' :
295
-					if ( false !== $event->end ) {
295
+					if (false !== $event->end) {
296 296
 						$duration = $event->start - $event->end;
297
-						$value    = human_time_diff( $event->start, $event->end );
297
+						$value    = human_time_diff($event->start, $event->end);
298 298
 					} else {
299 299
 						$duration = '-1';
300
-						$value    = __( 'No end time', 'google-calendar-events' );
300
+						$value    = __('No end time', 'google-calendar-events');
301 301
 					}
302 302
 
303
-					return ' <span class="simcal-event-duration" data-event-duration="' . $duration . '">' . $value . '</span>';
303
+					return ' <span class="simcal-event-duration" data-event-duration="'.$duration.'">'.$value.'</span>';
304 304
 
305 305
 				case 'location' :
306 306
 				case 'start-location' :
307 307
 				case 'end-location' :
308
-					$location       = ( 'end-location' == $tag ) ? $event->end_location['address'] : $event->start_location['address'];
309
-					$location_class = ( 'end-location' == $tag ) ? 'end' : 'start';
308
+					$location       = ('end-location' == $tag) ? $event->end_location['address'] : $event->start_location['address'];
309
+					$location_class = ('end-location' == $tag) ? 'end' : 'start';
310 310
 
311 311
 					// location, location.name, location.address (type PostalAddress) all required for schema data.
312 312
 					// Need to use event name where location data doesn't exist.
313 313
 					// Since we have 1 location field, use it as the name and address.
314 314
 					// If the location is blank, use the event title as the name and address.
315 315
 					// Wrap with wp_strip_all_tags().
316
-					$meta_location_name_and_address = empty( $location ) ? wp_strip_all_tags( $event->title ) : wp_strip_all_tags( $location );
316
+					$meta_location_name_and_address = empty($location) ? wp_strip_all_tags($event->title) : wp_strip_all_tags($location);
317 317
 
318
-					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>';
318
+					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>';
319 319
 
320 320
 				case 'start-location-link':
321 321
 				case 'end-location-link' :
322 322
 				case 'maps-link' :
323
-					$location = ( 'end-location-link' == $tag ) ? $event->end_location['address'] : $event->start_location['address'];
324
-					if ( ! empty( $location ) ) {
325
-						$url = '//maps.google.com?q=' . urlencode( $location );
323
+					$location = ('end-location-link' == $tag) ? $event->end_location['address'] : $event->start_location['address'];
324
+					if ( ! empty($location)) {
325
+						$url = '//maps.google.com?q='.urlencode($location);
326 326
 
327
-						return $this->make_link( $tag, $url, $calendar->get_event_html( $event, $partial ), $attr );
327
+						return $this->make_link($tag, $url, $calendar->get_event_html($event, $partial), $attr);
328 328
 					}
329 329
 					break;
330 330
 
331 331
 				case 'link' :
332 332
 				case 'url' :
333
-					$content = ( 'link' == $tag ) ? $calendar->get_event_html( $event, $partial ) : '';
333
+					$content = ('link' == $tag) ? $calendar->get_event_html($event, $partial) : '';
334 334
 
335
-					return $this->make_link( $tag, $event->link, $content, $attr );
335
+					return $this->make_link($tag, $event->link, $content, $attr);
336 336
 
337 337
 				case 'add-to-gcal-link';
338
-					$content = ( 'add-to-gcal-link' == $tag ) ? $calendar->get_event_html( $event, $partial ) : '';
339
-					if ( ! empty( $content ) ) {
340
-						$url = $calendar->get_add_to_gcal_url( $event );
338
+					$content = ('add-to-gcal-link' == $tag) ? $calendar->get_event_html($event, $partial) : '';
339
+					if ( ! empty($content)) {
340
+						$url = $calendar->get_add_to_gcal_url($event);
341 341
 
342
-						return $this->make_link( $tag, $url, $content, $attr );
342
+						return $this->make_link($tag, $url, $content, $attr);
343 343
 					}
344 344
 					break;
345 345
 
@@ -366,22 +366,22 @@  discard block
 block discarded – undo
366 366
 
367 367
 				case 'attachments' :
368 368
 					$attachments = $event->get_attachments();
369
-					if ( ! empty( $attachments ) ) {
370
-						return $this->get_attachments( $attachments );
369
+					if ( ! empty($attachments)) {
370
+						return $this->get_attachments($attachments);
371 371
 					}
372 372
 					break;
373 373
 
374 374
 				case 'attendees' :
375 375
 					$attendees = $event->get_attendees();
376
-					if ( ! empty( $attendees ) ) {
377
-						return $this->get_attendees( $attendees, $attr );
376
+					if ( ! empty($attendees)) {
377
+						return $this->get_attendees($attendees, $attr);
378 378
 					}
379 379
 					break;
380 380
 
381 381
 				case 'organizer' :
382 382
 					$organizer = $event->get_organizer();
383
-					if ( ! empty( $organizer ) ) {
384
-						return $this->get_organizer( $organizer, $attr );
383
+					if ( ! empty($organizer)) {
384
+						return $this->get_organizer($organizer, $attr);
385 385
 					}
386 386
 					break;
387 387
 
@@ -390,35 +390,35 @@  discard block
 block discarded – undo
390 390
 				 * ================ */
391 391
 
392 392
 				case 'if-title':
393
-					if ( ! empty( $event->title ) ) {
394
-						return $calendar->get_event_html( $event, $partial );
393
+					if ( ! empty($event->title)) {
394
+						return $calendar->get_event_html($event, $partial);
395 395
 					}
396 396
 					break;
397 397
 
398 398
 				case 'if-description':
399
-					if ( ! empty( $event->description ) ) {
400
-						return $calendar->get_event_html( $event, $partial );
399
+					if ( ! empty($event->description)) {
400
+						return $calendar->get_event_html($event, $partial);
401 401
 					}
402 402
 					break;
403 403
 
404 404
 				case 'if-now' :
405 405
 				case 'if-not-now' :
406 406
 
407
-					$start_dt = $event->start_dt->setTimezone( $calendar->timezone );
407
+					$start_dt = $event->start_dt->setTimezone($calendar->timezone);
408 408
 					$start    = $start_dt->getTimestamp();
409 409
 
410
-					if ( $event->end_dt instanceof Carbon ) {
411
-						$end = $event->end_dt->setTimezone( $calendar->timezone )->getTimestamp();
410
+					if ($event->end_dt instanceof Carbon) {
411
+						$end = $event->end_dt->setTimezone($calendar->timezone)->getTimestamp();
412 412
 					} else {
413 413
 						return '';
414 414
 					}
415 415
 
416
-					$now = ( $start <= $calendar->now ) && ( $end >= $calendar->now );
416
+					$now = ($start <= $calendar->now) && ($end >= $calendar->now);
417 417
 
418
-					if ( ( 'if-now' == $tag ) && $now ) {
419
-						return $calendar->get_event_html( $event, $partial );
420
-					} elseif ( ( 'if-not-now' == $tag ) && ( false == $now ) ) {
421
-						return $calendar->get_event_html( $event, $partial );
418
+					if (('if-now' == $tag) && $now) {
419
+						return $calendar->get_event_html($event, $partial);
420
+					} elseif (('if-not-now' == $tag) && (false == $now)) {
421
+						return $calendar->get_event_html($event, $partial);
422 422
 					}
423 423
 
424 424
 					break;
@@ -426,15 +426,15 @@  discard block
 block discarded – undo
426 426
 				case 'if-started' :
427 427
 				case 'if-not-started' :
428 428
 
429
-					$start = $event->start_dt->setTimezone( $calendar->timezone )->getTimestamp();
429
+					$start = $event->start_dt->setTimezone($calendar->timezone)->getTimestamp();
430 430
 
431
-					if ( 'if-started' == $tag ) {
432
-						if ( $start < $calendar->now ) {
433
-							return $calendar->get_event_html( $event, $partial );
431
+					if ('if-started' == $tag) {
432
+						if ($start < $calendar->now) {
433
+							return $calendar->get_event_html($event, $partial);
434 434
 						}
435
-					} elseif ( 'if-not-started' == $tag ) {
436
-						if ( $start > $calendar->now ) {
437
-							return $calendar->get_event_html( $event, $partial );
435
+					} elseif ('if-not-started' == $tag) {
436
+						if ($start > $calendar->now) {
437
+							return $calendar->get_event_html($event, $partial);
438 438
 						}
439 439
 					}
440 440
 
@@ -443,17 +443,17 @@  discard block
 block discarded – undo
443 443
 				case 'if-ended' :
444 444
 				case 'if-not-ended' :
445 445
 
446
-					if ( false !== $event->end ) {
446
+					if (false !== $event->end) {
447 447
 
448
-						$end = $event->end_dt->setTimezone( $calendar->timezone )->getTimestamp();
448
+						$end = $event->end_dt->setTimezone($calendar->timezone)->getTimestamp();
449 449
 
450
-						if ( 'if-ended' == $tag ) {
451
-							if ( $end < $calendar->now ) {
452
-								return $calendar->get_event_html( $event, $partial );
450
+						if ('if-ended' == $tag) {
451
+							if ($end < $calendar->now) {
452
+								return $calendar->get_event_html($event, $partial);
453 453
 							}
454
-						} elseif ( 'if-not-ended' == $tag ) {
455
-							if ( $end > $calendar->now ) {
456
-								return $calendar->get_event_html( $event, $partial );
454
+						} elseif ('if-not-ended' == $tag) {
455
+							if ($end > $calendar->now) {
456
+								return $calendar->get_event_html($event, $partial);
457 457
 							}
458 458
 						}
459 459
 
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
 					break;
463 463
 
464 464
 				case 'if-end-time' :
465
-					if ( false !== $event->end ) {
466
-						return $calendar->get_event_html( $event, $partial );
465
+					if (false !== $event->end) {
466
+						return $calendar->get_event_html($event, $partial);
467 467
 					}
468 468
 					break;
469 469
 
470 470
 				case 'if-no-end-time' :
471
-					if ( false === $event->end ) {
472
-						return $calendar->get_event_html( $event, $partial );
471
+					if (false === $event->end) {
472
+						return $calendar->get_event_html($event, $partial);
473 473
 					}
474 474
 					break;
475 475
 
@@ -477,62 +477,62 @@  discard block
 block discarded – undo
477 477
 				case 'if-whole-day' :
478 478
 				case 'if-not-all-day' :
479 479
 				case 'if-not-whole-day' :
480
-					$bool = strstr( $tag, 'not' ) ? false : true;
481
-					if ( $bool === $event->whole_day ) {
482
-						return $calendar->get_event_html( $event, $partial );
480
+					$bool = strstr($tag, 'not') ? false : true;
481
+					if ($bool === $event->whole_day) {
482
+						return $calendar->get_event_html($event, $partial);
483 483
 					}
484 484
 					break;
485 485
 
486 486
 				case 'if-recurring' :
487
-					if ( ! empty( $event->recurrence ) ) {
488
-						return $calendar->get_event_html( $event, $partial );
487
+					if ( ! empty($event->recurrence)) {
488
+						return $calendar->get_event_html($event, $partial);
489 489
 					}
490 490
 					break;
491 491
 
492 492
 				case 'if-not-recurring' :
493
-					if ( false === $event->recurrence ) {
494
-						return $calendar->get_event_html( $event, $partial );
493
+					if (false === $event->recurrence) {
494
+						return $calendar->get_event_html($event, $partial);
495 495
 					}
496 496
 					break;
497 497
 
498 498
 				case 'if-multi-day' :
499
-					if ( false !== $event->multiple_days ) {
500
-						return $calendar->get_event_html( $event, $partial );
499
+					if (false !== $event->multiple_days) {
500
+						return $calendar->get_event_html($event, $partial);
501 501
 					}
502 502
 					break;
503 503
 
504 504
 				case 'if-single-day' :
505
-					if ( false === $event->multiple_days ) {
506
-						return $calendar->get_event_html( $event, $partial );
505
+					if (false === $event->multiple_days) {
506
+						return $calendar->get_event_html($event, $partial);
507 507
 					}
508 508
 					break;
509 509
 
510 510
 				case 'if-location' :
511 511
 				case 'if-start-location' :
512
-					if ( ! empty( $event->start_location['address'] ) ) {
513
-						return $calendar->get_event_html( $event, $partial );
512
+					if ( ! empty($event->start_location['address'])) {
513
+						return $calendar->get_event_html($event, $partial);
514 514
 					}
515 515
 
516 516
 					return false;
517 517
 
518 518
 				case 'if-not-location' :
519 519
 				case 'if-not-start-location' :
520
-					if ( empty( $event->start_location['address'] ) ) {
521
-						return $calendar->get_event_html( $event, $partial );
520
+					if (empty($event->start_location['address'])) {
521
+						return $calendar->get_event_html($event, $partial);
522 522
 					}
523 523
 
524 524
 					return '';
525 525
 
526 526
 				case 'if-not-end-location' :
527
-					if ( empty( $event->end_location['address'] ) ) {
528
-						return $calendar->get_event_html( $event, $partial );
527
+					if (empty($event->end_location['address'])) {
528
+						return $calendar->get_event_html($event, $partial);
529 529
 					}
530 530
 
531 531
 					return '';
532 532
 
533 533
 				case 'if-end-location' :
534
-					if ( ! empty( $event->end_location['address'] ) ) {
535
-						return $calendar->get_event_html( $event, $partial );
534
+					if ( ! empty($event->end_location['address'])) {
535
+						return $calendar->get_event_html($event, $partial);
536 536
 					}
537 537
 
538 538
 					return '';
@@ -542,12 +542,12 @@  discard block
 block discarded – undo
542 542
 				 * ======= */
543 543
 
544 544
 				default :
545
-					$resultCustom = $this->do_custom_event_tag( $tag, $partial, $attr, $event );
546
-					if ( $resultCustom != "" ) {
545
+					$resultCustom = $this->do_custom_event_tag($tag, $partial, $attr, $event);
546
+					if ($resultCustom != "") {
547 547
 						return $resultCustom;
548 548
 					}
549 549
 
550
-					return wp_kses_post( $before . $partial . $after );
550
+					return wp_kses_post($before.$partial.$after);
551 551
 			}
552 552
 		}
553 553
 
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
565 565
 	 *
566 566
 	 * @return string
567 567
 	 */
568
-	private function limit_words( $text, $limit ) {
568
+	private function limit_words($text, $limit) {
569 569
 
570
-		$limit = max( absint( $limit ), 0 );
570
+		$limit = max(absint($limit), 0);
571 571
 
572
-		if ( $limit > 0 && ( str_word_count( $text, 0 ) > $limit ) ) {
573
-			$words = str_word_count( $text, 2 );
574
-			$pos   = array_keys( $words );
575
-			$text  = trim( substr( $text, 0, $pos[ $limit ] ) ) . '&hellip;';
572
+		if ($limit > 0 && (str_word_count($text, 0) > $limit)) {
573
+			$words = str_word_count($text, 2);
574
+			$pos   = array_keys($words);
575
+			$text  = trim(substr($text, 0, $pos[$limit])).'&hellip;';
576 576
 		}
577 577
 
578 578
 		return $text;
@@ -589,26 +589,26 @@  discard block
 block discarded – undo
589 589
 	 *
590 590
 	 * @return string
591 591
 	 */
592
-	private function get_title( $title, $attr ) {
592
+	private function get_title($title, $attr) {
593 593
 
594
-		if ( empty( $title ) ) {
594
+		if (empty($title)) {
595 595
 			return '';
596 596
 		}
597 597
 
598
-		$attr = array_merge( array(
599
-			'html'  => '',  // Parse HTML
600
-			'limit' => 0,   // Trim length to amount of words
601
-		), (array) shortcode_parse_atts( $attr ) );
598
+		$attr = array_merge(array(
599
+			'html'  => '', // Parse HTML
600
+			'limit' => 0, // Trim length to amount of words
601
+		), (array) shortcode_parse_atts($attr));
602 602
 
603
-		if ( ! empty( $attr['html'] ) ) {
604
-			$title = wp_kses_post( $title );
603
+		if ( ! empty($attr['html'])) {
604
+			$title = wp_kses_post($title);
605 605
 			$tag   = 'div';
606 606
 		} else {
607
-			$title = $this->limit_words( $title, $attr['limit'] );
607
+			$title = $this->limit_words($title, $attr['limit']);
608 608
 			$tag   = 'span';
609 609
 		}
610 610
 
611
-		return '<' . $tag . ' class="simcal-event-title" itemprop="name">' . $title . '</' . $tag . '>';
611
+		return '<'.$tag.' class="simcal-event-title" itemprop="name">'.$title.'</'.$tag.'>';
612 612
 	}
613 613
 
614 614
 	/**
@@ -622,18 +622,18 @@  discard block
 block discarded – undo
622 622
 	 *
623 623
 	 * @return string
624 624
 	 */
625
-	private function get_description( $description, $attr ) {
625
+	private function get_description($description, $attr) {
626 626
 
627
-		if ( empty( $description ) ) {
627
+		if (empty($description)) {
628 628
 			return '';
629 629
 		}
630 630
 
631
-		$attr = array_merge( array(
632
-			'limit'    => 0,       // Trim length to number of words
633
-			'html'     => 'no',    // Parse HTML content
634
-			'markdown' => 'no',    // Parse Markdown content
635
-			'autolink' => 'no',    // Automatically convert plaintext URIs to anchors
636
-		), (array) shortcode_parse_atts( $attr ) );
631
+		$attr = array_merge(array(
632
+			'limit'    => 0, // Trim length to number of words
633
+			'html'     => 'no', // Parse HTML content
634
+			'markdown' => 'no', // Parse Markdown content
635
+			'autolink' => 'no', // Automatically convert plaintext URIs to anchors
636
+		), (array) shortcode_parse_atts($attr));
637 637
 
638 638
 		$allow_html = 'no' != $attr['html'] ? true : false;
639 639
 		$allow_md   = 'no' != $attr['markdown'] ? true : false;
@@ -641,23 +641,23 @@  discard block
 block discarded – undo
641 641
 		$html = '<div class="simcal-event-description" itemprop="description">';
642 642
 
643 643
 		// Markdown and HTML don't play well together, use one or the other in the same tag.
644
-		if ( $allow_html || $allow_md ) {
645
-			if ( $allow_html ) {
646
-				$description = wp_kses_post( $description );
647
-			} elseif ( $allow_md ) {
644
+		if ($allow_html || $allow_md) {
645
+			if ($allow_html) {
646
+				$description = wp_kses_post($description);
647
+			} elseif ($allow_md) {
648 648
 				$markdown    = new \Parsedown();
649
-				$description = $markdown->text( wp_strip_all_tags( $description ) );
649
+				$description = $markdown->text(wp_strip_all_tags($description));
650 650
 			}
651 651
 		} else {
652
-			$description = wpautop( $description );
652
+			$description = wpautop($description);
653 653
 		}
654 654
 
655
-		$description = $this->limit_words( $description, $attr['limit'] );
655
+		$description = $this->limit_words($description, $attr['limit']);
656 656
 
657
-		$html .= $description . '</div>';
657
+		$html .= $description.'</div>';
658 658
 
659
-		if ( 'no' != $attr['autolink'] ) {
660
-			$html = ' ' . make_clickable( $html );
659
+		if ('no' != $attr['autolink']) {
660
+			$html = ' '.make_clickable($html);
661 661
 		}
662 662
 
663 663
 		return $html;
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 	 *
674 674
 	 * @return string
675 675
 	 */
676
-	private function get_when( Event $event ) {
676
+	private function get_when(Event $event) {
677 677
 
678 678
 		//$start = $event->start_dt->setTimezone( $event->timezone );
679 679
 		//$end   = ! is_null( $event->end_dt ) ? $event->end_dt->setTimezone( $event->timezone ) : null;
@@ -683,41 +683,41 @@  discard block
 block discarded – undo
683 683
 		$time_start = '';
684 684
 		$time_end   = '';
685 685
 		$start_ts   = $start->timestamp;
686
-		$end_ts     = ! is_null( $end ) ? $end->timestamp : null;
686
+		$end_ts     = ! is_null($end) ? $end->timestamp : null;
687 687
 		$start_iso  = $start->toIso8601String();
688
-		$end_iso    = ! is_null( $end ) ? $end->toIso8601String() : null;;
688
+		$end_iso    = ! is_null($end) ? $end->toIso8601String() : null; ;
689 689
 
690
-		if ( ! $event->whole_day ) {
690
+		if ( ! $event->whole_day) {
691 691
 
692
-			$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> ';
692
+			$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> ';
693 693
 
694
-			if ( $end instanceof Carbon ) {
694
+			if ($end instanceof Carbon) {
695 695
 
696
-				$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> ';
696
+				$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> ';
697 697
 
698 698
 			}
699 699
 
700 700
 		}
701 701
 
702
-		if ( $event->multiple_days ) {
702
+		if ($event->multiple_days) {
703 703
 
704
-			$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;
704
+			$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;
705 705
 
706
-			if ( $end instanceof Carbon ) {
706
+			if ($end instanceof Carbon) {
707 707
 
708
-				$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;
708
+				$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;
709 709
 			}
710 710
 
711 711
 		} else {
712 712
 
713
-			$time_end = ! empty( $time_start ) && ! empty( $time_end ) ? ' - ' . $time_end : '';
713
+			$time_end = ! empty($time_start) && ! empty($time_end) ? ' - '.$time_end : '';
714 714
 
715 715
 			// All-day events also need startDate for schema data.
716
-			$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;
716
+			$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;
717 717
 
718 718
 		}
719 719
 
720
-		return trim( $output );
720
+		return trim($output);
721 721
 	}
722 722
 
723 723
 	/**
@@ -732,52 +732,52 @@  discard block
 block discarded – undo
732 732
 	 *
733 733
 	 * @return string
734 734
 	 */
735
-	private function get_dt( $tag, Event $event, $attr ) {
735
+	private function get_dt($tag, Event $event, $attr) {
736 736
 
737
-		$bound = 0 === strpos( $tag, 'end' ) ? 'end' : 'start';
737
+		$bound = 0 === strpos($tag, 'end') ? 'end' : 'start';
738 738
 
739
-		if ( ( 'end' == $bound ) && ( false === $event->end ) ) {
739
+		if (('end' == $bound) && (false === $event->end)) {
740 740
 			return '';
741 741
 		}
742 742
 
743
-		$dt = $bound . '_dt';
743
+		$dt = $bound.'_dt';
744 744
 
745
-		if ( ! $event->$dt instanceof Carbon ) {
745
+		if ( ! $event->$dt instanceof Carbon) {
746 746
 			return '';
747 747
 		}
748 748
 
749 749
 		$event_dt = $event->$dt;
750 750
 
751
-		$attr = array_merge( array(
751
+		$attr = array_merge(array(
752 752
 			'format' => '',
753
-		), (array) shortcode_parse_atts( $attr ) );
753
+		), (array) shortcode_parse_atts($attr));
754 754
 
755
-		$format    = ltrim( strstr( $tag, '-' ), '-' );
755
+		$format    = ltrim(strstr($tag, '-'), '-');
756 756
 		$dt_format = '';
757 757
 
758
-		if ( ! empty( $attr['format'] ) ) {
759
-			$dt_format = esc_attr( wp_strip_all_tags( $attr['format'] ) );
760
-		} elseif ( 'date' == $format ) {
758
+		if ( ! empty($attr['format'])) {
759
+			$dt_format = esc_attr(wp_strip_all_tags($attr['format']));
760
+		} elseif ('date' == $format) {
761 761
 			$dt_format = $this->calendar->date_format;
762
-		} elseif ( 'time' == $format ) {
762
+		} elseif ('time' == $format) {
763 763
 			$dt_format = $this->calendar->time_format;
764 764
 		}
765 765
 
766 766
 		$dt_ts = $event_dt->timestamp;
767 767
 
768
-		if ( 'human' == $format ) {
769
-			$value = human_time_diff( $dt_ts, Carbon::now( $event->timezone )->getTimestamp() );
768
+		if ('human' == $format) {
769
+			$value = human_time_diff($dt_ts, Carbon::now($event->timezone)->getTimestamp());
770 770
 
771
-			if ( $dt_ts < Carbon::now( $event->timezone )->getTimestamp() ) {
772
-				$value .= ' ' . _x( 'ago', 'human date event builder code modifier', 'google-calendar-events' );
771
+			if ($dt_ts < Carbon::now($event->timezone)->getTimestamp()) {
772
+				$value .= ' '._x('ago', 'human date event builder code modifier', 'google-calendar-events');
773 773
 			} else {
774
-				$value .= ' ' . _x( 'from now', 'human date event builder code modifier', 'google-calendar-events' );
774
+				$value .= ' '._x('from now', 'human date event builder code modifier', 'google-calendar-events');
775 775
 			}
776 776
 		} else {
777
-			$value = date_i18n( $dt_format, strtotime( $event_dt->toDateTimeString() ) );
777
+			$value = date_i18n($dt_format, strtotime($event_dt->toDateTimeString()));
778 778
 		}
779 779
 
780
-		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>';
780
+		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>';
781 781
 	}
782 782
 
783 783
 	/**
@@ -793,23 +793,23 @@  discard block
 block discarded – undo
793 793
 	 *
794 794
 	 * @return string
795 795
 	 */
796
-	private function make_link( $tag, $url, $content, $attr ) {
796
+	private function make_link($tag, $url, $content, $attr) {
797 797
 
798
-		if ( empty( $url ) ) {
798
+		if (empty($url)) {
799 799
 			return '';
800 800
 		}
801 801
 
802
-		$text = empty( $content ) ? $url : $content;
802
+		$text = empty($content) ? $url : $content;
803 803
 
804
-		$attr = array_merge( array(
805
-			'autolink'  => false,   // Convert url to link anchor
806
-			'newwindow' => false,   // If autolink attribute is true, open link in new window
807
-		), (array) shortcode_parse_atts( $attr ) );
804
+		$attr = array_merge(array(
805
+			'autolink'  => false, // Convert url to link anchor
806
+			'newwindow' => false, // If autolink attribute is true, open link in new window
807
+		), (array) shortcode_parse_atts($attr));
808 808
 
809 809
 		$anchor = $tag != 'url' ? 'yes' : $attr['autolink'];
810 810
 		$target = $attr['newwindow'] !== false ? 'target="_blank"' : '';
811 811
 
812
-		return $anchor !== false ? ' <a href="' . esc_url( $url ) . '" ' . $target . '>' . $text . '</a>' : ' ' . $text;
812
+		return $anchor !== false ? ' <a href="'.esc_url($url).'" '.$target.'>'.$text.'</a>' : ' '.$text;
813 813
 	}
814 814
 
815 815
 	/**
@@ -822,20 +822,20 @@  discard block
 block discarded – undo
822 822
 	 *
823 823
 	 * @return string
824 824
 	 */
825
-	private function get_attachments( $attachments ) {
825
+	private function get_attachments($attachments) {
826 826
 
827
-		$html = '<ul class="simcal-attachments">' . "\n\t";
827
+		$html = '<ul class="simcal-attachments">'."\n\t";
828 828
 
829
-		foreach ( $attachments as $attachment ) {
829
+		foreach ($attachments as $attachment) {
830 830
 			$html .= '<li class="simcal-attachment">';
831
-			$html .= '<a href="' . $attachment['url'] . '" target="_blank">';
832
-			$html .= ! empty( $attachment['icon'] ) ? '<img src="' . $attachment['icon'] . '" />' : '';
833
-			$html .= '<span>' . $attachment['name'] . '</span>';
831
+			$html .= '<a href="'.$attachment['url'].'" target="_blank">';
832
+			$html .= ! empty($attachment['icon']) ? '<img src="'.$attachment['icon'].'" />' : '';
833
+			$html .= '<span>'.$attachment['name'].'</span>';
834 834
 			$html .= '</a>';
835
-			$html .= '</li>' . "\n";
835
+			$html .= '</li>'."\n";
836 836
 		}
837 837
 
838
-		$html .= '</ul>' . "\n";
838
+		$html .= '</ul>'."\n";
839 839
 
840 840
 		return $html;
841 841
 	}
@@ -851,41 +851,41 @@  discard block
 block discarded – undo
851 851
 	 *
852 852
 	 * @return string
853 853
 	 */
854
-	private function get_attendees( $attendees, $attr ) {
854
+	private function get_attendees($attendees, $attr) {
855 855
 
856
-		$attr = array_merge( array(
857
-			'photo'    => 'show',  // show/hide attendee photo
858
-			'email'    => 'hide',  // show/hide attendee email address
859
-			'rsvp'     => 'hide',  // show/hide rsvp response status
860
-			'response' => '',      // filter attendees by rsvp response (yes/no/maybe)
861
-		), (array) shortcode_parse_atts( $attr ) );
856
+		$attr = array_merge(array(
857
+			'photo'    => 'show', // show/hide attendee photo
858
+			'email'    => 'hide', // show/hide attendee email address
859
+			'rsvp'     => 'hide', // show/hide rsvp response status
860
+			'response' => '', // filter attendees by rsvp response (yes/no/maybe)
861
+		), (array) shortcode_parse_atts($attr));
862 862
 
863
-		$html = '<ul class="simcal-attendees" itemprop="attendees">' . "\n\t";
863
+		$html = '<ul class="simcal-attendees" itemprop="attendees">'."\n\t";
864 864
 
865 865
 		$known   = 0;
866 866
 		$unknown = 0;
867 867
 
868
-		foreach ( $attendees as $attendee ) {
868
+		foreach ($attendees as $attendee) {
869 869
 
870
-			if ( 'yes' == $attr['response'] && 'yes' != $attendee['response'] ) {
870
+			if ('yes' == $attr['response'] && 'yes' != $attendee['response']) {
871 871
 				continue;
872
-			} elseif ( 'no' == $attr['response'] && 'no' != $attendee['response'] ) {
872
+			} elseif ('no' == $attr['response'] && 'no' != $attendee['response']) {
873 873
 				continue;
874
-			} elseif ( 'maybe' == $attr['response'] && ! in_array( $attendee['response'], array( 'yes', 'maybe' ) ) ) {
874
+			} elseif ('maybe' == $attr['response'] && ! in_array($attendee['response'], array('yes', 'maybe'))) {
875 875
 				continue;
876 876
 			}
877 877
 
878
-			if ( ! empty( $attendee['name'] ) ) {
878
+			if ( ! empty($attendee['name'])) {
879 879
 
880
-				$photo    = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="' . $attendee['photo'] . '" itemprop="image" />' : '';
881
-				$response = 'hide' != $attr['rsvp'] ? $this->get_rsvp_response( $attendee['response'] ) : '';
882
-				$guest    = $photo . '<span itemprop="name">' . $attendee['name'] . $response . '</span>';
880
+				$photo    = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="'.$attendee['photo'].'" itemprop="image" />' : '';
881
+				$response = 'hide' != $attr['rsvp'] ? $this->get_rsvp_response($attendee['response']) : '';
882
+				$guest    = $photo.'<span itemprop="name">'.$attendee['name'].$response.'</span>';
883 883
 
884
-				if ( ! empty( $attendee['email'] ) && ( 'show' == $attr['email'] ) ) {
885
-					$guest = sprintf( '<a href="mailto:' . $attendee['email'] . '" itemprop="email">%s</a>', $guest );
884
+				if ( ! empty($attendee['email']) && ('show' == $attr['email'])) {
885
+					$guest = sprintf('<a href="mailto:'.$attendee['email'].'" itemprop="email">%s</a>', $guest);
886 886
 				}
887 887
 
888
-				$html .= '<li class="simcal-attendee" itemprop="attendee" itemscope itemtype="http://schema.org/Person">' . $guest . '</li>' . "\n";
888
+				$html .= '<li class="simcal-attendee" itemprop="attendee" itemscope itemtype="http://schema.org/Person">'.$guest.'</li>'."\n";
889 889
 
890 890
 				$known++;
891 891
 
@@ -896,21 +896,21 @@  discard block
 block discarded – undo
896 896
 			}
897 897
 		}
898 898
 
899
-		if ( $unknown > 0 ) {
900
-			if ( $known > 0 ) {
899
+		if ($unknown > 0) {
900
+			if ($known > 0) {
901 901
 				/* translators: One more person attending the event. */
902
-				$others = sprintf( _n( '1 more attendee', '%s more attendees', $unknown, 'google-calendar-events' ), $unknown );
902
+				$others = sprintf(_n('1 more attendee', '%s more attendees', $unknown, 'google-calendar-events'), $unknown);
903 903
 			} else {
904 904
 				/* translators: One or more persons attending the event whose name is unknown. */
905
-				$others = sprintf( _n( '1 anonymous attendee', '%s anonymous attendees', $unknown, 'google-calendar-events' ), $unknown );
905
+				$others = sprintf(_n('1 anonymous attendee', '%s anonymous attendees', $unknown, 'google-calendar-events'), $unknown);
906 906
 			}
907
-			$photo = $attr['photo'] !== 'hide' ? get_avatar( '', 128 ) : '';
908
-			$html .= '<li class="simcal-attendee simcal-attendee-anonymous">' . $photo . '<span>' . $others . '</span></li>' . "\n";
909
-		} elseif ( $known === 0 ) {
910
-			$html .= '<li class="simcal-attendee">' . _x( 'No one yet', 'No one yet rsvp to attend the event.', 'google-calendar-events' ) . '</li>' . "\n";
907
+			$photo = $attr['photo'] !== 'hide' ? get_avatar('', 128) : '';
908
+			$html .= '<li class="simcal-attendee simcal-attendee-anonymous">'.$photo.'<span>'.$others.'</span></li>'."\n";
909
+		} elseif ($known === 0) {
910
+			$html .= '<li class="simcal-attendee">'._x('No one yet', 'No one yet rsvp to attend the event.', 'google-calendar-events').'</li>'."\n";
911 911
 		}
912 912
 
913
-		$html .= '</ul>' . "\n";
913
+		$html .= '</ul>'."\n";
914 914
 
915 915
 		return $html;
916 916
 	}
@@ -924,23 +924,23 @@  discard block
 block discarded – undo
924 924
 	 *
925 925
 	 * @return string
926 926
 	 */
927
-	private function get_rsvp_response( $response ) {
927
+	private function get_rsvp_response($response) {
928 928
 
929
-		if ( 'yes' == $response ) {
929
+		if ('yes' == $response) {
930 930
 			/* translators: Someone replied with 'yes' to a rsvp request. */
931
-			$rsvp = __( 'Attending', 'google-calendar-events' );
932
-		} elseif ( 'no' == $response ) {
931
+			$rsvp = __('Attending', 'google-calendar-events');
932
+		} elseif ('no' == $response) {
933 933
 			/* translators: Someone replied with 'no' to a rsvp request. */
934
-			$rsvp = __( 'Not attending', 'google-calendar-events' );
935
-		} elseif ( 'maybe' == $response ) {
934
+			$rsvp = __('Not attending', 'google-calendar-events');
935
+		} elseif ('maybe' == $response) {
936 936
 			/* translators: Someone replied with 'maybe' to a rsvp request. */
937
-			$rsvp = __( 'Maybe attending', 'google-calendar-events' );
937
+			$rsvp = __('Maybe attending', 'google-calendar-events');
938 938
 		} else {
939 939
 			/* translators: Someone did not send yet a rsvp confirmation to join an event. */
940
-			$rsvp = __( 'Response pending', 'google-calendar-events' );
940
+			$rsvp = __('Response pending', 'google-calendar-events');
941 941
 		}
942 942
 
943
-		return ' <small>(' . $rsvp . ')</small>';
943
+		return ' <small>('.$rsvp.')</small>';
944 944
 	}
945 945
 
946 946
 	/**
@@ -954,21 +954,21 @@  discard block
 block discarded – undo
954 954
 	 *
955 955
 	 * @return string
956 956
 	 */
957
-	private function get_organizer( $organizer, $attr ) {
957
+	private function get_organizer($organizer, $attr) {
958 958
 
959
-		$attr = array_merge( array(
960
-			'photo' => 'show',  // show/hide attendee photo
961
-			'email' => 'hide',  // show/hide attendee email address
962
-		), (array) shortcode_parse_atts( $attr ) );
959
+		$attr = array_merge(array(
960
+			'photo' => 'show', // show/hide attendee photo
961
+			'email' => 'hide', // show/hide attendee email address
962
+		), (array) shortcode_parse_atts($attr));
963 963
 
964
-		$photo          = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="' . $organizer['photo'] . '" itemprop="image"  />' : '';
965
-		$organizer_html = $photo . '<span itemprop="name">' . $organizer['name'] . '</span>';
964
+		$photo          = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="'.$organizer['photo'].'" itemprop="image"  />' : '';
965
+		$organizer_html = $photo.'<span itemprop="name">'.$organizer['name'].'</span>';
966 966
 
967
-		if ( ! empty( $organizer['email'] ) && ( 'show' == $attr['email'] ) ) {
968
-			$organizer_html = sprintf( '<a href="mailto:' . $organizer['email'] . '" itemprop="email">%s</a>', $organizer_html );
967
+		if ( ! empty($organizer['email']) && ('show' == $attr['email'])) {
968
+			$organizer_html = sprintf('<a href="mailto:'.$organizer['email'].'" itemprop="email">%s</a>', $organizer_html);
969 969
 		}
970 970
 
971
-		return '<div class="simcal-organizer" itemprop="organizer" itemscope itemtype="https://schema.org/Person">' . $organizer_html . '</div>';
971
+		return '<div class="simcal-organizer" itemprop="organizer" itemscope itemtype="https://schema.org/Person">'.$organizer_html.'</div>';
972 972
 	}
973 973
 
974 974
 	/**
@@ -993,38 +993,38 @@  discard block
 block discarded – undo
993 993
 		// This is largely borrowed on get_shortcode_regex() from WordPress Core.
994 994
 		// @see /wp-includes/shortcodes.php (with some modification)
995 995
 
996
-		$tagregexp = implode( '|', array_values( $this->tags ) );
996
+		$tagregexp = implode('|', array_values($this->tags));
997 997
 
998
-		return '/' . '\\['                              // Opening bracket
998
+		return '/'.'\\['                              // Opening bracket
999 999
 		       . '(\\[?)'                           // 1: Optional second opening bracket for escaping tags: [[tag]]
1000 1000
 		       . "($tagregexp)"                     // 2: Tag name
1001 1001
 		       . '(?![\\w-])'                       // Not followed by word character or hyphen
1002 1002
 		       . '('                                // 3: Unroll the loop: Inside the opening tag
1003 1003
 		       . '[^\\]\\/]*'                   // Not a closing bracket or forward slash
1004
-		       . '(?:' . '\\/(?!\\])'               // A forward slash not followed by a closing bracket
1004
+		       . '(?:'.'\\/(?!\\])'               // A forward slash not followed by a closing bracket
1005 1005
 		       . '[^\\]\\/]*'               // Not a closing bracket or forward slash
1006
-		       . ')*?' . ')' . '(?:' . '(\\/)'                        // 4: Self closing tag ...
1006
+		       . ')*?'.')'.'(?:'.'(\\/)'                        // 4: Self closing tag ...
1007 1007
 		       . '\\]'                          // ... and closing bracket
1008
-		       . '|' . '\\]'                          // Closing bracket
1009
-		       . '(?:' . '('                        // 5: Unroll the loop: Optionally, anything between the opening and closing tags
1008
+		       . '|'.'\\]'                          // Closing bracket
1009
+		       . '(?:'.'('                        // 5: Unroll the loop: Optionally, anything between the opening and closing tags
1010 1010
 		       . '[^\\[]*+'             // Not an opening bracket
1011
-		       . '(?:' . '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing tag
1011
+		       . '(?:'.'\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing tag
1012 1012
 		       . '[^\\[]*+'         // Not an opening bracket
1013
-		       . ')*+' . ')' . '\\[\\/\\2\\]'             // Closing tag
1014
-		       . ')?' . ')' . '(\\]?)'                           // 6: Optional second closing bracket for escaping tags: [[tag]]
1013
+		       . ')*+'.')'.'\\[\\/\\2\\]'             // Closing tag
1014
+		       . ')?'.')'.'(\\]?)'                           // 6: Optional second closing bracket for escaping tags: [[tag]]
1015 1015
 		       . '/s';
1016 1016
 	}
1017 1017
 
1018 1018
 	//allow other plugins to register own event tags
1019 1019
 	private function add_custom_event_tags() {
1020
-		$array = apply_filters( 'simcal_event_tags_add_custom', array() );
1020
+		$array = apply_filters('simcal_event_tags_add_custom', array());
1021 1021
 
1022 1022
 		return $array;
1023 1023
 	}
1024 1024
 
1025 1025
 	//allow other plugins to replace own (registered) event tags with their value
1026
-	private function do_custom_event_tag( $tag, $partial, $attr, $event ) {
1027
-		$returnvalue = apply_filters( 'simcal_event_tags_do_custom', "", $tag, $partial, $attr, $event );
1026
+	private function do_custom_event_tag($tag, $partial, $attr, $event) {
1027
+		$returnvalue = apply_filters('simcal_event_tags_do_custom', "", $tag, $partial, $attr, $event);
1028 1028
 
1029 1029
 		return $returnvalue;
1030 1030
 	}
Please login to merge, or discard this patch.