Completed
Push — master ( 72dfec...61887c )
by
unknown
06:50
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.
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   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Events\Event;
14 14
 use SimpleCalendar\Calendars\Default_Calendar;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @param string|Calendar $calendar
57 57
 	 */
58
-	public function __construct( $calendar = '' ) {
58
+	public function __construct($calendar = '') {
59 59
 		$this->calendar = $calendar;
60 60
 	}
61 61
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return string
90 90
 	 */
91 91
 	public function get_name() {
92
-		return __( 'Grid', 'google-calendar-events' );
92
+		return __('Grid', 'google-calendar-events');
93 93
 	}
94 94
 
95 95
 	/**
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @since 3.0.0
99 99
 	 */
100 100
 	public function add_ajax_actions() {
101
-		add_action( 'wp_ajax_simcal_default_calendar_draw_grid', array( $this, 'draw_grid_ajax' ) );
102
-		add_action( 'wp_ajax_nopriv_simcal_default_calendar_draw_grid', array( $this, 'draw_grid_ajax' ) );
101
+		add_action('wp_ajax_simcal_default_calendar_draw_grid', array($this, 'draw_grid_ajax'));
102
+		add_action('wp_ajax_nopriv_simcal_default_calendar_draw_grid', array($this, 'draw_grid_ajax'));
103 103
 	}
104 104
 
105 105
 	/**
@@ -113,25 +113,25 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return array
115 115
 	 */
116
-	public function scripts( $min = '' ) {
116
+	public function scripts($min = '') {
117 117
 		return array(
118 118
 			'simcal-qtip' => array(
119
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/jquery.qtip' . $min . '.js',
120
-				'deps'      => array( 'jquery' ),
119
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/jquery.qtip'.$min.'.js',
120
+				'deps'      => array('jquery'),
121 121
 				'in_footer' => true,
122 122
 			),
123 123
 			'simcal-fullcal-moment' => array(
124
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/moment' . $min . '.js',
125
-				'deps'      => array( 'jquery' ),
124
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/moment'.$min.'.js',
125
+				'deps'      => array('jquery'),
126 126
 				'in_footer' => true,
127 127
 			),
128 128
 			'simcal-moment-timezone' => array(
129
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/moment-timezone-with-data' . $min . '.js',
130
-				'deps'      => array( 'jquery' ),
129
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/moment-timezone-with-data'.$min.'.js',
130
+				'deps'      => array('jquery'),
131 131
 				'in_footer' => true,
132 132
 			),
133 133
 			'simcal-default-calendar' => array(
134
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
134
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
135 135
 				'deps'      => array(
136 136
 					'jquery',
137 137
 					'simcal-qtip',
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @return array
159 159
 	 */
160
-	public function styles( $min = '' ) {
160
+	public function styles($min = '') {
161 161
 		return array(
162 162
 			'simcal-qtip' => array(
163
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/vendor/jquery.qtip' . $min . '.css',
163
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/vendor/jquery.qtip'.$min.'.css',
164 164
 				'media' => 'all',
165 165
 			),
166 166
 			'simcal-default-calendar-grid' => array(
167
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-grid' . $min . '.css',
167
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-grid'.$min.'.css',
168 168
 				'deps'  => array(
169 169
 					'simcal-qtip',
170 170
 				),
171 171
 				'media' => 'all',
172 172
 			),
173 173
 			'simcal-default-calendar-list' => array(
174
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
174
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
175 175
 				'deps'  => array(
176 176
 					'simcal-qtip',
177 177
 				),
@@ -189,22 +189,22 @@  discard block
 block discarded – undo
189 189
 
190 190
 		$calendar = $this->calendar;
191 191
 
192
-		if ( $calendar instanceof Default_Calendar ) {
192
+		if ($calendar instanceof Default_Calendar) {
193 193
 
194 194
 			?>
195 195
 
196
-			<?php edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id ); ?>
196
+			<?php edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id); ?>
197 197
 
198 198
 			<table class="simcal-calendar-grid"
199 199
 			       data-event-bubble-trigger="<?php echo $calendar->event_bubble_trigger; ?>">
200 200
 				<thead class="simcal-calendar-head">
201 201
 					<tr>
202
-						<?php if ( ! $calendar->static ) { ?>
203
-							<th class="simcal-nav simcal-prev-wrapper" colspan="<?php echo apply_filters( 'simcal_prev_cols', '1' ); ?>">
204
-								<button class="simcal-nav-button simcal-month-nav simcal-prev" title="<?php _e( 'Previous Month', 'google-calendar-events' ); ?>"><i class="simcal-icon-left"></i></button>
202
+						<?php if ( ! $calendar->static) { ?>
203
+							<th class="simcal-nav simcal-prev-wrapper" colspan="<?php echo apply_filters('simcal_prev_cols', '1'); ?>">
204
+								<button class="simcal-nav-button simcal-month-nav simcal-prev" title="<?php _e('Previous Month', 'google-calendar-events'); ?>"><i class="simcal-icon-left"></i></button>
205 205
 							</th>
206 206
 						<?php } ?>
207
-						<th colspan="<?php echo apply_filters( 'simcal_current_cols', $calendar->static ? '7' : '5' ); ?>"
207
+						<th colspan="<?php echo apply_filters('simcal_current_cols', $calendar->static ? '7' : '5'); ?>"
208 208
 						    class="simcal-nav simcal-current"
209 209
 						    data-calendar-current="<?php echo $calendar->start; ?>">
210 210
 							<?php
@@ -213,26 +213,26 @@  discard block
 block discarded – undo
213 213
 
214 214
 							// Display month and year according to user date format preference.
215 215
 
216
-							$year_pos  = strcspn( $calendar->date_format, 'Y y' );
217
-							$month_pos = strcspn( $calendar->date_format, 'F M m n' );
216
+							$year_pos  = strcspn($calendar->date_format, 'Y y');
217
+							$month_pos = strcspn($calendar->date_format, 'F M m n');
218 218
 
219
-							$current = array( 'month' => 'F', 'year' => 'Y' );
219
+							$current = array('month' => 'F', 'year' => 'Y');
220 220
 
221
-							if ( $year_pos < $month_pos ) {
222
-								$current = array_reverse( $current );
221
+							if ($year_pos < $month_pos) {
222
+								$current = array_reverse($current);
223 223
 							}
224 224
 
225
-							foreach ( $current as $k => $v ) {
226
-								echo ' <span class="simcal-current-' . $k , '">' . date_i18n( $v, $calendar->start ) . '</span> ';
225
+							foreach ($current as $k => $v) {
226
+								echo ' <span class="simcal-current-'.$k, '">'.date_i18n($v, $calendar->start).'</span> ';
227 227
 							}
228 228
 
229 229
 							echo '</h3>';
230 230
 
231 231
 							?>
232 232
 						</th>
233
-						<?php if ( ! $calendar->static ) { ?>
234
-							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters( 'simcal_next_cols', '1' ); ?>">
235
-								<button class="simcal-nav-button simcal-month-nav simcal-next" title="<?php _e( 'Next Month', 'google-calendar-events' ); ?>"><i class="simcal-icon-right"></i></button>
233
+						<?php if ( ! $calendar->static) { ?>
234
+							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters('simcal_next_cols', '1'); ?>">
235
+								<button class="simcal-nav-button simcal-month-nav simcal-next" title="<?php _e('Next Month', 'google-calendar-events'); ?>"><i class="simcal-icon-right"></i></button>
236 236
 							</th>
237 237
 						<?php } ?>
238 238
 					</tr>
@@ -242,28 +242,28 @@  discard block
 block discarded – undo
242 242
 						// Print day names in short or long form for different viewport sizes.
243 243
 
244 244
 						$week_starts     = $calendar->week_starts;
245
-						$week_days_short = simcal_get_calendar_names_i18n( 'day', 'short' );
246
-						$week_days_full  = simcal_get_calendar_names_i18n( 'day', 'full' );
245
+						$week_days_short = simcal_get_calendar_names_i18n('day', 'short');
246
+						$week_days_full  = simcal_get_calendar_names_i18n('day', 'full');
247 247
 
248
-						for ( $i = $week_starts; $i <= 6; $i ++ ) :
248
+						for ($i = $week_starts; $i <= 6; $i++) :
249 249
 
250 250
 							?>
251 251
 							<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
252
-								data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
253
-							    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
254
-							    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
252
+								data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
253
+							    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
254
+							    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
255 255
 							<?php
256 256
 
257 257
 						endfor;
258 258
 
259
-						if ( $week_starts !== 0 ) :
260
-							for ( $i = 0; $i < $week_starts; $i ++ ) :
259
+						if ($week_starts !== 0) :
260
+							for ($i = 0; $i < $week_starts; $i++) :
261 261
 
262 262
 								?>
263 263
 								<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
264
-								    data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
265
-								    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
266
-								    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
264
+								    data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
265
+								    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
266
+								    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
267 267
 								<?php
268 268
 
269 269
 							endfor;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 					</tr>
274 274
 				</thead>
275 275
 
276
-				<?php echo $this->draw_month( date( 'n', $calendar->start ), date( 'Y', $calendar->start ) ); ?>
276
+				<?php echo $this->draw_month(date('n', $calendar->start), date('Y', $calendar->start)); ?>
277 277
 
278 278
 			</table>
279 279
 
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @return string
301 301
 	 */
302
-	private function draw_month( $month, $year, $id = 0 ) {
302
+	private function draw_month($month, $year, $id = 0) {
303 303
 
304 304
 		$calendar = $this->calendar;
305
-		if ( empty( $calendar ) ) {
306
-			$calendar = simcal_get_calendar( intval( $id ) );
307
-			if ( ! $calendar ) {
305
+		if (empty($calendar)) {
306
+			$calendar = simcal_get_calendar(intval($id));
307
+			if ( ! $calendar) {
308 308
 				return '';
309 309
 			}
310 310
 		}
@@ -313,68 +313,68 @@  discard block
 block discarded – undo
313 313
 
314 314
 		// Variables to cycle days in current month and find today in calendar.
315 315
 		$now         = $calendar->now;
316
-		$current     = Carbon::create( $year, $month, 1, 0, 0, 0, $calendar->timezone );
316
+		$current     = Carbon::create($year, $month, 1, 0, 0, 0, $calendar->timezone);
317 317
 		$current_min = $current->getTimestamp();
318 318
 		$current_max = $current->endOfDay()->getTimestamp();
319 319
 
320 320
 		// Calendar grid variables.
321 321
 		$week_starts   = $calendar->week_starts;
322
-		$week_of_year  = $current->weekOfYear;   // Relative count of the week number of the year.
323
-		$month_starts  = $current->dayOfWeek;    // Day upon which the month starts.
324
-		$days_in_month = $current->daysInMonth;  // Number of days in the given month.
322
+		$week_of_year  = $current->weekOfYear; // Relative count of the week number of the year.
323
+		$month_starts  = $current->dayOfWeek; // Day upon which the month starts.
324
+		$days_in_month = $current->daysInMonth; // Number of days in the given month.
325 325
 
326 326
 		// Set current month events timestamp boundaries.
327 327
 		$this->start = $current_min;
328 328
 		$this->end   = $current->endOfMonth()->getTimestamp();
329 329
 
330 330
 		// Get daily events for this month.
331
-		if ( $events && is_array( $events ) ) {
331
+		if ($events && is_array($events)) {
332 332
 
333 333
 			// Filter events within the boundaries previously set above.
334
-			$timestamps   = array_keys( $events );
335
-			$lower_bound  = array_filter( $timestamps, array( $this, 'filter_events_before' ) );
336
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after' ) );
337
-			$filtered     = ( is_array( $events ) && is_array( $higher_bound) ) && ! empty( $events ) && ! empty( $higher_bound ) ? array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) ) : array();
334
+			$timestamps   = array_keys($events);
335
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
336
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
337
+			$filtered     = (is_array($events) && is_array($higher_bound)) && ! empty($events) && ! empty($higher_bound) ? array_intersect_key($events, array_combine($higher_bound, $higher_bound)) : array();
338 338
 
339 339
 			// Put resulting events in an associative array, with day of the month as key for easy retrieval in calendar days loop.
340 340
 			$day_events = array();
341
-			foreach ( $filtered as $timestamp => $events_in_day ) {
342
-				foreach ( $events_in_day as $event ) {
343
-					if ( $event instanceof Event ){
344
-						$day = intval( Carbon::createFromTimestamp( $timestamp, $calendar->timezone )->endOfDay()->day );
345
-						$day_events[ $day ][] = $event;
341
+			foreach ($filtered as $timestamp => $events_in_day) {
342
+				foreach ($events_in_day as $event) {
343
+					if ($event instanceof Event) {
344
+						$day = intval(Carbon::createFromTimestamp($timestamp, $calendar->timezone)->endOfDay()->day);
345
+						$day_events[$day][] = $event;
346 346
 					}
347 347
 				}
348 348
 			}
349 349
 
350
-			ksort( $day_events, SORT_NUMERIC );
350
+			ksort($day_events, SORT_NUMERIC);
351 351
 		}
352 352
 
353 353
 		ob_start();
354 354
 
355
-		echo '<tbody class="simcal-month simcal-month-' . $month . '">' . "\n";
356
-		echo "\t" . '<tr class="simcal-week simcal-week-' . $week_of_year . '">';
355
+		echo '<tbody class="simcal-month simcal-month-'.$month.'">'."\n";
356
+		echo "\t".'<tr class="simcal-week simcal-week-'.$week_of_year.'">';
357 357
 
358 358
 		$days_in_row = 0;
359 359
 		// Week may start on an arbitrary day (sun, 0 - sat, 6).
360 360
 		$week_day = $week_starts;
361 361
 
362 362
 		// This fixes a possible bug when a month starts by Sunday (0).
363
-		if ( 0 !== $week_starts ) {
363
+		if (0 !== $week_starts) {
364 364
 			$b = $month_starts === 0 ? 7 : $month_starts;
365 365
 		} else {
366 366
 			$b = $month_starts;
367 367
 		}
368 368
 
369 369
 		// Void days in first week.
370
-		for ( $a = $week_starts; $a < $b; $a++ ) :
370
+		for ($a = $week_starts; $a < $b; $a++) :
371 371
 
372
-			$last_void_day_class = ( $a === ( $b - 1 ) ) ? 'simcal-day-void-last' : '';
372
+			$last_void_day_class = ($a === ($b - 1)) ? 'simcal-day-void-last' : '';
373 373
 
374
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
374
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
375 375
 
376 376
 			// Reset day of the week count (sun, 0 - sat, 6).
377
-			if ( $week_day === 6 ) {
377
+			if ($week_day === 6) {
378 378
 				$week_day = -1;
379 379
 			}
380 380
 			$week_day++;
@@ -384,97 +384,97 @@  discard block
 block discarded – undo
384 384
 		endfor;
385 385
 
386 386
 		// Actual days of the month.
387
-		for ( $day = 1; $day <= $days_in_month; $day++ ) :
387
+		for ($day = 1; $day <= $days_in_month; $day++) :
388 388
 
389 389
 			$count = 0;
390 390
 			$calendar_classes = array();
391
-			$day_classes = 'simcal-day-' . $day . ' simcal-weekday-' . $week_day;
391
+			$day_classes = 'simcal-day-'.$day.' simcal-weekday-'.$week_day;
392 392
 
393 393
 			$border_style = $bg_color = $color = '';
394 394
 
395 395
 			// Is this the present, the past or the future, Doc?
396
-			if ( $current_min <= $now && $current_max >= $now ) {
396
+			if ($current_min <= $now && $current_max >= $now) {
397 397
 				$day_classes .= ' simcal-today simcal-present simcal-day';
398
-				$the_color = new Color( $calendar->today_color );
399
-				$bg_color = '#' . $the_color->getHex();
398
+				$the_color = new Color($calendar->today_color);
399
+				$bg_color = '#'.$the_color->getHex();
400 400
 				$color = $the_color->isDark() ? '#ffffff' : '#000000';
401
-				$border_style = ' style="border: 1px solid ' . $bg_color . ';"';
402
-			} elseif ( $current_max < $now ) {
401
+				$border_style = ' style="border: 1px solid '.$bg_color.';"';
402
+			} elseif ($current_max < $now) {
403 403
 				$day_classes .= ' simcal-past simcal-day';
404
-			} elseif ( $current_min > $now ) {
404
+			} elseif ($current_min > $now) {
405 405
 				$day_classes .= ' simcal-future simcal-day';
406 406
 			}
407 407
 
408 408
 			// Print events for the current day in loop, if found any.
409
-			if ( isset( $day_events[ $day ] ) ) :
409
+			if (isset($day_events[$day])) :
410 410
 
411 411
 				$bullet_colors = array();
412 412
 
413 413
 				$list_events = '<ul class="simcal-events">';
414 414
 
415
-				foreach ( $day_events[ $day ] as $event ) :
415
+				foreach ($day_events[$day] as $event) :
416 416
 
417 417
 					$event_classes = $event_visibility = '';
418 418
 
419
-					if ( $event instanceof Event ) :
419
+					if ($event instanceof Event) :
420 420
 
421 421
 						// Store the calendar id where the event belongs (useful in grouped calendar feeds)
422
-						$calendar_class  = 'simcal-events-calendar-' . strval( $event->calendar );
423
-						$calendar_classes[] = $calendar_class ;
422
+						$calendar_class = 'simcal-events-calendar-'.strval($event->calendar);
423
+						$calendar_classes[] = $calendar_class;
424 424
 
425 425
 						$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
426 426
 						$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
427 427
 
428
-						$event_classes  .= 'simcal-event ' . $recurring . $has_location . $calendar_class . ' simcal-tooltip';
428
+						$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class.' simcal-tooltip';
429 429
 
430 430
 						// Toggle some events visibility if more than optional limit.
431
-						if ( ( $calendar->events_limit > -1 )  && ( $count >= $calendar->events_limit ) ) :
431
+						if (($calendar->events_limit > -1) && ($count >= $calendar->events_limit)) :
432 432
 							$event_classes    .= ' simcal-event-toggled';
433 433
 							$event_visibility  = ' style="display: none"';
434 434
 						endif;
435 435
 
436 436
 						// Event title in list.
437
-						$title = ! empty( $event->title ) ? trim( $event->title ) : __( 'Event', 'google-calendar-events' );
438
-						if ( $calendar->trim_titles >= 1 ) {
439
-							$title = strlen( $title ) > $calendar->trim_titles ? mb_substr( $title, 0, $calendar->trim_titles ) . '&hellip;' : $title;
437
+						$title = ! empty($event->title) ? trim($event->title) : __('Event', 'google-calendar-events');
438
+						if ($calendar->trim_titles >= 1) {
439
+							$title = strlen($title) > $calendar->trim_titles ? mb_substr($title, 0, $calendar->trim_titles).'&hellip;' : $title;
440 440
 						}
441 441
 
442 442
 						// Event color.
443 443
 						$bullet = '';
444 444
 						//$bullet_color = '#000';
445 445
 						$event_color = $event->get_color();
446
-						if ( ! empty( $event_color ) ) {
447
-							$bullet = '<span style="color: ' . $event_color . ';">&#9632;</span> ';
446
+						if ( ! empty($event_color)) {
447
+							$bullet = '<span style="color: '.$event_color.';">&#9632;</span> ';
448 448
 							$bullet_colors[] = $event_color;
449 449
 						} else {
450 450
 							$bullet_colors[] = '#000';
451 451
 						}
452 452
 
453 453
 						// Event contents.
454
-						$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . ' itemscope itemtype="http://schema.org/Event">' . "\n";
455
-						$list_events .= "\t\t" . '<span class="simcal-event-title">' . $bullet . $title . '</span>' . "\n";
456
-						$list_events .= "\t\t" . '<div class="simcal-event-details simcal-tooltip-content" style="display: none;">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
457
-						$list_events .= "\t" . '</li>' . "\n";
454
+						$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.' itemscope itemtype="http://schema.org/Event">'."\n";
455
+						$list_events .= "\t\t".'<span class="simcal-event-title">'.$bullet.$title.'</span>'."\n";
456
+						$list_events .= "\t\t".'<div class="simcal-event-details simcal-tooltip-content" style="display: none;">'.$calendar->get_event_html($event).'</div>'."\n";
457
+						$list_events .= "\t".'</li>'."\n";
458 458
 
459
-						$count ++;
459
+						$count++;
460 460
 
461 461
 					endif;
462 462
 
463 463
 				endforeach;
464 464
 
465
-				if ( ( $current_min <= $now ) && ( $current_max >= $now ) ) {
465
+				if (($current_min <= $now) && ($current_max >= $now)) {
466 466
 					$day_classes .= ' simcal-today-has-events';
467 467
 				}
468
-				$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
468
+				$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
469 469
 
470
-				if ( $calendar_classes ) {
471
-					$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
470
+				if ($calendar_classes) {
471
+					$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
472 472
 				}
473 473
 
474
-				$list_events .= '</ul>' . "\n";
474
+				$list_events .= '</ul>'."\n";
475 475
 
476 476
 				// Optional button to toggle hidden events in list.
477
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
477
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
478 478
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
479 479
 				endif;
480 480
 
@@ -486,49 +486,49 @@  discard block
 block discarded – undo
486 486
 			endif;
487 487
 
488 488
 			// The actual days with numbers and events in each row cell.
489
-			echo '<td class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
490
-
491
-			if ( $color ) {
492
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
493
-			} elseif ( $count > 0 ) {
494
-				$the_color = new Color( $calendar->days_events_color );
495
-				$color = ! $color ? ( $the_color->isDark() ? '#ffffff' : '#000000' ) : $color;
496
-				$bg_color = ! $bg_color ? '#' . $the_color->getHex() : $bg_color;
497
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
489
+			echo '<td class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
490
+
491
+			if ($color) {
492
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
493
+			} elseif ($count > 0) {
494
+				$the_color = new Color($calendar->days_events_color);
495
+				$color = ! $color ? ($the_color->isDark() ? '#ffffff' : '#000000') : $color;
496
+				$bg_color = ! $bg_color ? '#'.$the_color->getHex() : $bg_color;
497
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
498 498
 			} else {
499 499
 				$day_style = '';
500 500
 			}
501 501
 
502
-			echo "\t" . '<div' . $border_style . '>' . "\n";
503
-			echo "\t\t" . '<span class="simcal-day-label simcal-day-number"' . $day_style . '>' . $day . '</span>' . "\n";
504
-			echo "\t\t" . $list_events . "\n";
502
+			echo "\t".'<div'.$border_style.'>'."\n";
503
+			echo "\t\t".'<span class="simcal-day-label simcal-day-number"'.$day_style.'>'.$day.'</span>'."\n";
504
+			echo "\t\t".$list_events."\n";
505 505
 			echo "\t\t";
506 506
 			echo '<span class="simcal-events-dots" style="display: none;">';
507 507
 
508 508
 			// Event bullets for calendar mobile mode.
509
-			for( $i = 0; $i < $count; $i++ ) {
510
-				echo '<b style="color: ' . $bullet_colors[ $i ] . ';"> &bull; </b>';
509
+			for ($i = 0; $i < $count; $i++) {
510
+				echo '<b style="color: '.$bullet_colors[$i].';"> &bull; </b>';
511 511
 			}
512 512
 
513
-			echo '</span>' . "\n";
514
-			echo "\t" . '</div>' . "\n";
515
-			echo '</td>' . "\n";
513
+			echo '</span>'."\n";
514
+			echo "\t".'</div>'."\n";
515
+			echo '</td>'."\n";
516 516
 
517 517
 			// Reset day of the week count (sun, 0 - sat, 6).
518
-			if ( $week_day === 6 ) {
518
+			if ($week_day === 6) {
519 519
 				$week_day = - 1;
520 520
 			}
521 521
 			$week_day++;
522 522
 
523 523
 			// Reset count of days for this row (0-6).
524
-			if ( $days_in_row === 6 ) :
524
+			if ($days_in_row === 6) :
525 525
 
526 526
 				// Close the week row.
527 527
 				echo '</tr>';
528 528
 
529 529
 				// Open a new week row.
530
-				if ( $day < $days_in_month ) {
531
-					echo '<tr class="simcal-week simcal-week-' . $week_of_year++ . '">' . "\n";
530
+				if ($day < $days_in_month) {
531
+					echo '<tr class="simcal-week simcal-week-'.$week_of_year++.'">'."\n";
532 532
 				}
533 533
 
534 534
 				$days_in_row = -1;
@@ -537,25 +537,25 @@  discard block
 block discarded – undo
537 537
 
538 538
 			$days_in_row++;
539 539
 
540
-			$current_min = Carbon::createFromTimestamp( $current_min, $calendar->timezone )->addDay()->getTimestamp();
541
-			$current_max = Carbon::createFromTimestamp( $current_max, $calendar->timezone )->addDay()->getTimestamp();
540
+			$current_min = Carbon::createFromTimestamp($current_min, $calendar->timezone)->addDay()->getTimestamp();
541
+			$current_max = Carbon::createFromTimestamp($current_max, $calendar->timezone)->addDay()->getTimestamp();
542 542
 
543 543
 		endfor;
544 544
 
545 545
 		// Void days at the end of the month.
546
-		$remainder_days = ( 6 - $days_in_row );
546
+		$remainder_days = (6 - $days_in_row);
547 547
 
548
-		for ( $i = 0; $i <= $remainder_days; $i ++ ) {
548
+		for ($i = 0; $i <= $remainder_days; $i++) {
549 549
 
550
-			$last_void_day_class = ( $i == $remainder_days ) ? 'simcal-day-void-last' : '';
550
+			$last_void_day_class = ($i == $remainder_days) ? 'simcal-day-void-last' : '';
551 551
 
552
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
552
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
553 553
 
554 554
 			$week_day++;
555 555
 		}
556 556
 
557
-		echo "\t" . '</tr>' . "\n";
558
-		echo '</tbody>' . "\n";
557
+		echo "\t".'</tr>'."\n";
558
+		echo '</tbody>'."\n";
559 559
 
560 560
 		return ob_get_clean();
561 561
 	}
@@ -567,17 +567,17 @@  discard block
 block discarded – undo
567 567
 	 */
568 568
 	public function draw_grid_ajax() {
569 569
 
570
-		if ( isset( $_POST['month'] ) && isset( $_POST['year'] ) && isset( $_POST['id'] ) ) {
570
+		if (isset($_POST['month']) && isset($_POST['year']) && isset($_POST['id'])) {
571 571
 
572
-			$month = absint( $_POST['month'] );
573
-			$year  = absint( $_POST['year'] );
574
-			$id    = absint( $_POST['id'] );
572
+			$month = absint($_POST['month']);
573
+			$year  = absint($_POST['year']);
574
+			$id    = absint($_POST['id']);
575 575
 
576
-			wp_send_json_success( $this->draw_month( $month, $year, $id ) );
576
+			wp_send_json_success($this->draw_month($month, $year, $id));
577 577
 
578 578
 		} else {
579 579
 
580
-			wp_send_json_error( 'Missing arguments in default calendar grid ajax request.' );
580
+			wp_send_json_error('Missing arguments in default calendar grid ajax request.');
581 581
 
582 582
 		}
583 583
 
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
 	 *
594 594
 	 * @return bool
595 595
 	 */
596
-	private function filter_events_before( $event ) {
597
-		return intval( $event ) >= intval( $this->start );
596
+	private function filter_events_before($event) {
597
+		return intval($event) >= intval($this->start);
598 598
 	}
599 599
 
600 600
 	/**
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 	 *
608 608
 	 * @return bool
609 609
 	 */
610
-	private function filter_events_after( $event ) {
611
-		return intval( $event ) < intval( $this->end );
610
+	private function filter_events_after($event) {
611
+		return intval($event) < intval($this->end);
612 612
 	}
613 613
 
614 614
 }
Please login to merge, or discard this patch.
includes/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   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Calendars\Default_Calendar;
14 14
 use SimpleCalendar\Events\Event;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @param string|Calendar $calendar
77 77
 	 */
78
-	public function __construct( $calendar = '' ) {
78
+	public function __construct($calendar = '') {
79 79
 		$this->calendar = $calendar;
80 80
 	}
81 81
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return string
110 110
 	 */
111 111
 	public function get_name() {
112
-		return __( 'List', 'google-calendar-events' );
112
+		return __('List', 'google-calendar-events');
113 113
 	}
114 114
 
115 115
 	/**
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * @since 3.0.0
119 119
 	 */
120 120
 	public function add_ajax_actions() {
121
-		add_action( 'wp_ajax_simcal_default_calendar_draw_list', array( $this, 'draw_list_ajax' ) );
122
-		add_action( 'wp_ajax_nopriv_simcal_default_calendar_draw_list', array( $this, 'draw_list_ajax' ) );
121
+		add_action('wp_ajax_simcal_default_calendar_draw_list', array($this, 'draw_list_ajax'));
122
+		add_action('wp_ajax_nopriv_simcal_default_calendar_draw_list', array($this, 'draw_list_ajax'));
123 123
 	}
124 124
 
125 125
 	/**
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return array
135 135
 	 */
136
-	public function scripts( $min = '' ) {
136
+	public function scripts($min = '') {
137 137
 		return array(
138 138
 			'simcal-qtip' => array(
139
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/qtip' . $min . '.js',
140
-				'deps'      => array( 'jquery' ),
139
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/qtip'.$min.'.js',
140
+				'deps'      => array('jquery'),
141 141
 				'in_footer' => true,
142 142
 			),
143 143
 			'simcal-default-calendar' => array(
144
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
144
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
145 145
 				'deps'      => array(
146 146
 					'jquery',
147 147
 					'simcal-qtip',
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return array
167 167
 	 */
168
-	public function styles( $min = '' ) {
168
+	public function styles($min = '') {
169 169
 		return array(
170 170
 			'simcal-default-calendar-list' => array(
171
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
171
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
172 172
 				'media' => 'all',
173 173
 			),
174 174
 		);
@@ -183,49 +183,49 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$calendar = $this->calendar;
185 185
 
186
-		if ( $calendar instanceof Default_Calendar ) {
186
+		if ($calendar instanceof Default_Calendar) {
187 187
 
188
-			$disabled = $calendar->static === true || empty( $calendar->events ) ? ' disabled="disabled"' : '';
188
+			$disabled = $calendar->static === true || empty($calendar->events) ? ' disabled="disabled"' : '';
189 189
 
190 190
 
191
-			$hide_header = get_post_meta( $this->calendar->id, '_default_calendar_list_header', true ) == 'yes' ? true : false;
192
-			$static_calendar = get_post_meta( $this->calendar->id, '_calendar_is_static', true ) == 'yes' ? true : false;
191
+			$hide_header = get_post_meta($this->calendar->id, '_default_calendar_list_header', true) == 'yes' ? true : false;
192
+			$static_calendar = get_post_meta($this->calendar->id, '_calendar_is_static', true) == 'yes' ? true : false;
193 193
 
194 194
 			$header_class = '';
195 195
 			$compact_list_class = $calendar->compact_list ? 'simcal-calendar-list-compact' : '';
196 196
 
197
-			edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id );
197
+			edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id);
198 198
 
199
-			echo '<div class="simcal-calendar-list ' . $compact_list_class . '">';
199
+			echo '<div class="simcal-calendar-list '.$compact_list_class.'">';
200 200
 
201
-			if ( ! $hide_header && ! $static_calendar ) {
202
-				echo '<nav class="simcal-calendar-head">' . "\n";
201
+			if ( ! $hide_header && ! $static_calendar) {
202
+				echo '<nav class="simcal-calendar-head">'."\n";
203 203
 
204
-				echo "\t" . '<div class="simcal-nav">' . "\n";
205
-				echo "\t\t" . '<button class="simcal-nav-button simcal-prev" title="' . __('Previous', 'google-calendar-events') . '"' . $disabled . '>' . "\n";
206
-				echo "\t\t\t" . '<i class="simcal-icon-left"></i>' . "\n";
207
-				echo "\t\t" . '</button>' . "\n";
208
-				echo "\t" . '</div>' . "\n";
204
+				echo "\t".'<div class="simcal-nav">'."\n";
205
+				echo "\t\t".'<button class="simcal-nav-button simcal-prev" title="'.__('Previous', 'google-calendar-events').'"'.$disabled.'>'."\n";
206
+				echo "\t\t\t".'<i class="simcal-icon-left"></i>'."\n";
207
+				echo "\t\t".'</button>'."\n";
208
+				echo "\t".'</div>'."\n";
209 209
 
210
-				if ( $hide_header ) {
210
+				if ($hide_header) {
211 211
 					$header_class = 'simcal-hide-header';
212 212
 				}
213 213
 
214 214
 
215
-				echo "\t" . '<div class="simcal-nav simcal-current ' . $header_class . '" data-calendar-current="' . $calendar->start . '">' . "\n";
216
-				echo "\t\t" . '<h3 class="simcal-current-label"> </h3>' . "\n";
217
-				echo "\t" . '</div>' . "\n";
215
+				echo "\t".'<div class="simcal-nav simcal-current '.$header_class.'" data-calendar-current="'.$calendar->start.'">'."\n";
216
+				echo "\t\t".'<h3 class="simcal-current-label"> </h3>'."\n";
217
+				echo "\t".'</div>'."\n";
218 218
 
219
-				echo "\t" . '<div class="simcal-nav">';
220
-				echo "\t\t" . '<button class="simcal-nav-button simcal-next" title="' . __('Next', 'google-calendar-events') . '"' . $disabled . '>';
221
-				echo "\t\t\t" . '<i class="simcal-icon-right"></i>' . "\n";
222
-				echo "\t\t" . '</button>' . "\n";
223
-				echo "\t" . '</div>' . "\n";
219
+				echo "\t".'<div class="simcal-nav">';
220
+				echo "\t\t".'<button class="simcal-nav-button simcal-next" title="'.__('Next', 'google-calendar-events').'"'.$disabled.'>';
221
+				echo "\t\t\t".'<i class="simcal-icon-right"></i>'."\n";
222
+				echo "\t\t".'</button>'."\n";
223
+				echo "\t".'</div>'."\n";
224 224
 
225
-				echo '</nav>' . "\n";
225
+				echo '</nav>'."\n";
226 226
 			}
227 227
 
228
-			echo $this->draw_list( $calendar->start );
228
+			echo $this->draw_list($calendar->start);
229 229
 
230 230
 			echo '<div class="simcal-ajax-loader simcal-spinner-top" style="display: none;"><i class="simcal-icon-spinner simcal-icon-spin"></i></div>';
231 231
 
@@ -245,92 +245,92 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @return array
247 247
 	 */
248
-	private function get_events( $timestamp ) {
248
+	private function get_events($timestamp) {
249 249
 
250 250
 		$calendar = $this->calendar;
251 251
 
252
-		if ( ! $calendar->group_type || ! $calendar->group_span ) {
252
+		if ( ! $calendar->group_type || ! $calendar->group_span) {
253 253
 			return array();
254 254
 		}
255 255
 
256 256
 		// Need to pass in timezone here to get beginning of day.
257
-		$current = Carbon::createFromTimestamp( $timestamp, $calendar->timezone );
257
+		$current = Carbon::createFromTimestamp($timestamp, $calendar->timezone);
258 258
 		$prev = clone $current;
259 259
 		$next = clone $current;
260 260
 
261 261
 		$this->start = $timestamp;
262 262
 
263
-		$interval = $span = max( absint( $calendar->group_span ), 1 );
264
-
265
-		if ( 'monthly' == $calendar->group_type ) {
266
-			$this->prev = $prev->subMonths( $span )->getTimestamp();
267
-			$this->next = $next->addMonths( $span )->getTimestamp();
268
-		} elseif ( 'weekly' == $calendar->group_type ) {
269
-			$week = new Carbon( $calendar->timezone );
270
-			$week->setTimestamp( $timestamp );
271
-			$week->setWeekStartsAt( $calendar->week_starts );
272
-			$this->prev = $prev->subWeeks( $span )->getTimestamp();
273
-			$this->next = $next->addWeeks( $span )->getTimestamp();
274
-		} elseif ( 'daily' == $calendar->group_type ) {
275
-			$this->prev = $prev->subDays( $span )->getTimestamp();
276
-			$this->next = $next->addDays( $span )->getTimestamp();
263
+		$interval = $span = max(absint($calendar->group_span), 1);
264
+
265
+		if ('monthly' == $calendar->group_type) {
266
+			$this->prev = $prev->subMonths($span)->getTimestamp();
267
+			$this->next = $next->addMonths($span)->getTimestamp();
268
+		} elseif ('weekly' == $calendar->group_type) {
269
+			$week = new Carbon($calendar->timezone);
270
+			$week->setTimestamp($timestamp);
271
+			$week->setWeekStartsAt($calendar->week_starts);
272
+			$this->prev = $prev->subWeeks($span)->getTimestamp();
273
+			$this->next = $next->addWeeks($span)->getTimestamp();
274
+		} elseif ('daily' == $calendar->group_type) {
275
+			$this->prev = $prev->subDays($span)->getTimestamp();
276
+			$this->next = $next->addDays($span)->getTimestamp();
277 277
 		}
278 278
 
279 279
 		$events = $calendar->events;
280 280
 		$daily_events = $paged_events = $flattened_events = array();
281 281
 
282
-		if ( 'events' != $calendar->group_type ) {
282
+		if ('events' != $calendar->group_type) {
283 283
 
284
-			$this->end   = $this->next - 1;
284
+			$this->end = $this->next - 1;
285 285
 
286
-			$timestamps   = array_keys( $events );
287
-			$lower_bound  = array_filter( $timestamps,  array( $this, 'filter_events_before' ) );
288
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after'  ) );
286
+			$timestamps   = array_keys($events);
287
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
288
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
289 289
 
290
-			if ( is_array( $higher_bound ) && !empty( $higher_bound ) ) {
291
-				$filtered = array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) );
292
-				foreach ( $filtered as $timestamp => $events ) {
293
-					$paged_events[ intval( $timestamp ) ] = $events;
290
+			if (is_array($higher_bound) && ! empty($higher_bound)) {
291
+				$filtered = array_intersect_key($events, array_combine($higher_bound, $higher_bound));
292
+				foreach ($filtered as $timestamp => $events) {
293
+					$paged_events[intval($timestamp)] = $events;
294 294
 				}
295 295
 			}
296 296
 
297 297
 		} else {
298 298
 
299
-			foreach ( $events as $timestamp => $e ) {
299
+			foreach ($events as $timestamp => $e) {
300 300
 				$second = 0;
301
-				foreach ( $e as $event ) {
302
-					$flattened_events[ intval( $timestamp + $second ) ][] = $event;
301
+				foreach ($e as $event) {
302
+					$flattened_events[intval($timestamp + $second)][] = $event;
303 303
 					$second++;
304 304
 				}
305 305
 			}
306 306
 
307
-			ksort( $flattened_events, SORT_NUMERIC );
307
+			ksort($flattened_events, SORT_NUMERIC);
308 308
 
309
-			$keys  = array_keys( $flattened_events );
309
+			$keys = array_keys($flattened_events);
310 310
 			$current = 0;
311
-			foreach ( $keys as $timestamp ) {
312
-				if ( $timestamp < $this->start ) {
311
+			foreach ($keys as $timestamp) {
312
+				if ($timestamp < $this->start) {
313 313
 					$current++;
314 314
 				}
315 315
 			}
316 316
 
317
-			$paged_events = array_slice( $flattened_events, $current, $interval, true );
317
+			$paged_events = array_slice($flattened_events, $current, $interval, true);
318 318
 
319
-			$events_end = isset( $keys[ $current + $interval ] ) ? $keys[ $current + $interval ] : $calendar->end;
319
+			$events_end = isset($keys[$current + $interval]) ? $keys[$current + $interval] : $calendar->end;
320 320
 			$this->end  = $events_end > $calendar->end ? $calendar->end : $events_end;
321 321
 
322
-			$this->prev = isset( $keys[ $current - $interval ] ) ? $keys[ $current - $interval ] : $calendar->earliest_event;
323
-			$this->next = isset( $keys[ $current + $interval ] ) ? $keys[ $current + $interval ] : $this->end;
322
+			$this->prev = isset($keys[$current - $interval]) ? $keys[$current - $interval] : $calendar->earliest_event;
323
+			$this->next = isset($keys[$current + $interval]) ? $keys[$current + $interval] : $this->end;
324 324
 
325 325
 		}
326 326
 
327 327
 		// Put resulting events in an associative array, with Ymd date as key for easy retrieval in calendar days loop.
328 328
 
329
-		foreach ( $paged_events as $timestamp => $events ) {
329
+		foreach ($paged_events as $timestamp => $events) {
330 330
 
331 331
 			// TODO First $paged_events item timestamp 1 second off? Plus or minus?
332 332
 
333
-			if ( $timestamp <= $this->end ) {
333
+			if ($timestamp <= $this->end) {
334 334
 
335 335
 				// TODO Could go back to using Carbon to be consistent.
336 336
 				// $date is off by a couple hours for dates in multi-day event, but not for first event.
@@ -349,34 +349,34 @@  discard block
 block discarded – undo
349 349
 
350 350
 				// Using native PHP 5.3+ (not Carbon) here.
351 351
 				// Offset value after first day same behavior as Carbon above still.
352
-				$dtz = new \DateTimeZone( $calendar->timezone );
352
+				$dtz = new \DateTimeZone($calendar->timezone);
353 353
 
354
-				$date = \DateTime::createFromFormat( 'U', $timestamp );
354
+				$date = \DateTime::createFromFormat('U', $timestamp);
355 355
 
356 356
 				// Doesn't seem to make a difference omitting timezone.
357 357
 				//$date = \DateTime::createFromFormat( 'U', $timestamp, $dtz );
358 358
 
359 359
 				// Add offset to timestamp to get correct date.
360 360
 				// TODO Need to add +1 second also?
361
-				$offset = $dtz->getOffset( $date );
361
+				$offset = $dtz->getOffset($date);
362 362
 				$date_offset = clone $date;
363
-				$date_offset->add( \DateInterval::createFromDateString( $offset . ' seconds' ) );
363
+				$date_offset->add(\DateInterval::createFromDateString($offset.' seconds'));
364 364
 
365 365
 				// TODO Multiple day events will be off if part-way through there's daylight savings.
366 366
 
367
-				$dateYmd = $date_offset->format( 'Ymd' );
368
-				$daily_events[ intval( $dateYmd ) ][] = $events;
367
+				$dateYmd = $date_offset->format('Ymd');
368
+				$daily_events[intval($dateYmd)][] = $events;
369 369
 			}
370 370
 		}
371 371
 
372
-		ksort( $daily_events, SORT_NUMERIC );
372
+		ksort($daily_events, SORT_NUMERIC);
373 373
 
374
-		if ( ! empty( $paged_events ) ) {
375
-			$first_event       = array_slice( $paged_events, 0, 1, true );
376
-			$first_event       = array_pop( $first_event );
374
+		if ( ! empty($paged_events)) {
375
+			$first_event       = array_slice($paged_events, 0, 1, true);
376
+			$first_event       = array_pop($first_event);
377 377
 			$this->first_event = $first_event[0]->start;
378 378
 
379
-			$last_event       = array_pop( $paged_events );
379
+			$last_event       = array_pop($paged_events);
380 380
 			$this->last_event = $last_event[0]->start;
381 381
 		}
382 382
 
@@ -396,84 +396,84 @@  discard block
 block discarded – undo
396 396
 	private function get_heading() {
397 397
 
398 398
 		$calendar = $this->calendar;
399
-		$start = Carbon::createFromTimestamp( $calendar->start, $calendar->timezone );
400
-		$end = Carbon::createFromTimestamp( $this->end, $calendar->timezone );
399
+		$start = Carbon::createFromTimestamp($calendar->start, $calendar->timezone);
400
+		$end = Carbon::createFromTimestamp($this->end, $calendar->timezone);
401 401
 		$date_format = $this->calendar->date_format;
402
-		$date_order  = simcal_get_date_format_order( $date_format );
402
+		$date_order  = simcal_get_date_format_order($date_format);
403 403
 
404
-		if ( $this->first_event !== 0 ) {
405
-			$start = Carbon::createFromTimestamp( $this->first_event, $calendar->timezone );
404
+		if ($this->first_event !== 0) {
405
+			$start = Carbon::createFromTimestamp($this->first_event, $calendar->timezone);
406 406
 		}
407 407
 
408
-		if ( $this->last_event !== 0 ) {
409
-			$end = Carbon::createFromTimestamp( $this->last_event, $calendar->timezone );
408
+		if ($this->last_event !== 0) {
409
+			$end = Carbon::createFromTimestamp($this->last_event, $calendar->timezone);
410 410
 		}
411 411
 
412
-		$st = strtotime( $start->toDateTimeString() );
413
-		$et = strtotime( $end->toDateTimeString() );
412
+		$st = strtotime($start->toDateTimeString());
413
+		$et = strtotime($end->toDateTimeString());
414 414
 
415 415
 		// TODO Is logic here causing the weird "29 Oct, 2016" format when navigating?
416 416
 
417
-		if ( ( $start->day == $end->day ) && ( $start->month == $end->month ) && ( $start->year == $end->year ) ) {
417
+		if (($start->day == $end->day) && ($start->month == $end->month) && ($start->year == $end->year)) {
418 418
 			// Start and end on the same day.
419 419
 			// e.g. 1 February 2020
420
-			$large = $small = date_i18n( $calendar->date_format , $st );
421
-			if ( ( $date_order['d'] !== false ) && ( $date_order['m'] !== false ) ) {
422
-				if ( $date_order['m'] > $date_order['d'] ) {
423
-					if ( $date_order['y'] !== false && $date_order['y'] > $date_order['m'] ) {
424
-						$small = date_i18n( 'Y, d M', $st );
420
+			$large = $small = date_i18n($calendar->date_format, $st);
421
+			if (($date_order['d'] !== false) && ($date_order['m'] !== false)) {
422
+				if ($date_order['m'] > $date_order['d']) {
423
+					if ($date_order['y'] !== false && $date_order['y'] > $date_order['m']) {
424
+						$small = date_i18n('Y, d M', $st);
425 425
 					} else {
426
-						$small = date_i18n( 'd M Y', $st );
426
+						$small = date_i18n('d M Y', $st);
427 427
 					}
428 428
 				} else {
429
-					if ( $date_order['y'] !== false && $date_order['y'] > $date_order['m'] ) {
430
-						$small = date_i18n( 'Y, M d', $st );
429
+					if ($date_order['y'] !== false && $date_order['y'] > $date_order['m']) {
430
+						$small = date_i18n('Y, M d', $st);
431 431
 					} else {
432
-						$small = date_i18n( 'M d Y', $st );
432
+						$small = date_i18n('M d Y', $st);
433 433
 					}
434 434
 				}
435 435
 			}
436
-		} elseif ( ( $start->month == $end->month ) && ( $start->year == $end->year ) ) {
436
+		} elseif (($start->month == $end->month) && ($start->year == $end->year)) {
437 437
 			// Start and end days on the same month.
438 438
 			// e.g. August 2020
439
-			if ( $date_order['y'] === false ) {
439
+			if ($date_order['y'] === false) {
440 440
 				// August.
441
-				$large = $small = date_i18n( 'F', $st );
441
+				$large = $small = date_i18n('F', $st);
442 442
 			} else {
443
-				if ( $date_order['y'] < $date_order['m'] ) {
443
+				if ($date_order['y'] < $date_order['m']) {
444 444
 					// 2020 August.
445
-					$large = date_i18n( 'Y F', $st );
446
-					$small = date_i18n( 'Y M', $st );
445
+					$large = date_i18n('Y F', $st);
446
+					$small = date_i18n('Y M', $st);
447 447
 				} else {
448 448
 					// August 2020.
449
-					$large = date_i18n( 'F Y', $st );
450
-					$small = date_i18n( 'M Y', $st );
449
+					$large = date_i18n('F Y', $st);
450
+					$small = date_i18n('M Y', $st);
451 451
 				}
452 452
 			}
453
-		} elseif ( $start->year == $end->year ) {
453
+		} elseif ($start->year == $end->year) {
454 454
 			// Start and end days on months of the same year.
455 455
 			// e.g. August - September 2020
456
-			if ( $date_order['y'] === false ) {
456
+			if ($date_order['y'] === false) {
457 457
 				// August - September.
458
-				$large = date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et );
459
-				$small = date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et );
458
+				$large = date_i18n('F', $st).' - '.date_i18n('F', $et);
459
+				$small = date_i18n('M', $st).' - '.date_i18n('M', $et);
460 460
 			} else {
461
-				if ( $date_order['y'] < $date_order['m'] ) {
461
+				if ($date_order['y'] < $date_order['m']) {
462 462
 					// 2020, August - September.
463
-					$large  = $small = date( 'Y', $st ) . ', ';
464
-					$large .= date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et );
465
-					$small .= date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et );
463
+					$large  = $small = date('Y', $st).', ';
464
+					$large .= date_i18n('F', $st).' - '.date_i18n('F', $et);
465
+					$small .= date_i18n('M', $st).' - '.date_i18n('M', $et);
466 466
 				} else {
467 467
 					// August - September, 2020.
468
-					$large  = date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et ) . ', ';
469
-					$small  = date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et ) . ' ';
470
-					$year   = date( 'Y', $st );
468
+					$large  = date_i18n('F', $st).' - '.date_i18n('F', $et).', ';
469
+					$small  = date_i18n('M', $st).' - '.date_i18n('M', $et).' ';
470
+					$year   = date('Y', $st);
471 471
 					$large .= $year;
472 472
 					$small .= $year;
473 473
 				}
474 474
 			}
475 475
 		} else {
476
-			$large = $small = date( 'Y', $st ) . ' - ' . date( 'Y', $et );
476
+			$large = $small = date('Y', $st).' - '.date('Y', $et);
477 477
 		}
478 478
 
479 479
 		return array(
@@ -495,43 +495,43 @@  discard block
 block discarded – undo
495 495
 	 *
496 496
 	 * @return string
497 497
 	 */
498
-	private function draw_list( $timestamp, $id = 0 ) {
498
+	private function draw_list($timestamp, $id = 0) {
499 499
 
500 500
 		$calendar = $this->calendar;
501 501
 
502
-		if ( empty( $calendar ) ) {
503
-			$calendar = $this->calendar = simcal_get_calendar( intval( $id ) );
504
-			if ( ! $calendar instanceof Default_Calendar ) {
502
+		if (empty($calendar)) {
503
+			$calendar = $this->calendar = simcal_get_calendar(intval($id));
504
+			if ( ! $calendar instanceof Default_Calendar) {
505 505
 				return '';
506 506
 			}
507 507
 		}
508 508
 
509 509
 		$now = $calendar->now;
510
-		$current_events = $this->get_events( $timestamp );
510
+		$current_events = $this->get_events($timestamp);
511 511
 		$format = $calendar->date_format;
512 512
 
513 513
 		ob_start();
514 514
 
515 515
 		// Draw the events.
516 516
 
517
-		$block_tag = $calendar->compact_list && ! empty( $current_events ) ? 'div' : 'dl';
517
+		$block_tag = $calendar->compact_list && ! empty($current_events) ? 'div' : 'dl';
518 518
 
519 519
 		$data_heading = '';
520 520
 		$heading = $this->get_heading();
521
-		foreach ( $heading as $k => $v ) {
522
-			$data_heading .= ' data-heading-' . $k . '="' . $v . '"';
521
+		foreach ($heading as $k => $v) {
522
+			$data_heading .= ' data-heading-'.$k.'="'.$v.'"';
523 523
 		}
524 524
 
525
-		echo '<' . $block_tag . ' class="simcal-events-list-container"' .
526
-			' data-prev="' . $this->prev . '"' .
527
-			' data-next="' . $this->next . '"' .
528
-			$data_heading . '>';
525
+		echo '<'.$block_tag.' class="simcal-events-list-container"'.
526
+			' data-prev="'.$this->prev.'"'.
527
+			' data-next="'.$this->next.'"'.
528
+			$data_heading.'>';
529 529
 
530
-		if ( ! empty( $current_events ) && is_array( $current_events ) ) :
530
+		if ( ! empty($current_events) && is_array($current_events)) :
531 531
 
532 532
 			$last_event = null;
533 533
 
534
-			foreach ( $current_events as $ymd => $events ) :
534
+			foreach ($current_events as $ymd => $events) :
535 535
 
536 536
 				// This is where we can find out if an event is a multi-day event and if it needs to be shown.
537 537
 				// Since this is for list view we are showing the event on the day viewed if it is part of that day even when
@@ -539,20 +539,20 @@  discard block
 block discarded – undo
539 539
 
540 540
 				$first_event = $events[0][0];
541 541
 
542
-				if ( isset( $first_event->multiple_days ) && $first_event->multiple_days > 0 ) {
542
+				if (isset($first_event->multiple_days) && $first_event->multiple_days > 0) {
543 543
 
544
-					if ( 'current_day_only' == get_post_meta( $calendar->id, '_default_calendar_expand_multi_day_events', true ) ) {
544
+					if ('current_day_only' == get_post_meta($calendar->id, '_default_calendar_expand_multi_day_events', true)) {
545 545
 
546
-						$year  = substr( $ymd, 0, 4 );
547
-						$month = substr( $ymd, 4, 2 );
548
-						$day   = substr( $ymd, 6, 2 );
546
+						$year  = substr($ymd, 0, 4);
547
+						$month = substr($ymd, 4, 2);
548
+						$day   = substr($ymd, 6, 2);
549 549
 
550
-						$temp_date = Carbon::createFromDate( $year, $month, $day );
550
+						$temp_date = Carbon::createFromDate($year, $month, $day);
551 551
 
552
-						if ( ! ( $temp_date < Carbon::now()->endOfDay() ) ) {
552
+						if ( ! ($temp_date < Carbon::now()->endOfDay())) {
553 553
 
554 554
 							// Break here only if event already shown once.
555
-							if ( $last_event == $first_event ) {
555
+							if ($last_event == $first_event) {
556 556
 								continue;
557 557
 							} else {
558 558
 								// Save event as "last" for next time through, then break.
@@ -563,139 +563,139 @@  discard block
 block discarded – undo
563 563
 				}
564 564
 
565 565
 				// Add offset offset for list view day headings.
566
-				$day_date = Carbon::createFromFormat( 'Ymd', $ymd, $calendar->timezone );
566
+				$day_date = Carbon::createFromFormat('Ymd', $ymd, $calendar->timezone);
567 567
 				$day_date_offset = clone $day_date;
568
-				$day_date_offset->addSeconds( $day_date->offset );
568
+				$day_date_offset->addSeconds($day_date->offset);
569 569
 				$day_date_ts_offset = $day_date_offset->timestamp;
570 570
 
571
-				if ( ! $calendar->compact_list ) {
572
-					if ( $day_date_offset->isToday() ) {
573
-						$the_color = new Color( $calendar->today_color );
571
+				if ( ! $calendar->compact_list) {
572
+					if ($day_date_offset->isToday()) {
573
+						$the_color = new Color($calendar->today_color);
574 574
 					} else {
575
-						$the_color = new Color( $calendar->days_events_color );
575
+						$the_color = new Color($calendar->days_events_color);
576 576
 					}
577 577
 
578
-					$bg_color     = '#' . $the_color->getHex();
578
+					$bg_color     = '#'.$the_color->getHex();
579 579
 					$color        = $the_color->isDark() ? '#ffffff' : '#000000';
580
-					$border_style = ' style="border-bottom: 1px solid ' . $bg_color . ';" ';
581
-					$bg_style     = ' style="background-color: ' . $bg_color . '; color: ' . $color . ';"';
580
+					$border_style = ' style="border-bottom: 1px solid '.$bg_color.';" ';
581
+					$bg_style     = ' style="background-color: '.$bg_color.'; color: '.$color.';"';
582 582
 
583
-					echo "\t" . '<dt class="simcal-day-label"' . $border_style . '>';
584
-					echo '<span' . $bg_style . '>';
583
+					echo "\t".'<dt class="simcal-day-label"'.$border_style.'>';
584
+					echo '<span'.$bg_style.'>';
585 585
 
586
-					echo $format ? '<span class="simcal-date-format" data-date-format="' . $format . '">' . date_i18n( $format, $day_date_ts_offset, strtotime( $day_date_offset->toDateTimeString() ) ) . '</span> ' : ' ';
586
+					echo $format ? '<span class="simcal-date-format" data-date-format="'.$format.'">'.date_i18n($format, $day_date_ts_offset, strtotime($day_date_offset->toDateTimeString())).'</span> ' : ' ';
587 587
 
588 588
 					echo '</span>';
589
-					echo '</dt>' . "\n";
589
+					echo '</dt>'."\n";
590 590
 				}
591 591
 
592
-				$list_events = '<ul class="simcal-events">' . "\n";
592
+				$list_events = '<ul class="simcal-events">'."\n";
593 593
 
594 594
 				$calendar_classes = array();
595 595
 
596 596
 				// Add day of week number to CSS class.
597
-				$day_classes = 'simcal-weekday-' . date( 'w', $day_date_ts_offset );
597
+				$day_classes = 'simcal-weekday-'.date('w', $day_date_ts_offset);
598 598
 
599 599
 				// Is this the present, the past or the future, Doc?
600
-				if ( $timestamp <= $now && $timestamp >= $now ) {
600
+				if ($timestamp <= $now && $timestamp >= $now) {
601 601
 					$day_classes .= ' simcal-today simcal-present simcal-day';
602
-				} elseif ( $timestamp < $now ) {
602
+				} elseif ($timestamp < $now) {
603 603
 					$day_classes .= ' simcal-past simcal-day';
604
-				} elseif ( $this->end > $now ) {
604
+				} elseif ($this->end > $now) {
605 605
 					$day_classes .= ' simcal-future simcal-day';
606 606
 				}
607 607
 
608 608
 				$count = 0;
609 609
 
610
-				foreach ( $events as $day_events ) :
611
-					foreach ( $day_events as $event ) :
610
+				foreach ($events as $day_events) :
611
+					foreach ($day_events as $event) :
612 612
 
613
-						if ( $event instanceof Event ) :
613
+						if ($event instanceof Event) :
614 614
 
615 615
 							$event_classes = $event_visibility = '';
616 616
 
617
-							$calendar_class     = 'simcal-events-calendar-' . strval( $event->calendar );
617
+							$calendar_class     = 'simcal-events-calendar-'.strval($event->calendar);
618 618
 							$calendar_classes[] = $calendar_class;
619 619
 
620 620
 							$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
621 621
 							$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
622 622
 
623
-							$event_classes .= 'simcal-event ' . $recurring . $has_location . $calendar_class;
623
+							$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class;
624 624
 
625 625
 							// Toggle some events visibility if more than optional limit.
626
-							if ( ( $calendar->events_limit > - 1 ) && ( $count >= $calendar->events_limit ) ) :
626
+							if (($calendar->events_limit > - 1) && ($count >= $calendar->events_limit)) :
627 627
 								$event_classes .= ' simcal-event-toggled';
628 628
 								$event_visibility = ' style="display: none"';
629 629
 							endif;
630 630
 
631 631
 							$event_color = $event->get_color();
632
-							if ( ! empty( $event_color ) ) {
632
+							if ( ! empty($event_color)) {
633 633
 								$side = is_rtl() ? 'right' : 'left';
634
-								$event_color = ' style="border-' . $side . ': 4px solid ' . $event_color . '; padding-' . $side . ': 8px;"';
634
+								$event_color = ' style="border-'.$side.': 4px solid '.$event_color.'; padding-'.$side.': 8px;"';
635 635
 							}
636 636
 
637
-							$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . $event_color . ' itemscope itemtype="http://schema.org/Event" data-start="' . esc_attr( $event->start ) . '">' . "\n";
638
-							$list_events .= "\t\t" . '<div class="simcal-event-details">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
639
-							$list_events .= "\t" . '</li>' . "\n";
637
+							$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.$event_color.' itemscope itemtype="http://schema.org/Event" data-start="'.esc_attr($event->start).'">'."\n";
638
+							$list_events .= "\t\t".'<div class="simcal-event-details">'.$calendar->get_event_html($event).'</div>'."\n";
639
+							$list_events .= "\t".'</li>'."\n";
640 640
 
641
-							$count ++;
641
+							$count++;
642 642
 
643 643
 							// Event falls within today.
644
-							if ( ( $this->end <= $now ) && ( $this->start >= $now ) ) :
644
+							if (($this->end <= $now) && ($this->start >= $now)) :
645 645
 								$day_classes .= ' simcal-today-has-events';
646 646
 							endif;
647
-							$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
647
+							$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
648 648
 
649
-							if ( $calendar_classes ) :
650
-								$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
649
+							if ($calendar_classes) :
650
+								$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
651 651
 							endif;
652 652
 
653 653
 						endif;
654 654
 					endforeach;
655 655
 				endforeach;
656 656
 
657
-				$list_events .= '</ul>' . "\n";
657
+				$list_events .= '</ul>'."\n";
658 658
 
659 659
 				// If events visibility is limited, print the button toggle.
660
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
660
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
661 661
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
662 662
 				endif;
663 663
 
664 664
 				// Print final list of events for the current day.
665 665
 				$tag = $calendar->compact_list ? 'div' : 'dd';
666
-				echo '<'  . $tag . ' class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
667
-				echo "\t" . $list_events . "\n";
668
-				echo '</' . $tag . '>' . "\n";
666
+				echo '<'.$tag.' class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
667
+				echo "\t".$list_events."\n";
668
+				echo '</'.$tag.'>'."\n";
669 669
 
670 670
 			endforeach;
671 671
 
672 672
 		else :
673 673
 
674
-			echo "\t" . '<p>';
674
+			echo "\t".'<p>';
675 675
 
676
-			$message = get_post_meta( $calendar->id, '_no_events_message', true );
676
+			$message = get_post_meta($calendar->id, '_no_events_message', true);
677 677
 
678
-			if ( 'events' == $calendar->group_type ) {
679
-				echo ! empty( $message ) ? $message : __( 'There are no upcoming events.', 'google-calendar-events' );
678
+			if ('events' == $calendar->group_type) {
679
+				echo ! empty($message) ? $message : __('There are no upcoming events.', 'google-calendar-events');
680 680
 			} else {
681
-				if ( ! empty( $message ) ) {
681
+				if ( ! empty($message)) {
682 682
 					echo $message;
683 683
 				} else {
684
-					$from = Carbon::createFromTimestamp( $this->start, $calendar->timezone )->getTimestamp();
685
-					$to = Carbon::createFromTimestamp( $this->end, $calendar->timezone )->getTimestamp();
686
-					echo apply_filters( 'simcal_no_events_message', sprintf(
687
-						__( 'Nothing from %1$s to %2$s.', 'google-calendar-events' ),
688
-						date_i18n( $calendar->date_format, $from ),
689
-						date_i18n( $calendar->date_format, $to )
690
-					), $calendar->id, $from, $to );
684
+					$from = Carbon::createFromTimestamp($this->start, $calendar->timezone)->getTimestamp();
685
+					$to = Carbon::createFromTimestamp($this->end, $calendar->timezone)->getTimestamp();
686
+					echo apply_filters('simcal_no_events_message', sprintf(
687
+						__('Nothing from %1$s to %2$s.', 'google-calendar-events'),
688
+						date_i18n($calendar->date_format, $from),
689
+						date_i18n($calendar->date_format, $to)
690
+					), $calendar->id, $from, $to);
691 691
 				}
692 692
 			}
693 693
 
694
-			echo "\t" . '</p>' . "\n";
694
+			echo "\t".'</p>'."\n";
695 695
 
696 696
 		endif;
697 697
 
698
-		echo '</' . $block_tag . '>';
698
+		echo '</'.$block_tag.'>';
699 699
 
700 700
 		return ob_get_clean();
701 701
 	}
@@ -707,16 +707,16 @@  discard block
 block discarded – undo
707 707
 	 */
708 708
 	public function draw_list_ajax() {
709 709
 
710
-		if ( isset( $_POST['ts'] ) && isset( $_POST['id'] ) ) {
710
+		if (isset($_POST['ts']) && isset($_POST['id'])) {
711 711
 
712
-			$ts = absint( $_POST['ts'] );
713
-			$id = absint( $_POST['id'] );
712
+			$ts = absint($_POST['ts']);
713
+			$id = absint($_POST['id']);
714 714
 
715
-			wp_send_json_success( $this->draw_list( $ts, $id ) );
715
+			wp_send_json_success($this->draw_list($ts, $id));
716 716
 
717 717
 		} else {
718 718
 
719
-			wp_send_json_error( 'Missing arguments in default calendar list ajax request.' );
719
+			wp_send_json_error('Missing arguments in default calendar list ajax request.');
720 720
 
721 721
 		}
722 722
 	}
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
 	 *
732 732
 	 * @return bool
733 733
 	 */
734
-	private function filter_events_before( $event ) {
735
-		return intval( $event ) >= intval( $this->start );
734
+	private function filter_events_before($event) {
735
+		return intval($event) >= intval($this->start);
736 736
 	}
737 737
 
738 738
 	/**
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
 	 *
746 746
 	 * @return bool
747 747
 	 */
748
-	private function filter_events_after( $event ) {
749
-		return intval( $event ) < intval( $this->end );
748
+	private function filter_events_after($event) {
749
+		return intval($event) < intval($this->end);
750 750
 	}
751 751
 
752 752
 }
Please login to merge, or discard this patch.
includes/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.