Completed
Push — master ( 72dfec...61887c )
by
unknown
06:50
created
includes/calendars/views/default-calendar-grid.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Events\Event;
14 14
 use SimpleCalendar\Calendars\Default_Calendar;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @param string|Calendar $calendar
57 57
 	 */
58
-	public function __construct( $calendar = '' ) {
58
+	public function __construct($calendar = '') {
59 59
 		$this->calendar = $calendar;
60 60
 	}
61 61
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return string
90 90
 	 */
91 91
 	public function get_name() {
92
-		return __( 'Grid', 'google-calendar-events' );
92
+		return __('Grid', 'google-calendar-events');
93 93
 	}
94 94
 
95 95
 	/**
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @since 3.0.0
99 99
 	 */
100 100
 	public function add_ajax_actions() {
101
-		add_action( 'wp_ajax_simcal_default_calendar_draw_grid', array( $this, 'draw_grid_ajax' ) );
102
-		add_action( 'wp_ajax_nopriv_simcal_default_calendar_draw_grid', array( $this, 'draw_grid_ajax' ) );
101
+		add_action('wp_ajax_simcal_default_calendar_draw_grid', array($this, 'draw_grid_ajax'));
102
+		add_action('wp_ajax_nopriv_simcal_default_calendar_draw_grid', array($this, 'draw_grid_ajax'));
103 103
 	}
104 104
 
105 105
 	/**
@@ -113,25 +113,25 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return array
115 115
 	 */
116
-	public function scripts( $min = '' ) {
116
+	public function scripts($min = '') {
117 117
 		return array(
118 118
 			'simcal-qtip' => array(
119
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/jquery.qtip' . $min . '.js',
120
-				'deps'      => array( 'jquery' ),
119
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/jquery.qtip'.$min.'.js',
120
+				'deps'      => array('jquery'),
121 121
 				'in_footer' => true,
122 122
 			),
123 123
 			'simcal-fullcal-moment' => array(
124
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/moment' . $min . '.js',
125
-				'deps'      => array( 'jquery' ),
124
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/moment'.$min.'.js',
125
+				'deps'      => array('jquery'),
126 126
 				'in_footer' => true,
127 127
 			),
128 128
 			'simcal-moment-timezone' => array(
129
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/moment-timezone-with-data' . $min . '.js',
130
-				'deps'      => array( 'jquery' ),
129
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/moment-timezone-with-data'.$min.'.js',
130
+				'deps'      => array('jquery'),
131 131
 				'in_footer' => true,
132 132
 			),
133 133
 			'simcal-default-calendar' => array(
134
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
134
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
135 135
 				'deps'      => array(
136 136
 					'jquery',
137 137
 					'simcal-qtip',
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @return array
159 159
 	 */
160
-	public function styles( $min = '' ) {
160
+	public function styles($min = '') {
161 161
 		return array(
162 162
 			'simcal-qtip' => array(
163
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/vendor/jquery.qtip' . $min . '.css',
163
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/vendor/jquery.qtip'.$min.'.css',
164 164
 				'media' => 'all',
165 165
 			),
166 166
 			'simcal-default-calendar-grid' => array(
167
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-grid' . $min . '.css',
167
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-grid'.$min.'.css',
168 168
 				'deps'  => array(
169 169
 					'simcal-qtip',
170 170
 				),
171 171
 				'media' => 'all',
172 172
 			),
173 173
 			'simcal-default-calendar-list' => array(
174
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
174
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
175 175
 				'deps'  => array(
176 176
 					'simcal-qtip',
177 177
 				),
@@ -189,22 +189,22 @@  discard block
 block discarded – undo
189 189
 
190 190
 		$calendar = $this->calendar;
191 191
 
192
-		if ( $calendar instanceof Default_Calendar ) {
192
+		if ($calendar instanceof Default_Calendar) {
193 193
 
194 194
 			?>
195 195
 
196
-			<?php edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id ); ?>
196
+			<?php edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id); ?>
197 197
 
198 198
 			<table class="simcal-calendar-grid"
199 199
 			       data-event-bubble-trigger="<?php echo $calendar->event_bubble_trigger; ?>">
200 200
 				<thead class="simcal-calendar-head">
201 201
 					<tr>
202
-						<?php if ( ! $calendar->static ) { ?>
203
-							<th class="simcal-nav simcal-prev-wrapper" colspan="<?php echo apply_filters( 'simcal_prev_cols', '1' ); ?>">
204
-								<button class="simcal-nav-button simcal-month-nav simcal-prev" title="<?php _e( 'Previous Month', 'google-calendar-events' ); ?>"><i class="simcal-icon-left"></i></button>
202
+						<?php if ( ! $calendar->static) { ?>
203
+							<th class="simcal-nav simcal-prev-wrapper" colspan="<?php echo apply_filters('simcal_prev_cols', '1'); ?>">
204
+								<button class="simcal-nav-button simcal-month-nav simcal-prev" title="<?php _e('Previous Month', 'google-calendar-events'); ?>"><i class="simcal-icon-left"></i></button>
205 205
 							</th>
206 206
 						<?php } ?>
207
-						<th colspan="<?php echo apply_filters( 'simcal_current_cols', $calendar->static ? '7' : '5' ); ?>"
207
+						<th colspan="<?php echo apply_filters('simcal_current_cols', $calendar->static ? '7' : '5'); ?>"
208 208
 						    class="simcal-nav simcal-current"
209 209
 						    data-calendar-current="<?php echo $calendar->start; ?>">
210 210
 							<?php
@@ -213,26 +213,26 @@  discard block
 block discarded – undo
213 213
 
214 214
 							// Display month and year according to user date format preference.
215 215
 
216
-							$year_pos  = strcspn( $calendar->date_format, 'Y y' );
217
-							$month_pos = strcspn( $calendar->date_format, 'F M m n' );
216
+							$year_pos  = strcspn($calendar->date_format, 'Y y');
217
+							$month_pos = strcspn($calendar->date_format, 'F M m n');
218 218
 
219
-							$current = array( 'month' => 'F', 'year' => 'Y' );
219
+							$current = array('month' => 'F', 'year' => 'Y');
220 220
 
221
-							if ( $year_pos < $month_pos ) {
222
-								$current = array_reverse( $current );
221
+							if ($year_pos < $month_pos) {
222
+								$current = array_reverse($current);
223 223
 							}
224 224
 
225
-							foreach ( $current as $k => $v ) {
226
-								echo ' <span class="simcal-current-' . $k , '">' . date_i18n( $v, $calendar->start ) . '</span> ';
225
+							foreach ($current as $k => $v) {
226
+								echo ' <span class="simcal-current-'.$k, '">'.date_i18n($v, $calendar->start).'</span> ';
227 227
 							}
228 228
 
229 229
 							echo '</h3>';
230 230
 
231 231
 							?>
232 232
 						</th>
233
-						<?php if ( ! $calendar->static ) { ?>
234
-							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters( 'simcal_next_cols', '1' ); ?>">
235
-								<button class="simcal-nav-button simcal-month-nav simcal-next" title="<?php _e( 'Next Month', 'google-calendar-events' ); ?>"><i class="simcal-icon-right"></i></button>
233
+						<?php if ( ! $calendar->static) { ?>
234
+							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters('simcal_next_cols', '1'); ?>">
235
+								<button class="simcal-nav-button simcal-month-nav simcal-next" title="<?php _e('Next Month', 'google-calendar-events'); ?>"><i class="simcal-icon-right"></i></button>
236 236
 							</th>
237 237
 						<?php } ?>
238 238
 					</tr>
@@ -242,28 +242,28 @@  discard block
 block discarded – undo
242 242
 						// Print day names in short or long form for different viewport sizes.
243 243
 
244 244
 						$week_starts     = $calendar->week_starts;
245
-						$week_days_short = simcal_get_calendar_names_i18n( 'day', 'short' );
246
-						$week_days_full  = simcal_get_calendar_names_i18n( 'day', 'full' );
245
+						$week_days_short = simcal_get_calendar_names_i18n('day', 'short');
246
+						$week_days_full  = simcal_get_calendar_names_i18n('day', 'full');
247 247
 
248
-						for ( $i = $week_starts; $i <= 6; $i ++ ) :
248
+						for ($i = $week_starts; $i <= 6; $i++) :
249 249
 
250 250
 							?>
251 251
 							<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
252
-								data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
253
-							    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
254
-							    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
252
+								data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
253
+							    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
254
+							    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
255 255
 							<?php
256 256
 
257 257
 						endfor;
258 258
 
259
-						if ( $week_starts !== 0 ) :
260
-							for ( $i = 0; $i < $week_starts; $i ++ ) :
259
+						if ($week_starts !== 0) :
260
+							for ($i = 0; $i < $week_starts; $i++) :
261 261
 
262 262
 								?>
263 263
 								<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
264
-								    data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
265
-								    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
266
-								    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
264
+								    data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
265
+								    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
266
+								    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
267 267
 								<?php
268 268
 
269 269
 							endfor;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 					</tr>
274 274
 				</thead>
275 275
 
276
-				<?php echo $this->draw_month( date( 'n', $calendar->start ), date( 'Y', $calendar->start ) ); ?>
276
+				<?php echo $this->draw_month(date('n', $calendar->start), date('Y', $calendar->start)); ?>
277 277
 
278 278
 			</table>
279 279
 
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @return string
301 301
 	 */
302
-	private function draw_month( $month, $year, $id = 0 ) {
302
+	private function draw_month($month, $year, $id = 0) {
303 303
 
304 304
 		$calendar = $this->calendar;
305
-		if ( empty( $calendar ) ) {
306
-			$calendar = simcal_get_calendar( intval( $id ) );
307
-			if ( ! $calendar ) {
305
+		if (empty($calendar)) {
306
+			$calendar = simcal_get_calendar(intval($id));
307
+			if ( ! $calendar) {
308 308
 				return '';
309 309
 			}
310 310
 		}
@@ -313,68 +313,68 @@  discard block
 block discarded – undo
313 313
 
314 314
 		// Variables to cycle days in current month and find today in calendar.
315 315
 		$now         = $calendar->now;
316
-		$current     = Carbon::create( $year, $month, 1, 0, 0, 0, $calendar->timezone );
316
+		$current     = Carbon::create($year, $month, 1, 0, 0, 0, $calendar->timezone);
317 317
 		$current_min = $current->getTimestamp();
318 318
 		$current_max = $current->endOfDay()->getTimestamp();
319 319
 
320 320
 		// Calendar grid variables.
321 321
 		$week_starts   = $calendar->week_starts;
322
-		$week_of_year  = $current->weekOfYear;   // Relative count of the week number of the year.
323
-		$month_starts  = $current->dayOfWeek;    // Day upon which the month starts.
324
-		$days_in_month = $current->daysInMonth;  // Number of days in the given month.
322
+		$week_of_year  = $current->weekOfYear; // Relative count of the week number of the year.
323
+		$month_starts  = $current->dayOfWeek; // Day upon which the month starts.
324
+		$days_in_month = $current->daysInMonth; // Number of days in the given month.
325 325
 
326 326
 		// Set current month events timestamp boundaries.
327 327
 		$this->start = $current_min;
328 328
 		$this->end   = $current->endOfMonth()->getTimestamp();
329 329
 
330 330
 		// Get daily events for this month.
331
-		if ( $events && is_array( $events ) ) {
331
+		if ($events && is_array($events)) {
332 332
 
333 333
 			// Filter events within the boundaries previously set above.
334
-			$timestamps   = array_keys( $events );
335
-			$lower_bound  = array_filter( $timestamps, array( $this, 'filter_events_before' ) );
336
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after' ) );
337
-			$filtered     = ( is_array( $events ) && is_array( $higher_bound) ) && ! empty( $events ) && ! empty( $higher_bound ) ? array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) ) : array();
334
+			$timestamps   = array_keys($events);
335
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
336
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
337
+			$filtered     = (is_array($events) && is_array($higher_bound)) && ! empty($events) && ! empty($higher_bound) ? array_intersect_key($events, array_combine($higher_bound, $higher_bound)) : array();
338 338
 
339 339
 			// Put resulting events in an associative array, with day of the month as key for easy retrieval in calendar days loop.
340 340
 			$day_events = array();
341
-			foreach ( $filtered as $timestamp => $events_in_day ) {
342
-				foreach ( $events_in_day as $event ) {
343
-					if ( $event instanceof Event ){
344
-						$day = intval( Carbon::createFromTimestamp( $timestamp, $calendar->timezone )->endOfDay()->day );
345
-						$day_events[ $day ][] = $event;
341
+			foreach ($filtered as $timestamp => $events_in_day) {
342
+				foreach ($events_in_day as $event) {
343
+					if ($event instanceof Event) {
344
+						$day = intval(Carbon::createFromTimestamp($timestamp, $calendar->timezone)->endOfDay()->day);
345
+						$day_events[$day][] = $event;
346 346
 					}
347 347
 				}
348 348
 			}
349 349
 
350
-			ksort( $day_events, SORT_NUMERIC );
350
+			ksort($day_events, SORT_NUMERIC);
351 351
 		}
352 352
 
353 353
 		ob_start();
354 354
 
355
-		echo '<tbody class="simcal-month simcal-month-' . $month . '">' . "\n";
356
-		echo "\t" . '<tr class="simcal-week simcal-week-' . $week_of_year . '">';
355
+		echo '<tbody class="simcal-month simcal-month-'.$month.'">'."\n";
356
+		echo "\t".'<tr class="simcal-week simcal-week-'.$week_of_year.'">';
357 357
 
358 358
 		$days_in_row = 0;
359 359
 		// Week may start on an arbitrary day (sun, 0 - sat, 6).
360 360
 		$week_day = $week_starts;
361 361
 
362 362
 		// This fixes a possible bug when a month starts by Sunday (0).
363
-		if ( 0 !== $week_starts ) {
363
+		if (0 !== $week_starts) {
364 364
 			$b = $month_starts === 0 ? 7 : $month_starts;
365 365
 		} else {
366 366
 			$b = $month_starts;
367 367
 		}
368 368
 
369 369
 		// Void days in first week.
370
-		for ( $a = $week_starts; $a < $b; $a++ ) :
370
+		for ($a = $week_starts; $a < $b; $a++) :
371 371
 
372
-			$last_void_day_class = ( $a === ( $b - 1 ) ) ? 'simcal-day-void-last' : '';
372
+			$last_void_day_class = ($a === ($b - 1)) ? 'simcal-day-void-last' : '';
373 373
 
374
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
374
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
375 375
 
376 376
 			// Reset day of the week count (sun, 0 - sat, 6).
377
-			if ( $week_day === 6 ) {
377
+			if ($week_day === 6) {
378 378
 				$week_day = -1;
379 379
 			}
380 380
 			$week_day++;
@@ -384,97 +384,97 @@  discard block
 block discarded – undo
384 384
 		endfor;
385 385
 
386 386
 		// Actual days of the month.
387
-		for ( $day = 1; $day <= $days_in_month; $day++ ) :
387
+		for ($day = 1; $day <= $days_in_month; $day++) :
388 388
 
389 389
 			$count = 0;
390 390
 			$calendar_classes = array();
391
-			$day_classes = 'simcal-day-' . $day . ' simcal-weekday-' . $week_day;
391
+			$day_classes = 'simcal-day-'.$day.' simcal-weekday-'.$week_day;
392 392
 
393 393
 			$border_style = $bg_color = $color = '';
394 394
 
395 395
 			// Is this the present, the past or the future, Doc?
396
-			if ( $current_min <= $now && $current_max >= $now ) {
396
+			if ($current_min <= $now && $current_max >= $now) {
397 397
 				$day_classes .= ' simcal-today simcal-present simcal-day';
398
-				$the_color = new Color( $calendar->today_color );
399
-				$bg_color = '#' . $the_color->getHex();
398
+				$the_color = new Color($calendar->today_color);
399
+				$bg_color = '#'.$the_color->getHex();
400 400
 				$color = $the_color->isDark() ? '#ffffff' : '#000000';
401
-				$border_style = ' style="border: 1px solid ' . $bg_color . ';"';
402
-			} elseif ( $current_max < $now ) {
401
+				$border_style = ' style="border: 1px solid '.$bg_color.';"';
402
+			} elseif ($current_max < $now) {
403 403
 				$day_classes .= ' simcal-past simcal-day';
404
-			} elseif ( $current_min > $now ) {
404
+			} elseif ($current_min > $now) {
405 405
 				$day_classes .= ' simcal-future simcal-day';
406 406
 			}
407 407
 
408 408
 			// Print events for the current day in loop, if found any.
409
-			if ( isset( $day_events[ $day ] ) ) :
409
+			if (isset($day_events[$day])) :
410 410
 
411 411
 				$bullet_colors = array();
412 412
 
413 413
 				$list_events = '<ul class="simcal-events">';
414 414
 
415
-				foreach ( $day_events[ $day ] as $event ) :
415
+				foreach ($day_events[$day] as $event) :
416 416
 
417 417
 					$event_classes = $event_visibility = '';
418 418
 
419
-					if ( $event instanceof Event ) :
419
+					if ($event instanceof Event) :
420 420
 
421 421
 						// Store the calendar id where the event belongs (useful in grouped calendar feeds)
422
-						$calendar_class  = 'simcal-events-calendar-' . strval( $event->calendar );
423
-						$calendar_classes[] = $calendar_class ;
422
+						$calendar_class = 'simcal-events-calendar-'.strval($event->calendar);
423
+						$calendar_classes[] = $calendar_class;
424 424
 
425 425
 						$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
426 426
 						$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
427 427
 
428
-						$event_classes  .= 'simcal-event ' . $recurring . $has_location . $calendar_class . ' simcal-tooltip';
428
+						$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class.' simcal-tooltip';
429 429
 
430 430
 						// Toggle some events visibility if more than optional limit.
431
-						if ( ( $calendar->events_limit > -1 )  && ( $count >= $calendar->events_limit ) ) :
431
+						if (($calendar->events_limit > -1) && ($count >= $calendar->events_limit)) :
432 432
 							$event_classes    .= ' simcal-event-toggled';
433 433
 							$event_visibility  = ' style="display: none"';
434 434
 						endif;
435 435
 
436 436
 						// Event title in list.
437
-						$title = ! empty( $event->title ) ? trim( $event->title ) : __( 'Event', 'google-calendar-events' );
438
-						if ( $calendar->trim_titles >= 1 ) {
439
-							$title = strlen( $title ) > $calendar->trim_titles ? mb_substr( $title, 0, $calendar->trim_titles ) . '&hellip;' : $title;
437
+						$title = ! empty($event->title) ? trim($event->title) : __('Event', 'google-calendar-events');
438
+						if ($calendar->trim_titles >= 1) {
439
+							$title = strlen($title) > $calendar->trim_titles ? mb_substr($title, 0, $calendar->trim_titles).'&hellip;' : $title;
440 440
 						}
441 441
 
442 442
 						// Event color.
443 443
 						$bullet = '';
444 444
 						//$bullet_color = '#000';
445 445
 						$event_color = $event->get_color();
446
-						if ( ! empty( $event_color ) ) {
447
-							$bullet = '<span style="color: ' . $event_color . ';">&#9632;</span> ';
446
+						if ( ! empty($event_color)) {
447
+							$bullet = '<span style="color: '.$event_color.';">&#9632;</span> ';
448 448
 							$bullet_colors[] = $event_color;
449 449
 						} else {
450 450
 							$bullet_colors[] = '#000';
451 451
 						}
452 452
 
453 453
 						// Event contents.
454
-						$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . ' itemscope itemtype="http://schema.org/Event">' . "\n";
455
-						$list_events .= "\t\t" . '<span class="simcal-event-title">' . $bullet . $title . '</span>' . "\n";
456
-						$list_events .= "\t\t" . '<div class="simcal-event-details simcal-tooltip-content" style="display: none;">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
457
-						$list_events .= "\t" . '</li>' . "\n";
454
+						$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.' itemscope itemtype="http://schema.org/Event">'."\n";
455
+						$list_events .= "\t\t".'<span class="simcal-event-title">'.$bullet.$title.'</span>'."\n";
456
+						$list_events .= "\t\t".'<div class="simcal-event-details simcal-tooltip-content" style="display: none;">'.$calendar->get_event_html($event).'</div>'."\n";
457
+						$list_events .= "\t".'</li>'."\n";
458 458
 
459
-						$count ++;
459
+						$count++;
460 460
 
461 461
 					endif;
462 462
 
463 463
 				endforeach;
464 464
 
465
-				if ( ( $current_min <= $now ) && ( $current_max >= $now ) ) {
465
+				if (($current_min <= $now) && ($current_max >= $now)) {
466 466
 					$day_classes .= ' simcal-today-has-events';
467 467
 				}
468
-				$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
468
+				$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
469 469
 
470
-				if ( $calendar_classes ) {
471
-					$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
470
+				if ($calendar_classes) {
471
+					$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
472 472
 				}
473 473
 
474
-				$list_events .= '</ul>' . "\n";
474
+				$list_events .= '</ul>'."\n";
475 475
 
476 476
 				// Optional button to toggle hidden events in list.
477
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
477
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
478 478
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
479 479
 				endif;
480 480
 
@@ -486,49 +486,49 @@  discard block
 block discarded – undo
486 486
 			endif;
487 487
 
488 488
 			// The actual days with numbers and events in each row cell.
489
-			echo '<td class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
490
-
491
-			if ( $color ) {
492
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
493
-			} elseif ( $count > 0 ) {
494
-				$the_color = new Color( $calendar->days_events_color );
495
-				$color = ! $color ? ( $the_color->isDark() ? '#ffffff' : '#000000' ) : $color;
496
-				$bg_color = ! $bg_color ? '#' . $the_color->getHex() : $bg_color;
497
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
489
+			echo '<td class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
490
+
491
+			if ($color) {
492
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
493
+			} elseif ($count > 0) {
494
+				$the_color = new Color($calendar->days_events_color);
495
+				$color = ! $color ? ($the_color->isDark() ? '#ffffff' : '#000000') : $color;
496
+				$bg_color = ! $bg_color ? '#'.$the_color->getHex() : $bg_color;
497
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
498 498
 			} else {
499 499
 				$day_style = '';
500 500
 			}
501 501
 
502
-			echo "\t" . '<div' . $border_style . '>' . "\n";
503
-			echo "\t\t" . '<span class="simcal-day-label simcal-day-number"' . $day_style . '>' . $day . '</span>' . "\n";
504
-			echo "\t\t" . $list_events . "\n";
502
+			echo "\t".'<div'.$border_style.'>'."\n";
503
+			echo "\t\t".'<span class="simcal-day-label simcal-day-number"'.$day_style.'>'.$day.'</span>'."\n";
504
+			echo "\t\t".$list_events."\n";
505 505
 			echo "\t\t";
506 506
 			echo '<span class="simcal-events-dots" style="display: none;">';
507 507
 
508 508
 			// Event bullets for calendar mobile mode.
509
-			for( $i = 0; $i < $count; $i++ ) {
510
-				echo '<b style="color: ' . $bullet_colors[ $i ] . ';"> &bull; </b>';
509
+			for ($i = 0; $i < $count; $i++) {
510
+				echo '<b style="color: '.$bullet_colors[$i].';"> &bull; </b>';
511 511
 			}
512 512
 
513
-			echo '</span>' . "\n";
514
-			echo "\t" . '</div>' . "\n";
515
-			echo '</td>' . "\n";
513
+			echo '</span>'."\n";
514
+			echo "\t".'</div>'."\n";
515
+			echo '</td>'."\n";
516 516
 
517 517
 			// Reset day of the week count (sun, 0 - sat, 6).
518
-			if ( $week_day === 6 ) {
518
+			if ($week_day === 6) {
519 519
 				$week_day = - 1;
520 520
 			}
521 521
 			$week_day++;
522 522
 
523 523
 			// Reset count of days for this row (0-6).
524
-			if ( $days_in_row === 6 ) :
524
+			if ($days_in_row === 6) :
525 525
 
526 526
 				// Close the week row.
527 527
 				echo '</tr>';
528 528
 
529 529
 				// Open a new week row.
530
-				if ( $day < $days_in_month ) {
531
-					echo '<tr class="simcal-week simcal-week-' . $week_of_year++ . '">' . "\n";
530
+				if ($day < $days_in_month) {
531
+					echo '<tr class="simcal-week simcal-week-'.$week_of_year++.'">'."\n";
532 532
 				}
533 533
 
534 534
 				$days_in_row = -1;
@@ -537,25 +537,25 @@  discard block
 block discarded – undo
537 537
 
538 538
 			$days_in_row++;
539 539
 
540
-			$current_min = Carbon::createFromTimestamp( $current_min, $calendar->timezone )->addDay()->getTimestamp();
541
-			$current_max = Carbon::createFromTimestamp( $current_max, $calendar->timezone )->addDay()->getTimestamp();
540
+			$current_min = Carbon::createFromTimestamp($current_min, $calendar->timezone)->addDay()->getTimestamp();
541
+			$current_max = Carbon::createFromTimestamp($current_max, $calendar->timezone)->addDay()->getTimestamp();
542 542
 
543 543
 		endfor;
544 544
 
545 545
 		// Void days at the end of the month.
546
-		$remainder_days = ( 6 - $days_in_row );
546
+		$remainder_days = (6 - $days_in_row);
547 547
 
548
-		for ( $i = 0; $i <= $remainder_days; $i ++ ) {
548
+		for ($i = 0; $i <= $remainder_days; $i++) {
549 549
 
550
-			$last_void_day_class = ( $i == $remainder_days ) ? 'simcal-day-void-last' : '';
550
+			$last_void_day_class = ($i == $remainder_days) ? 'simcal-day-void-last' : '';
551 551
 
552
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
552
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
553 553
 
554 554
 			$week_day++;
555 555
 		}
556 556
 
557
-		echo "\t" . '</tr>' . "\n";
558
-		echo '</tbody>' . "\n";
557
+		echo "\t".'</tr>'."\n";
558
+		echo '</tbody>'."\n";
559 559
 
560 560
 		return ob_get_clean();
561 561
 	}
@@ -567,17 +567,17 @@  discard block
 block discarded – undo
567 567
 	 */
568 568
 	public function draw_grid_ajax() {
569 569
 
570
-		if ( isset( $_POST['month'] ) && isset( $_POST['year'] ) && isset( $_POST['id'] ) ) {
570
+		if (isset($_POST['month']) && isset($_POST['year']) && isset($_POST['id'])) {
571 571
 
572
-			$month = absint( $_POST['month'] );
573
-			$year  = absint( $_POST['year'] );
574
-			$id    = absint( $_POST['id'] );
572
+			$month = absint($_POST['month']);
573
+			$year  = absint($_POST['year']);
574
+			$id    = absint($_POST['id']);
575 575
 
576
-			wp_send_json_success( $this->draw_month( $month, $year, $id ) );
576
+			wp_send_json_success($this->draw_month($month, $year, $id));
577 577
 
578 578
 		} else {
579 579
 
580
-			wp_send_json_error( 'Missing arguments in default calendar grid ajax request.' );
580
+			wp_send_json_error('Missing arguments in default calendar grid ajax request.');
581 581
 
582 582
 		}
583 583
 
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
 	 *
594 594
 	 * @return bool
595 595
 	 */
596
-	private function filter_events_before( $event ) {
597
-		return intval( $event ) >= intval( $this->start );
596
+	private function filter_events_before($event) {
597
+		return intval($event) >= intval($this->start);
598 598
 	}
599 599
 
600 600
 	/**
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 	 *
608 608
 	 * @return bool
609 609
 	 */
610
-	private function filter_events_after( $event ) {
611
-		return intval( $event ) < intval( $this->end );
610
+	private function filter_events_after($event) {
611
+		return intval($event) < intval($this->end);
612 612
 	}
613 613
 
614 614
 }
Please login to merge, or discard this patch.