Completed
Push — master ( 55ab5a...492b47 )
by
unknown
03:15
created
includes/ajax.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Calendar_View;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @since 3.0.0
26 26
 	 */
27 27
 	public function __construct() {
28
-		add_action( 'init', array( $this, 'add_callbacks' ), 100 );
28
+		add_action('init', array($this, 'add_callbacks'), 100);
29 29
 	}
30 30
 
31 31
 	/**
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 
38 38
 		$calendars = simcal_get_calendar_types();
39 39
 
40
-		foreach ( $calendars as $calendar => $views ) {
40
+		foreach ($calendars as $calendar => $views) {
41 41
 
42
-			foreach ( $views as $view ) {
42
+			foreach ($views as $view) {
43 43
 
44
-				$the_view = simcal_get_calendar_view( 0, $calendar . '-' . $view );
44
+				$the_view = simcal_get_calendar_view(0, $calendar.'-'.$view);
45 45
 
46
-				if ( $the_view instanceof Calendar_View ) {
46
+				if ($the_view instanceof Calendar_View) {
47 47
 					$the_view->add_ajax_actions();
48 48
 				}
49 49
 			}
50 50
 		}
51 51
 
52
-		do_action( 'simcal_add_ajax_callbacks' );
52
+		do_action('simcal_add_ajax_callbacks');
53 53
 	}
54 54
 
55 55
 }
Please login to merge, or discard this patch.
includes/autoload.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
  * @package SimpleCalendar
6 6
  */
7 7
 
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if ( ! defined('ABSPATH')) {
9 9
 	exit;
10 10
 }
11 11
 
12
-if ( ! function_exists( 'SimpleCalendar_Autoload' ) ) {
12
+if ( ! function_exists('SimpleCalendar_Autoload')) {
13 13
 
14 14
 	/**
15 15
 	 * Plugin autoloader.
@@ -22,31 +22,31 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param $class
24 24
 	 */
25
-	function SimpleCalendar_Autoload( $class ) {
25
+	function SimpleCalendar_Autoload($class) {
26 26
 
27 27
 		// Do not load unless in plugin domain.
28 28
 		$namespace = 'SimpleCalendar';
29
-		if ( strpos( $class, $namespace ) !== 0 ) {
29
+		if (strpos($class, $namespace) !== 0) {
30 30
 			return;
31 31
 		}
32 32
 
33 33
 		// Converts Class_Name (class convention) to class-name (file convention).
34
-		$class_name = implode( '-', array_map( 'lcfirst', explode( '_', strtolower( $class ) ) ) );
34
+		$class_name = implode('-', array_map('lcfirst', explode('_', strtolower($class))));
35 35
 
36 36
 		// Remove the root namespace.
37
-		$unprefixed = substr( $class_name, strlen( $namespace ) );
37
+		$unprefixed = substr($class_name, strlen($namespace));
38 38
 
39 39
 		// Build the file path.
40
-		$file_path = str_replace( '\\', DIRECTORY_SEPARATOR, $unprefixed );
41
-		$file      = dirname( __FILE__ ) . '/' . $file_path . '.php';
40
+		$file_path = str_replace('\\', DIRECTORY_SEPARATOR, $unprefixed);
41
+		$file      = dirname(__FILE__).'/'.$file_path.'.php';
42 42
 
43
-		if ( file_exists( $file ) ) {
43
+		if (file_exists($file)) {
44 44
 			require $file;
45 45
 		}
46 46
 
47 47
 	}
48 48
 
49 49
 	// Register the autoloader.
50
-	spl_autoload_register( 'SimpleCalendar_Autoload' );
50
+	spl_autoload_register('SimpleCalendar_Autoload');
51 51
 
52 52
 }
Please login to merge, or discard this patch.
includes/calendars/views/default-calendar-grid.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -453,10 +453,12 @@
 block discarded – undo
453 453
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
454 454
 				endif;
455 455
 
456
-			else :
456
+			else {
457
+				:
457 458
 
458 459
 				// Empty cell for day with no events.
459 460
 				$list_events = '<span class="simcal-no-events"></span>';
461
+			}
460 462
 
461 463
 			endif;
462 464
 
Please login to merge, or discard this patch.
Spacing   +147 added lines, -147 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,28 +113,28 @@  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
 				'ver'       => '2.2.1',
122 122
 				'in_footer' => true,
123 123
 			),
124 124
 			'simcal-fullcal-moment' => array(
125
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/moment' . $min . '.js',
126
-				'deps'      => array( 'jquery' ),
125
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/moment'.$min.'.js',
126
+				'deps'      => array('jquery'),
127 127
 				'ver'       => '',
128 128
 				'in_footer' => true,
129 129
 			),
130 130
 			'simcal-moment-timezone' => array(
131
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/moment-timezone-with-data' . $min . '.js',
132
-				'deps'      => array( 'jquery' ),
131
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/moment-timezone-with-data'.$min.'.js',
132
+				'deps'      => array('jquery'),
133 133
 				'ver'       => '',
134 134
 				'in_footer' => true,
135 135
 			),
136 136
 			'simcal-default-calendar' => array(
137
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
137
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
138 138
 				'deps'      => array(
139 139
 					'jquery',
140 140
 					'simcal-qtip',
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return array
163 163
 	 */
164
-	public function styles( $min = '' ) {
164
+	public function styles($min = '') {
165 165
 		return array(
166 166
 			'simcal-qtip' => array(
167
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/vendor/jquery.qtip' . $min . '.css',
167
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/vendor/jquery.qtip'.$min.'.css',
168 168
 				'ver'   => '2.2.1',
169 169
 				'media' => 'all',
170 170
 			),
171 171
 			'simcal-default-calendar-grid' => array(
172
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-grid' . $min . '.css',
172
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-grid'.$min.'.css',
173 173
 				'deps'  => array(
174 174
 					'simcal-qtip',
175 175
 				),
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 				'media' => 'all',
178 178
 			),
179 179
 			'simcal-default-calendar-list' => array(
180
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
180
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
181 181
 				'deps'  => array(
182 182
 					'simcal-qtip',
183 183
 				),
@@ -196,22 +196,22 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$calendar = $this->calendar;
198 198
 
199
-		if ( $calendar instanceof Default_Calendar ) {
199
+		if ($calendar instanceof Default_Calendar) {
200 200
 
201 201
 			?>
202 202
 
203
-			<?php edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id ); ?>
203
+			<?php edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id); ?>
204 204
 
205 205
 			<table class="simcal-calendar-grid"
206 206
 			       data-event-bubble-trigger="<?php echo $calendar->event_bubble_trigger; ?>">
207 207
 				<thead class="simcal-calendar-head">
208 208
 					<tr>
209
-						<?php if ( ! $calendar->static ) { ?>
210
-							<th class="simcal-nav simcal-prev-wrapper" colspan="<?php echo apply_filters( 'simcal_prev_cols', '1' ); ?>">
211
-								<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>
209
+						<?php if ( ! $calendar->static) { ?>
210
+							<th class="simcal-nav simcal-prev-wrapper" colspan="<?php echo apply_filters('simcal_prev_cols', '1'); ?>">
211
+								<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>
212 212
 							</th>
213 213
 						<?php } ?>
214
-						<th colspan="<?php echo apply_filters( 'simcal_current_cols', $calendar->static ? '7' : '5' ); ?>"
214
+						<th colspan="<?php echo apply_filters('simcal_current_cols', $calendar->static ? '7' : '5'); ?>"
215 215
 						    class="simcal-nav simcal-current"
216 216
 						    data-calendar-current="<?php echo $calendar->start; ?>">
217 217
 							<?php
@@ -220,26 +220,26 @@  discard block
 block discarded – undo
220 220
 
221 221
 							// Display month and year according to user date format preference.
222 222
 
223
-							$year_pos  = strcspn( $calendar->date_format, 'Y y' );
224
-							$month_pos = strcspn( $calendar->date_format, 'F M m n' );
223
+							$year_pos  = strcspn($calendar->date_format, 'Y y');
224
+							$month_pos = strcspn($calendar->date_format, 'F M m n');
225 225
 
226
-							$current = array( 'month' => 'F', 'year' => 'Y' );
226
+							$current = array('month' => 'F', 'year' => 'Y');
227 227
 
228
-							if ( $year_pos < $month_pos ) {
229
-								$current = array_reverse( $current );
228
+							if ($year_pos < $month_pos) {
229
+								$current = array_reverse($current);
230 230
 							}
231 231
 
232
-							foreach ( $current as $k => $v ) {
233
-								echo ' <span class="simcal-current-' . $k , '">' . date_i18n( $v, $calendar->start ) . '</span> ';
232
+							foreach ($current as $k => $v) {
233
+								echo ' <span class="simcal-current-'.$k, '">'.date_i18n($v, $calendar->start).'</span> ';
234 234
 							}
235 235
 
236 236
 							echo '</h3>';
237 237
 
238 238
 							?>
239 239
 						</th>
240
-						<?php if ( ! $calendar->static ) { ?>
241
-							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters( 'simcal_next_cols', '1' ); ?>">
242
-								<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>
240
+						<?php if ( ! $calendar->static) { ?>
241
+							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters('simcal_next_cols', '1'); ?>">
242
+								<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>
243 243
 							</th>
244 244
 						<?php } ?>
245 245
 					</tr>
@@ -249,28 +249,28 @@  discard block
 block discarded – undo
249 249
 						// Print day names in short or long form for different viewport sizes.
250 250
 
251 251
 						$week_starts     = $calendar->week_starts;
252
-						$week_days_short = simcal_get_calendar_names_i18n( 'day', 'short' );
253
-						$week_days_full  = simcal_get_calendar_names_i18n( 'day', 'full' );
252
+						$week_days_short = simcal_get_calendar_names_i18n('day', 'short');
253
+						$week_days_full  = simcal_get_calendar_names_i18n('day', 'full');
254 254
 
255
-						for ( $i = $week_starts; $i <= 6; $i ++ ) :
255
+						for ($i = $week_starts; $i <= 6; $i++) :
256 256
 
257 257
 							?>
258 258
 							<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
259
-								data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
260
-							    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
261
-							    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
259
+								data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
260
+							    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
261
+							    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
262 262
 							<?php
263 263
 
264 264
 						endfor;
265 265
 
266
-						if ( $week_starts !== 0 ) :
267
-							for ( $i = 0; $i < $week_starts; $i ++ ) :
266
+						if ($week_starts !== 0) :
267
+							for ($i = 0; $i < $week_starts; $i++) :
268 268
 
269 269
 								?>
270 270
 								<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
271
-								    data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
272
-								    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
273
-								    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
271
+								    data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
272
+								    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
273
+								    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
274 274
 								<?php
275 275
 
276 276
 							endfor;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 					</tr>
281 281
 				</thead>
282 282
 
283
-				<?php echo $this->draw_month( date( 'n', $calendar->start ), date( 'Y', $calendar->start ) ); ?>
283
+				<?php echo $this->draw_month(date('n', $calendar->start), date('Y', $calendar->start)); ?>
284 284
 
285 285
 			</table>
286 286
 
@@ -306,85 +306,85 @@  discard block
 block discarded – undo
306 306
 	 *
307 307
 	 * @return string
308 308
 	 */
309
-	private function draw_month( $month, $year, $id = 0 ) {
309
+	private function draw_month($month, $year, $id = 0) {
310 310
 
311 311
 		$calendar = $this->calendar;
312
-		if ( empty( $calendar ) ) {
313
-			$calendar = simcal_get_calendar( intval( $id ) );
314
-			if ( ! $calendar ) {
312
+		if (empty($calendar)) {
313
+			$calendar = simcal_get_calendar(intval($id));
314
+			if ( ! $calendar) {
315 315
 				return '';
316 316
 			}
317 317
 		}
318 318
 
319 319
 		$events = $calendar->events;
320 320
 
321
-		$feed          = simcal_get_feed( $calendar );
322
-		$feed_timezone = get_post_meta( $feed->post_id, '_feed_timezone', true );
321
+		$feed          = simcal_get_feed($calendar);
322
+		$feed_timezone = get_post_meta($feed->post_id, '_feed_timezone', true);
323 323
 
324 324
 		// Variables to cycle days in current month and find today in calendar.
325 325
 		$now         = $calendar->now;
326
-		$current     = Carbon::create( $year, $month, 1, 0, 0, 0, $calendar->timezone );
326
+		$current     = Carbon::create($year, $month, 1, 0, 0, 0, $calendar->timezone);
327 327
 		$current_min = $current->getTimestamp();
328 328
 		$current_max = $current->endOfDay()->getTimestamp();
329 329
 
330 330
 		// Calendar grid variables.
331 331
 		$week_starts   = $calendar->week_starts;
332
-		$week_of_year  = $current->weekOfYear;   // Relative count of the week number of the year.
333
-		$month_starts  = $current->dayOfWeek;    // Day upon which the month starts.
334
-		$days_in_month = $current->daysInMonth;  // Number of days in the given month.
332
+		$week_of_year  = $current->weekOfYear; // Relative count of the week number of the year.
333
+		$month_starts  = $current->dayOfWeek; // Day upon which the month starts.
334
+		$days_in_month = $current->daysInMonth; // Number of days in the given month.
335 335
 
336 336
 		// Set current month events timestamp boundaries.
337 337
 		$this->start = $current_min;
338 338
 		$this->end   = $current->endOfMonth()->timestamp;
339 339
 
340 340
 		// Get daily events for this month.
341
-		if ( $events && is_array( $events ) ) {
341
+		if ($events && is_array($events)) {
342 342
 
343 343
 			// Filter events within the boundaries previously set above.
344
-			$timestamps   = array_keys( $events );
345
-			$lower_bound  = array_filter( $timestamps, array( $this, 'filter_events_before' ) );
346
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after' ) );
347
-			$filtered     = ( is_array( $events ) && is_array( $higher_bound) ) && ! empty( $events ) && ! empty( $higher_bound ) ? array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) ) : array();
344
+			$timestamps   = array_keys($events);
345
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
346
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
347
+			$filtered     = (is_array($events) && is_array($higher_bound)) && ! empty($events) && ! empty($higher_bound) ? array_intersect_key($events, array_combine($higher_bound, $higher_bound)) : array();
348 348
 
349 349
 			// Put resulting events in an associative array, with day of the month as key for easy retrieval in calendar days loop.
350 350
 			$day_events = array();
351
-			foreach ( $filtered as $timestamp => $events_in_day ) {
352
-				foreach ( $events_in_day as $event ) {
353
-					if ( $event instanceof Event ){
354
-						$day = intval( Carbon::createFromTimestamp( $timestamp, $event->timezone )->endOfDay()->day );
355
-						$day_events[ $day ][] = $event;
351
+			foreach ($filtered as $timestamp => $events_in_day) {
352
+				foreach ($events_in_day as $event) {
353
+					if ($event instanceof Event) {
354
+						$day = intval(Carbon::createFromTimestamp($timestamp, $event->timezone)->endOfDay()->day);
355
+						$day_events[$day][] = $event;
356 356
 					}
357 357
 				}
358 358
 			}
359 359
 
360
-			ksort( $day_events, SORT_NUMERIC );
360
+			ksort($day_events, SORT_NUMERIC);
361 361
 		}
362 362
 
363 363
 		ob_start();
364 364
 
365
-		echo '<tbody class="simcal-month simcal-month-' . $month . '">' . "\n";
366
-		echo "\t" . '<tr class="simcal-week simcal-week-' . $week_of_year . '">';
365
+		echo '<tbody class="simcal-month simcal-month-'.$month.'">'."\n";
366
+		echo "\t".'<tr class="simcal-week simcal-week-'.$week_of_year.'">';
367 367
 
368 368
 		$days_in_row = 0;
369 369
 		// Week may start on an arbitrary day (sun, 0 - sat, 6).
370 370
 		$week_day = $week_starts;
371 371
 
372 372
 		// This fixes a possible bug when a month starts by Sunday (0).
373
-		if ( 0 !== $week_starts ) {
373
+		if (0 !== $week_starts) {
374 374
 			$b = $month_starts === 0 ? 7 : $month_starts;
375 375
 		} else {
376 376
 			$b = $month_starts;
377 377
 		}
378 378
 
379 379
 		// Void days in first week.
380
-		for ( $a = $week_starts; $a < $b; $a++ ) :
380
+		for ($a = $week_starts; $a < $b; $a++) :
381 381
 
382
-			$last_void_day_class = ( $a === ( $b - 1 ) ) ? 'simcal-day-void-last' : '';
382
+			$last_void_day_class = ($a === ($b - 1)) ? 'simcal-day-void-last' : '';
383 383
 
384
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
384
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
385 385
 
386 386
 			// Reset day of the week count (sun, 0 - sat, 6).
387
-			if ( $week_day === 6 ) {
387
+			if ($week_day === 6) {
388 388
 				$week_day = -1;
389 389
 			}
390 390
 			$week_day++;
@@ -394,103 +394,103 @@  discard block
 block discarded – undo
394 394
 		endfor;
395 395
 
396 396
 		// Actual days of the month.
397
-		for ( $day = 1; $day <= $days_in_month; $day++ ) :
397
+		for ($day = 1; $day <= $days_in_month; $day++) :
398 398
 
399 399
 			$count = 0;
400 400
 			$calendar_classes = array();
401
-			$day_classes = 'simcal-day-' . $day . ' simcal-weekday-' . $week_day;
401
+			$day_classes = 'simcal-day-'.$day.' simcal-weekday-'.$week_day;
402 402
 
403 403
 			$border_style = $bg_color = $color = '';
404 404
 
405 405
 			// Is this the present, the past or the future, Doc?
406
-			if ( $current_min <= $now && $current_max >= $now ) {
406
+			if ($current_min <= $now && $current_max >= $now) {
407 407
 				$day_classes .= ' simcal-today simcal-present simcal-day';
408
-				$the_color = new Color( $calendar->today_color );
409
-				$bg_color = '#' . $the_color->getHex();
408
+				$the_color = new Color($calendar->today_color);
409
+				$bg_color = '#'.$the_color->getHex();
410 410
 				$color = $the_color->isDark() ? '#ffffff' : '#000000';
411
-				$border_style = ' style="border: 1px solid ' . $bg_color . ';"';
412
-			} elseif ( $current_max < $now ) {
411
+				$border_style = ' style="border: 1px solid '.$bg_color.';"';
412
+			} elseif ($current_max < $now) {
413 413
 				$day_classes .= ' simcal-past simcal-day';
414
-			} elseif ( $current_min > $now ) {
414
+			} elseif ($current_min > $now) {
415 415
 				$day_classes .= ' simcal-future simcal-day';
416 416
 			}
417 417
 
418 418
 			// Print events for the current day in loop, if found any.
419
-			if ( isset( $day_events[ $day ] ) ) :
419
+			if (isset($day_events[$day])) :
420 420
 
421 421
 				$bullet_colors = array();
422 422
 
423 423
 				$list_events = '<ul class="simcal-events">';
424 424
 
425
-				foreach ( $day_events[ $day ] as $event ) :
425
+				foreach ($day_events[$day] as $event) :
426 426
 
427 427
 					$event_classes = $event_visibility = '';
428 428
 
429
-					if ( $event instanceof Event ) :
429
+					if ($event instanceof Event) :
430 430
 
431
-						if ( $feed->type == 'grouped-calendars' ) {
432
-							date_default_timezone_set( $feed_timezone );
431
+						if ($feed->type == 'grouped-calendars') {
432
+							date_default_timezone_set($feed_timezone);
433 433
 						} else {
434
-							date_default_timezone_set( $event->timezone );
434
+							date_default_timezone_set($event->timezone);
435 435
 						}
436 436
 
437 437
 						// Store the calendar id where the event belongs (useful in grouped calendar feeds)
438
-						$calendar_class  = 'simcal-events-calendar-' . strval( $event->calendar );
439
-						$calendar_classes[] = $calendar_class ;
438
+						$calendar_class = 'simcal-events-calendar-'.strval($event->calendar);
439
+						$calendar_classes[] = $calendar_class;
440 440
 
441 441
 						$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
442 442
 						$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
443 443
 
444
-						$event_classes  .= 'simcal-event ' . $recurring . $has_location . $calendar_class . ' simcal-tooltip';
444
+						$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class.' simcal-tooltip';
445 445
 
446 446
 						// Toggle some events visibility if more than optional limit.
447
-						if ( ( $calendar->events_limit > -1 )  && ( $count >= $calendar->events_limit ) ) :
447
+						if (($calendar->events_limit > -1) && ($count >= $calendar->events_limit)) :
448 448
 							$event_classes    .= ' simcal-event-toggled';
449 449
 							$event_visibility  = ' style="display: none"';
450 450
 						endif;
451 451
 
452 452
 						// Event title in list.
453
-						$title = ! empty( $event->title ) ? trim( $event->title ) : __( 'Event', 'google-calendar-events' );
454
-						if ( $calendar->trim_titles >= 1 ) {
455
-							$title = strlen( $title ) > $calendar->trim_titles ? mb_substr( $title, 0, $calendar->trim_titles ) . '&hellip;' : $title;
453
+						$title = ! empty($event->title) ? trim($event->title) : __('Event', 'google-calendar-events');
454
+						if ($calendar->trim_titles >= 1) {
455
+							$title = strlen($title) > $calendar->trim_titles ? mb_substr($title, 0, $calendar->trim_titles).'&hellip;' : $title;
456 456
 						}
457 457
 
458 458
 						// Event color.
459 459
 						$bullet = '';
460 460
 						//$bullet_color = '#000';
461 461
 						$event_color = $event->get_color();
462
-						if ( ! empty( $event_color ) ) {
463
-							$bullet = '<span style="color: ' . $event_color . ';">&#9632;</span> ';
462
+						if ( ! empty($event_color)) {
463
+							$bullet = '<span style="color: '.$event_color.';">&#9632;</span> ';
464 464
 							$bullet_colors[] = $event_color;
465 465
 						} else {
466 466
 							$bullet_colors[] = '#000';
467 467
 						}
468 468
 
469 469
 						// Event contents.
470
-						$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . ' itemscope itemtype="http://schema.org/Event">' . "\n";
471
-						$list_events .= "\t\t" . '<span class="simcal-event-title">' . $bullet . $title . '</span>' . "\n";
472
-						$list_events .= "\t\t" . '<div class="simcal-event-details simcal-tooltip-content" style="display: none;">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
473
-						$list_events .= "\t" . '</li>' . "\n";
470
+						$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.' itemscope itemtype="http://schema.org/Event">'."\n";
471
+						$list_events .= "\t\t".'<span class="simcal-event-title">'.$bullet.$title.'</span>'."\n";
472
+						$list_events .= "\t\t".'<div class="simcal-event-details simcal-tooltip-content" style="display: none;">'.$calendar->get_event_html($event).'</div>'."\n";
473
+						$list_events .= "\t".'</li>'."\n";
474 474
 
475
-						$count ++;
475
+						$count++;
476 476
 
477 477
 					endif;
478 478
 
479 479
 				endforeach;
480 480
 
481
-				if ( ( $current_min <= $now ) && ( $current_max >= $now ) ) {
481
+				if (($current_min <= $now) && ($current_max >= $now)) {
482 482
 					$day_classes .= ' simcal-today-has-events';
483 483
 				}
484
-				$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
484
+				$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
485 485
 
486
-				if ( $calendar_classes ) {
487
-					$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
486
+				if ($calendar_classes) {
487
+					$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
488 488
 				}
489 489
 
490
-				$list_events .= '</ul>' . "\n";
490
+				$list_events .= '</ul>'."\n";
491 491
 
492 492
 				// Optional button to toggle hidden events in list.
493
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
493
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
494 494
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
495 495
 				endif;
496 496
 
@@ -502,49 +502,49 @@  discard block
 block discarded – undo
502 502
 			endif;
503 503
 
504 504
 			// The actual days with numbers and events in each row cell.
505
-			echo '<td class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
506
-
507
-			if ( $color ) {
508
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
509
-			} elseif ( $count > 0 ) {
510
-				$the_color = new Color( $calendar->days_events_color );
511
-				$color = ! $color ? ( $the_color->isDark() ? '#ffffff' : '#000000' ) : $color;
512
-				$bg_color = ! $bg_color ? '#' . $the_color->getHex() : $bg_color;
513
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
505
+			echo '<td class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
506
+
507
+			if ($color) {
508
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
509
+			} elseif ($count > 0) {
510
+				$the_color = new Color($calendar->days_events_color);
511
+				$color = ! $color ? ($the_color->isDark() ? '#ffffff' : '#000000') : $color;
512
+				$bg_color = ! $bg_color ? '#'.$the_color->getHex() : $bg_color;
513
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
514 514
 			} else {
515 515
 				$day_style = '';
516 516
 			}
517 517
 
518
-			echo "\t" . '<div' . $border_style . '>' . "\n";
519
-			echo "\t\t" . '<span class="simcal-day-label simcal-day-number"' . $day_style . '>' . $day . '</span>' . "\n";
520
-			echo "\t\t" . $list_events . "\n";
518
+			echo "\t".'<div'.$border_style.'>'."\n";
519
+			echo "\t\t".'<span class="simcal-day-label simcal-day-number"'.$day_style.'>'.$day.'</span>'."\n";
520
+			echo "\t\t".$list_events."\n";
521 521
 			echo "\t\t";
522 522
 			echo '<span class="simcal-events-dots" style="display: none;">';
523 523
 
524 524
 			// Event bullets for calendar mobile mode.
525
-			for( $i = 0; $i < $count; $i++ ) {
526
-				echo '<b style="color: ' . $bullet_colors[ $i ] . ';"> &bull; </b>';
525
+			for ($i = 0; $i < $count; $i++) {
526
+				echo '<b style="color: '.$bullet_colors[$i].';"> &bull; </b>';
527 527
 			}
528 528
 
529
-			echo '</span>' . "\n";
530
-			echo "\t" . '</div>' . "\n";
531
-			echo '</td>' . "\n";
529
+			echo '</span>'."\n";
530
+			echo "\t".'</div>'."\n";
531
+			echo '</td>'."\n";
532 532
 
533 533
 			// Reset day of the week count (sun, 0 - sat, 6).
534
-			if ( $week_day === 6 ) {
534
+			if ($week_day === 6) {
535 535
 				$week_day = - 1;
536 536
 			}
537 537
 			$week_day++;
538 538
 
539 539
 			// Reset count of days for this row (0-6).
540
-			if ( $days_in_row === 6 ) :
540
+			if ($days_in_row === 6) :
541 541
 
542 542
 				// Close the week row.
543 543
 				echo '</tr>';
544 544
 
545 545
 				// Open a new week row.
546
-				if ( $day < $days_in_month ) {
547
-					echo '<tr class="simcal-week simcal-week-' . $week_of_year++ . '">' . "\n";
546
+				if ($day < $days_in_month) {
547
+					echo '<tr class="simcal-week simcal-week-'.$week_of_year++.'">'."\n";
548 548
 				}
549 549
 
550 550
 				$days_in_row = -1;
@@ -553,27 +553,27 @@  discard block
 block discarded – undo
553 553
 
554 554
 			$days_in_row++;
555 555
 
556
-			$current_min = Carbon::createFromTimestamp( $current_min, $calendar->timezone )->addDay()->getTimestamp();
557
-			$current_max = Carbon::createFromTimestamp( $current_max, $calendar->timezone )->addDay()->getTimestamp();
556
+			$current_min = Carbon::createFromTimestamp($current_min, $calendar->timezone)->addDay()->getTimestamp();
557
+			$current_max = Carbon::createFromTimestamp($current_max, $calendar->timezone)->addDay()->getTimestamp();
558 558
 
559 559
 		endfor;
560 560
 
561 561
 		// Void days at the end of the month.
562
-		$remainder_days = ( 6 - $days_in_row );
562
+		$remainder_days = (6 - $days_in_row);
563 563
 
564
-		for ( $i = 0; $i <= $remainder_days; $i ++ ) {
564
+		for ($i = 0; $i <= $remainder_days; $i++) {
565 565
 
566
-			$last_void_day_class = ( $i == $remainder_days ) ? 'simcal-day-void-last' : '';
566
+			$last_void_day_class = ($i == $remainder_days) ? 'simcal-day-void-last' : '';
567 567
 
568
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
568
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
569 569
 
570 570
 			$week_day++;
571 571
 		}
572 572
 
573
-		echo "\t" . '</tr>' . "\n";
574
-		echo '</tbody>' . "\n";
573
+		echo "\t".'</tr>'."\n";
574
+		echo '</tbody>'."\n";
575 575
 
576
-		date_default_timezone_set( $calendar->site_timezone );
576
+		date_default_timezone_set($calendar->site_timezone);
577 577
 
578 578
 		return ob_get_clean();
579 579
 	}
@@ -585,17 +585,17 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	public function draw_grid_ajax() {
587 587
 
588
-		if ( isset( $_POST['month'] ) && isset( $_POST['year'] ) && isset( $_POST['id'] ) ) {
588
+		if (isset($_POST['month']) && isset($_POST['year']) && isset($_POST['id'])) {
589 589
 
590
-			$month = absint( $_POST['month'] );
591
-			$year  = absint( $_POST['year'] );
592
-			$id    = absint( $_POST['id'] );
590
+			$month = absint($_POST['month']);
591
+			$year  = absint($_POST['year']);
592
+			$id    = absint($_POST['id']);
593 593
 
594
-			wp_send_json_success( $this->draw_month( $month, $year, $id ) );
594
+			wp_send_json_success($this->draw_month($month, $year, $id));
595 595
 
596 596
 		} else {
597 597
 
598
-			wp_send_json_error( 'Missing arguments in default calendar grid ajax request.' );
598
+			wp_send_json_error('Missing arguments in default calendar grid ajax request.');
599 599
 
600 600
 		}
601 601
 
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 	 *
612 612
 	 * @return bool
613 613
 	 */
614
-	private function filter_events_before( $event ) {
615
-		return intval( $event ) >= intval( $this->start );
614
+	private function filter_events_before($event) {
615
+		return intval($event) >= intval($this->start);
616 616
 	}
617 617
 
618 618
 	/**
@@ -625,8 +625,8 @@  discard block
 block discarded – undo
625 625
 	 *
626 626
 	 * @return bool
627 627
 	 */
628
-	private function filter_events_after( $event ) {
629
-		return intval( $event ) < intval( $this->end );
628
+	private function filter_events_after($event) {
629
+		return intval($event) < intval($this->end);
630 630
 	}
631 631
 
632 632
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
 	 *
74 74
 	 * @since 3.0.0
75 75
 	 *
76
-	 * @param string|Calendar $calendar
76
+	 * @param Default_Calendar $calendar
77 77
 	 */
78 78
 	public function __construct( $calendar = '' ) {
79 79
 		$this->calendar = $calendar;
Please login to merge, or discard this patch.
includes/calendars/views/default-calendar-list.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -576,9 +576,11 @@
 block discarded – undo
576 576
 
577 577
 			endforeach;
578 578
 
579
-		else :
579
+		else {
580
+			:
580 581
 
581 582
 			echo "\t" . '<p>';
583
+		}
582 584
 
583 585
 			$message = get_post_meta( $calendar->id, '_no_events_message', true );
584 586
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
 	 *
74 74
 	 * @since 3.0.0
75 75
 	 *
76
-	 * @param string|Calendar $calendar
76
+	 * @param Default_Calendar $calendar
77 77
 	 */
78 78
 	public function __construct( $calendar = '' ) {
79 79
 		$this->calendar = $calendar;
Please login to merge, or discard this patch.
Spacing   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Calendars\Default_Calendar;
14 14
 use SimpleCalendar\Events\Event;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @param string|Calendar $calendar
77 77
 	 */
78
-	public function __construct( $calendar = '' ) {
78
+	public function __construct($calendar = '') {
79 79
 		$this->calendar = $calendar;
80 80
 	}
81 81
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return string
110 110
 	 */
111 111
 	public function get_name() {
112
-		return __( 'List', 'google-calendar-events' );
112
+		return __('List', 'google-calendar-events');
113 113
 	}
114 114
 
115 115
 	/**
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * @since 3.0.0
119 119
 	 */
120 120
 	public function add_ajax_actions() {
121
-		add_action( 'wp_ajax_simcal_default_calendar_draw_list', array( $this, 'draw_list_ajax' ) );
122
-		add_action( 'wp_ajax_nopriv_simcal_default_calendar_draw_list', array( $this, 'draw_list_ajax' ) );
121
+		add_action('wp_ajax_simcal_default_calendar_draw_list', array($this, 'draw_list_ajax'));
122
+		add_action('wp_ajax_nopriv_simcal_default_calendar_draw_list', array($this, 'draw_list_ajax'));
123 123
 	}
124 124
 
125 125
 	/**
@@ -133,16 +133,16 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return array
135 135
 	 */
136
-	public function scripts( $min = '' ) {
136
+	public function scripts($min = '') {
137 137
 		return array(
138 138
 			'simcal-qtip' => array(
139
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/qtip' . $min . '.js',
140
-				'deps'      => array( 'jquery' ),
139
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/qtip'.$min.'.js',
140
+				'deps'      => array('jquery'),
141 141
 				'ver'       => '2.2.1',
142 142
 				'in_footer' => true,
143 143
 			),
144 144
 			'simcal-default-calendar' => array(
145
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
145
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
146 146
 				'deps'      => array(
147 147
 					'jquery',
148 148
 					'simcal-qtip',
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return array
169 169
 	 */
170
-	public function styles( $min = '' ) {
170
+	public function styles($min = '') {
171 171
 		return array(
172 172
 			'simcal-default-calendar-list' => array(
173
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
173
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
174 174
 				'ver'   => SIMPLE_CALENDAR_VERSION,
175 175
 				'media' => 'all',
176 176
 			),
@@ -186,49 +186,49 @@  discard block
 block discarded – undo
186 186
 
187 187
 		$calendar = $this->calendar;
188 188
 
189
-		if ( $calendar instanceof Default_Calendar ) {
189
+		if ($calendar instanceof Default_Calendar) {
190 190
 
191
-			$disabled = $calendar->static === true || empty( $calendar->events ) ? ' disabled="disabled"' : '';
191
+			$disabled = $calendar->static === true || empty($calendar->events) ? ' disabled="disabled"' : '';
192 192
 
193 193
 
194
-			$hide_header = get_post_meta( $this->calendar->id, '_default_calendar_list_header', true ) == 'yes' ? true : false;
195
-			$static_calendar = get_post_meta( $this->calendar->id, '_calendar_is_static', true ) == 'yes' ? true : false;
194
+			$hide_header = get_post_meta($this->calendar->id, '_default_calendar_list_header', true) == 'yes' ? true : false;
195
+			$static_calendar = get_post_meta($this->calendar->id, '_calendar_is_static', true) == 'yes' ? true : false;
196 196
 
197 197
 			$header_class = '';
198 198
 			$compact_list_class = $calendar->compact_list ? 'simcal-calendar-list-compact' : '';
199 199
 
200
-			edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id );
200
+			edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id);
201 201
 
202
-			echo '<div class="simcal-calendar-list ' . $compact_list_class . '">';
202
+			echo '<div class="simcal-calendar-list '.$compact_list_class.'">';
203 203
 
204
-			if ( ! $hide_header && ! $static_calendar ) {
205
-				echo '<nav class="simcal-calendar-head">' . "\n";
204
+			if ( ! $hide_header && ! $static_calendar) {
205
+				echo '<nav class="simcal-calendar-head">'."\n";
206 206
 
207
-				echo "\t" . '<div class="simcal-nav">' . "\n";
208
-				echo "\t\t" . '<button class="simcal-nav-button simcal-prev" title="' . __('Previous', 'google-calendar-events') . '"' . $disabled . '>' . "\n";
209
-				echo "\t\t\t" . '<i class="simcal-icon-left"></i>' . "\n";
210
-				echo "\t\t" . '</button>' . "\n";
211
-				echo "\t" . '</div>' . "\n";
207
+				echo "\t".'<div class="simcal-nav">'."\n";
208
+				echo "\t\t".'<button class="simcal-nav-button simcal-prev" title="'.__('Previous', 'google-calendar-events').'"'.$disabled.'>'."\n";
209
+				echo "\t\t\t".'<i class="simcal-icon-left"></i>'."\n";
210
+				echo "\t\t".'</button>'."\n";
211
+				echo "\t".'</div>'."\n";
212 212
 
213
-				if ( $hide_header ) {
213
+				if ($hide_header) {
214 214
 					$header_class = 'simcal-hide-header';
215 215
 				}
216 216
 
217 217
 
218
-				echo "\t" . '<div class="simcal-nav simcal-current ' . $header_class . '" data-calendar-current="' . $calendar->start . '">' . "\n";
219
-				echo "\t\t" . '<h3 class="simcal-current-label"> </h3>' . "\n";
220
-				echo "\t" . '</div>' . "\n";
218
+				echo "\t".'<div class="simcal-nav simcal-current '.$header_class.'" data-calendar-current="'.$calendar->start.'">'."\n";
219
+				echo "\t\t".'<h3 class="simcal-current-label"> </h3>'."\n";
220
+				echo "\t".'</div>'."\n";
221 221
 
222
-				echo "\t" . '<div class="simcal-nav">';
223
-				echo "\t\t" . '<button class="simcal-nav-button simcal-next" title="' . __('Next', 'google-calendar-events') . '"' . $disabled . '>';
224
-				echo "\t\t\t" . '<i class="simcal-icon-right"></i>' . "\n";
225
-				echo "\t\t" . '</button>' . "\n";
226
-				echo "\t" . '</div>' . "\n";
222
+				echo "\t".'<div class="simcal-nav">';
223
+				echo "\t\t".'<button class="simcal-nav-button simcal-next" title="'.__('Next', 'google-calendar-events').'"'.$disabled.'>';
224
+				echo "\t\t\t".'<i class="simcal-icon-right"></i>'."\n";
225
+				echo "\t\t".'</button>'."\n";
226
+				echo "\t".'</div>'."\n";
227 227
 
228
-				echo '</nav>' . "\n";
228
+				echo '</nav>'."\n";
229 229
 			}
230 230
 
231
-			echo $this->draw_list( $calendar->start );
231
+			echo $this->draw_list($calendar->start);
232 232
 
233 233
 			echo '<div class="simcal-ajax-loader simcal-spinner-top" style="display: none;"><i class="simcal-icon-spinner simcal-icon-spin"></i></div>';
234 234
 
@@ -248,99 +248,99 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @return array
250 250
 	 */
251
-	private function get_events( $timestamp ) {
251
+	private function get_events($timestamp) {
252 252
 
253 253
 		$calendar = $this->calendar;
254 254
 		$timezone = $calendar->timezone;
255 255
 
256
-		if ( ! $calendar->group_type || ! $calendar->group_span ) {
256
+		if ( ! $calendar->group_type || ! $calendar->group_span) {
257 257
 			return array();
258 258
 		}
259 259
 
260
-		$current = Carbon::createFromTimestamp( $timestamp, $timezone );
260
+		$current = Carbon::createFromTimestamp($timestamp, $timezone);
261 261
 		$prev = clone $current;
262 262
 		$next = clone $current;
263 263
 
264 264
 		$this->start = $current->getTimestamp();
265 265
 
266
-		$interval = $span = max( absint( $calendar->group_span ), 1 );
267
-
268
-		if ( 'monthly' == $calendar->group_type ) {
269
-			$this->prev = $prev->subMonths( $span )->getTimestamp();
270
-			$this->next = $next->addMonths( $span )->getTimestamp();
271
-		} elseif ( 'weekly' == $calendar->group_type ) {
272
-			$week = new Carbon( $calendar->timezone );
273
-			$week->setTimestamp( $timestamp );
274
-			$week->setWeekStartsAt( $calendar->week_starts );
275
-			$this->prev = $prev->subWeeks( $span )->getTimestamp();
276
-			$this->next = $next->addWeeks( $span )->getTimestamp();
277
-		} elseif ( 'daily' == $calendar->group_type ) {
278
-			$this->prev = $prev->subDays( $span )->getTimestamp();
279
-			$this->next = $next->addDays( $span )->getTimestamp();
266
+		$interval = $span = max(absint($calendar->group_span), 1);
267
+
268
+		if ('monthly' == $calendar->group_type) {
269
+			$this->prev = $prev->subMonths($span)->getTimestamp();
270
+			$this->next = $next->addMonths($span)->getTimestamp();
271
+		} elseif ('weekly' == $calendar->group_type) {
272
+			$week = new Carbon($calendar->timezone);
273
+			$week->setTimestamp($timestamp);
274
+			$week->setWeekStartsAt($calendar->week_starts);
275
+			$this->prev = $prev->subWeeks($span)->getTimestamp();
276
+			$this->next = $next->addWeeks($span)->getTimestamp();
277
+		} elseif ('daily' == $calendar->group_type) {
278
+			$this->prev = $prev->subDays($span)->getTimestamp();
279
+			$this->next = $next->addDays($span)->getTimestamp();
280 280
 		}
281 281
 
282 282
 		$events = $calendar->events;
283 283
 		$daily_events = $paged_events = $flattened_events = array();
284 284
 
285
-		if ( 'events' != $calendar->group_type ) {
285
+		if ('events' != $calendar->group_type) {
286 286
 
287
-			$this->end   = $this->next - 1;
287
+			$this->end = $this->next - 1;
288 288
 
289
-			$timestamps   = array_keys( $events );
290
-			$lower_bound  = array_filter( $timestamps,  array( $this, 'filter_events_before' ) );
291
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after'  ) );
289
+			$timestamps   = array_keys($events);
290
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
291
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
292 292
 
293
-			if ( is_array( $higher_bound ) && !empty( $higher_bound ) ) {
294
-				$filtered = array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) );
295
-				foreach ( $filtered as $timestamp => $events ) {
296
-					$paged_events[ intval( $timestamp ) ] = $events;
293
+			if (is_array($higher_bound) && ! empty($higher_bound)) {
294
+				$filtered = array_intersect_key($events, array_combine($higher_bound, $higher_bound));
295
+				foreach ($filtered as $timestamp => $events) {
296
+					$paged_events[intval($timestamp)] = $events;
297 297
 				}
298 298
 			}
299 299
 
300 300
 		} else {
301 301
 
302
-			foreach ( $events as $timestamp => $e ) {
302
+			foreach ($events as $timestamp => $e) {
303 303
 				$second = 0;
304
-				foreach ( $e as $event ) {
305
-					$flattened_events[ intval( $timestamp + $second ) ][] = $event;
304
+				foreach ($e as $event) {
305
+					$flattened_events[intval($timestamp + $second)][] = $event;
306 306
 					$second++;
307 307
 				}
308 308
 			}
309
-			ksort( $flattened_events, SORT_NUMERIC );
309
+			ksort($flattened_events, SORT_NUMERIC);
310 310
 
311
-			$keys  = array_keys( $flattened_events );
311
+			$keys = array_keys($flattened_events);
312 312
 			$current = 0;
313
-			foreach ( $keys as $timestamp ) {
314
-				if ( $timestamp < $this->start ) {
313
+			foreach ($keys as $timestamp) {
314
+				if ($timestamp < $this->start) {
315 315
 					$current++;
316 316
 				}
317 317
 			}
318 318
 
319
-			$paged_events = array_slice( $flattened_events, $current, $interval, true );
319
+			$paged_events = array_slice($flattened_events, $current, $interval, true);
320 320
 
321
-			$events_end = isset( $keys[ $current + $interval ] ) ? $keys[ $current + $interval ] : $calendar->end;
321
+			$events_end = isset($keys[$current + $interval]) ? $keys[$current + $interval] : $calendar->end;
322 322
 			$this->end  = $events_end > $calendar->end ? $calendar->end : $events_end;
323 323
 
324
-			$this->prev = isset( $keys[ $current - $interval ] ) ? $keys[ $current - $interval ] : $calendar->earliest_event;
325
-			$this->next = isset( $keys[ $current + $interval ] ) ? $keys[ $current + $interval ] : $this->end;
324
+			$this->prev = isset($keys[$current - $interval]) ? $keys[$current - $interval] : $calendar->earliest_event;
325
+			$this->next = isset($keys[$current + $interval]) ? $keys[$current + $interval] : $this->end;
326 326
 
327 327
 		}
328 328
 
329 329
 		// Put resulting events in an associative array, with Ymd date as key for easy retrieval in calendar days loop.
330
-		foreach ( $paged_events as $timestamp => $events ) {
331
-			if ( $timestamp <= $this->end ) {
332
-				$date = Carbon::createFromTimestamp( $timestamp, $calendar->timezone )->endOfDay()->format( 'Ymd' );
333
-				$daily_events[ intval( $date ) ][] = $events;
330
+		foreach ($paged_events as $timestamp => $events) {
331
+			if ($timestamp <= $this->end) {
332
+				$date = Carbon::createFromTimestamp($timestamp, $calendar->timezone)->endOfDay()->format('Ymd');
333
+				$daily_events[intval($date)][] = $events;
334 334
 			}
335 335
 		}
336
-		ksort( $daily_events, SORT_NUMERIC );
336
+		ksort($daily_events, SORT_NUMERIC);
337 337
 
338
-		if ( ! empty( $paged_events ) ) {
339
-			$first_event       = array_slice( $paged_events, 0, 1, true );
340
-			$first_event       = array_pop( $first_event );
338
+		if ( ! empty($paged_events)) {
339
+			$first_event       = array_slice($paged_events, 0, 1, true);
340
+			$first_event       = array_pop($first_event);
341 341
 			$this->first_event = $first_event[0]->start;
342 342
 
343
-			$last_event       = array_pop( $paged_events );
343
+			$last_event       = array_pop($paged_events);
344 344
 			$this->last_event = $last_event[0]->start;
345 345
 		}
346 346
 
@@ -360,84 +360,84 @@  discard block
 block discarded – undo
360 360
 	private function get_heading() {
361 361
 
362 362
 		$calendar = $this->calendar;
363
-		$start = Carbon::createFromTimestamp( $calendar->start, $calendar->timezone );
364
-		$end = Carbon::createFromTimestamp( $this->end, $calendar->timezone );
363
+		$start = Carbon::createFromTimestamp($calendar->start, $calendar->timezone);
364
+		$end = Carbon::createFromTimestamp($this->end, $calendar->timezone);
365 365
 		$date_format = $this->calendar->date_format;
366
-		$date_order  = simcal_get_date_format_order( $date_format );
366
+		$date_order  = simcal_get_date_format_order($date_format);
367 367
 
368 368
 		$st = $this->start;
369 369
 		$et = $this->end;
370 370
 
371
-		if ( $this->first_event !== 0 ) {
372
-			$start = Carbon::createFromTimestamp( $this->first_event, $calendar->timezone );
371
+		if ($this->first_event !== 0) {
372
+			$start = Carbon::createFromTimestamp($this->first_event, $calendar->timezone);
373 373
 			$st = $this->first_event;
374 374
 		}
375 375
 
376
-		if ( $this->last_event !== 0 ) {
377
-			$end = Carbon::createFromTimestamp( $this->last_event, $calendar->timezone );
376
+		if ($this->last_event !== 0) {
377
+			$end = Carbon::createFromTimestamp($this->last_event, $calendar->timezone);
378 378
 			$et = $this->last_event;
379 379
 		}
380 380
 
381
-		if ( ( $start->day == $end->day ) && ( $start->month == $end->month ) && ( $start->year == $end->year ) ) {
381
+		if (($start->day == $end->day) && ($start->month == $end->month) && ($start->year == $end->year)) {
382 382
 			// Start and end on the same day.
383 383
 			// e.g. 1 February 2020
384
-			$large = $small = date_i18n( $calendar->date_format , $st );
385
-			if ( ( $date_order['d'] !== false ) && ( $date_order['m'] !== false ) ) {
386
-				if ( $date_order['m'] > $date_order['d'] ) {
387
-					if ( $date_order['y'] !== false && $date_order['y'] > $date_order['m'] ) {
388
-						$small = date_i18n( 'Y, d M', $st );
384
+			$large = $small = date_i18n($calendar->date_format, $st);
385
+			if (($date_order['d'] !== false) && ($date_order['m'] !== false)) {
386
+				if ($date_order['m'] > $date_order['d']) {
387
+					if ($date_order['y'] !== false && $date_order['y'] > $date_order['m']) {
388
+						$small = date_i18n('Y, d M', $st);
389 389
 					} else {
390
-						$small = date_i18n( 'd M Y', $st );
390
+						$small = date_i18n('d M Y', $st);
391 391
 					}
392 392
 				} else {
393
-					if ( $date_order['y'] !== false && $date_order['y'] > $date_order['m'] ) {
394
-						$small = date_i18n( 'Y, M d', $st );
393
+					if ($date_order['y'] !== false && $date_order['y'] > $date_order['m']) {
394
+						$small = date_i18n('Y, M d', $st);
395 395
 					} else {
396
-						$small = date_i18n( 'M d Y', $st );
396
+						$small = date_i18n('M d Y', $st);
397 397
 					}
398 398
 				}
399 399
 			}
400
-		} elseif ( ( $start->month == $end->month ) && ( $start->year == $end->year ) ) {
400
+		} elseif (($start->month == $end->month) && ($start->year == $end->year)) {
401 401
 			// Start and end days on the same month.
402 402
 			// e.g. August 2020
403
-			if ( $date_order['y'] === false ) {
403
+			if ($date_order['y'] === false) {
404 404
 				// August.
405
-				$large = $small = date_i18n( 'F', $st );
405
+				$large = $small = date_i18n('F', $st);
406 406
 			} else {
407
-				if ( $date_order['y'] < $date_order['m'] ) {
407
+				if ($date_order['y'] < $date_order['m']) {
408 408
 					// 2020 August.
409
-					$large = date_i18n( 'Y F', $st );
410
-					$small = date_i18n( 'Y M', $st );
409
+					$large = date_i18n('Y F', $st);
410
+					$small = date_i18n('Y M', $st);
411 411
 				} else {
412 412
 					// August 2020.
413
-					$large = date_i18n( 'F Y', $st );
414
-					$small = date_i18n( 'M Y', $st );
413
+					$large = date_i18n('F Y', $st);
414
+					$small = date_i18n('M Y', $st);
415 415
 				}
416 416
 			}
417
-		} elseif ( $start->year == $end->year ) {
417
+		} elseif ($start->year == $end->year) {
418 418
 			// Start and end days on months of the same year.
419 419
 			// e.g. August - September 2020
420
-			if ( $date_order['y'] === false ) {
420
+			if ($date_order['y'] === false) {
421 421
 				// August - September.
422
-				$large = date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et );
423
-				$small = date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et );
422
+				$large = date_i18n('F', $st).' - '.date_i18n('F', $et);
423
+				$small = date_i18n('M', $st).' - '.date_i18n('M', $et);
424 424
 			} else {
425
-				if ( $date_order['y'] < $date_order['m'] ) {
425
+				if ($date_order['y'] < $date_order['m']) {
426 426
 					// 2020, August - September.
427
-					$large  = $small = date( 'Y', $st ) . ', ';
428
-					$large .= date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et );
429
-					$small .= date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et );
427
+					$large  = $small = date('Y', $st).', ';
428
+					$large .= date_i18n('F', $st).' - '.date_i18n('F', $et);
429
+					$small .= date_i18n('M', $st).' - '.date_i18n('M', $et);
430 430
 				} else {
431 431
 					// August - September, 2020.
432
-					$large  = date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et ) . ', ';
433
-					$small  = date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et ) . ' ';
434
-					$year   = date( 'Y', $st );
432
+					$large  = date_i18n('F', $st).' - '.date_i18n('F', $et).', ';
433
+					$small  = date_i18n('M', $st).' - '.date_i18n('M', $et).' ';
434
+					$year   = date('Y', $st);
435 435
 					$large .= $year;
436 436
 					$small .= $year;
437 437
 				}
438 438
 			}
439 439
 		} else {
440
-			$large = $small = date( 'Y', $st ) . ' - ' . date( 'Y', $et );
440
+			$large = $small = date('Y', $st).' - '.date('Y', $et);
441 441
 		}
442 442
 
443 443
 		return array(
@@ -459,133 +459,133 @@  discard block
 block discarded – undo
459 459
 	 *
460 460
 	 * @return string
461 461
 	 */
462
-	private function draw_list( $timestamp, $id = 0 ) {
462
+	private function draw_list($timestamp, $id = 0) {
463 463
 
464 464
 		$calendar = $this->calendar;
465 465
 
466
-		if ( empty( $calendar ) ) {
467
-			$calendar = $this->calendar = simcal_get_calendar( intval( $id ) );
468
-			if ( ! $calendar instanceof Default_Calendar ) {
466
+		if (empty($calendar)) {
467
+			$calendar = $this->calendar = simcal_get_calendar(intval($id));
468
+			if ( ! $calendar instanceof Default_Calendar) {
469 469
 				return '';
470 470
 			}
471 471
 		}
472 472
 
473
-		$feed          = simcal_get_feed( $calendar );
474
-		$feed_timezone = get_post_meta( $feed->post_id, '_feed_timezone', true );
473
+		$feed          = simcal_get_feed($calendar);
474
+		$feed_timezone = get_post_meta($feed->post_id, '_feed_timezone', true);
475 475
 
476 476
 		$now = $calendar->now;
477
-		$current_events = $this->get_events( $timestamp );
478
-		$day_format = explode( ' ', $calendar->date_format );
477
+		$current_events = $this->get_events($timestamp);
478
+		$day_format = explode(' ', $calendar->date_format);
479 479
 
480 480
 		ob_start();
481 481
 
482 482
 		// Draw the events.
483 483
 
484
-		$block_tag = $calendar->compact_list && ! empty( $current_events ) ? 'div' : 'dl';
484
+		$block_tag = $calendar->compact_list && ! empty($current_events) ? 'div' : 'dl';
485 485
 
486 486
 		$data_heading = '';
487 487
 		$heading = $this->get_heading();
488
-		foreach ( $heading as $k => $v ) {
489
-			$data_heading .= ' data-heading-' . $k . '="' . $v . '"';
488
+		foreach ($heading as $k => $v) {
489
+			$data_heading .= ' data-heading-'.$k.'="'.$v.'"';
490 490
 		}
491 491
 
492
-		echo '<' . $block_tag . ' class="simcal-events-list-container"' .
493
-			' data-prev="' . $this->prev . '"' .
494
-			' data-next="' . $this->next . '"' .
495
-			$data_heading . '>';
492
+		echo '<'.$block_tag.' class="simcal-events-list-container"'.
493
+			' data-prev="'.$this->prev.'"'.
494
+			' data-next="'.$this->next.'"'.
495
+			$data_heading.'>';
496 496
 
497
-		if ( ! empty( $current_events ) && is_array( $current_events ) ) :
497
+		if ( ! empty($current_events) && is_array($current_events)) :
498 498
 
499
-			foreach ( $current_events as $ymd => $events ) :
499
+			foreach ($current_events as $ymd => $events) :
500 500
 
501 501
 
502 502
 
503 503
 				// This is where we can find out if an event is a multi-day event and if it needs to be shown.
504 504
 				// Since this is for list view we are showing the event on the day viewed if it is part of that day even when
505 505
 				// expand multi-day events are turned off.
506
-				if ( isset( $events[0][0]->multiple_days ) && $events[0][0]->multiple_days > 0 ) {
507
-					if ( 'current_day_only' == get_post_meta($calendar->id, '_default_calendar_expand_multi_day_events', true ) ) {
506
+				if (isset($events[0][0]->multiple_days) && $events[0][0]->multiple_days > 0) {
507
+					if ('current_day_only' == get_post_meta($calendar->id, '_default_calendar_expand_multi_day_events', true)) {
508 508
 
509
-						$year  = substr( $ymd, 0, 4 );
510
-						$month = substr( $ymd, 4, 2 );
511
-						$day   = substr( $ymd, 6, 2 );
509
+						$year  = substr($ymd, 0, 4);
510
+						$month = substr($ymd, 4, 2);
511
+						$day   = substr($ymd, 6, 2);
512 512
 
513
-						$temp_date = Carbon::createFromDate( $year, $month, $day );
513
+						$temp_date = Carbon::createFromDate($year, $month, $day);
514 514
 
515
-						if( ! ( $temp_date < Carbon::now()->endOfDay() ) ) {
515
+						if ( ! ($temp_date < Carbon::now()->endOfDay())) {
516 516
 							continue;
517 517
 						}
518 518
 					}
519 519
 				}
520 520
 
521
-				$day_ts = Carbon::createFromFormat( 'Ymd', $ymd, $calendar->timezone )->startOfDay()->getTimestamp();
521
+				$day_ts = Carbon::createFromFormat('Ymd', $ymd, $calendar->timezone)->startOfDay()->getTimestamp();
522 522
 
523
-				if ( ! $calendar->compact_list ) :
523
+				if ( ! $calendar->compact_list) :
524 524
 
525
-					$date = new Carbon( 'now', $calendar->timezone );
526
-					$date->setLocale( substr( get_locale(), 0, 2 ) );
527
-					$date->setTimestamp( $day_ts );
525
+					$date = new Carbon('now', $calendar->timezone);
526
+					$date->setLocale(substr(get_locale(), 0, 2));
527
+					$date->setTimestamp($day_ts);
528 528
 
529
-					if ( $date->isToday() ) {
530
-						$the_color = new Color( $calendar->today_color );
529
+					if ($date->isToday()) {
530
+						$the_color = new Color($calendar->today_color);
531 531
 					} else {
532
-						$the_color = new Color( $calendar->days_events_color );
532
+						$the_color = new Color($calendar->days_events_color);
533 533
 					}
534 534
 
535
-					$bg_color = '#' . $the_color->getHex();
535
+					$bg_color = '#'.$the_color->getHex();
536 536
 					$color = $the_color->isDark() ? '#ffffff' : '#000000';
537
-					$border_style = ' style="border-bottom: 1px solid ' . $bg_color . ';" ';
538
-					$bg_style = ' style="background-color: ' . $bg_color . '; color: ' . $color . ';"';
537
+					$border_style = ' style="border-bottom: 1px solid '.$bg_color.';" ';
538
+					$bg_style = ' style="background-color: '.$bg_color.'; color: '.$color.';"';
539 539
 
540
-					echo "\t" . '<dt class="simcal-day-label"' . $border_style . '>';
541
-					echo '<span' . $bg_style .'>';
542
-					foreach ( $day_format as $format ) {
543
-						echo $format ? '<span class="simcal-date-format" data-date-format="' . $format . '">' . date_i18n( $format, $day_ts ) . '</span> ' : ' ';
540
+					echo "\t".'<dt class="simcal-day-label"'.$border_style.'>';
541
+					echo '<span'.$bg_style.'>';
542
+					foreach ($day_format as $format) {
543
+						echo $format ? '<span class="simcal-date-format" data-date-format="'.$format.'">'.date_i18n($format, $day_ts).'</span> ' : ' ';
544 544
 					}
545 545
 					echo '</span>';
546
-					echo '</dt>' . "\n";
546
+					echo '</dt>'."\n";
547 547
 
548 548
 				endif;
549 549
 
550
-				$list_events = '<ul class="simcal-events">' . "\n";
550
+				$list_events = '<ul class="simcal-events">'."\n";
551 551
 
552 552
 				$calendar_classes = array();
553
-				$day_classes = 'simcal-weekday-' . date( 'w', $day_ts );
553
+				$day_classes = 'simcal-weekday-'.date('w', $day_ts);
554 554
 
555 555
 				// Is this the present, the past or the future, Doc?
556
-				if ( $timestamp <= $now && $timestamp >= $now ) {
556
+				if ($timestamp <= $now && $timestamp >= $now) {
557 557
 					$day_classes .= ' simcal-today simcal-present simcal-day';
558
-				} elseif ( $timestamp < $now ) {
558
+				} elseif ($timestamp < $now) {
559 559
 					$day_classes .= ' simcal-past simcal-day';
560
-				} elseif ( $this->end > $now ) {
560
+				} elseif ($this->end > $now) {
561 561
 					$day_classes .= ' simcal-future simcal-day';
562 562
 				}
563 563
 
564 564
 				$count = 0;
565 565
 
566
-				foreach ( $events as $day_events ) :
567
-					foreach ( $day_events as $event ) :
566
+				foreach ($events as $day_events) :
567
+					foreach ($day_events as $event) :
568 568
 
569
-						if ( $event instanceof Event ) :
569
+						if ($event instanceof Event) :
570 570
 
571
-							if ( $feed->type == 'grouped-calendars' ) {
572
-								date_default_timezone_set( $feed_timezone );
571
+							if ($feed->type == 'grouped-calendars') {
572
+								date_default_timezone_set($feed_timezone);
573 573
 							} else {
574
-								date_default_timezone_set( $event->timezone );
574
+								date_default_timezone_set($event->timezone);
575 575
 							}
576 576
 
577 577
 							$event_classes = $event_visibility = '';
578 578
 
579
-							$calendar_class     = 'simcal-events-calendar-' . strval( $event->calendar );
579
+							$calendar_class     = 'simcal-events-calendar-'.strval($event->calendar);
580 580
 							$calendar_classes[] = $calendar_class;
581 581
 
582 582
 							$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
583 583
 							$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
584 584
 
585
-							$event_classes .= 'simcal-event ' . $recurring . $has_location . $calendar_class;
585
+							$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class;
586 586
 
587 587
 							// Toggle some events visibility if more than optional limit.
588
-							if ( ( $calendar->events_limit > - 1 ) && ( $count >= $calendar->events_limit ) ) :
588
+							if (($calendar->events_limit > - 1) && ($count >= $calendar->events_limit)) :
589 589
 								$event_classes .= ' simcal-event-toggled';
590 590
 								$event_visibility = ' style="display: none"';
591 591
 							endif;
@@ -593,75 +593,75 @@  discard block
 block discarded – undo
593 593
 							$event_color = '';
594 594
 							$bullet = '';
595 595
 							$event_color = $event->get_color();
596
-							if ( ! empty( $event_color ) ) {
596
+							if ( ! empty($event_color)) {
597 597
 								$side = is_rtl() ? 'right' : 'left';
598
-								$event_color = ' style="border-' . $side . ': 4px solid ' . $event_color . '; padding-' . $side . ': 8px;"';
598
+								$event_color = ' style="border-'.$side.': 4px solid '.$event_color.'; padding-'.$side.': 8px;"';
599 599
 							}
600 600
 
601
-							$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . $event_color . ' itemscope itemtype="http://schema.org/Event" data-start="' . esc_attr( $event->start ) . '">' . "\n";
602
-							$list_events .= "\t\t" . '<div class="simcal-event-details">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
603
-							$list_events .= "\t" . '</li>' . "\n";
601
+							$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.$event_color.' itemscope itemtype="http://schema.org/Event" data-start="'.esc_attr($event->start).'">'."\n";
602
+							$list_events .= "\t\t".'<div class="simcal-event-details">'.$calendar->get_event_html($event).'</div>'."\n";
603
+							$list_events .= "\t".'</li>'."\n";
604 604
 
605
-							$count ++;
605
+							$count++;
606 606
 
607 607
 							// Event falls within today.
608
-							if ( ( $this->end <= $now ) && ( $this->start >= $now ) ) :
608
+							if (($this->end <= $now) && ($this->start >= $now)) :
609 609
 								$day_classes .= ' simcal-today-has-events';
610 610
 							endif;
611
-							$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
611
+							$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
612 612
 
613
-							if ( $calendar_classes ) :
614
-								$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
613
+							if ($calendar_classes) :
614
+								$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
615 615
 							endif;
616 616
 
617 617
 						endif;
618 618
 					endforeach;
619 619
 				endforeach;
620 620
 
621
-				$list_events .= '</ul>' . "\n";
621
+				$list_events .= '</ul>'."\n";
622 622
 
623 623
 				// If events visibility is limited, print the button toggle.
624
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
624
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
625 625
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
626 626
 				endif;
627 627
 
628 628
 				// Print final list of events for the current day.
629 629
 				$tag = $calendar->compact_list ? 'div' : 'dd';
630
-				echo '<'  . $tag . ' class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
631
-				echo "\t" . $list_events . "\n";
632
-				echo '</' . $tag . '>' . "\n";
630
+				echo '<'.$tag.' class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
631
+				echo "\t".$list_events."\n";
632
+				echo '</'.$tag.'>'."\n";
633 633
 
634 634
 			endforeach;
635 635
 
636 636
 		else :
637 637
 
638
-			echo "\t" . '<p>';
638
+			echo "\t".'<p>';
639 639
 
640
-			$message = get_post_meta( $calendar->id, '_no_events_message', true );
640
+			$message = get_post_meta($calendar->id, '_no_events_message', true);
641 641
 
642
-			if ( 'events' == $calendar->group_type ) {
643
-				echo ! empty( $message ) ? $message : __( 'There are no upcoming events.', 'google-calendar-events' );
642
+			if ('events' == $calendar->group_type) {
643
+				echo ! empty($message) ? $message : __('There are no upcoming events.', 'google-calendar-events');
644 644
 			} else {
645
-				if ( ! empty( $message ) ) {
645
+				if ( ! empty($message)) {
646 646
 					echo $message;
647 647
 				} else {
648
-					$from = Carbon::createFromTimestamp( $this->start, $calendar->timezone )->getTimestamp();
649
-					$to = Carbon::createFromTimestamp( $this->end, $calendar->timezone )->getTimestamp();
650
-					echo apply_filters( 'simcal_no_events_message', sprintf(
651
-						__( 'Nothing from %1$s to %2$s.', 'google-calendar-events' ),
652
-						date_i18n( $calendar->date_format, $from ),
653
-						date_i18n( $calendar->date_format, $to )
654
-					), $calendar->id, $from, $to );
648
+					$from = Carbon::createFromTimestamp($this->start, $calendar->timezone)->getTimestamp();
649
+					$to = Carbon::createFromTimestamp($this->end, $calendar->timezone)->getTimestamp();
650
+					echo apply_filters('simcal_no_events_message', sprintf(
651
+						__('Nothing from %1$s to %2$s.', 'google-calendar-events'),
652
+						date_i18n($calendar->date_format, $from),
653
+						date_i18n($calendar->date_format, $to)
654
+					), $calendar->id, $from, $to);
655 655
 				}
656 656
 			}
657 657
 
658
-			echo "\t" . '</p>' . "\n";
658
+			echo "\t".'</p>'."\n";
659 659
 
660 660
 		endif;
661 661
 
662
-		echo '</' . $block_tag . '>';
662
+		echo '</'.$block_tag.'>';
663 663
 
664
-		date_default_timezone_set( $calendar->site_timezone );
664
+		date_default_timezone_set($calendar->site_timezone);
665 665
 
666 666
 		return ob_get_clean();
667 667
 	}
@@ -673,16 +673,16 @@  discard block
 block discarded – undo
673 673
 	 */
674 674
 	public function draw_list_ajax() {
675 675
 
676
-		if ( isset( $_POST['ts'] ) && isset( $_POST['id'] ) ) {
676
+		if (isset($_POST['ts']) && isset($_POST['id'])) {
677 677
 
678
-			$ts = absint( $_POST['ts'] );
679
-			$id = absint( $_POST['id'] );
678
+			$ts = absint($_POST['ts']);
679
+			$id = absint($_POST['id']);
680 680
 
681
-			wp_send_json_success( $this->draw_list( $ts, $id ) );
681
+			wp_send_json_success($this->draw_list($ts, $id));
682 682
 
683 683
 		} else {
684 684
 
685
-			wp_send_json_error( 'Missing arguments in default calendar list ajax request.' );
685
+			wp_send_json_error('Missing arguments in default calendar list ajax request.');
686 686
 
687 687
 		}
688 688
 	}
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
 	 *
698 698
 	 * @return bool
699 699
 	 */
700
-	private function filter_events_before( $event ) {
701
-		return intval( $event ) >= intval( $this->start );
700
+	private function filter_events_before($event) {
701
+		return intval($event) >= intval($this->start);
702 702
 	}
703 703
 
704 704
 	/**
@@ -711,8 +711,8 @@  discard block
 block discarded – undo
711 711
 	 *
712 712
 	 * @return bool
713 713
 	 */
714
-	private function filter_events_after( $event ) {
715
-		return intval( $event ) < intval( $this->end );
714
+	private function filter_events_after($event) {
715
+		return intval($event) < intval($this->end);
716 716
 	}
717 717
 
718 718
 }
Please login to merge, or discard this patch.
includes/events/events.php 2 patches
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use Carbon\Carbon;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 * @param array $e Events.
46 46
 	 * @param string|\DateTimeZone $tz Timezone.
47 47
 	 */
48
-	public function __construct( $e = array(), $tz = 'UTC' ) {
49
-		$this->set_events( $e );
50
-		$this->set_timezone( $tz );
48
+	public function __construct($e = array(), $tz = 'UTC') {
49
+		$this->set_events($e);
50
+		$this->set_timezone($tz);
51 51
 	}
52 52
 
53 53
 	/**
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @return array
61 61
 	 */
62
-	public function get_events( $n = '' ) {
63
-		if ( ! empty( $n ) && ! empty( $this->events ) ) {
64
-			$length = absint( $n );
65
-			return array_slice( $this->events, 0, $length, true );
62
+	public function get_events($n = '') {
63
+		if ( ! empty($n) && ! empty($this->events)) {
64
+			$length = absint($n);
65
+			return array_slice($this->events, 0, $length, true);
66 66
 		}
67 67
 		return $this->events;
68 68
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @param array $ev Events.
76 76
 	 */
77
-	public function set_events( array $ev ) {
77
+	public function set_events(array $ev) {
78 78
 		$this->events = $ev;
79 79
 	}
80 80
 
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return Events
89 89
 	 */
90
-	public function set_timezone( $tz ) {
91
-		if ( $tz instanceof \DateTimeZone ) {
90
+	public function set_timezone($tz) {
91
+		if ($tz instanceof \DateTimeZone) {
92 92
 			$tz = $tz->getName();
93 93
 		}
94
-		$this->timezone = simcal_esc_timezone( $tz, $this->timezone );
94
+		$this->timezone = simcal_esc_timezone($tz, $this->timezone);
95 95
 		return $this;
96 96
 	}
97 97
 
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return Events
106 106
 	 */
107
-	public function shift( $n ) {
108
-		if ( ! empty( $this->events ) ) {
109
-			$offset = intval( $n );
110
-			$length = count( $this->events );
111
-			$this->set_events( array_slice( $this->events, $offset, $length, true ) );
107
+	public function shift($n) {
108
+		if ( ! empty($this->events)) {
109
+			$offset = intval($n);
110
+			$length = count($this->events);
111
+			$this->set_events(array_slice($this->events, $offset, $length, true));
112 112
 		}
113 113
 		return $this;
114 114
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @return Events
122 122
 	 */
123 123
 	public function private_only() {
124
-		$this->set_events( $this->filter_property( 'public', 'hide' ) );
124
+		$this->set_events($this->filter_property('public', 'hide'));
125 125
 		return $this;
126 126
 	}
127 127
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return Events
134 134
 	 */
135 135
 	public function public_only() {
136
-		$this->set_events( $this->filter_property( 'public', 'show' ) );
136
+		$this->set_events($this->filter_property('public', 'show'));
137 137
 		return $this;
138 138
 	}
139 139
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return Events
146 146
 	 */
147 147
 	public function recurring() {
148
-		$this->set_events( $this->filter_property( 'recurrence', 'show' ) );
148
+		$this->set_events($this->filter_property('recurrence', 'show'));
149 149
 		return $this;
150 150
 	}
151 151
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return Events
158 158
 	 */
159 159
 	public function not_recurring() {
160
-		$this->set_events( $this->filter_property( 'recurrence', 'hide' ) );
160
+		$this->set_events($this->filter_property('recurrence', 'hide'));
161 161
 		return $this;
162 162
 	}
163 163
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @return Events
170 170
 	 */
171 171
 	public function whole_day() {
172
-		$this->set_events( $this->filter_property( 'whole_day', 'show' ) );
172
+		$this->set_events($this->filter_property('whole_day', 'show'));
173 173
 		return $this;
174 174
 	}
175 175
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @return Events
182 182
 	 */
183 183
 	public function not_whole_day() {
184
-		$this->set_events( $this->filter_property( 'whole_day', 'hide' ) );
184
+		$this->set_events($this->filter_property('whole_day', 'hide'));
185 185
 		return $this;
186 186
 	}
187 187
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @return Events
194 194
 	 */
195 195
 	public function multi_day() {
196
-		$this->set_events( $this->filter_property( 'multiple_days', 'show' ) );
196
+		$this->set_events($this->filter_property('multiple_days', 'show'));
197 197
 		return $this;
198 198
 	}
199 199
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 * @return Events
206 206
 	 */
207 207
 	public function single_day() {
208
-		$this->set_events( $this->filter_property( 'multiple_days', 'hide' ) );
208
+		$this->set_events($this->filter_property('multiple_days', 'hide'));
209 209
 		return $this;
210 210
 	}
211 211
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @return Events
218 218
 	 */
219 219
 	public function with_location() {
220
-		$this->set_events( $this->filter_property( 'venue', 'show' ) );
220
+		$this->set_events($this->filter_property('venue', 'show'));
221 221
 		return $this;
222 222
 	}
223 223
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @return Events
230 230
 	 */
231 231
 	public function without_location() {
232
-		$this->set_events( $this->filter_property( 'venue', 'hide' ) );
232
+		$this->set_events($this->filter_property('venue', 'hide'));
233 233
 		return $this;
234 234
 	}
235 235
 
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @return array
246 246
 	 */
247
-	private function filter_property( $property, $toggle ) {
247
+	private function filter_property($property, $toggle) {
248 248
 		$filtered = array();
249
-		if ( ! empty( $this->events ) ) {
250
-			foreach ( $this->events as $ts => $events ) {
251
-				foreach ( $events as $event ) {
252
-					if ( 'hide' == $toggle ) {
253
-						if ( ! $event->$property ) {
254
-							$filtered[ $ts ][] = $event;
249
+		if ( ! empty($this->events)) {
250
+			foreach ($this->events as $ts => $events) {
251
+				foreach ($events as $event) {
252
+					if ('hide' == $toggle) {
253
+						if ( ! $event->$property) {
254
+							$filtered[$ts][] = $event;
255 255
 						}
256
-					} elseif ( 'show' == $toggle ) {
257
-						if ( $event->$property ) {
258
-							$filtered[ $ts ][] = $event;
256
+					} elseif ('show' == $toggle) {
257
+						if ($event->$property) {
258
+							$filtered[$ts][] = $event;
259 259
 						}
260 260
 					}
261 261
 				}
@@ -273,14 +273,14 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return Events
275 275
 	 */
276
-	public function future( $present = '' ) {
276
+	public function future($present = '') {
277 277
 		$last = $this->get_last();
278 278
 		$to = $last instanceof Event ? $last->start_utc : false;
279
-		if ( $to ) {
280
-			if ( empty( $present ) ) {
281
-				$present = Carbon::now( $this->timezone )->getTimestamp();
279
+		if ($to) {
280
+			if (empty($present)) {
281
+				$present = Carbon::now($this->timezone)->getTimestamp();
282 282
 			}
283
-			$this->set_events( $this->filter_events( intval( $present ), $to ) );
283
+			$this->set_events($this->filter_events(intval($present), $to));
284 284
 		}
285 285
 		return $this;
286 286
 	}
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @return Events
296 296
 	 */
297
-	public function past( $present = '' ) {
297
+	public function past($present = '') {
298 298
 		$first = $this->get_last();
299 299
 		$from  = $first instanceof Event ? $first->start_utc : false;
300
-		if ( $from ) {
301
-			if ( empty( $present ) ) {
302
-				$present = Carbon::now( $this->timezone )->getTimestamp();
300
+		if ($from) {
301
+			if (empty($present)) {
302
+				$present = Carbon::now($this->timezone)->getTimestamp();
303 303
 			}
304
-			$this->set_events( $this->filter_events( $from, intval( $present ) ) );
304
+			$this->set_events($this->filter_events($from, intval($present)));
305 305
 		}
306 306
 		return $this;
307 307
 	}
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @return Events
317 317
 	 */
318
-	public function after( $time ) {
319
-		$dt = $this->parse( $time );
320
-		return ! is_null( $dt ) ? $this->future( $dt->getTimestamp() ) : $this;
318
+	public function after($time) {
319
+		$dt = $this->parse($time);
320
+		return ! is_null($dt) ? $this->future($dt->getTimestamp()) : $this;
321 321
 	}
322 322
 
323 323
 	/**
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 	 *
330 330
 	 * @return Events
331 331
 	 */
332
-	public function before( $time ) {
333
-		$dt = $this->parse( $time );
334
-		return ! is_null( $dt ) ? $this->past( $dt->getTimestamp() ) : $this;
332
+	public function before($time) {
333
+		$dt = $this->parse($time);
334
+		return ! is_null($dt) ? $this->past($dt->getTimestamp()) : $this;
335 335
 	}
336 336
 
337 337
 	/**
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
 	 *
344 344
 	 * @return Events
345 345
 	 */
346
-	public function from( $time ) {
347
-		$last = $this->parse( $time );
348
-		if ( ! is_null( $last ) ) {
349
-			$this->set_events( $this->filter_events( $time, $last->getTimestamp() ) );
346
+	public function from($time) {
347
+		$last = $this->parse($time);
348
+		if ( ! is_null($last)) {
349
+			$this->set_events($this->filter_events($time, $last->getTimestamp()));
350 350
 		}
351 351
 		return $this;
352 352
 	}
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 	 *
361 361
 	 * @return Events
362 362
 	 */
363
-	public function to( $time ) {
364
-		$first = $this->parse( $time );
365
-		if ( ! is_null( $first ) ) {
366
-			$this->set_events( $this->filter_events( $first->getTimestamp(), $time ) );
363
+	public function to($time) {
364
+		$first = $this->parse($time);
365
+		if ( ! is_null($first)) {
366
+			$this->set_events($this->filter_events($first->getTimestamp(), $time));
367 367
 		}
368 368
 		return $this;
369 369
 	}
@@ -377,15 +377,15 @@  discard block
 block discarded – undo
377 377
 	 *
378 378
 	 * @return null|Carbon
379 379
 	 */
380
-	private function parse( $time ) {
381
-		if ( is_int( $time ) ) {
382
-			return Carbon::createFromTimestamp( $time, $this->timezone );
383
-		} elseif ( is_string( $time ) && ! empty( $time ) ) {
384
-			return Carbon::parse( $time, $this->timezone );
385
-		} elseif ( $time instanceof Carbon ) {
386
-			return $time->setTimezone( $this->timezone );
387
-		} elseif ( $time instanceof \DateTime ) {
388
-			return Carbon::instance( $time )->setTimezone( $this->timezone );
380
+	private function parse($time) {
381
+		if (is_int($time)) {
382
+			return Carbon::createFromTimestamp($time, $this->timezone);
383
+		} elseif (is_string($time) && ! empty($time)) {
384
+			return Carbon::parse($time, $this->timezone);
385
+		} elseif ($time instanceof Carbon) {
386
+			return $time->setTimezone($this->timezone);
387
+		} elseif ($time instanceof \DateTime) {
388
+			return Carbon::instance($time)->setTimezone($this->timezone);
389 389
 		}
390 390
 		return null;
391 391
 	}
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 * @return null|Event
399 399
 	 */
400 400
 	public function get_first() {
401
-		return array_shift( $this->events );
401
+		return array_shift($this->events);
402 402
 	}
403 403
 
404 404
 	/**
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 * @return null|Event
410 410
 	 */
411 411
 	public function get_last() {
412
-		return array_pop( $this->events );
412
+		return array_pop($this->events);
413 413
 	}
414 414
 
415 415
 	/**
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	 * @return null|Event
421 421
 	 */
422 422
 	public function get_upcoming() {
423
-		return $this->get_closest( 'future' );
423
+		return $this->get_closest('future');
424 424
 	}
425 425
 
426 426
 	/**
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * @return null|Event
432 432
 	 */
433 433
 	public function get_latest() {
434
-		return $this->get_closest( 'past' );
434
+		return $this->get_closest('past');
435 435
 	}
436 436
 
437 437
 	/**
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
 	 *
445 445
 	 * @return null|Event
446 446
 	 */
447
-	private function get_closest( $dir ) {
448
-		if ( 'future' == $dir ) {
449
-			return array_shift( $this->future()->get_events() );
450
-		} elseif ( 'past' == $dir ) {
451
-			return array_shift( $this->past()->get_events() );
447
+	private function get_closest($dir) {
448
+		if ('future' == $dir) {
449
+			return array_shift($this->future()->get_events());
450
+		} elseif ('past' == $dir) {
451
+			return array_shift($this->past()->get_events());
452 452
 		}
453 453
 		return null;
454 454
 	}
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
 	 *
463 463
 	 * @return array Multidimensional array with month number, week number and Event objects for each weekday.
464 464
 	 */
465
-	public function get_year( $year ) {
466
-		$y = intval( $year );
465
+	public function get_year($year) {
466
+		$y = intval($year);
467 467
 		$months = array();
468
-		for ( $m = 1; $m <= 12; $m++ ) {
469
-			$months[ strval( $m ) ] = $this->get_month( $y, $m );
468
+		for ($m = 1; $m <= 12; $m++) {
469
+			$months[strval($m)] = $this->get_month($y, $m);
470 470
 		}
471 471
 		return $months;
472 472
 	}
@@ -481,16 +481,16 @@  discard block
 block discarded – undo
481 481
 	 *
482 482
 	 * @return array Multidimensional array with week number, day of the week and array of Event objects for each week day.
483 483
 	 */
484
-	public function get_month( $year, $month ) {
485
-		$y = intval( $year );
486
-		$m = min( max( 1, absint( $month ) ), 12 );
487
-		$days  = Carbon::createFromDate( $y, $m, 2, $this->timezone )->startOfMonth()->daysInMonth;
484
+	public function get_month($year, $month) {
485
+		$y = intval($year);
486
+		$m = min(max(1, absint($month)), 12);
487
+		$days  = Carbon::createFromDate($y, $m, 2, $this->timezone)->startOfMonth()->daysInMonth;
488 488
 		$weeks = array();
489
-		for ( $d = 1; $d < $days; $d++ ) {
490
-			$current = Carbon::createFromDate( $y, $m, $d );
489
+		for ($d = 1; $d < $days; $d++) {
490
+			$current = Carbon::createFromDate($y, $m, $d);
491 491
 			$week = $current->weekOfYear;
492 492
 			$day  = $current->dayOfWeek;
493
-			$weeks[ strval( $week ) ][ strval( $day ) ] = $this->get_day( $y, $m, $d );
493
+			$weeks[strval($week)][strval($day)] = $this->get_day($y, $m, $d);
494 494
 		}
495 495
 		return $weeks;
496 496
 	}
@@ -505,16 +505,16 @@  discard block
 block discarded – undo
505 505
 	 *
506 506
 	 * @return array Associative array with day of the week for key and array of Event objects for value.
507 507
 	 */
508
-	public function get_week( $year, $week ) {
509
-		$y = intval( $year );
510
-		$w = absint( $week );
511
-		$m = date( 'n', strtotime( strval( $y ) . '-W' . strval( $w ) ) );
512
-		$month_dt = Carbon::createFromDate( $y, $m, 2, $this->timezone );
508
+	public function get_week($year, $week) {
509
+		$y = intval($year);
510
+		$w = absint($week);
511
+		$m = date('n', strtotime(strval($y).'-W'.strval($w)));
512
+		$month_dt = Carbon::createFromDate($y, $m, 2, $this->timezone);
513 513
 		$days = array();
514
-		for ( $d = 1; $d < $month_dt->daysInMonth; $d++ ) {
515
-			$current = Carbon::createFromDate( $y, $m, $d );
516
-			if ( $w == $current->weekOfYear ) {
517
-				$days[ strval( $current->dayOfWeek ) ] = $this->get_day( $y, $m, $d );
514
+		for ($d = 1; $d < $month_dt->daysInMonth; $d++) {
515
+			$current = Carbon::createFromDate($y, $m, $d);
516
+			if ($w == $current->weekOfYear) {
517
+				$days[strval($current->dayOfWeek)] = $this->get_day($y, $m, $d);
518 518
 			}
519 519
 		}
520 520
 		return $days;
@@ -531,13 +531,13 @@  discard block
 block discarded – undo
531 531
 	 *
532 532
 	 * @return array Event objects for the day.
533 533
 	 */
534
-	public function get_day( $year, $month, $day ) {
535
-		$y = intval( $year );
536
-		$m = min( max( 1, absint( $month ) ), 12 );
537
-		$d = min( absint( $day ), 31 );
538
-		$from = Carbon::createFromDate( $y, $m, $d, $this->timezone )->startOfDay()->getTimestamp();
539
-		$to   = Carbon::createFromDate( $y, $m, $d, $this->timezone )->endOfDay()->getTimestamp();
540
-		return $this->filter_events( $from, $to );
534
+	public function get_day($year, $month, $day) {
535
+		$y = intval($year);
536
+		$m = min(max(1, absint($month)), 12);
537
+		$d = min(absint($day), 31);
538
+		$from = Carbon::createFromDate($y, $m, $d, $this->timezone)->startOfDay()->getTimestamp();
539
+		$to   = Carbon::createFromDate($y, $m, $d, $this->timezone)->endOfDay()->getTimestamp();
540
+		return $this->filter_events($from, $to);
541 541
 	}
542 542
 
543 543
 	/**
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
 	 * @return array Event objects for today.
549 549
 	 */
550 550
 	public function get_today() {
551
-		$start = Carbon::today( $this->timezone )->startOfDay()->getTimestamp();
552
-		$end   = Carbon::today( $this->timezone )->endOfDay()->getTimestamp();
553
-		return $this->filter_events( $start, $end );
551
+		$start = Carbon::today($this->timezone)->startOfDay()->getTimestamp();
552
+		$end   = Carbon::today($this->timezone)->endOfDay()->getTimestamp();
553
+		return $this->filter_events($start, $end);
554 554
 	}
555 555
 
556 556
 	/**
@@ -561,9 +561,9 @@  discard block
 block discarded – undo
561 561
 	 * @return array Event objects for tomorrow.
562 562
 	 */
563 563
 	public function get_tomorrow() {
564
-		$start = Carbon::tomorrow( $this->timezone )->startOfDay()->getTimestamp();
565
-		$end   = Carbon::tomorrow( $this->timezone )->endOfDay()->getTimestamp();
566
-		return $this->filter_events( $start, $end );
564
+		$start = Carbon::tomorrow($this->timezone)->startOfDay()->getTimestamp();
565
+		$end   = Carbon::tomorrow($this->timezone)->endOfDay()->getTimestamp();
566
+		return $this->filter_events($start, $end);
567 567
 	}
568 568
 
569 569
 	/**
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
 	 * @return array Event objects for yesterday.
575 575
 	 */
576 576
 	public function get_yesterday() {
577
-		$start = Carbon::yesterday( $this->timezone )->startOfDay()->getTimestamp();
578
-		$end   = Carbon::yesterday( $this->timezone )->endOfDay()->getTimestamp();
579
-		return $this->filter_events( $start, $end );
577
+		$start = Carbon::yesterday($this->timezone)->startOfDay()->getTimestamp();
578
+		$end   = Carbon::yesterday($this->timezone)->endOfDay()->getTimestamp();
579
+		return $this->filter_events($start, $end);
580 580
 	}
581 581
 
582 582
 	/**
@@ -590,16 +590,16 @@  discard block
 block discarded – undo
590 590
 	 *
591 591
 	 * @return array Filtered array of Event objects.
592 592
 	 */
593
-	private function filter_events( $from, $to ) {
594
-		$timestamps   = array_keys( $this->events );
595
-		$lower_bound  = array_filter( $timestamps,  function( $ts ) use( $from ) {
596
-			return intval( $ts ) > intval( $from );
593
+	private function filter_events($from, $to) {
594
+		$timestamps   = array_keys($this->events);
595
+		$lower_bound  = array_filter($timestamps, function($ts) use($from) {
596
+			return intval($ts) > intval($from);
597 597
 		} );
598
-		$higher_bound = array_filter( $lower_bound, function( $ts ) use( $to ) {
599
-			return intval( $ts ) > intval( $to );
598
+		$higher_bound = array_filter($lower_bound, function($ts) use($to) {
599
+			return intval($ts) > intval($to);
600 600
 		} );
601
-		$filtered = array_combine( $higher_bound, $higher_bound );
602
-		return array_intersect_key( $this->events, $filtered );
601
+		$filtered = array_combine($higher_bound, $higher_bound);
602
+		return array_intersect_key($this->events, $filtered);
603 603
 	}
604 604
 
605 605
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @since 3.0.0
44 44
 	 *
45 45
 	 * @param array $e Events.
46
-	 * @param string|\DateTimeZone $tz Timezone.
46
+	 * @param string $tz Timezone.
47 47
 	 */
48 48
 	public function __construct( $e = array(), $tz = 'UTC' ) {
49 49
 		$this->set_events( $e );
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @since  3.0.0
271 271
 	 *
272
-	 * @param  int|string $present
272
+	 * @param  integer $present
273 273
 	 *
274 274
 	 * @return Events
275 275
 	 */
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @since  3.0.0
292 292
 	 *
293
-	 * @param  int|string $present
293
+	 * @param  integer $present
294 294
 	 *
295 295
 	 * @return Events
296 296
 	 */
Please login to merge, or discard this patch.
includes/functions/deprecated.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @deprecated
9 9
  */
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -16,18 +16,18 @@  discard block
 block discarded – undo
16 16
  * Print a calendar.
17 17
  * @deprecated Use simcal_print_calendar()
18 18
  */
19
-function gce_print_calendar( $feed_ids, $display, $args  ) {
19
+function gce_print_calendar($feed_ids, $display, $args) {
20 20
 
21 21
 	$id = 0;
22 22
 
23
-	if ( is_numeric( $feed_ids ) ) {
24
-		$id = intval( $feed_ids );
25
-	} elseif ( is_array( $feed_ids ) ) {
26
-		$id = isset( $feed_ids[0] ) ? intval( $feed_ids[0] ) : '';
23
+	if (is_numeric($feed_ids)) {
24
+		$id = intval($feed_ids);
25
+	} elseif (is_array($feed_ids)) {
26
+		$id = isset($feed_ids[0]) ? intval($feed_ids[0]) : '';
27 27
 	}
28 28
 
29
-	if ( $id > 0 ) {
30
-		simcal_print_calendar( $id );
29
+	if ($id > 0) {
30
+		simcal_print_calendar($id);
31 31
 	}
32 32
 }
33 33
 
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
  * Convert date from mm/dd/yyyy to unix timestamp.
36 36
  * @deprecated Assumes a US-only time format.
37 37
  */
38
-function gce_date_unix( $date = '' ) {
39
-	if ( empty( $date ) ) {
40
-		$current_time = current_time( 'timestamp' );
41
-		$timestamp = mktime( 0, 0, 0, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );
38
+function gce_date_unix($date = '') {
39
+	if (empty($date)) {
40
+		$current_time = current_time('timestamp');
41
+		$timestamp = mktime(0, 0, 0, date('m', $current_time), date('d', $current_time), date('Y', $current_time));
42 42
 	} else {
43
-		$date = explode( '/', $date );
43
+		$date = explode('/', $date);
44 44
 		$month = $date[0];
45 45
 		$day   = $date[1];
46 46
 		$year  = $date[2];
47
-		$timestamp = mktime( 0, 0, 0, $month, $day, $year );
47
+		$timestamp = mktime(0, 0, 0, $month, $day, $year);
48 48
 	}
49 49
 	return $timestamp;
50 50
 }
Please login to merge, or discard this patch.
includes/installation.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Admin\Pages;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		self::create_terms();
35 35
 		self::create_options();
36 36
 
37
-		do_action( 'simcal_activated' );
37
+		do_action('simcal_activated');
38 38
 	}
39 39
 
40 40
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 		flush_rewrite_rules();
48 48
 
49
-		do_action( 'simcal_deactivated' );
49
+		do_action('simcal_deactivated');
50 50
 	}
51 51
 
52 52
 	/**
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 			)
67 67
 		);
68 68
 
69
-		foreach ( $taxonomies as $taxonomy => $terms ) {
70
-			foreach ( $terms as $term ) {
71
-				if ( ! get_term_by( 'slug', sanitize_title( $term ), $taxonomy ) ) {
72
-					wp_insert_term( $term, $taxonomy );
69
+		foreach ($taxonomies as $taxonomy => $terms) {
70
+			foreach ($terms as $term) {
71
+				if ( ! get_term_by('slug', sanitize_title($term), $taxonomy)) {
72
+					wp_insert_term($term, $taxonomy);
73 73
 				}
74 74
 			}
75 75
 		}
@@ -85,33 +85,33 @@  discard block
 block discarded – undo
85 85
 
86 86
 		$default = '';
87 87
 		$page    = 'settings';
88
-		$settings_pages  = new Pages( $page );
88
+		$settings_pages  = new Pages($page);
89 89
 		$plugin_settings = $settings_pages->get_settings();
90 90
 
91
-		if ( $plugin_settings && is_array( $plugin_settings ) ) {
91
+		if ($plugin_settings && is_array($plugin_settings)) {
92 92
 
93
-			foreach ( $plugin_settings as $id => $settings ) {
93
+			foreach ($plugin_settings as $id => $settings) {
94 94
 
95
-				$group = 'simple-calendar_' . $page . '_' . $id;
95
+				$group = 'simple-calendar_'.$page.'_'.$id;
96 96
 
97
-				if ( isset( $settings['sections'] ) ) {
97
+				if (isset($settings['sections'])) {
98 98
 
99
-					if ( $settings['sections'] && is_array( $settings['sections'] ) ) {
99
+					if ($settings['sections'] && is_array($settings['sections'])) {
100 100
 
101
-						foreach ( $settings['sections'] as $section_id => $section ) {
101
+						foreach ($settings['sections'] as $section_id => $section) {
102 102
 
103
-							if ( isset( $section['fields'] ) ) {
103
+							if (isset($section['fields'])) {
104 104
 
105
-								if ( $section['fields'] && is_array( $section['fields'] ) ) {
105
+								if ($section['fields'] && is_array($section['fields'])) {
106 106
 
107
-									foreach ( $section['fields'] as $key => $field ) {
107
+									foreach ($section['fields'] as $key => $field) {
108 108
 
109
-										if ( isset ( $field['type'] ) ) {
109
+										if (isset ($field['type'])) {
110 110
 											// Maybe an associative array.
111
-											if ( is_int( $key ) ) {
112
-												$default[ $section_id ] = self::get_field_default_value( $field );
111
+											if (is_int($key)) {
112
+												$default[$section_id] = self::get_field_default_value($field);
113 113
 											} else {
114
-												$default[ $section_id ][ $key ] = self::get_field_default_value( $field );
114
+												$default[$section_id][$key] = self::get_field_default_value($field);
115 115
 											}
116 116
 										}
117 117
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
 				} // Are there sections?
129 129
 
130
-				add_option( $group, $default, '', true );
130
+				add_option($group, $default, '', true);
131 131
 
132 132
 				// Reset before looping next settings page.
133 133
 				$default = '';
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @return mixed
149 149
 	 */
150
-	private static function get_field_default_value( $field ) {
150
+	private static function get_field_default_value($field) {
151 151
 
152
-		$saved_value   = isset( $field['value'] )   ? $field['value']   : '';
153
-		$default_value = isset( $field['default'] ) ? $field['default'] : '';
152
+		$saved_value   = isset($field['value']) ? $field['value'] : '';
153
+		$default_value = isset($field['default']) ? $field['default'] : '';
154 154
 
155
-		return ! empty( $saved_value ) ? $saved_value : $default_value;
155
+		return ! empty($saved_value) ? $saved_value : $default_value;
156 156
 	}
157 157
 
158 158
 }
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function __construct() {
28 28
 		// Register custom taxonomies.
29
-		add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 5 );
29
+		add_action('init', array(__CLASS__, 'register_taxonomies'), 5);
30 30
 		// Register custom post types.
31
-		add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 );
31
+		add_action('init', array(__CLASS__, 'register_post_types'), 5);
32 32
 		// Filter the calendar feed post content to display a calendar view.
33
-		add_filter( 'the_content', array( $this, 'filter_post_content' ), 100 );
33
+		add_filter('the_content', array($this, 'filter_post_content'), 100);
34 34
 		// Delete calendar transients and notices upon post deletion.
35
-		add_action( 'before_delete_post', array( $this, 'upon_deletion' ), 10, 1 );
35
+		add_action('before_delete_post', array($this, 'upon_deletion'), 10, 1);
36 36
 	}
37 37
 
38 38
 	/**
@@ -42,32 +42,32 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public static function register_taxonomies() {
44 44
 
45
-		do_action( 'simcal_register_taxonomies' );
45
+		do_action('simcal_register_taxonomies');
46 46
 
47
-		if ( ! taxonomy_exists( 'calendar_feed' ) ) {
47
+		if ( ! taxonomy_exists('calendar_feed')) {
48 48
 
49 49
 			// Feed Type.
50 50
 			$labels = array(
51
-				'name'                       => __( 'Events Source Types', 'google-calendar-events' ),
52
-				'singular_name'              => __( 'Events Source Type', 'google-calendar-events' ),
53
-				'menu_name'                  => __( 'Events Source Type', 'google-calendar-events' ),
54
-				'all_items'                  => __( 'All Events Source Types', 'google-calendar-events' ),
55
-				'parent_item'                => __( 'Parent Events Source Type', 'google-calendar-events' ),
56
-				'parent_item_colon'          => __( 'Parent Events Source Type:', 'google-calendar-events' ),
57
-				'new_item_name'              => __( 'New Events Source Type', 'google-calendar-events' ),
58
-				'add_new_item'               => __( 'Add New Events Source Type', 'google-calendar-events' ),
59
-				'edit_item'                  => __( 'Edit Events Source Type', 'google-calendar-events' ),
60
-				'update_item'                => __( 'Update Events Source Type', 'google-calendar-events' ),
61
-				'view_item'                  => __( 'View Events Source Type', 'google-calendar-events' ),
62
-				'separate_items_with_commas' => __( 'Separate events source types with commas', 'google-calendar-events' ),
63
-				'add_or_remove_items'        => __( 'Add or remove events source types', 'google-calendar-events' ),
64
-				'choose_from_most_used'      => __( 'Choose from the most used', 'google-calendar-events' ),
65
-				'popular_items'              => __( 'Popular events source types', 'google-calendar-events' ),
66
-				'search_items'               => __( 'Search Events Source Types', 'google-calendar-events' ),
67
-				'not_found'                  => __( 'Not Found', 'google-calendar-events' ),
51
+				'name'                       => __('Events Source Types', 'google-calendar-events'),
52
+				'singular_name'              => __('Events Source Type', 'google-calendar-events'),
53
+				'menu_name'                  => __('Events Source Type', 'google-calendar-events'),
54
+				'all_items'                  => __('All Events Source Types', 'google-calendar-events'),
55
+				'parent_item'                => __('Parent Events Source Type', 'google-calendar-events'),
56
+				'parent_item_colon'          => __('Parent Events Source Type:', 'google-calendar-events'),
57
+				'new_item_name'              => __('New Events Source Type', 'google-calendar-events'),
58
+				'add_new_item'               => __('Add New Events Source Type', 'google-calendar-events'),
59
+				'edit_item'                  => __('Edit Events Source Type', 'google-calendar-events'),
60
+				'update_item'                => __('Update Events Source Type', 'google-calendar-events'),
61
+				'view_item'                  => __('View Events Source Type', 'google-calendar-events'),
62
+				'separate_items_with_commas' => __('Separate events source types with commas', 'google-calendar-events'),
63
+				'add_or_remove_items'        => __('Add or remove events source types', 'google-calendar-events'),
64
+				'choose_from_most_used'      => __('Choose from the most used', 'google-calendar-events'),
65
+				'popular_items'              => __('Popular events source types', 'google-calendar-events'),
66
+				'search_items'               => __('Search Events Source Types', 'google-calendar-events'),
67
+				'not_found'                  => __('Not Found', 'google-calendar-events'),
68 68
 			);
69 69
 
70
-			$args   = array(
70
+			$args = array(
71 71
 				'hierarchical'      => true,
72 72
 				'labels'            => $labels,
73 73
 				'public'            => false,
@@ -76,34 +76,34 @@  discard block
 block discarded – undo
76 76
 				'show_tagcloud'     => false,
77 77
 				'show_ui'           => false,
78 78
 			);
79
-			register_taxonomy( 'calendar_feed', array( 'calendar' ), $args );
79
+			register_taxonomy('calendar_feed', array('calendar'), $args);
80 80
 
81 81
 		}
82 82
 
83
-		if ( ! taxonomy_exists( 'calendar_type' ) ) {
83
+		if ( ! taxonomy_exists('calendar_type')) {
84 84
 
85 85
 			// Calendar Type.
86 86
 			$labels = array(
87
-				'name'                       => __( 'Calendar Types', 'google-calendar-events' ),
88
-				'singular_name'              => __( 'Calendar Type', 'google-calendar-events' ),
89
-				'menu_name'                  => __( 'Calendar Type', 'google-calendar-events' ),
90
-				'all_items'                  => __( 'All Calendar Types', 'google-calendar-events' ),
91
-				'parent_item'                => __( 'Parent Calendar Type', 'google-calendar-events' ),
92
-				'parent_item_colon'          => __( 'Parent Calendar Type:', 'google-calendar-events' ),
93
-				'new_item_name'              => __( 'New Calendar Type', 'google-calendar-events' ),
94
-				'add_new_item'               => __( 'Add New Calendar Type', 'google-calendar-events' ),
95
-				'edit_item'                  => __( 'Edit Calendar Type', 'google-calendar-events' ),
96
-				'update_item'                => __( 'Update Calendar Type', 'google-calendar-events' ),
97
-				'view_item'                  => __( 'View Calendar Type', 'google-calendar-events' ),
98
-				'separate_items_with_commas' => __( 'Separate calendar types with commas', 'google-calendar-events' ),
99
-				'add_or_remove_items'        => __( 'Add or remove calendar types', 'google-calendar-events' ),
100
-				'choose_from_most_used'      => __( 'Choose from the most used', 'google-calendar-events' ),
101
-				'popular_items'              => __( 'Popular calendar types', 'google-calendar-events' ),
102
-				'search_items'               => __( 'Search Calendar Types', 'google-calendar-events' ),
103
-				'not_found'                  => __( 'Not Found', 'google-calendar-events' ),
87
+				'name'                       => __('Calendar Types', 'google-calendar-events'),
88
+				'singular_name'              => __('Calendar Type', 'google-calendar-events'),
89
+				'menu_name'                  => __('Calendar Type', 'google-calendar-events'),
90
+				'all_items'                  => __('All Calendar Types', 'google-calendar-events'),
91
+				'parent_item'                => __('Parent Calendar Type', 'google-calendar-events'),
92
+				'parent_item_colon'          => __('Parent Calendar Type:', 'google-calendar-events'),
93
+				'new_item_name'              => __('New Calendar Type', 'google-calendar-events'),
94
+				'add_new_item'               => __('Add New Calendar Type', 'google-calendar-events'),
95
+				'edit_item'                  => __('Edit Calendar Type', 'google-calendar-events'),
96
+				'update_item'                => __('Update Calendar Type', 'google-calendar-events'),
97
+				'view_item'                  => __('View Calendar Type', 'google-calendar-events'),
98
+				'separate_items_with_commas' => __('Separate calendar types with commas', 'google-calendar-events'),
99
+				'add_or_remove_items'        => __('Add or remove calendar types', 'google-calendar-events'),
100
+				'choose_from_most_used'      => __('Choose from the most used', 'google-calendar-events'),
101
+				'popular_items'              => __('Popular calendar types', 'google-calendar-events'),
102
+				'search_items'               => __('Search Calendar Types', 'google-calendar-events'),
103
+				'not_found'                  => __('Not Found', 'google-calendar-events'),
104 104
 			);
105 105
 
106
-			$args   = array(
106
+			$args = array(
107 107
 				'hierarchical'      => true,
108 108
 				'labels'            => $labels,
109 109
 				'public'            => false,
@@ -112,34 +112,34 @@  discard block
 block discarded – undo
112 112
 				'show_tagcloud'     => false,
113 113
 				'show_ui'           => false,
114 114
 			);
115
-			register_taxonomy( 'calendar_type', array( 'calendar' ), $args );
115
+			register_taxonomy('calendar_type', array('calendar'), $args);
116 116
 
117 117
 		}
118 118
 
119
-		if ( ! taxonomy_exists( 'calendar_category' ) ) {
119
+		if ( ! taxonomy_exists('calendar_category')) {
120 120
 
121 121
 			// Feed Category.
122 122
 			$labels = array(
123
-				'name'                       => __( 'Categories', 'google-calendar-events' ),
124
-				'singular_name'              => __( 'Category', 'google-calendar-events' ),
125
-				'menu_name'                  => __( 'Categories', 'google-calendar-events' ),
126
-				'all_items'                  => __( 'All Categories', 'google-calendar-events' ),
127
-				'parent_item'                => __( 'Parent Category', 'google-calendar-events' ),
128
-				'parent_item_colon'          => __( 'Parent Category:', 'google-calendar-events' ),
129
-				'new_item_name'              => __( 'New Category', 'google-calendar-events' ),
130
-				'add_new_item'               => __( 'Add New Category', 'google-calendar-events' ),
131
-				'edit_item'                  => __( 'Edit Category', 'google-calendar-events' ),
132
-				'update_item'                => __( 'Update Category', 'google-calendar-events' ),
133
-				'view_item'                  => __( 'View Category', 'google-calendar-events' ),
134
-				'separate_items_with_commas' => __( 'Separate categories with commas', 'google-calendar-events' ),
135
-				'add_or_remove_items'        => __( 'Add or remove categories', 'google-calendar-events' ),
136
-				'choose_from_most_used'      => __( 'Choose from the most used', 'google-calendar-events' ),
137
-				'popular_items'              => __( 'Popular Categories', 'google-calendar-events' ),
138
-				'search_items'               => __( 'Search Categories', 'google-calendar-events' ),
139
-				'not_found'                  => __( 'Not Found', 'google-calendar-events' ),
123
+				'name'                       => __('Categories', 'google-calendar-events'),
124
+				'singular_name'              => __('Category', 'google-calendar-events'),
125
+				'menu_name'                  => __('Categories', 'google-calendar-events'),
126
+				'all_items'                  => __('All Categories', 'google-calendar-events'),
127
+				'parent_item'                => __('Parent Category', 'google-calendar-events'),
128
+				'parent_item_colon'          => __('Parent Category:', 'google-calendar-events'),
129
+				'new_item_name'              => __('New Category', 'google-calendar-events'),
130
+				'add_new_item'               => __('Add New Category', 'google-calendar-events'),
131
+				'edit_item'                  => __('Edit Category', 'google-calendar-events'),
132
+				'update_item'                => __('Update Category', 'google-calendar-events'),
133
+				'view_item'                  => __('View Category', 'google-calendar-events'),
134
+				'separate_items_with_commas' => __('Separate categories with commas', 'google-calendar-events'),
135
+				'add_or_remove_items'        => __('Add or remove categories', 'google-calendar-events'),
136
+				'choose_from_most_used'      => __('Choose from the most used', 'google-calendar-events'),
137
+				'popular_items'              => __('Popular Categories', 'google-calendar-events'),
138
+				'search_items'               => __('Search Categories', 'google-calendar-events'),
139
+				'not_found'                  => __('Not Found', 'google-calendar-events'),
140 140
 			);
141 141
 
142
-			$args   = array(
142
+			$args = array(
143 143
 				'hierarchical'      => true,
144 144
 				'labels'            => $labels,
145 145
 				'public'            => true,
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 				'show_ui'           => true,
150 150
 			);
151 151
 
152
-			register_taxonomy( 'calendar_category', array( 'calendar' ), $args );
152
+			register_taxonomy('calendar_category', array('calendar'), $args);
153 153
 		}
154 154
 
155 155
 	}
@@ -161,27 +161,27 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public static function register_post_types() {
163 163
 
164
-		do_action( 'simcal_register_post_types' );
164
+		do_action('simcal_register_post_types');
165 165
 
166
-		if ( ! post_type_exists( 'calendar' ) ) {
166
+		if ( ! post_type_exists('calendar')) {
167 167
 
168 168
 			// Calendar feed post type.
169
-			$labels        = array(
170
-				'name'               => _x( 'Calendars', 'Post Type General Name', 'google-calendar-events' ),
171
-				'singular_name'      => _x( 'Calendar', 'Post Type Singular Name', 'google-calendar-events' ),
172
-				'menu_name'          => __( 'Calendars', 'google-calendar-events' ),
173
-				'name_admin_bar'     => __( 'Calendar', 'google-calendar-events' ),
174
-				'parent_item_colon'  => __( 'Parent Calendar:', 'google-calendar-events' ),
175
-				'all_items'          => __( 'All Calendars', 'google-calendar-events' ),
176
-				'add_new_item'       => __( 'Add New Calendar', 'google-calendar-events' ),
177
-				'add_new'            => __( 'Add New', 'google-calendar-events' ),
178
-				'new_item'           => __( 'New Calendar', 'google-calendar-events' ),
179
-				'edit_item'          => __( 'Edit Calendar', 'google-calendar-events' ),
180
-				'update_item'        => __( 'Update Calendar', 'google-calendar-events' ),
181
-				'view_item'          => __( 'View Calendar', 'google-calendar-events' ),
182
-				'search_items'       => __( 'Search Calendar', 'google-calendar-events' ),
183
-				'not_found'          => __( 'Calendars not found', 'google-calendar-events' ),
184
-				'not_found_in_trash' => __( 'Calendars not found in Trash', 'google-calendar-events' ),
169
+			$labels = array(
170
+				'name'               => _x('Calendars', 'Post Type General Name', 'google-calendar-events'),
171
+				'singular_name'      => _x('Calendar', 'Post Type Singular Name', 'google-calendar-events'),
172
+				'menu_name'          => __('Calendars', 'google-calendar-events'),
173
+				'name_admin_bar'     => __('Calendar', 'google-calendar-events'),
174
+				'parent_item_colon'  => __('Parent Calendar:', 'google-calendar-events'),
175
+				'all_items'          => __('All Calendars', 'google-calendar-events'),
176
+				'add_new_item'       => __('Add New Calendar', 'google-calendar-events'),
177
+				'add_new'            => __('Add New', 'google-calendar-events'),
178
+				'new_item'           => __('New Calendar', 'google-calendar-events'),
179
+				'edit_item'          => __('Edit Calendar', 'google-calendar-events'),
180
+				'update_item'        => __('Update Calendar', 'google-calendar-events'),
181
+				'view_item'          => __('View Calendar', 'google-calendar-events'),
182
+				'search_items'       => __('Search Calendar', 'google-calendar-events'),
183
+				'not_found'          => __('Calendars not found', 'google-calendar-events'),
184
+				'not_found_in_trash' => __('Calendars not found in Trash', 'google-calendar-events'),
185 185
 			);
186 186
 
187 187
 			$rewrite_rules = array(
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 
194 194
 			$svg_icon = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iU2hhcGVzX3hBMF9JbWFnZV8xXyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDEwMjQgMTAyNCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik01MTMuNCwxMDEzLjNjLTE2My44LDAtMzI3LjcsMC00OTEuNSwwYy05LjcsMC04LjgsMC45LTguOC04LjljMC0yNDMuNywwLjItNDg3LjMtMC4zLTczMWMtMC4xLTM5LjYsMjcuNy03Ni40LDY5LjYtODIuM2MzLTAuNCw2LTAuNSw5LTAuNWMzNSwwLDcwLDAuMSwxMDUtMC4xYzUuMSwwLDYuNSwxLjQsNi41LDYuNWMtMC4yLDI2LjgsMC4xLDUzLjctMC4yLDgwLjVjLTAuMiwxNS4yLDMuOSwyOC4yLDE1LjksMzguMmMyLjcsMi4yLDUsNC44LDcuNCw3LjRjOCw4LjYsMTguMSwxMi40LDI5LjYsMTIuNGMzMC43LDAuMiw2MS4zLDAuMiw5MiwwYzExLjItMC4xLDIxLjItMy45LDI5LjEtMTIuMmMzLjQtMy42LDctNy4yLDEwLjYtMTAuNmM5LTguNCwxMi43LTE4LjksMTIuNy0zMWMwLjEtMjguMiwwLTU2LjMsMC04NC41YzAtNi42LDAtNi42LDYuNi02LjZjNzEuNSwwLDE0MywwLDIxNC41LDBjNi42LDAsNi42LDAsNi42LDYuN2MwLDI2LjgsMC4yLDUzLjctMC4xLDgwLjVjLTAuMiwxNSw1LjEsMjYuOCwxNS40LDM4YzEzLjYsMTQuNywyOC45LDIwLjgsNDguNywyMC4xYzI1LjYtMSw1MS4zLTAuNCw3Ny0wLjJjMTMuOSwwLjEsMjQuOC01LjEsMzUuNC0xNC40YzE1LjktMTQsMjIuMS0zMC40LDIxLjEtNTEuM2MtMS4xLTI0LjMtMC4xLTQ4LjctMC40LTczYzAtNS4xLDEuNC02LjUsNi41LTYuNWMzNC43LDAuMiw2OS4zLDAsMTA0LDAuMWM0Mi4zLDAuMiw3OC4zLDM2LDc4LjMsNzguM2MwLjEsMjQ2LDAsNDkyLDAsNzM4YzAsNi40LDAsNi40LTcuMyw2LjRDODQyLDEwMTMuMyw2NzcuNywxMDEzLjMsNTEzLjQsMTAxMy4zeiBNNDM5LjUsNjc4LjljMS42LTEsMi4yLTEuNSwzLTEuOGMxMS44LTUuOCwyMS41LTE0LjIsMjktMjQuOGMyNC4zLTM0LjEsMjQuMy03MC45LDguNi0xMDcuOGMtMTMuMy0zMS4zLTM5LjMtNDkuMy03MS01OS40Yy0yNy42LTguOC01Ni05LjQtODQuNS01LjZjLTIwLjMsMi43LTM5LjIsOS42LTU1LjUsMjIuMmMtMzUuNSwyNy4yLTQ4LjQsNjUuMS01MC40LDEwOGMtMC4yLDMuNywyLjEsMy45LDQuOCwzLjljMjIuMiwwLDQ0LjMtMC4xLDY2LjUsMGMzLjgsMCw1LjQtMS4xLDUuMy01LjFjLTAuMS03LjcsMS0xNS4zLDMtMjIuN2M1LjQtMjAsMTYuNS0zNC43LDM3LjgtMzkuN2M4LjEtMS45LDE2LjMtMi4xLDI0LjQtMS4zYzIxLjQsMi4xLDM2LjMsMTMuMSw0My41LDMzLjdjMy41LDEwLjEsMy45LDIwLjQsMi45LDMxYy0yLjIsMjMuNC0xNi4yLDM5LjctMzkuMSw0NC42Yy0xMy4yLDIuOC0yNi42LDQuMS00MC4yLDRjLTMuNywwLTUsMS4yLTQuOSw0LjljMC4xLDE2LjUsMC4yLDMzLDAsNDkuNWMwLDQsMS41LDUuMiw1LjMsNS4xYzEyLjktMC4zLDI1LjYsMC45LDM4LjMsM2MyNi4zLDQuMiw0My41LDE4LjgsNDkuMiw0MmMzLjMsMTMuNSwzLDI3LjEtMC4yLDQwLjZjLTIuMyw5LjctNi44LDE4LjQtMTMuOCwyNS43Yy0xNS40LDE2LjEtMzQuNSwyMS42LTU2LDE4LjljLTI3LjUtMy40LTQzLjUtMTgtNTAuNS00NC44Yy0xLjktNy4zLTMuMS0xNC43LTIuOC0yMi4yYzAuMi00LTEuMS01LjYtNS40LTUuNmMtMjMuNywwLjItNDcuMywwLjItNzEsMGMtNCwwLTUuNCwxLjItNC45LDUuMmMxLjQsMTMuMiwyLjcsMjYuNSw1LjksMzkuNWMxMS4xLDQ1LjIsMzguMiw3NS42LDgzLjQsODguMmMzNi43LDEwLjMsNzMuOCwxMC4xLDExMC41LDAuMWMyNC41LTYuNiw0NC43LTIwLjEsNjEtMzkuOGMyNC41LTI5LjcsMzQuNC02My45LDMxLjQtMTAxLjljLTIuMi0yNy40LTEyLjUtNTEuMy0zMy42LTY5LjhDNDYwLjcsNjg5LjMsNDUxLjksNjgyLDQzOS41LDY3OC45eiBNNzU1LDY5Mi41YzAtNjguNi0wLjEtMTM3LjMsMC4xLTIwNS45YzAtNS4xLTEuNC02LjUtNi41LTYuNGMtMTguMywwLjMtMzYuNywwLjQtNTUsMGMtNS43LTAuMS03LjIsMS45LTguMiw3Yy01LjksMzIuMS0yNC40LDUzLTU2LjMsNjEuMWMtMTcuNSw0LjUtMzUuNiw1LTUzLjUsNS44Yy0zLjksMC4yLTUuMiwxLjQtNS4yLDUuM2MwLjIsMTUuMywwLjIsMzAuNywwLDQ2Yy0wLjEsNC4zLDEuNiw1LjQsNS42LDUuM2MxNC4yLTAuMiwyOC4zLTAuMSw0Mi41LTAuMWMxNS41LDAsMzEsMC4xLDQ2LjUtMC4xYzQuMSwwLDUuOSwxLjMsNS41LDUuNGMtMC4xLDEuNywwLDMuMywwLDVjMCw5Mi4xLDAsMTg0LjMsMCwyNzYuNGMwLDcuMiwwLDcuMiw3LDcuMmMyMy41LDAsNDcsMCw3MC41LDBjNywwLDcsMCw3LTcuMkM3NTUsODI5LjEsNzU1LDc2MC44LDc1NSw2OTIuNXoiLz48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgZD0iTTM3Ni43LDE5OS4yYzAsMjQuMiwwLDQ4LjMsMCw3Mi41Yy0wLjEsMjMuMS0xNy40LDQwLjUtNDAuNCw0MC42Yy0yMy4zLDAuMS00Ni42LDAuMS03MCwwYy0yMi44LTAuMS00MC4zLTE3LjQtNDAuMy00MC4xYy0wLjEtNDguNS0wLjEtOTYuOSwwLTE0NS40YzAtMjIuNCwxNy41LTQwLDM5LjktNDAuMWMyMy43LTAuMSw0Ny4zLTAuMSw3MSwwYzIyLjQsMC4xLDM5LjgsMTcuNywzOS44LDQwLjFDMzc2LjgsMTUwLjksMzc2LjcsMTc1LjEsMzc2LjcsMTk5LjJ6Ii8+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik04MDEuNywxOTkuNmMwLDI0LDAsNDgsMCw3MmMwLDIzLjQtMTcuMyw0MC43LTQwLjcsNDAuOGMtMjMuMiwwLjEtNDYuMywwLjEtNjkuNSwwYy0yMy4xLTAuMS00MC41LTE3LjQtNDAuNS00MC41Yy0wLjEtNDguMy0wLjEtOTYuNiwwLTE0NC45YzAtMjIuNywxNy41LTQwLjIsNDAuMi00MC4zYzIzLjMtMC4xLDQ2LjYtMC4xLDcwLDBjMjMuMSwwLjEsNDAuNCwxNy40LDQwLjUsNDAuNUM4MDEuOCwxNTEuMyw4MDEuNywxNzUuNCw4MDEuNywxOTkuNnoiLz48L3N2Zz4=';
195 195
 
196
-			$args          = array(
196
+			$args = array(
197 197
 				'capability_type'     => 'post',
198 198
 				'exclude_from_search' => false,
199 199
 				'has_archive'         => false,
200 200
 				'hierarchical'        => false,
201
-				'label'               => __( 'Calendar', 'google-calendar-events' ),
201
+				'label'               => __('Calendar', 'google-calendar-events'),
202 202
 				'labels'              => $labels,
203 203
 				'query_var'           => true,
204 204
 				'public'              => true,
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 				'show_in_menu'        => true,
211 211
 				'show_in_nav_menus'   => true,
212 212
 				'show_ui'             => true,
213
-				'supports'            => array( 'title', 'editor' ),
213
+				'supports'            => array('title', 'editor'),
214 214
 				'taxonomies'          => array(
215 215
 					'calendar_category',
216 216
 					'calendar_feed',
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 				),
219 219
 			);
220 220
 
221
-			register_post_type( 'calendar', $args );
221
+			register_post_type('calendar', $args);
222 222
 		}
223 223
 
224 224
 	}
@@ -232,49 +232,49 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @return string
234 234
 	 */
235
-	public function filter_post_content( $the_content ) {
235
+	public function filter_post_content($the_content) {
236 236
 
237
-		if ( is_singular() ) {
237
+		if (is_singular()) {
238 238
 
239 239
 			global $post;
240 240
 
241
-			if ( 'calendar' == $post->post_type ) {
241
+			if ('calendar' == $post->post_type) {
242 242
 
243
-				if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
243
+				if (is_admin() && ! defined('DOING_AJAX')) {
244 244
 					return '';
245 245
 				} else {
246 246
 					ob_start();
247
-					simcal_print_calendar( $post );
247
+					simcal_print_calendar($post);
248 248
 					return ob_get_clean();
249 249
 				}
250 250
 
251 251
 			} else {
252 252
 
253 253
 				$post_types = array();
254
-				$settings   = get_option( 'simple-calendar_settings_calendars' );
255
-				if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
254
+				$settings   = get_option('simple-calendar_settings_calendars');
255
+				if (isset($settings['general']['attach_calendars_posts'])) {
256 256
 					$post_types = $settings['general']['attach_calendars_posts'];
257 257
 				}
258 258
 
259
-				if ( empty( $post_types ) ) {
259
+				if (empty($post_types)) {
260 260
 					return $the_content;
261 261
 				}
262 262
 
263
-				if ( in_array( $post->post_type, (array) $post_types ) ) {
263
+				if (in_array($post->post_type, (array) $post_types)) {
264 264
 
265
-					$id = absint( get_post_meta( $post->ID, '_simcal_attach_calendar_id', true ) );
265
+					$id = absint(get_post_meta($post->ID, '_simcal_attach_calendar_id', true));
266 266
 
267
-					if ( $id > 0 ) {
267
+					if ($id > 0) {
268 268
 
269
-						$pos = esc_attr( get_post_meta( $post->ID, '_simcal_attach_calendar_position', true ) );
269
+						$pos = esc_attr(get_post_meta($post->ID, '_simcal_attach_calendar_position', true));
270 270
 
271 271
 						ob_start();
272 272
 
273
-						if ( 'after' == $pos ) {
273
+						if ('after' == $pos) {
274 274
 							echo $the_content;
275
-							simcal_print_calendar( $id );
276
-						} elseif ( 'before' == $pos ) {
277
-							simcal_print_calendar( $id );
275
+							simcal_print_calendar($id);
276
+						} elseif ('before' == $pos) {
277
+							simcal_print_calendar($id);
278 278
 							echo $the_content;
279 279
 						} else {
280 280
 							echo $the_content;
@@ -300,20 +300,20 @@  discard block
 block discarded – undo
300 300
 	 *
301 301
 	 * @param $post_id
302 302
 	 */
303
-	public function upon_deletion( $post_id ) {
303
+	public function upon_deletion($post_id) {
304 304
 
305
-		$post_type = get_post_type( $post_id );
305
+		$post_type = get_post_type($post_id);
306 306
 
307
-		if ( 'calendar' == $post_type ) {
307
+		if ('calendar' == $post_type) {
308 308
 
309
-			$notices = get_option( 'simple-calendar_admin_notices', array() );
309
+			$notices = get_option('simple-calendar_admin_notices', array());
310 310
 
311
-			if ( ! empty( $notices ) && isset( $notices[ 'calendar_' . strval( $post_id ) ] ) ) {
312
-				unset( $notices[ 'calendar_' . strval( $post_id ) ] );
313
-				update_option( 'simple-calendar_admin_notices', $notices );
311
+			if ( ! empty($notices) && isset($notices['calendar_'.strval($post_id)])) {
312
+				unset($notices['calendar_'.strval($post_id)]);
313
+				update_option('simple-calendar_admin_notices', $notices);
314 314
 			}
315 315
 
316
-			simcal_delete_feed_transients( $post_id );
316
+			simcal_delete_feed_transients($post_id);
317 317
 		}
318 318
 	}
319 319
 
Please login to merge, or discard this patch.
includes/shortcodes.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Calendar;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function __construct() {
30 30
 
31 31
 		// Add shortcodes.
32
-		add_action( 'init', array( $this, 'register' ) );
32
+		add_action('init', array($this, 'register'));
33 33
 	}
34 34
 
35 35
 	/**
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function register() {
41 41
 
42
-		add_shortcode( 'calendar', array( $this, 'print_calendar' ) );
42
+		add_shortcode('calendar', array($this, 'print_calendar'));
43 43
 		// @deprecated legacy shortcode
44
-		add_shortcode( 'gcal', array( $this, 'print_calendar' ) );
44
+		add_shortcode('gcal', array($this, 'print_calendar'));
45 45
 
46
-		do_action( 'simcal_add_shortcodes' );
46
+		do_action('simcal_add_shortcodes');
47 47
 	}
48 48
 
49 49
 	/**
@@ -55,19 +55,19 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return string
57 57
 	 */
58
-	public function print_calendar( $attributes ) {
58
+	public function print_calendar($attributes) {
59 59
 
60
-		$args = shortcode_atts( array(
60
+		$args = shortcode_atts(array(
61 61
 			'id' => null,
62
-		), $attributes );
62
+		), $attributes);
63 63
 
64
-		$id = absint( $args['id'] );
64
+		$id = absint($args['id']);
65 65
 
66
-		if ( $id > 0 ) {
66
+		if ($id > 0) {
67 67
 
68
-			$calendar = simcal_get_calendar( $id );
68
+			$calendar = simcal_get_calendar($id);
69 69
 
70
-			if ( $calendar instanceof Calendar ) {
70
+			if ($calendar instanceof Calendar) {
71 71
 				ob_start();
72 72
 				$calendar->html();
73 73
 				return ob_get_clean();
Please login to merge, or discard this patch.