Completed
Push — master ( e47c17...035b95 )
by
unknown
04:49
created
includes/feeds/admin/google-admin.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 		return array(
83 83
 			'name' => $this->feed->name,
84 84
 			'description' => __( "To read events from your public Google Calendars you'll need create a Google API key and save it here.", 'google-calendar-events' ) .
85
-			                 '<br/><br/>' .
86
-			                 '<em style="font-size: 14px;">' .
87
-			                 sprintf( __( '<strong>Note:</strong> Calendars configured to use the <strong><a href="%s" target="_blank">Google Calendar Pro add-on</a></strong> use a different method of authorization.', 'google-calendar-events' ),
88
-				                 simcal_ga_campaign_url( simcal_get_url( 'gcal-pro' ), 'core-plugin', 'settings-link' )
89
-			                 ) .
90
-			                 '</em>',
85
+							 '<br/><br/>' .
86
+							 '<em style="font-size: 14px;">' .
87
+							 sprintf( __( '<strong>Note:</strong> Calendars configured to use the <strong><a href="%s" target="_blank">Google Calendar Pro add-on</a></strong> use a different method of authorization.', 'google-calendar-events' ),
88
+								 simcal_ga_campaign_url( simcal_get_url( 'gcal-pro' ), 'core-plugin', 'settings-link' )
89
+							 ) .
90
+							 '</em>',
91 91
 			'fields' => array(
92 92
 				'api_key' => array(
93 93
 					'type'       => 'standard',
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
 					'post'        => $post_id,
274 274
 					'dismissable' => false,
275 275
 					'content'     => '<p>' .
276
-					                 '<i class="simcal-icon-warning"></i> ' .
277
-					                 sprintf(
278
-						                 __( 'Your Google Calendar events will not show up until you <a href="%s">create and save a Google API key</a>.', 'google-calendar-events' ),
279
-						                 admin_url( 'edit.php?post_type=calendar&page=simple-calendar_settings&tab=feeds' )
280
-					                 ) .
281
-					                 '</p>',
276
+									 '<i class="simcal-icon-warning"></i> ' .
277
+									 sprintf(
278
+										 __( 'Your Google Calendar events will not show up until you <a href="%s">create and save a Google API key</a>.', 'google-calendar-events' ),
279
+										 admin_url( 'edit.php?post_type=calendar&page=simple-calendar_settings&tab=feeds' )
280
+									 ) .
281
+									 '</p>',
282 282
 				)
283 283
 			);
284 284
 
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 						'post'        => $post_id,
306 306
 						'dismissable' => false,
307 307
 						'content'     => '<p>' .
308
-						                 '<i class="simcal-icon-warning"></i> ' .
309
-						                 __( 'While trying to retrieve events, Google returned an error:', 'google-calendar-events' ) .
310
-						                 '<br>' . $message . '<br>' .
311
-						                 __( 'Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events' ) .
312
-						                 '</p>',
308
+										 '<i class="simcal-icon-warning"></i> ' .
309
+										 __( 'While trying to retrieve events, Google returned an error:', 'google-calendar-events' ) .
310
+										 '<br>' . $message . '<br>' .
311
+										 __( 'Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events' ) .
312
+										 '</p>',
313 313
 					)
314 314
 				);
315 315
 
Please login to merge, or discard this patch.
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use SimpleCalendar\Admin\Notice;
11 11
 use SimpleCalendar\Feeds\Google;
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param string $google_api_key
55 55
 	 * @param string $google_calendar_id
56 56
 	 */
57
-	public function __construct( Google $feed, $google_api_key, $google_calendar_id ) {
57
+	public function __construct(Google $feed, $google_api_key, $google_calendar_id) {
58 58
 
59 59
 		$this->feed = $feed;
60 60
 		$this->google_api_key = $google_api_key;
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 
63 63
 		$screen = simcal_is_admin_screen();
64 64
 
65
-		if ( 'calendar' == $screen ) {
66
-			$this->test_api_key_connection( $this->google_calendar_id );
67
-			add_filter( 'simcal_settings_meta_tabs_li', array( $this, 'add_settings_meta_tab_li' ), 10, 1 );
68
-			add_action( 'simcal_settings_meta_panels', array( $this, 'add_settings_meta_panel' ), 10, 1 );
65
+		if ('calendar' == $screen) {
66
+			$this->test_api_key_connection($this->google_calendar_id);
67
+			add_filter('simcal_settings_meta_tabs_li', array($this, 'add_settings_meta_tab_li'), 10, 1);
68
+			add_action('simcal_settings_meta_panels', array($this, 'add_settings_meta_panel'), 10, 1);
69 69
 		}
70 70
 
71
-		add_action( 'simcal_process_settings_meta', array( $this, 'process_meta' ), 10, 1 );
71
+		add_action('simcal_process_settings_meta', array($this, 'process_meta'), 10, 1);
72 72
 	}
73 73
 
74 74
 	/**
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
 	public function settings_fields() {
82 82
 		return array(
83 83
 			'name' => $this->feed->name,
84
-			'description' => __( "To read events from your public Google Calendars you'll need create a Google API key and save it here.", 'google-calendar-events' ) .
85
-			                 '<br/><br/>' .
86
-			                 '<em style="font-size: 14px;">' .
87
-			                 sprintf( __( '<strong>Note:</strong> Calendars configured to use the <strong><a href="%s" target="_blank">Google Calendar Pro add-on</a></strong> use a different method of authorization.', 'google-calendar-events' ),
88
-				                 simcal_ga_campaign_url( simcal_get_url( 'gcal-pro' ), 'core-plugin', 'settings-link' )
89
-			                 ) .
84
+			'description' => __("To read events from your public Google Calendars you'll need create a Google API key and save it here.", 'google-calendar-events').
85
+			                 '<br/><br/>'.
86
+			                 '<em style="font-size: 14px;">'.
87
+			                 sprintf(__('<strong>Note:</strong> Calendars configured to use the <strong><a href="%s" target="_blank">Google Calendar Pro add-on</a></strong> use a different method of authorization.', 'google-calendar-events'),
88
+				                 simcal_ga_campaign_url(simcal_get_url('gcal-pro'), 'core-plugin', 'settings-link')
89
+			                 ).
90 90
 			                 '</em>',
91 91
 			'fields' => array(
92 92
 				'api_key' => array(
93 93
 					'type'       => 'standard',
94 94
 					'subtype'    => 'text',
95
-					'class'      => array( 'simcal-wide-text regular-text', 'ltr' ),
96
-					'title'      => __( 'Google API Key', 'google-calendar-events' ),
97
-					'validation' => array( $this, 'check_google_api_key' ),
95
+					'class'      => array('simcal-wide-text regular-text', 'ltr'),
96
+					'title'      => __('Google API Key', 'google-calendar-events'),
97
+					'validation' => array($this, 'check_google_api_key'),
98 98
 				),
99 99
 			),
100 100
 		);
@@ -113,27 +113,27 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return true|string
115 115
 	 */
116
-	public function check_google_api_key( $api_key = '' ) {
116
+	public function check_google_api_key($api_key = '') {
117 117
 
118 118
 		$message    = '';
119 119
 		$has_errors = false;
120 120
 
121
-		if ( empty( $api_key ) ){
121
+		if (empty($api_key)) {
122 122
 			$api_key = $this->google_api_key;
123
-			if ( empty( $api_key ) ) {
124
-				$settings = get_option( 'simple-calendar_settings_feeds' );
125
-				$api_key = isset( $settings['google']['api_key'] ) ? esc_attr( $settings['google']['api_key'] ) : '';
123
+			if (empty($api_key)) {
124
+				$settings = get_option('simple-calendar_settings_feeds');
125
+				$api_key = isset($settings['google']['api_key']) ? esc_attr($settings['google']['api_key']) : '';
126 126
 			}
127 127
 		}
128 128
 
129
-		$message = '<p class="description">' .
130
-				   sprintf( __( '<a href="%s" target="_blank">Step-by-step instructions</a> ', 'google-calendar-events' ),
131
-					   simcal_ga_campaign_url( simcal_get_url( 'docs' ) . '/google-api-key/', 'core-plugin', 'settings-link' )
132
-				   ) .
133
-				   '<br/>' .
134
-				   sprintf( __( '<a href="%s" target="_blank">Google Developers Console</a> ', 'google-calendar-events' ),
135
-					   simcal_get_url( 'gdev-console' )
136
-				   ) .
129
+		$message = '<p class="description">'.
130
+				   sprintf(__('<a href="%s" target="_blank">Step-by-step instructions</a> ', 'google-calendar-events'),
131
+					   simcal_ga_campaign_url(simcal_get_url('docs').'/google-api-key/', 'core-plugin', 'settings-link')
132
+				   ).
133
+				   '<br/>'.
134
+				   sprintf(__('<a href="%s" target="_blank">Google Developers Console</a> ', 'google-calendar-events'),
135
+					   simcal_get_url('gdev-console')
136
+				   ).
137 137
 				   '</p>';
138 138
 
139 139
 		return $message;
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return array
150 150
 	 */
151
-	public function add_settings_meta_tab_li( $tabs ) {
152
-		return array_merge( $tabs, array(
151
+	public function add_settings_meta_tab_li($tabs) {
152
+		return array_merge($tabs, array(
153 153
 			'google' => array(
154 154
 				'label'   => $this->feed->name,
155 155
 				'target'  => 'google-settings-panel',
156
-				'class'   => array( 'simcal-feed-type', 'simcal-feed-type-google' ),
156
+				'class'   => array('simcal-feed-type', 'simcal-feed-type-google'),
157 157
 				'icon'    => 'simcal-icon-google',
158 158
 			),
159
-		) );
159
+		));
160 160
 	}
161 161
 
162 162
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @param int $post_id
168 168
 	 */
169
-	public function add_settings_meta_panel( $post_id ) {
169
+	public function add_settings_meta_panel($post_id) {
170 170
 
171 171
 		$inputs = array(
172 172
 			$this->feed->type => array(
@@ -175,30 +175,30 @@  discard block
 block discarded – undo
175 175
 					'subtype'     => 'text',
176 176
 					'name'        => '_google_calendar_id',
177 177
 					'id'          => '_google_calendar_id',
178
-					'title'       => __( 'Calendar ID', 'google-calendar-events' ),
179
-					'tooltip'     => __( 'Visit your Google Calendar account, copy your public calendar ID, then paste it here.', 'google-calendar-events' ),
180
-					'placeholder' => __( 'Enter a valid Google Calendar ID from a public calendar', 'google-calendar-events' ),
181
-					'escaping'    => array( $this->feed, 'esc_google_calendar_id' ),
182
-					'validation'  => array( $this, 'test_api_key_connection' ),
178
+					'title'       => __('Calendar ID', 'google-calendar-events'),
179
+					'tooltip'     => __('Visit your Google Calendar account, copy your public calendar ID, then paste it here.', 'google-calendar-events'),
180
+					'placeholder' => __('Enter a valid Google Calendar ID from a public calendar', 'google-calendar-events'),
181
+					'escaping'    => array($this->feed, 'esc_google_calendar_id'),
182
+					'validation'  => array($this, 'test_api_key_connection'),
183 183
 				),
184 184
 				'_google_events_search_query' => array(
185 185
 					'type'        => 'standard',
186 186
 					'subtype'     => 'text',
187 187
 					'name'        => '_google_events_search_query',
188 188
 					'id'          => '_google_events_search_query',
189
-					'title'       => __( 'Search Query', 'google-calendar-events' ),
190
-					'tooltip'     => __( 'Type in keywords if you only want display events that match these terms. You can use basic boolean search operators too.', 'google-calendar-events' ),
191
-					'placeholder' => __( 'Filter events to display by search terms...', 'google-calendar-events' ),
189
+					'title'       => __('Search Query', 'google-calendar-events'),
190
+					'tooltip'     => __('Type in keywords if you only want display events that match these terms. You can use basic boolean search operators too.', 'google-calendar-events'),
191
+					'placeholder' => __('Filter events to display by search terms...', 'google-calendar-events'),
192 192
 				),
193 193
 				'_google_events_recurring' => array(
194 194
 					'type'    => 'select',
195 195
 					'name'    => '_google_events_recurring',
196 196
 					'id'      => '_google_events_recurring',
197
-					'title'   => __( 'Recurring Events', 'google-calendar-events' ),
198
-					'tooltip' => __( 'Events that are programmed to repeat themselves periodically.', 'google-calendar-events' ),
197
+					'title'   => __('Recurring Events', 'google-calendar-events'),
198
+					'tooltip' => __('Events that are programmed to repeat themselves periodically.', 'google-calendar-events'),
199 199
 					'options' => array(
200
-						'show' => __( 'Show all', 'google-calendar-events' ),
201
-						'first-only' => __( 'Only show first occurrence', 'google-calendar-events' ),
200
+						'show' => __('Show all', 'google-calendar-events'),
201
+						'first-only' => __('Only show first occurrence', 'google-calendar-events'),
202 202
 					),
203 203
 				),
204 204
 				'_google_events_max_results' => array(
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 					'subtype'     => 'number',
207 207
 					'name'        => '_google_events_max_results',
208 208
 					'id'          => '_google_events_max_results',
209
-					'title'       => __( 'Maximum Events', 'google-calendar-events' ),
210
-					'tooltip'     => __( 'Google Calendar only allows to query for a maximum amount of 2500 events from a calendar each time.', 'google-calendar-events' ),
209
+					'title'       => __('Maximum Events', 'google-calendar-events'),
210
+					'tooltip'     => __('Google Calendar only allows to query for a maximum amount of 2500 events from a calendar each time.', 'google-calendar-events'),
211 211
 					'class'       => array(
212 212
 						'simcal-field-small',
213 213
 					),
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 		<div id="google-settings-panel" class="simcal-panel">
225 225
 			<table>
226 226
 				<thead>
227
-					<tr><th colspan="2"><?php _e( 'Google Calendar Settings', 'google-calendar-events' ); ?></th></tr>
227
+					<tr><th colspan="2"><?php _e('Google Calendar Settings', 'google-calendar-events'); ?></th></tr>
228 228
 				</thead>
229
-				<?php Settings::print_panel_fields( $inputs, $post_id ); ?>
229
+				<?php Settings::print_panel_fields($inputs, $post_id); ?>
230 230
 			</table>
231 231
 		</div>
232 232
 		<?php
@@ -242,47 +242,47 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return true|string
244 244
 	 */
245
-	public function test_api_key_connection( $google_calendar_id ) {
245
+	public function test_api_key_connection($google_calendar_id) {
246 246
 
247 247
 		global $post;
248 248
 
249
-		$post_id = isset( $post->ID ) ? $post->ID : 0;
249
+		$post_id = isset($post->ID) ? $post->ID : 0;
250 250
 		$feed = null;
251
-		if ( $feed_type = wp_get_object_terms( $post_id, 'calendar_feed' ) ) {
252
-			$feed = sanitize_title( current( $feed_type )->name );
251
+		if ($feed_type = wp_get_object_terms($post_id, 'calendar_feed')) {
252
+			$feed = sanitize_title(current($feed_type)->name);
253 253
 		}
254 254
 
255 255
 		$message = '';
256 256
 		$error = '';
257 257
 		$has_errors = false;
258 258
 
259
-		$message .= '<p class="description">' .
259
+		$message .= '<p class="description">'.
260 260
 					sprintf(
261
-						__( 'Step 1: Set the Google Calendar you want to use as <strong>"public."</strong> <a href="%1s" target="_blank">Detailed instructions</a>', 'google-calendar-events' ) . '<br />' .
262
-						__( 'Step 2: Copy and paste your Google Calendar ID here. <a href="%2s" target="_blank">Detailed instructions</a>', 'google-calendar-events' ),
263
-						simcal_ga_campaign_url( simcal_get_url( 'docs' ) . '/make-google-calendar-public/', 'core-plugin', 'settings-link' ),
264
-						simcal_ga_campaign_url( simcal_get_url( 'docs' ) . '/find-google-calendar-id/', 'core-plugin', 'settings-link' )
265
-					) . '</p>';
261
+						__('Step 1: Set the Google Calendar you want to use as <strong>"public."</strong> <a href="%1s" target="_blank">Detailed instructions</a>', 'google-calendar-events').'<br />'.
262
+						__('Step 2: Copy and paste your Google Calendar ID here. <a href="%2s" target="_blank">Detailed instructions</a>', 'google-calendar-events'),
263
+						simcal_ga_campaign_url(simcal_get_url('docs').'/make-google-calendar-public/', 'core-plugin', 'settings-link'),
264
+						simcal_ga_campaign_url(simcal_get_url('docs').'/find-google-calendar-id/', 'core-plugin', 'settings-link')
265
+					).'</p>';
266 266
 
267
-		if ( $post_id > 0 && ! is_null( $feed ) && ! empty( $this->feed->type ) ) {
267
+		if ($post_id > 0 && ! is_null($feed) && ! empty($this->feed->type)) {
268 268
 
269
-			$no_key_notice = new Notice( array(
270
-					'id'          => array( 'calendar_' . $post_id => 'google-no-api-key' ),
269
+			$no_key_notice = new Notice(array(
270
+					'id'          => array('calendar_'.$post_id => 'google-no-api-key'),
271 271
 					'type'        => 'error',
272 272
 					'screen'      => 'calendar',
273 273
 					'post'        => $post_id,
274 274
 					'dismissable' => false,
275
-					'content'     => '<p>' .
276
-					                 '<i class="simcal-icon-warning"></i> ' .
275
+					'content'     => '<p>'.
276
+					                 '<i class="simcal-icon-warning"></i> '.
277 277
 					                 sprintf(
278
-						                 __( 'Your Google Calendar events will not show up until you <a href="%s">create and save a Google API key</a>.', 'google-calendar-events' ),
279
-						                 admin_url( 'edit.php?post_type=calendar&page=simple-calendar_settings&tab=feeds' )
280
-					                 ) .
278
+						                 __('Your Google Calendar events will not show up until you <a href="%s">create and save a Google API key</a>.', 'google-calendar-events'),
279
+						                 admin_url('edit.php?post_type=calendar&page=simple-calendar_settings&tab=feeds')
280
+					                 ).
281 281
 					                 '</p>',
282 282
 				)
283 283
 			);
284 284
 
285
-			if ( empty( $this->google_api_key ) && ( $feed == $this->feed->type ) ) {
285
+			if (empty($this->google_api_key) && ($feed == $this->feed->type)) {
286 286
 
287 287
 				$has_errors = true;
288 288
 				$no_key_notice->add();
@@ -292,28 +292,28 @@  discard block
 block discarded – undo
292 292
 				$no_key_notice->remove();
293 293
 
294 294
 				try {
295
-					$this->feed->make_request( $google_calendar_id );
296
-				} catch ( \Exception $e ) {
295
+					$this->feed->make_request($google_calendar_id);
296
+				} catch (\Exception $e) {
297 297
 					$error   = $e->getMessage();
298
-					$message = ! empty( $error ) ? '<blockquote>' . $error . '</blockquote>' : '';
298
+					$message = ! empty($error) ? '<blockquote>'.$error.'</blockquote>' : '';
299 299
 				}
300 300
 
301
-				$error_notice = new Notice( array(
302
-						'id'          => array( 'calendar_' . $post_id => 'google-error-response' ),
301
+				$error_notice = new Notice(array(
302
+						'id'          => array('calendar_'.$post_id => 'google-error-response'),
303 303
 						'type'        => 'error',
304 304
 						'screen'      => 'calendar',
305 305
 						'post'        => $post_id,
306 306
 						'dismissable' => false,
307
-						'content'     => '<p>' .
308
-						                 '<i class="simcal-icon-warning"></i> ' .
309
-						                 __( 'While trying to retrieve events, Google returned an error:', 'google-calendar-events' ) .
310
-						                 '<br>' . $message . '<br>' .
311
-						                 __( 'Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events' ) .
307
+						'content'     => '<p>'.
308
+						                 '<i class="simcal-icon-warning"></i> '.
309
+						                 __('While trying to retrieve events, Google returned an error:', 'google-calendar-events').
310
+						                 '<br>'.$message.'<br>'.
311
+						                 __('Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events').
312 312
 						                 '</p>',
313 313
 					)
314 314
 				);
315 315
 
316
-				if ( ! empty( $error ) && ( $feed == $this->feed->type ) ) {
316
+				if ( ! empty($error) && ($feed == $this->feed->type)) {
317 317
 					$error_notice->add();
318 318
 					$has_errors = true;
319 319
 				} else {
@@ -335,21 +335,21 @@  discard block
 block discarded – undo
335 335
 	 *
336 336
 	 * @param int $post_id
337 337
 	 */
338
-	public function process_meta( $post_id ) {
338
+	public function process_meta($post_id) {
339 339
 
340
-		$calendar_id = isset( $_POST['_google_calendar_id'] ) ? base64_encode( trim( $_POST['_google_calendar_id'] ) ): '';
341
-		update_post_meta( $post_id, '_google_calendar_id', $calendar_id );
340
+		$calendar_id = isset($_POST['_google_calendar_id']) ? base64_encode(trim($_POST['_google_calendar_id'])) : '';
341
+		update_post_meta($post_id, '_google_calendar_id', $calendar_id);
342 342
 
343
-		$search_query = isset( $_POST['_google_events_search_query'] ) ? sanitize_text_field( $_POST['_google_events_search_query'] ) : '';
344
-		update_post_meta( $post_id, '_google_events_search_query', $search_query );
343
+		$search_query = isset($_POST['_google_events_search_query']) ? sanitize_text_field($_POST['_google_events_search_query']) : '';
344
+		update_post_meta($post_id, '_google_events_search_query', $search_query);
345 345
 
346
-		$recurring = isset( $_POST['_google_events_recurring'] ) ? sanitize_key( $_POST['_google_events_recurring'] ) : 'show';
347
-		update_post_meta( $post_id, '_google_events_recurring', $recurring );
346
+		$recurring = isset($_POST['_google_events_recurring']) ? sanitize_key($_POST['_google_events_recurring']) : 'show';
347
+		update_post_meta($post_id, '_google_events_recurring', $recurring);
348 348
 
349
-		$max_results = isset( $_POST['_google_events_max_results'] ) ? absint( $_POST['_google_events_max_results'] ) : '2500';
350
-		update_post_meta( $post_id, '_google_events_max_results', $max_results );
349
+		$max_results = isset($_POST['_google_events_max_results']) ? absint($_POST['_google_events_max_results']) : '2500';
350
+		update_post_meta($post_id, '_google_events_max_results', $max_results);
351 351
 
352
-		$this->test_api_key_connection( $calendar_id );
352
+		$this->test_api_key_connection($calendar_id);
353 353
 	}
354 354
 
355 355
 }
Please login to merge, or discard this patch.
includes/abstracts/feed.php 1 patch
Spacing   +42 added lines, -42 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
 
@@ -132,22 +132,22 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @param string|Calendar $calendar
134 134
 	 */
135
-	public function __construct( $calendar = '' ) {
135
+	public function __construct($calendar = '') {
136 136
 
137
-		if ( $calendar instanceof Calendar ) {
137
+		if ($calendar instanceof Calendar) {
138 138
 
139
-			if ( isset( $calendar->id ) ) {
139
+			if (isset($calendar->id)) {
140 140
 				$this->post_id = $calendar->id;
141 141
 			}
142
-			if ( isset( $calendar->start ) ) {
142
+			if (isset($calendar->start)) {
143 143
 				$this->calendar_start = $calendar->start;
144 144
 			}
145
-			$this->week_starts      = isset( $calendar->week_starts ) ? $calendar->week_starts : get_option( 'start_of_week' );
146
-			$this->events_template  = ! empty( $calendar->events_template ) ? $calendar->events_template : simcal_default_event_template();
145
+			$this->week_starts      = isset($calendar->week_starts) ? $calendar->week_starts : get_option('start_of_week');
146
+			$this->events_template  = ! empty($calendar->events_template) ? $calendar->events_template : simcal_default_event_template();
147 147
 
148
-			if ( $this->post_id > 0 ) {
148
+			if ($this->post_id > 0) {
149 149
 				$this->set_cache();
150
-				$this->timezone_setting = get_post_meta( $this->post_id, '_feed_timezone_setting', true );
150
+				$this->timezone_setting = get_post_meta($this->post_id, '_feed_timezone_setting', true);
151 151
 				$this->timezone = $calendar->timezone;
152 152
 				$this->set_earliest_event();
153 153
 				$this->set_latest_event();
@@ -173,25 +173,25 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @param int $timestamp
175 175
 	 */
176
-	public function set_earliest_event( $timestamp = 0 ) {
176
+	public function set_earliest_event($timestamp = 0) {
177 177
 
178
-		$earliest = intval( $timestamp );
178
+		$earliest = intval($timestamp);
179 179
 
180
-		if ( $earliest === 0 ) {
180
+		if ($earliest === 0) {
181 181
 
182
-			$start = Carbon::createFromTimestamp( $this->calendar_start, $this->timezone );
182
+			$start = Carbon::createFromTimestamp($this->calendar_start, $this->timezone);
183 183
 
184
-			$earliest_date  = esc_attr( get_post_meta( $this->post_id, '_feed_earliest_event_date', true ) );
185
-			$earliest_range = max( absint( get_post_meta( $this->post_id, '_feed_earliest_event_date_range', true ) ), 1 );
184
+			$earliest_date  = esc_attr(get_post_meta($this->post_id, '_feed_earliest_event_date', true));
185
+			$earliest_range = max(absint(get_post_meta($this->post_id, '_feed_earliest_event_date_range', true)), 1);
186 186
 
187
-			if ( 'days_before' == $earliest_date ) {
188
-				$earliest = $start->subDays( $earliest_range )->getTimestamp();
189
-			} elseif ( 'weeks_before' == $earliest_date ) {
190
-				$earliest = $start->subWeeks( $earliest_range )->addDay()->getTimestamp();
191
-			} elseif ( 'months_before' == $earliest_date ) {
192
-				$earliest = $start->subMonths( $earliest_range )->addDay()->getTimestamp();
193
-			} elseif ( 'years_before' == $earliest_date ) {
194
-				$earliest = $start->subYears( $earliest_range )->addDay()->getTimestamp();
187
+			if ('days_before' == $earliest_date) {
188
+				$earliest = $start->subDays($earliest_range)->getTimestamp();
189
+			} elseif ('weeks_before' == $earliest_date) {
190
+				$earliest = $start->subWeeks($earliest_range)->addDay()->getTimestamp();
191
+			} elseif ('months_before' == $earliest_date) {
192
+				$earliest = $start->subMonths($earliest_range)->addDay()->getTimestamp();
193
+			} elseif ('years_before' == $earliest_date) {
194
+				$earliest = $start->subYears($earliest_range)->addDay()->getTimestamp();
195 195
 			} else {
196 196
 				$earliest = $start->getTimestamp();
197 197
 			}
@@ -207,25 +207,25 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param int $timestamp
209 209
 	 */
210
-	public function set_latest_event( $timestamp = 0 ) {
210
+	public function set_latest_event($timestamp = 0) {
211 211
 
212
-		$latest = intval( $timestamp );
212
+		$latest = intval($timestamp);
213 213
 
214
-		if ( $latest === 0 ) {
214
+		if ($latest === 0) {
215 215
 
216
-			$start = Carbon::createFromTimestamp( $this->calendar_start, $this->timezone )->endOfDay();
216
+			$start = Carbon::createFromTimestamp($this->calendar_start, $this->timezone)->endOfDay();
217 217
 
218
-			$latest_date  = esc_attr( get_post_meta( $this->post_id, '_feed_latest_event_date', true ) );
219
-			$latest_range = max( absint( get_post_meta( $this->post_id, '_feed_latest_event_date_range', true ) ), 1 );
218
+			$latest_date  = esc_attr(get_post_meta($this->post_id, '_feed_latest_event_date', true));
219
+			$latest_range = max(absint(get_post_meta($this->post_id, '_feed_latest_event_date_range', true)), 1);
220 220
 
221
-			if ( 'days_after' == $latest_date ) {
222
-				$latest = $start->addDays( $latest_range )->getTimestamp();
223
-			} elseif ( 'weeks_after' == $latest_date ) {
224
-				$latest = $start->addWeeks( $latest_range )->subDay()->getTimestamp();
225
-			} elseif ( 'months_after' == $latest_date ) {
226
-				$latest = $start->addMonths( $latest_range )->subDay()->getTimestamp();
227
-			} elseif ( 'years_after' == $latest_date ) {
228
-				$latest = $start->addYears( $latest_range )->subDay()->getTimestamp();
221
+			if ('days_after' == $latest_date) {
222
+				$latest = $start->addDays($latest_range)->getTimestamp();
223
+			} elseif ('weeks_after' == $latest_date) {
224
+				$latest = $start->addWeeks($latest_range)->subDay()->getTimestamp();
225
+			} elseif ('months_after' == $latest_date) {
226
+				$latest = $start->addMonths($latest_range)->subDay()->getTimestamp();
227
+			} elseif ('years_after' == $latest_date) {
228
+				$latest = $start->addYears($latest_range)->subDay()->getTimestamp();
229 229
 			} else {
230 230
 				$latest = $start->getTimestamp();
231 231
 			}
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @param int $time
244 244
 	 */
245
-	public function set_cache( $time = 0 ) {
246
-		if ( $time === 0 || ! is_numeric( $time ) ) {
247
-			$cache = get_post_meta( $this->post_id, '_feed_cache', true );
248
-			$time  = is_numeric( $cache ) && $cache >= 0 ? absint( $cache ) : $this->cache;
245
+	public function set_cache($time = 0) {
246
+		if ($time === 0 || ! is_numeric($time)) {
247
+			$cache = get_post_meta($this->post_id, '_feed_cache', true);
248
+			$time  = is_numeric($cache) && $cache >= 0 ? absint($cache) : $this->cache;
249 249
 		}
250
-		$this->cache = absint( $time );
250
+		$this->cache = absint($time);
251 251
 	}
252 252
 
253 253
 	/**
Please login to merge, or discard this patch.
includes/update.php 1 patch
Spacing   +41 added lines, -41 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
 
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @param string $version (optional) Current plugin version, defaults to value in plugin constant.
65 65
 	 */
66
-	public function __construct( $version = SIMPLE_CALENDAR_VERSION ) {
66
+	public function __construct($version = SIMPLE_CALENDAR_VERSION) {
67 67
 		// Look for previous version in current or legacy option, null for fresh install.
68
-		$installed = get_option( 'simple-calendar_version', null );
69
-		$this->installed_ver = is_null( $installed ) ? get_option( 'gce_version', null ) : $installed;
68
+		$installed = get_option('simple-calendar_version', null);
69
+		$this->installed_ver = is_null($installed) ? get_option('gce_version', null) : $installed;
70 70
 		$this->new_ver = $version;
71 71
 
72
-		if ( version_compare( $this->installed_ver, $this->new_ver, '<' ) ) {
72
+		if (version_compare($this->installed_ver, $this->new_ver, '<')) {
73 73
 			$this->run_updates();
74 74
 		}
75 75
 	}
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function run_updates() {
85 85
 
86
-		do_action( 'simcal_before_update', $this->installed_ver );
86
+		do_action('simcal_before_update', $this->installed_ver);
87 87
 
88
-		if ( ! is_null( $this->installed_ver ) ) {
88
+		if ( ! is_null($this->installed_ver)) {
89 89
 
90
-			if ( version_compare( $this->installed_ver, $this->new_ver ) === -1 ) {
90
+			if (version_compare($this->installed_ver, $this->new_ver) === -1) {
91 91
 
92
-				$post_type = version_compare( $this->installed_ver, '3.0.0' ) === -1 ? 'gce_feed' : 'calendar';
93
-				$this->posts = $this->get_posts( $post_type );
92
+				$post_type = version_compare($this->installed_ver, '3.0.0') === -1 ? 'gce_feed' : 'calendar';
93
+				$this->posts = $this->get_posts($post_type);
94 94
 
95
-				foreach ( $this->update_path as $update_to ) {
96
-					if ( version_compare( $this->installed_ver, $update_to, '<' ) ) {
97
-						$this->update( $update_to );
95
+				foreach ($this->update_path as $update_to) {
96
+					if (version_compare($this->installed_ver, $update_to, '<')) {
97
+						$this->update($update_to);
98 98
 					}
99 99
 				}
100 100
 
@@ -109,28 +109,28 @@  discard block
 block discarded – undo
109 109
 
110 110
 		}
111 111
 
112
-		do_action( 'simcal_updated', $this->new_ver );
112
+		do_action('simcal_updated', $this->new_ver);
113 113
 
114 114
 		// Redirect to a welcome page if new install or major update.
115
-		if ( is_null( $this->installed_ver ) ) {
116
-			set_transient( '_simple-calendar_activation_redirect', 'fresh', 60 );
115
+		if (is_null($this->installed_ver)) {
116
+			set_transient('_simple-calendar_activation_redirect', 'fresh', 60);
117 117
 		} else {
118
-			$major_new = substr( $this->new_ver, 0, strrpos( $this->new_ver, '.' ) );
119
-			$major_old = substr( $this->installed_ver, 0, strrpos( $this->installed_ver, '.' ) );
120
-			if ( version_compare( $major_new, $major_old, '>' ) ) {
121
-				set_transient( '_simple-calendar_activation_redirect', 'update', 60 );
122
-			} elseif ( $major_old == $major_new ) {
123
-				$version = explode( '.', $this->new_ver );
124
-				end( $version );
125
-				if ( 0 === intval( current( $version ) ) ) {
126
-					set_transient( '_simple-calendar_activation_redirect', 'update', 60 );
118
+			$major_new = substr($this->new_ver, 0, strrpos($this->new_ver, '.'));
119
+			$major_old = substr($this->installed_ver, 0, strrpos($this->installed_ver, '.'));
120
+			if (version_compare($major_new, $major_old, '>')) {
121
+				set_transient('_simple-calendar_activation_redirect', 'update', 60);
122
+			} elseif ($major_old == $major_new) {
123
+				$version = explode('.', $this->new_ver);
124
+				end($version);
125
+				if (0 === intval(current($version))) {
126
+					set_transient('_simple-calendar_activation_redirect', 'update', 60);
127 127
 				}
128 128
 			}
129 129
 		}
130 130
 
131 131
 		$this->admin_redirects();
132 132
 
133
-		update_option( 'simple-calendar_version', $this->new_ver );
133
+		update_option('simple-calendar_version', $this->new_ver);
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,25 +142,25 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public function admin_redirects() {
144 144
 
145
-		$transient = get_transient( '_simple-calendar_activation_redirect' );
145
+		$transient = get_transient('_simple-calendar_activation_redirect');
146 146
 
147
-		if ( ! $transient || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) {
147
+		if ( ! $transient || is_network_admin() || isset($_GET['activate-multi']) || ! current_user_can('manage_options')) {
148 148
 			return;
149 149
 		}
150 150
 
151
-		delete_transient( '_simple-calendar_activation_redirect' );
151
+		delete_transient('_simple-calendar_activation_redirect');
152 152
 
153 153
 		// Do not redirect if already on welcome page screen.
154
-		if ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'simple-calendar_about' ) ) ) {
154
+		if ( ! empty($_GET['page']) && in_array($_GET['page'], array('simple-calendar_about'))) {
155 155
 			return;
156 156
 		}
157 157
 
158 158
 		$url = add_query_arg(
159 159
 				'simcal_install',
160
-				esc_attr( $transient ),
161
-				admin_url( 'index.php?page=simple-calendar_about' )
160
+				esc_attr($transient),
161
+				admin_url('index.php?page=simple-calendar_about')
162 162
 		);
163
-		wp_safe_redirect( $url );
163
+		wp_safe_redirect($url);
164 164
 		exit;
165 165
 	}
166 166
 
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @return array
175 175
 	 */
176
-	private function get_posts( $post_type ) {
176
+	private function get_posts($post_type) {
177 177
 
178 178
 		$posts = array();
179 179
 
180
-		if ( ! empty( $post_type ) ) {
180
+		if ( ! empty($post_type)) {
181 181
 
182 182
 			// https://core.trac.wordpress.org/ticket/18408
183
-			$posts = get_posts( array(
183
+			$posts = get_posts(array(
184 184
 				'post_type'   => $post_type,
185 185
 				'post_status' => array(
186 186
 					'draft',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 					'trash',
192 192
 				),
193 193
 				'nopaging'    => true,
194
-			) );
194
+			));
195 195
 
196 196
 			wp_reset_postdata();
197 197
 		}
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @param string $version
210 210
 	 */
211
-	private function update( $version ) {
211
+	private function update($version) {
212 212
 
213
-		$update_v = '\\' . __NAMESPACE__ . '\Updates\\Update_V' . str_replace( '.', '', $version );
213
+		$update_v = '\\'.__NAMESPACE__.'\Updates\\Update_V'.str_replace('.', '', $version);
214 214
 
215
-		if ( class_exists( $update_v ) ) {
216
-			new $update_v( $this->posts );
215
+		if (class_exists($update_v)) {
216
+			new $update_v($this->posts);
217 217
 		}
218 218
 	}
219 219
 
Please login to merge, or discard this patch.
includes/updates/update-v3013.php 2 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -6,9 +6,6 @@
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Updates;
8 8
 
9
-use Carbon\Carbon;
10
-use SimpleCalendar\Post_Types;
11
-
12 9
 if ( ! defined( 'ABSPATH' ) ) {
13 10
 	exit;
14 11
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Carbon\Carbon;
10 10
 use SimpleCalendar\Post_Types;
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param array $posts
25 25
 	 */
26
-	public function __construct( $posts ) {
26
+	public function __construct($posts) {
27 27
 
28 28
 		$this->update_options();
29 29
 	}
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function update_options() {
36 36
 
37
-		$settings_advanced = get_option( 'simple-calendar_settings_advanced' );
37
+		$settings_advanced = get_option('simple-calendar_settings_advanced');
38 38
 		
39 39
 		// Remove stored always_enqueue value
40
-		if ( isset( $settings_advanced['assets']['always_enqueue'] ) ) {
41
-			unset( $settings_advanced['assets']['always_enqueue'] );
40
+		if (isset($settings_advanced['assets']['always_enqueue'])) {
41
+			unset($settings_advanced['assets']['always_enqueue']);
42 42
 		}
43 43
 
44 44
 		// Remove stored disable_js value
45
-		if ( isset( $settings_advanced['assets']['disable_js'] ) ) {
46
-			unset( $settings_advanced['assets']['disable_js'] );
45
+		if (isset($settings_advanced['assets']['disable_js'])) {
46
+			unset($settings_advanced['assets']['disable_js']);
47 47
 		}
48 48
 
49
-		update_option( 'simple-calendar_settings_advanced', $settings_advanced );
49
+		update_option('simple-calendar_settings_advanced', $settings_advanced);
50 50
 
51 51
 		// Delete legacy options.
52
-		delete_option( 'simple-calendar_defaults' );
52
+		delete_option('simple-calendar_defaults');
53 53
 	}
54 54
 
55 55
 }
Please login to merge, or discard this patch.
includes/calendars/admin/default-calendar-admin.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -298,8 +298,8 @@
 block discarded – undo
298 298
 						'name'    => '_default_calendar_expand_multi_day_events',
299 299
 						'id'      => '_default_calendar_expand_multi_day_events',
300 300
 						'tooltip' => __( 'For events spanning multiple days, you can display them on each day of the event, ' .
301
-						                 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
302
-						                 'Third option applies to list views only.', 'google-calendar-events' ),
301
+										 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
302
+										 'Third option applies to list views only.', 'google-calendar-events' ),
303 303
 						'value'   => $multi_day_value,
304 304
 						'options' => array(
305 305
 							'yes'              => __( 'Yes, display on all days of event', 'google-calendar-events' ),
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Calendars\Admin;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		if ( simcal_is_admin_screen() !== false ) {
28
-			add_action( 'simcal_settings_meta_calendar_panel', array( $this, 'add_settings_meta_calendar_panel' ), 10, 1 );
27
+		if (simcal_is_admin_screen() !== false) {
28
+			add_action('simcal_settings_meta_calendar_panel', array($this, 'add_settings_meta_calendar_panel'), 10, 1);
29 29
 		}
30
-		add_action( 'simcal_process_settings_meta', array( $this, 'process_meta' ), 10, 1 );
30
+		add_action('simcal_process_settings_meta', array($this, 'process_meta'), 10, 1);
31 31
 	}
32 32
 
33 33
 	/**
@@ -76,47 +76,47 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param int $post_id
78 78
 	 */
79
-	public function add_settings_meta_calendar_panel( $post_id ) {
79
+	public function add_settings_meta_calendar_panel($post_id) {
80 80
 
81 81
 		?>
82 82
 		<table id="default-calendar-settings">
83 83
 			<thead>
84
-			<tr><th colspan="2"><?php _e( 'Default Calendar', 'google-calendar-events' ); ?></th></tr>
84
+			<tr><th colspan="2"><?php _e('Default Calendar', 'google-calendar-events'); ?></th></tr>
85 85
 			</thead>
86 86
 			<tbody class="simcal-panel-section">
87 87
 
88 88
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
89
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Event Bubbles', 'google-calendar-events' ); ?></label></th>
89
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Event Bubbles', 'google-calendar-events'); ?></label></th>
90 90
 				<td>
91 91
 					<?php
92 92
 
93
-					$bubbles = get_post_meta( $post_id, '_default_calendar_event_bubble_trigger', true );
93
+					$bubbles = get_post_meta($post_id, '_default_calendar_event_bubble_trigger', true);
94 94
 
95
-					simcal_print_field( array(
95
+					simcal_print_field(array(
96 96
 						'type'    => 'radio',
97 97
 						'inline'  => 'inline',
98 98
 						'name'    => '_default_calendar_event_bubble_trigger',
99 99
 						'id'      => '_default_calendar_event_bubble_trigger',
100
-						'tooltip' => __( 'Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events' ),
100
+						'tooltip' => __('Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events'),
101 101
 						'value'   => $bubbles ? $bubbles : 'hover',
102 102
 						'default' => 'hover',
103 103
 						'options' => array(
104
-							'click' => __( 'Click', 'google-calendar-events' ),
105
-							'hover' => __( 'Hover', 'google-calendar-events' ),
104
+							'click' => __('Click', 'google-calendar-events'),
105
+							'hover' => __('Hover', 'google-calendar-events'),
106 106
 						),
107
-					) );
107
+					));
108 108
 
109 109
 					?>
110 110
 				</td>
111 111
 			</tr>
112 112
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
113
-				<th><label for="_default_calendar_trim_titles"><?php _e( 'Trim Event Titles', 'google-calendar-events' ); ?></label></th>
113
+				<th><label for="_default_calendar_trim_titles"><?php _e('Trim Event Titles', 'google-calendar-events'); ?></label></th>
114 114
 				<td>
115 115
 					<?php
116 116
 
117
-					$trim = get_post_meta( $post_id, '_default_calendar_trim_titles', true );
117
+					$trim = get_post_meta($post_id, '_default_calendar_trim_titles', true);
118 118
 
119
-					simcal_print_field( array(
119
+					simcal_print_field(array(
120 120
 						'type'        => 'checkbox',
121 121
 						'name'        => '_default_calendar_trim_titles',
122 122
 						'id'          => '_default_calendar_trim_titles',
@@ -127,34 +127,34 @@  discard block
 block discarded – undo
127 127
 						'attributes'  => array(
128 128
 							'data-show-next-if-value' => 'yes',
129 129
 						),
130
-					) );
130
+					));
131 131
 
132
-					simcal_print_field( array(
132
+					simcal_print_field(array(
133 133
 						'type'       => 'standard',
134 134
 						'subtype'    => 'number',
135 135
 						'name'       => '_default_calendar_trim_titles_chars',
136 136
 						'id'         => '_default_calendar_trim_titles_chars',
137
-						'tooltip'    => __( 'Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events' ),
137
+						'tooltip'    => __('Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events'),
138 138
 						'class'      => array(
139 139
 							'simcal-field-tiny',
140 140
 						),
141
-						'value'      => 'yes' == $trim ? strval( max( absint( get_post_meta( $post_id, '_default_calendar_trim_titles_chars', true ) ), 1 ) ) : '20',
141
+						'value'      => 'yes' == $trim ? strval(max(absint(get_post_meta($post_id, '_default_calendar_trim_titles_chars', true)), 1)) : '20',
142 142
 						'attributes' => array(
143 143
 							'min'     => '1',
144 144
 						),
145
-					) );
145
+					));
146 146
 
147 147
 					?>
148 148
 				</td>
149 149
 			</tr>
150 150
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
151
-				<th><label for="_default_calendar_list_grouped_span"><?php _e( 'Span', 'google-calendar-events' ); ?></label></th>
151
+				<th><label for="_default_calendar_list_grouped_span"><?php _e('Span', 'google-calendar-events'); ?></label></th>
152 152
 				<td>
153 153
 					<?php
154 154
 
155
-					$list_span = max( absint( get_post_meta( $post_id, '_default_calendar_list_range_span', true ) ), 1 );
155
+					$list_span = max(absint(get_post_meta($post_id, '_default_calendar_list_range_span', true)), 1);
156 156
 
157
-					simcal_print_field( array(
157
+					simcal_print_field(array(
158 158
 						'type'    => 'standard',
159 159
 						'subtype' => 'number',
160 160
 						'name'    => '_default_calendar_list_range_span',
@@ -163,78 +163,78 @@  discard block
 block discarded – undo
163 163
 							'simcal-field-tiny',
164 164
 							'simcal-field-inline',
165 165
 						),
166
-						'value'   => strval( $list_span ),
166
+						'value'   => strval($list_span),
167 167
 						'attributes'  => array(
168 168
 							'min' => '1',
169 169
 						),
170
-					) );
170
+					));
171 171
 
172
-					$list_type = get_post_meta( $post_id, '_default_calendar_list_range_type', true );
172
+					$list_type = get_post_meta($post_id, '_default_calendar_list_range_type', true);
173 173
 
174
-					simcal_print_field( array(
174
+					simcal_print_field(array(
175 175
 						'type'    => 'select',
176 176
 						'name'    => '_default_calendar_list_range_type',
177 177
 						'id'      => '_default_calendar_list_range_type',
178
-						'tooltip' => __( 'Range of events to show on each calendar page.', 'google-calendar-events' ),
178
+						'tooltip' => __('Range of events to show on each calendar page.', 'google-calendar-events'),
179 179
 						'class'   => array(
180 180
 							'simcal-field-inline',
181 181
 						),
182 182
 						'value'   => $list_type,
183 183
 						'options' => array(
184
-							'monthly' => __( 'Month(s)', 'google-calendar-events' ),
185
-							'weekly'  => __( 'Week(s)', 'google-calendar-events' ),
186
-							'daily'   => __( 'Day(s)', 'google-calendar-events' ),
187
-							'events'  => __( 'Event(s)', 'google-calendar-events' ),
184
+							'monthly' => __('Month(s)', 'google-calendar-events'),
185
+							'weekly'  => __('Week(s)', 'google-calendar-events'),
186
+							'daily'   => __('Day(s)', 'google-calendar-events'),
187
+							'events'  => __('Event(s)', 'google-calendar-events'),
188 188
 						),
189
-					) );
189
+					));
190 190
 
191 191
 					?>
192 192
 				</td>
193 193
 			</tr>
194 194
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
195
-				<th><label for="_default_calendar_list_header"><?php _e( 'Hide Header', 'google-calendar-events' ); ?></label></th>
195
+				<th><label for="_default_calendar_list_header"><?php _e('Hide Header', 'google-calendar-events'); ?></label></th>
196 196
 				<td>
197 197
 					<?php
198 198
 
199
-					$header = get_post_meta( $post_id, '_default_calendar_list_header', true );
199
+					$header = get_post_meta($post_id, '_default_calendar_list_header', true);
200 200
 
201
-					simcal_print_field( array(
201
+					simcal_print_field(array(
202 202
 						'type'    => 'checkbox',
203 203
 						'name'    => '_default_calendar_list_header',
204 204
 						'id'      => '_default_calendar_list_header',
205
-						'tooltip' => __( 'You can use this to hide the month header for this calendar.', 'google-calendar-events' ),
205
+						'tooltip' => __('You can use this to hide the month header for this calendar.', 'google-calendar-events'),
206 206
 						'value'   => 'yes' == $header ? 'yes' : 'no',
207
-					) );
207
+					));
208 208
 
209 209
 					?>
210 210
 				</td>
211 211
 			</tr>
212 212
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
213
-				<th><label for="_default_calendar_compact_list"><?php _e( 'Compact List', 'google-calendar-events' ); ?></label></th>
213
+				<th><label for="_default_calendar_compact_list"><?php _e('Compact List', 'google-calendar-events'); ?></label></th>
214 214
 				<td>
215 215
 					<?php
216 216
 
217
-					$compact = get_post_meta( $post_id, '_default_calendar_compact_list', true );
217
+					$compact = get_post_meta($post_id, '_default_calendar_compact_list', true);
218 218
 
219
-					simcal_print_field( array(
219
+					simcal_print_field(array(
220 220
 						'type'    => 'checkbox',
221 221
 						'name'    => '_default_calendar_compact_list',
222 222
 						'id'      => '_default_calendar_compact_list',
223
-						'tooltip' => __( 'Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events' ),
223
+						'tooltip' => __('Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events'),
224 224
 						'value'   => 'yes' == $compact ? 'yes' : 'no',
225
-					) );
225
+					));
226 226
 
227 227
 					?>
228 228
 				</td>
229 229
 			</tr>
230 230
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list"  style="display: none;">
231
-				<th><label for="_default_calendar_limit_visible_events"><?php _e( 'Limit Visible Events', 'google-calendar-events' ); ?></label></th>
231
+				<th><label for="_default_calendar_limit_visible_events"><?php _e('Limit Visible Events', 'google-calendar-events'); ?></label></th>
232 232
 				<td>
233 233
 					<?php
234 234
 
235
-					$limit = get_post_meta( $post_id, '_default_calendar_limit_visible_events', true );
235
+					$limit = get_post_meta($post_id, '_default_calendar_limit_visible_events', true);
236 236
 
237
-					simcal_print_field( array(
237
+					simcal_print_field(array(
238 238
 						'type'        => 'checkbox',
239 239
 						'name'        => '_default_calendar_limit_visible_events',
240 240
 						'id'          => '_default_calendar_limit_visible_events',
@@ -245,17 +245,17 @@  discard block
 block discarded – undo
245 245
 						'attributes'  => array(
246 246
 							'data-show-next-if-value' => 'yes',
247 247
 						)
248
-					) );
248
+					));
249 249
 
250
-					$visible_events = absint( get_post_meta( $post_id, '_default_calendar_visible_events', true ) );
250
+					$visible_events = absint(get_post_meta($post_id, '_default_calendar_visible_events', true));
251 251
 					$visible_events = $visible_events > 0 ? $visible_events : 3;
252 252
 
253
-					simcal_print_field( array(
253
+					simcal_print_field(array(
254 254
 						'type'       => 'standard',
255 255
 						'subtype'    => 'number',
256 256
 						'name'       => '_default_calendar_visible_events',
257 257
 						'id'         => '_default_calendar_visible_events',
258
-						'tooltip'    => __( 'Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events' ),
258
+						'tooltip'    => __('Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events'),
259 259
 						'class'      => array(
260 260
 							'simcal-field-tiny',
261 261
 						),
@@ -263,39 +263,39 @@  discard block
 block discarded – undo
263 263
 						'attributes' => array(
264 264
 							'min'     => '1',
265 265
 						)
266
-					) );
266
+					));
267 267
 
268 268
 					?>
269 269
 				</td>
270 270
 			</tr>
271 271
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
272
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Expand Multi-day Events', 'google-calendar-events' ); ?></label></th>
272
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Expand Multi-day Events', 'google-calendar-events'); ?></label></th>
273 273
 				<td>
274 274
 					<?php
275 275
 
276
-					$post_meta = get_post_meta( $post_id );
276
+					$post_meta = get_post_meta($post_id);
277 277
 
278
-					if ( ! is_array( $post_meta ) && ! empty( $post_meta ) ) {
278
+					if ( ! is_array($post_meta) && ! empty($post_meta)) {
279 279
 						$multi_day_value = 'current_day_only';
280 280
 					} else {
281
-						$multi_day_value = get_post_meta( $post_id, '_default_calendar_expand_multi_day_events', true );
281
+						$multi_day_value = get_post_meta($post_id, '_default_calendar_expand_multi_day_events', true);
282 282
 					}
283 283
 
284
-					simcal_print_field( array(
284
+					simcal_print_field(array(
285 285
 						'type'    => 'select',
286 286
 						'name'    => '_default_calendar_expand_multi_day_events',
287 287
 						'id'      => '_default_calendar_expand_multi_day_events',
288
-						'tooltip' => __( 'For events spanning multiple days, you can display them on each day of the event, ' .
289
-						                 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
290
-						                 'Third option applies to list views only.', 'google-calendar-events' ),
288
+						'tooltip' => __('For events spanning multiple days, you can display them on each day of the event, '.
289
+						                 'only on the first day of the event, or on all days of the event, but only up to the current day. '.
290
+						                 'Third option applies to list views only.', 'google-calendar-events'),
291 291
 						'value'   => $multi_day_value,
292 292
 						'options' => array(
293
-							'yes'              => __( 'Yes, display on all days of event', 'google-calendar-events' ),
294
-							'no'               => __( 'No, display only on first day of event', 'google-calendar-events' ),
295
-							'current_day_only' => __( 'No, display on all days of event up to current day (list view only)', 'google-calendar-events' ),
293
+							'yes'              => __('Yes, display on all days of event', 'google-calendar-events'),
294
+							'no'               => __('No, display only on first day of event', 'google-calendar-events'),
295
+							'current_day_only' => __('No, display on all days of event up to current day (list view only)', 'google-calendar-events'),
296 296
 						),
297 297
 						'default' => 'current_day_only',
298
-					) );
298
+					));
299 299
 
300 300
 					?>
301 301
 				</td>
@@ -303,72 +303,72 @@  discard block
 block discarded – undo
303 303
 			</tbody>
304 304
 			<?php
305 305
 
306
-			$settings                   = get_option( 'simple-calendar_settings_calendars' );
307
-			$default_theme              = isset( $settings['default-calendar']['theme'] ) ? $settings['default-calendar']['theme'] : 'light';
306
+			$settings                   = get_option('simple-calendar_settings_calendars');
307
+			$default_theme              = isset($settings['default-calendar']['theme']) ? $settings['default-calendar']['theme'] : 'light';
308 308
 			$default_today_color        = /*isset( $settings['default-calendar']['today_color'] ) ? $settings['default-calendar']['today_color'] :*/ '#1e73be';
309 309
 			$default_days_events_color  = /*isset( $settings['default-calendar']['days_events_color'] ) ? $settings['default-calendar']['days_events_color'] :*/ '#000000';
310 310
 
311 311
 			?>
312 312
 			<tbody class="simcal-panel-section">
313 313
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
314
-				<th><label for="_default_calendar_style_theme"><?php _e( 'Theme', 'google-calendar-events' ); ?></label></th>
314
+				<th><label for="_default_calendar_style_theme"><?php _e('Theme', 'google-calendar-events'); ?></label></th>
315 315
 				<td>
316 316
 					<?php
317 317
 
318
-					$saved = get_post_meta( $post_id, '_default_calendar_style_theme', true );
318
+					$saved = get_post_meta($post_id, '_default_calendar_style_theme', true);
319 319
 					$value = ! $saved ? $default_theme : $saved;
320 320
 
321
-					simcal_print_field( array(
321
+					simcal_print_field(array(
322 322
 						'type'    => 'select',
323 323
 						'name'    => '_default_calendar_style_theme',
324 324
 						'id'      => '_default_calendar_style_theme',
325 325
 						'value'   => $value,
326
-						'tooltip' => __( 'Choose a calendar theme to match your site theme.', 'google-calendar-events' ),
326
+						'tooltip' => __('Choose a calendar theme to match your site theme.', 'google-calendar-events'),
327 327
 						'options' => array(
328
-							'light' => __( 'Light', 'google-calendar-events' ),
329
-							'dark' => __( 'Dark', 'google-calendar-events' ),
328
+							'light' => __('Light', 'google-calendar-events'),
329
+							'dark' => __('Dark', 'google-calendar-events'),
330 330
 						),
331
-					) );
331
+					));
332 332
 
333 333
 					?>
334 334
 				</td>
335 335
 			</tr>
336 336
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
337
-				<th><label for="_default_calendar_style_today"><?php _e( 'Today', 'google-calendar-events' ); ?></label></th>
337
+				<th><label for="_default_calendar_style_today"><?php _e('Today', 'google-calendar-events'); ?></label></th>
338 338
 				<td>
339 339
 					<?php
340 340
 
341
-					$saved = get_post_meta( $post_id, '_default_calendar_style_today', true );
341
+					$saved = get_post_meta($post_id, '_default_calendar_style_today', true);
342 342
 					$value = ! $saved ? $default_today_color : $saved;
343 343
 
344
-					simcal_print_field( array(
344
+					simcal_print_field(array(
345 345
 						'type'    => 'standard',
346 346
 						'subtype' => 'color-picker',
347 347
 						'name'    => '_default_calendar_style_today',
348 348
 						'id'      => '_default_calendar_style_today',
349 349
 						'value'   => $value,
350
-						'tooltip' => __( "This option will set the background color for today's date. It will change the day number background and the border around the current day.", 'google-calendar-events' ),
351
-					) );
350
+						'tooltip' => __("This option will set the background color for today's date. It will change the day number background and the border around the current day.", 'google-calendar-events'),
351
+					));
352 352
 
353 353
 					?>
354 354
 				</td>
355 355
 			</tr>
356 356
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
357
-				<th><label for="_default_calendar_style_days_events"><?php _e( 'Days with Events', 'google-calendar-events' ); ?></label></th>
357
+				<th><label for="_default_calendar_style_days_events"><?php _e('Days with Events', 'google-calendar-events'); ?></label></th>
358 358
 				<td>
359 359
 					<?php
360 360
 
361
-					$saved = get_post_meta( $post_id, '_default_calendar_style_days_events', true );
361
+					$saved = get_post_meta($post_id, '_default_calendar_style_days_events', true);
362 362
 					$value = ! $saved ? $default_days_events_color : $saved;
363 363
 
364
-					simcal_print_field( array(
364
+					simcal_print_field(array(
365 365
 						'type'    => 'standard',
366 366
 						'subtype' => 'color-picker',
367 367
 						'name'    => '_default_calendar_style_days_events',
368 368
 						'id'      => '_default_calendar_style_days_events',
369 369
 						'value'   => $value,
370
-						'tooltip' => __( 'This setting will modify the day number background for any days that have events on them.', 'google-calendar-events' ),
371
-					) );
370
+						'tooltip' => __('This setting will modify the day number background for any days that have events on them.', 'google-calendar-events'),
371
+					));
372 372
 
373 373
 					?>
374 374
 				</td>
@@ -390,55 +390,55 @@  discard block
 block discarded – undo
390 390
 	 *
391 391
 	 * @param int $post_id
392 392
 	 */
393
-	public function process_meta( $post_id ) {
393
+	public function process_meta($post_id) {
394 394
 
395 395
 		// Theme.
396
-		$theme = isset( $_POST['_default_calendar_style_theme'] ) ? sanitize_key( $_POST['_default_calendar_style_theme'] ) : 'light';
397
-		update_post_meta( $post_id, '_default_calendar_style_theme', $theme );
396
+		$theme = isset($_POST['_default_calendar_style_theme']) ? sanitize_key($_POST['_default_calendar_style_theme']) : 'light';
397
+		update_post_meta($post_id, '_default_calendar_style_theme', $theme);
398 398
 
399 399
 		// Today color.
400
-		$today_color = isset( $_POST['_default_calendar_style_today'] ) ? sanitize_text_field( $_POST['_default_calendar_style_today'] ) : '#FF000';
401
-		update_post_meta( $post_id, '_default_calendar_style_today', $today_color );
400
+		$today_color = isset($_POST['_default_calendar_style_today']) ? sanitize_text_field($_POST['_default_calendar_style_today']) : '#FF000';
401
+		update_post_meta($post_id, '_default_calendar_style_today', $today_color);
402 402
 
403 403
 		// Days with events color.
404
-		$days_events_color = isset( $_POST['_default_calendar_style_days_events'] ) ? sanitize_text_field( $_POST['_default_calendar_style_days_events'] ) : '#000000';
405
-		update_post_meta( $post_id, '_default_calendar_style_days_events', $days_events_color );
404
+		$days_events_color = isset($_POST['_default_calendar_style_days_events']) ? sanitize_text_field($_POST['_default_calendar_style_days_events']) : '#000000';
405
+		update_post_meta($post_id, '_default_calendar_style_days_events', $days_events_color);
406 406
 
407 407
 		// List range span.
408
-		$span = isset( $_POST['_default_calendar_list_range_span'] ) ? max( absint( $_POST['_default_calendar_list_range_span'] ), 1 ) : 1;
409
-		update_post_meta( $post_id, '_default_calendar_list_range_span', $span );
408
+		$span = isset($_POST['_default_calendar_list_range_span']) ? max(absint($_POST['_default_calendar_list_range_span']), 1) : 1;
409
+		update_post_meta($post_id, '_default_calendar_list_range_span', $span);
410 410
 
411 411
 		// List range type.
412
-		$group = isset( $_POST['_default_calendar_list_range_type'] ) ? sanitize_key( $_POST['_default_calendar_list_range_type'] ) : 'monthly';
413
-		update_post_meta( $post_id, '_default_calendar_list_range_type', $group );
412
+		$group = isset($_POST['_default_calendar_list_range_type']) ? sanitize_key($_POST['_default_calendar_list_range_type']) : 'monthly';
413
+		update_post_meta($post_id, '_default_calendar_list_range_type', $group);
414 414
 
415 415
 		// Hide header.
416
-		$header = isset( $_POST['_default_calendar_list_header'] ) ? 'yes' : 'no';
417
-		update_post_meta( $post_id, '_default_calendar_list_header', $header );
416
+		$header = isset($_POST['_default_calendar_list_header']) ? 'yes' : 'no';
417
+		update_post_meta($post_id, '_default_calendar_list_header', $header);
418 418
 
419 419
 		// Compact list.
420
-		$compact = isset( $_POST['_default_calendar_compact_list'] ) ? 'yes' : 'no';
421
-		update_post_meta( $post_id, '_default_calendar_compact_list', $compact );
420
+		$compact = isset($_POST['_default_calendar_compact_list']) ? 'yes' : 'no';
421
+		update_post_meta($post_id, '_default_calendar_compact_list', $compact);
422 422
 
423 423
 		// Limit number of initially visible daily events.
424
-		$limit = isset( $_POST['_default_calendar_limit_visible_events'] ) ? 'yes' : 'no';
425
-		update_post_meta( $post_id, '_default_calendar_limit_visible_events', $limit );
426
-		$number = isset( $_POST['_default_calendar_visible_events'] ) ? absint( $_POST['_default_calendar_visible_events'] ) : 3;
427
-		update_post_meta( $post_id, '_default_calendar_visible_events', $number );
424
+		$limit = isset($_POST['_default_calendar_limit_visible_events']) ? 'yes' : 'no';
425
+		update_post_meta($post_id, '_default_calendar_limit_visible_events', $limit);
426
+		$number = isset($_POST['_default_calendar_visible_events']) ? absint($_POST['_default_calendar_visible_events']) : 3;
427
+		update_post_meta($post_id, '_default_calendar_visible_events', $number);
428 428
 
429 429
 		// Grid event bubbles action.
430
-		$bubbles = isset( $_POST['_default_calendar_event_bubble_trigger'] ) ? esc_attr( $_POST['_default_calendar_event_bubble_trigger'] ) : 'hover';
431
-		update_post_meta( $post_id, '_default_calendar_event_bubble_trigger', $bubbles );
430
+		$bubbles = isset($_POST['_default_calendar_event_bubble_trigger']) ? esc_attr($_POST['_default_calendar_event_bubble_trigger']) : 'hover';
431
+		update_post_meta($post_id, '_default_calendar_event_bubble_trigger', $bubbles);
432 432
 
433 433
 		// Trim event titles characters length.
434
-		$trim = isset( $_POST['_default_calendar_trim_titles'] ) ? 'yes' : 'no';
435
-		update_post_meta( $post_id, '_default_calendar_trim_titles', $trim );
436
-		$chars = isset( $_POST['_default_calendar_trim_titles_chars'] ) ? max( absint( $_POST['_default_calendar_trim_titles_chars'] ), 1 ) : 20;
437
-		update_post_meta( $post_id, '_default_calendar_trim_titles_chars', $chars );
434
+		$trim = isset($_POST['_default_calendar_trim_titles']) ? 'yes' : 'no';
435
+		update_post_meta($post_id, '_default_calendar_trim_titles', $trim);
436
+		$chars = isset($_POST['_default_calendar_trim_titles_chars']) ? max(absint($_POST['_default_calendar_trim_titles_chars']), 1) : 20;
437
+		update_post_meta($post_id, '_default_calendar_trim_titles_chars', $chars);
438 438
 
439 439
 		// Expand multiple day events on each day.
440
-		$multi_day = isset( $_POST['_default_calendar_expand_multi_day_events'] ) && ! empty( $_POST['_default_calendar_expand_multi_day_events'] ) ? sanitize_key( $_POST['_default_calendar_expand_multi_day_events'] ) : 'current_day_only';
441
-		update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', $multi_day );
440
+		$multi_day = isset($_POST['_default_calendar_expand_multi_day_events']) && ! empty($_POST['_default_calendar_expand_multi_day_events']) ? sanitize_key($_POST['_default_calendar_expand_multi_day_events']) : 'current_day_only';
441
+		update_post_meta($post_id, '_default_calendar_expand_multi_day_events', $multi_day);
442 442
 
443 443
 	}
444 444
 
Please login to merge, or discard this patch.
includes/wp-requirements.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @license GPL2+
12 12
  */
13 13
 
14
-if ( ! class_exists( 'SimCal_WP_Requirements' ) ) {
14
+if ( ! class_exists('SimCal_WP_Requirements')) {
15 15
 
16 16
 	class SimCal_WP_Requirements {
17 17
 
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 		 * @param string $plugin       Output of `plugin_basename( __FILE__ )`.
91 91
 		 * @param array  $requirements Associative array with requirements.
92 92
 		 */
93
-		public function __construct( $name, $plugin, $requirements ) {
93
+		public function __construct($name, $plugin, $requirements) {
94 94
 
95
-			$this->name = htmlspecialchars( strip_tags( $name ) );
95
+			$this->name = htmlspecialchars(strip_tags($name));
96 96
 			$this->plugin = $plugin;
97 97
 			$this->requirements = $requirements;
98 98
 
99
-			if ( ! empty( $requirements ) && is_array( $requirements ) ) {
99
+			if ( ! empty($requirements) && is_array($requirements)) {
100 100
 
101 101
 				$failures = $extensions = array();
102 102
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 				);
110 110
 
111 111
 				// Check for WordPress version.
112
-				if ( $requirements['WordPress'] && is_string( $requirements['WordPress'] ) ) {
113
-					if ( function_exists( 'get_bloginfo' ) ) {
114
-						$wp_version = get_bloginfo( 'version' );
115
-						if ( version_compare( $wp_version, $requirements['WordPress'] ) === - 1 ) {
112
+				if ($requirements['WordPress'] && is_string($requirements['WordPress'])) {
113
+					if (function_exists('get_bloginfo')) {
114
+						$wp_version = get_bloginfo('version');
115
+						if (version_compare($wp_version, $requirements['WordPress']) === - 1) {
116 116
 							$failures['WordPress'] = $wp_version;
117 117
 							$this->wp = false;
118 118
 						}
@@ -120,24 +120,24 @@  discard block
 block discarded – undo
120 120
 				}
121 121
 
122 122
 				// Check fo PHP version.
123
-				if ( $requirements['PHP'] && is_string( $requirements['PHP'] ) ) {
124
-					if ( version_compare( PHP_VERSION, $requirements['PHP'] ) === -1 ) {
123
+				if ($requirements['PHP'] && is_string($requirements['PHP'])) {
124
+					if (version_compare(PHP_VERSION, $requirements['PHP']) === -1) {
125 125
 						$failures['PHP'] = PHP_VERSION;
126 126
 						$this->php = false;
127 127
 					}
128 128
 				}
129 129
 
130 130
 				// Check fo PHP Extensions.
131
-				if ( $requirements['Extensions'] && is_array( $requirements['Extensions'] ) ) {
132
-					foreach ( $requirements['Extensions'] as $extension ) {
133
-						if ( $extension && is_string( $extension ) ) {
134
-							$extensions[ $extension ] = extension_loaded( $extension );
131
+				if ($requirements['Extensions'] && is_array($requirements['Extensions'])) {
132
+					foreach ($requirements['Extensions'] as $extension) {
133
+						if ($extension && is_string($extension)) {
134
+							$extensions[$extension] = extension_loaded($extension);
135 135
 						}
136 136
 					}
137
-					if ( in_array( false, $extensions ) ) {
138
-						foreach ( $extensions as $extension_name => $found  ) {
139
-							if ( $found === false ) {
140
-								$failures['Extensions'][ $extension_name ] = $extension_name;
137
+					if (in_array(false, $extensions)) {
138
+						foreach ($extensions as $extension_name => $found) {
139
+							if ($found === false) {
140
+								$failures['Extensions'][$extension_name] = $extension_name;
141 141
 							}
142 142
 						}
143 143
 						$this->extensions = false;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
 			} else {
150 150
 
151
-				trigger_error( 'WP Requirements: the requirements are invalid.', E_USER_ERROR );
151
+				trigger_error('WP Requirements: the requirements are invalid.', E_USER_ERROR);
152 152
 
153 153
 			}
154 154
 		}
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 		 * @return bool
169 169
 		 */
170 170
 		public function pass() {
171
-			if ( in_array( false, array(
171
+			if (in_array(false, array(
172 172
 				$this->wp,
173 173
 				$this->php,
174 174
 				$this->extensions,
175
-			) ) ) {
175
+			))) {
176 176
 				return false;
177 177
 			}
178 178
 			return true;
@@ -185,28 +185,28 @@  discard block
 block discarded – undo
185 185
 		 *
186 186
 		 * @return string
187 187
 		 */
188
-		public function get_notice( $message = '' ) {
188
+		public function get_notice($message = '') {
189 189
 
190 190
 			$notice   = '';
191 191
 			$name     = $this->name;
192 192
 			$failures = $this->failures;
193 193
 
194
-			if ( ! empty( $failures ) && is_array( $failures ) ) {
194
+			if ( ! empty($failures) && is_array($failures)) {
195 195
 
196
-				$notice  = '<div class="error">' . "\n";
197
-				$notice .= "\t" . '<p>' . "\n";
198
-				$notice .= '<strong>' . sprintf( '%s could not be activated.', $name ) . '</strong><br>';
196
+				$notice  = '<div class="error">'."\n";
197
+				$notice .= "\t".'<p>'."\n";
198
+				$notice .= '<strong>'.sprintf('%s could not be activated.', $name).'</strong><br>';
199 199
 
200
-				foreach ( $failures as $requirement => $found ) {
200
+				foreach ($failures as $requirement => $found) {
201 201
 
202
-					$required = $this->requirements[ $requirement ];
202
+					$required = $this->requirements[$requirement];
203 203
 
204
-					if ( 'Extensions' == $requirement ) {
205
-						if ( is_array( $found ) ) {
204
+					if ('Extensions' == $requirement) {
205
+						if (is_array($found)) {
206 206
 							$notice .= sprintf( 
207 207
 									'Required PHP Extension(s) not found: %s.', 
208
-									join( ', ', $found ) 
209
-								) . '<br>';
208
+									join(', ', $found) 
209
+								).'<br>';
210 210
 						}
211 211
 					} else {
212 212
 						$notice .= sprintf( 
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 								$requirement, 
215 215
 								$required, 
216 216
 								$found 
217
-							) . '<br>';
217
+							).'<br>';
218 218
 					}
219 219
 
220 220
 				}
221 221
 
222
-				$notice .= '<em>' . sprintf( 'Please update to meet %s requirements.', $name ) . '</em>' . "\n";
223
-				$notice .= "\t" . '</p>' . "\n";
224
-				if ( $message ) {
222
+				$notice .= '<em>'.sprintf('Please update to meet %s requirements.', $name).'</em>'."\n";
223
+				$notice .= "\t".'</p>'."\n";
224
+				if ($message) {
225 225
 					$notice .= $message;
226 226
 				}
227 227
 				$notice .= '</div>';
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 		 * Deactivate plugin.
242 242
 		 */
243 243
 		public function deactivate_plugin() {
244
-			if ( function_exists( 'deactivate_plugins' ) && function_exists( 'plugin_basename' ) ) {
245
-				deactivate_plugins( $this->plugin );
244
+			if (function_exists('deactivate_plugins') && function_exists('plugin_basename')) {
245
+				deactivate_plugins($this->plugin);
246 246
 			}
247 247
 		}
248 248
 
@@ -251,17 +251,17 @@  discard block
 block discarded – undo
251 251
 		 *
252 252
 		 * @param string $message An additional message in notice.
253 253
 		 */
254
-		public function halt( $message = '' ) {
254
+		public function halt($message = '') {
255 255
 
256
-			$this->notice = $this->get_notice( $message );
256
+			$this->notice = $this->get_notice($message);
257 257
 
258
-			if ( $this->notice && function_exists( 'add_action' ) ) {
258
+			if ($this->notice && function_exists('add_action')) {
259 259
 
260
-				add_action( 'admin_notices', array( $this, 'print_notice' ) );
261
-				add_action( 'admin_init', array( $this, 'deactivate_plugin' ) );
260
+				add_action('admin_notices', array($this, 'print_notice'));
261
+				add_action('admin_init', array($this, 'deactivate_plugin'));
262 262
 
263
-				if ( isset( $_GET['activate'] ) ) {
264
-					unset( $_GET['activate'] );
263
+				if (isset($_GET['activate'])) {
264
+					unset($_GET['activate']);
265 265
 				}
266 266
 			}
267 267
 		}
Please login to merge, or discard this patch.
includes/admin/assets.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Admin;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function __construct() {
36 36
 
37
-		$this->min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) ? '' : '.min';
37
+		$this->min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true) ? '' : '.min';
38 38
 
39
-		add_action( 'admin_enqueue_scripts', array( $this, 'load' ) );
39
+		add_action('admin_enqueue_scripts', array($this, 'load'));
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function load() {
48 48
 
49
-		$css_path        = SIMPLE_CALENDAR_ASSETS . 'css/';
50
-		$css_path_vendor = $css_path . 'vendor/';
51
-		$js_path         = SIMPLE_CALENDAR_ASSETS . 'js/';
52
-		$js_path_vendor  = $js_path . 'vendor/';
49
+		$css_path        = SIMPLE_CALENDAR_ASSETS.'css/';
50
+		$css_path_vendor = $css_path.'vendor/';
51
+		$js_path         = SIMPLE_CALENDAR_ASSETS.'js/';
52
+		$js_path_vendor  = $js_path.'vendor/';
53 53
 
54 54
 		/* ====================== *
55 55
 		 * Register Admin Scripts *
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
 		// TipTip uses ".minified.js" filename ending.
59 59
 		wp_register_script(
60 60
 			'simcal-tiptip',
61
-			$js_path_vendor . 'jquery.tipTip' . ( ( $this->min !== '' ) ? '.minified' : '' ) . '.js',
62
-			array( 'jquery' ),
61
+			$js_path_vendor.'jquery.tipTip'.(($this->min !== '') ? '.minified' : '').'.js',
62
+			array('jquery'),
63 63
 			'1.3',
64 64
 			true
65 65
 		);
66 66
 		wp_register_script(
67 67
 			'simcal-select2',
68
-			$js_path_vendor . 'select2' . $this->min . '.js',
68
+			$js_path_vendor.'select2'.$this->min.'.js',
69 69
 			array(),
70 70
 			'4.0',
71 71
 			true
72 72
 		);
73 73
 		wp_register_script(
74 74
 			'simcal-admin',
75
-			$js_path . 'admin' . $this->min . '.js',
75
+			$js_path.'admin'.$this->min.'.js',
76 76
 			array(
77 77
 				'jquery',
78 78
 				'jquery-ui-sortable',
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		);
87 87
 		wp_register_script(
88 88
 			'simcal-admin-add-calendar',
89
-			$js_path . 'admin-add-calendar' . $this->min . '.js',
90
-			array( 'simcal-select2' ),
89
+			$js_path.'admin-add-calendar'.$this->min.'.js',
90
+			array('simcal-select2'),
91 91
 			SIMPLE_CALENDAR_VERSION,
92 92
 			true
93 93
 		);
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 
99 99
 		wp_register_style(
100 100
 			'simcal-select2',
101
-			$css_path_vendor . 'select2' . $this->min . '.css',
101
+			$css_path_vendor.'select2'.$this->min.'.css',
102 102
 			array(),
103 103
 			'4.0.0'
104 104
 		);
105 105
 		wp_register_style(
106 106
 			'simcal-admin',
107
-			$css_path . 'admin' . $this->min . '.css',
107
+			$css_path.'admin'.$this->min.'.css',
108 108
 			array(
109 109
 				'wp-color-picker',
110 110
 				'simcal-select2',
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
 		);
114 114
 		wp_register_style(
115 115
 			'simcal-admin-add-calendar',
116
-			$css_path . 'admin-add-calendar' . $this->min . '.css',
117
-			array( 'simcal-select2' ),
116
+			$css_path.'admin-add-calendar'.$this->min.'.css',
117
+			array('simcal-select2'),
118 118
 			SIMPLE_CALENDAR_VERSION
119 119
 		);
120 120
 
121
-		if ( simcal_is_admin_screen() !== false ) {
121
+		if (simcal_is_admin_screen() !== false) {
122 122
 
123
-			wp_enqueue_script( 'simcal-admin' );
123
+			wp_enqueue_script('simcal-admin');
124 124
 			wp_localize_script(
125 125
 				'simcal-admin',
126 126
 				'simcal_admin',
127 127
 				simcal_common_scripts_variables()
128 128
 			);
129 129
 
130
-			wp_enqueue_style( 'simcal-admin' );
130
+			wp_enqueue_style('simcal-admin');
131 131
 
132 132
 		} else {
133 133
 
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 			$screen = get_current_screen();
136 136
 
137 137
 			$post_types = array();
138
-			$settings = get_option( 'simple-calendar_settings_calendars' );
139
-			if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
138
+			$settings = get_option('simple-calendar_settings_calendars');
139
+			if (isset($settings['general']['attach_calendars_posts'])) {
140 140
 				$post_types = $settings['general']['attach_calendars_posts'];
141 141
 			}
142 142
 
143 143
 			$conditions = array(
144
-				in_array( $post_type, (array) $post_types ),
144
+				in_array($post_type, (array) $post_types),
145 145
 				$screen->id == 'widgets',
146 146
 			);
147 147
 
148
-			if ( in_array( true, $conditions ) ) {
148
+			if (in_array(true, $conditions)) {
149 149
 
150
-				wp_enqueue_script( 'simcal-admin-add-calendar' );
151
-				wp_localize_script( 'simcal-admin-add-calendar', 'simcal_admin', array(
150
+				wp_enqueue_script('simcal-admin-add-calendar');
151
+				wp_localize_script('simcal-admin-add-calendar', 'simcal_admin', array(
152 152
 					'locale'   => get_locale(),
153 153
 					'text_dir' => is_rtl() ? 'rtl' : 'ltr',
154
-				) );
154
+				));
155 155
 
156
-				wp_enqueue_style( 'simcal-admin-add-calendar' );
156
+				wp_enqueue_style('simcal-admin-add-calendar');
157 157
 			}
158 158
 
159 159
 		}
Please login to merge, or discard this patch.
includes/admin/fields/select.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Field;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -51,32 +51,32 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @param array $field
53 53
 	 */
54
-	public function __construct( $field ) {
54
+	public function __construct($field) {
55 55
 
56 56
 		$class = 'simcal-field-select';
57 57
 
58
-		$enhanced = isset( $field['enhanced'] ) ? $field['enhanced'] : '';
59
-		if ( 'enhanced' == $enhanced )  {
58
+		$enhanced = isset($field['enhanced']) ? $field['enhanced'] : '';
59
+		if ('enhanced' == $enhanced) {
60 60
 			$this->enhanced = true;
61 61
 			$class .= ' simcal-field-select-enhanced';
62 62
 		}
63 63
 
64
-		$multiselect = isset( $field['multiselect'] ) ? $field['multiselect'] : '';
65
-		if ( 'multiselect' == $multiselect ) {
64
+		$multiselect = isset($field['multiselect']) ? $field['multiselect'] : '';
65
+		if ('multiselect' == $multiselect) {
66 66
 			$this->multiselect = true;
67 67
 			$class .= ' simcal-field-multiselect';
68 68
 		}
69 69
 
70
-		if ( isset( $field['default'] ) ) {
70
+		if (isset($field['default'])) {
71 71
 			$this->default = $field['default'];
72 72
 		}
73 73
 
74 74
 		$this->type_class = $class;
75 75
 
76
-		$allow_void = isset( $field['allow_void'] ) ? $field['allow_void'] : '';
76
+		$allow_void = isset($field['allow_void']) ? $field['allow_void'] : '';
77 77
 		$this->allow_void = 'allow_void' == $allow_void ? true : false;
78 78
 
79
-		parent::__construct( $field );
79
+		parent::__construct($field);
80 80
 	}
81 81
 
82 82
 	/**
@@ -86,36 +86,36 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function html() {
88 88
 
89
-		if ( $this->multiselect === true && ! is_array( $this->value ) ) {
90
-			$this->value = explode( ',', $this->value );
89
+		if ($this->multiselect === true && ! is_array($this->value)) {
90
+			$this->value = explode(',', $this->value);
91 91
 		}
92 92
 
93
-		if ( $this->default ) {
94
-			if ( empty( $this->value ) || $this->value == '' ) {
93
+		if ($this->default) {
94
+			if (empty($this->value) || $this->value == '') {
95 95
 				$this->value = $this->default;
96 96
 			}
97 97
 		}
98 98
 
99 99
 		?>
100
-		<select name="<?php echo $this->name; ?><?php if ( $this->multiselect === true ) { echo '[]'; } ?>"
100
+		<select name="<?php echo $this->name; ?><?php if ($this->multiselect === true) { echo '[]'; } ?>"
101 101
 		        id="<?php echo $this->id; ?>"
102 102
 		        style="<?php echo $this->style; ?>"
103 103
 		        class="<?php echo $this->class; ?>"
104 104
 				<?php echo $this->attributes; ?>
105
-				<?php echo ( $this->multiselect === true ) ? ' multiple="multiple"' : ''; ?>>
105
+				<?php echo ($this->multiselect === true) ? ' multiple="multiple"' : ''; ?>>
106 106
 			<?php
107 107
 
108
-			if ( $this->allow_void === true ) {
109
-				echo '<option value=""' . selected( '', $this->value, false ) . '></option>';
108
+			if ($this->allow_void === true) {
109
+				echo '<option value=""'.selected('', $this->value, false).'></option>';
110 110
 			}
111 111
 
112
-			foreach ( $this->options as $option => $name ) {
113
-				if ( is_array( $this->value ) ) {
114
-					$selected =	selected( in_array( $option, $this->value ), true, false );
112
+			foreach ($this->options as $option => $name) {
113
+				if (is_array($this->value)) {
114
+					$selected = selected(in_array($option, $this->value), true, false);
115 115
 				} else {
116
-					$selected = selected( $this->value, trim( strval( $option ) ), false );
116
+					$selected = selected($this->value, trim(strval($option)), false);
117 117
 				}
118
-				echo '<option value="' . $option . '" ' . $selected . '>' . esc_attr( $name ) . '</option>';
118
+				echo '<option value="'.$option.'" '.$selected.'>'.esc_attr($name).'</option>';
119 119
 			}
120 120
 
121 121
 			?>
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 
125 125
 		echo $this->tooltip;
126 126
 
127
-		if ( ! empty( $this->description ) ) {
128
-			echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>';
127
+		if ( ! empty($this->description)) {
128
+			echo '<p class="description">'.wp_kses_post($this->description).'</p>';
129 129
 		}
130 130
 
131 131
 	}
Please login to merge, or discard this patch.
includes/abstracts/calendar.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -784,8 +784,8 @@
 block discarded – undo
784 784
 				if ( 'yes' == $poweredby ) {
785 785
 					$align = is_rtl() ? 'left' : 'right';
786 786
 					echo '<small class="simcal-powered simcal-align-' . $align .'">' .
787
-					     sprintf( __( 'Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events' ), simcal_get_url( 'home' ) ) .
788
-					     '</small>';
787
+						 sprintf( __( 'Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events' ), simcal_get_url( 'home' ) ) .
788
+						 '</small>';
789 789
 				}
790 790
 
791 791
 				echo '</div>';
Please login to merge, or discard this patch.
Spacing   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 use SimpleCalendar\Events\Event_Builder;
12 12
 use SimpleCalendar\Events\Events;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 	 * @param int|object|\WP_Post|Calendar $calendar
235 235
 	 * @param string $view
236 236
 	 */
237
-	public function __construct( $calendar, $view = '' ) {
237
+	public function __construct($calendar, $view = '') {
238 238
 
239 239
 		// Set the post object.
240
-		$this->set_post_object( $calendar );
240
+		$this->set_post_object($calendar);
241 241
 
242
-		if ( ! is_null( $this->post ) ) {
242
+		if ( ! is_null($this->post)) {
243 243
 
244 244
 			// Set calendar type and events source.
245 245
 			$this->set_taxonomies();
@@ -256,23 +256,23 @@  discard block
 block discarded – undo
256 256
 			$this->set_events_template();
257 257
 
258 258
 			// Get events source data.
259
-			$feed = simcal_get_feed( $this );
260
-			if ( $feed instanceof Feed ) {
261
-				if ( ! empty( $feed->events ) ) {
262
-					if ( is_array( $feed->events ) ) {
263
-						$this->set_events( $feed->events );
264
-						if ( 'use_calendar' == get_post_meta( $this->id, '_feed_timezone_setting', true ) ) {
259
+			$feed = simcal_get_feed($this);
260
+			if ($feed instanceof Feed) {
261
+				if ( ! empty($feed->events)) {
262
+					if (is_array($feed->events)) {
263
+						$this->set_events($feed->events);
264
+						if ('use_calendar' == get_post_meta($this->id, '_feed_timezone_setting', true)) {
265 265
 							$this->timezone = $feed->timezone;
266 266
 							$this->set_start();
267 267
 						}
268
-					} elseif ( is_string( $feed->events ) ) {
268
+					} elseif (is_string($feed->events)) {
269 269
 						$this->errors[] = $feed->events;
270 270
 					}
271 271
 				}
272 272
 			}
273 273
 
274 274
 			// Set general purpose timestamps.
275
-			$now = Carbon::now( $this->timezone );
275
+			$now = Carbon::now($this->timezone);
276 276
 			$this->now    = $now->getTimestamp();
277 277
 			$this->today  = $now->startOfDay()->getTimestamp();
278 278
 			$this->offset = $now->getOffset();
@@ -283,26 +283,26 @@  discard block
 block discarded – undo
283 283
 			$this->set_datetime_separator();
284 284
 
285 285
 			// Set earliest and latest event timestamps.
286
-			if ( $this->events && is_array( $this->events ) ) {
287
-				$this->earliest_event = intval( current( array_keys( $this->events ) ) );
288
-				$this->latest_event   = intval( key( array_slice( $this->events, -1, 1, true ) ) );
286
+			if ($this->events && is_array($this->events)) {
287
+				$this->earliest_event = intval(current(array_keys($this->events)));
288
+				$this->latest_event   = intval(key(array_slice($this->events, -1, 1, true)));
289 289
 			}
290 290
 
291 291
 			// Set calendar end.
292 292
 			$this->set_end();
293 293
 
294 294
 			// Set view.
295
-			if ( ! $view ) {
295
+			if ( ! $view) {
296 296
 
297
-				$calendar_view = get_post_meta( $this->id, '_calendar_view', true );
298
-				$calendar_view = isset( $calendar_view[ $this->type ] ) ? $calendar_view[ $this->type ] : '';
297
+				$calendar_view = get_post_meta($this->id, '_calendar_view', true);
298
+				$calendar_view = isset($calendar_view[$this->type]) ? $calendar_view[$this->type] : '';
299 299
 
300
-				$view = esc_attr( $calendar_view );
300
+				$view = esc_attr($calendar_view);
301 301
 			}
302 302
 		}
303 303
 
304 304
 		// Get view.
305
-		$this->view = $this->get_view( $view );
305
+		$this->view = $this->get_view($view);
306 306
 	}
307 307
 
308 308
 	/**
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @return bool
316 316
 	 */
317
-	public function __isset( $key ) {
318
-		return metadata_exists( 'post', $this->id, '_' . $key );
317
+	public function __isset($key) {
318
+		return metadata_exists('post', $this->id, '_'.$key);
319 319
 	}
320 320
 
321 321
 	/**
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @return mixed
329 329
 	 */
330
-	public function __get( $key ) {
331
-		$value = get_post_meta( $this->id, '_' . $key, true );
332
-		if ( ! empty( $value ) ) {
330
+	public function __get($key) {
331
+		$value = get_post_meta($this->id, '_'.$key, true);
332
+		if ( ! empty($value)) {
333 333
 			$this->$key = $value;
334 334
 		}
335 335
 		return $value;
@@ -342,17 +342,17 @@  discard block
 block discarded – undo
342 342
 	 *
343 343
 	 * @param int|object|\WP_Post|Calendar $calendar
344 344
 	 */
345
-	public function set_post_object( $calendar ) {
346
-		if ( is_numeric( $calendar ) ) {
347
-			$this->id   = absint( $calendar );
348
-			$this->post = get_post( $this->id );
349
-		} elseif ( $calendar instanceof Calendar ) {
350
-			$this->id   = absint( $calendar->id );
345
+	public function set_post_object($calendar) {
346
+		if (is_numeric($calendar)) {
347
+			$this->id   = absint($calendar);
348
+			$this->post = get_post($this->id);
349
+		} elseif ($calendar instanceof Calendar) {
350
+			$this->id   = absint($calendar->id);
351 351
 			$this->post = $calendar->post;
352
-		} elseif ( $calendar instanceof \WP_Post ) {
353
-			$this->id   = absint( $calendar->ID );
352
+		} elseif ($calendar instanceof \WP_Post) {
353
+			$this->id   = absint($calendar->ID);
354 354
 			$this->post = $calendar;
355
-		} elseif ( isset( $calendar->id ) && isset( $calendar->post ) ) {
355
+		} elseif (isset($calendar->id) && isset($calendar->post)) {
356 356
 			$this->id   = $calendar->id;
357 357
 			$this->post = $calendar->post;
358 358
 		}
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 	 * @return string
367 367
 	 */
368 368
 	public function get_title() {
369
-		$title = isset( $this->post->post_title ) ? $this->post->post_title : '';
370
-		return apply_filters( 'simcal_calendar_title', $title );
369
+		$title = isset($this->post->post_title) ? $this->post->post_title : '';
370
+		return apply_filters('simcal_calendar_title', $title);
371 371
 	}
372 372
 
373 373
 	/**
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 	 */
390 390
 	protected function set_taxonomies() {
391 391
 		// Set calendar type.
392
-		if ( $type = wp_get_object_terms( $this->id, 'calendar_type' ) ) {
393
-			$this->type = sanitize_title( current( $type )->name );
392
+		if ($type = wp_get_object_terms($this->id, 'calendar_type')) {
393
+			$this->type = sanitize_title(current($type)->name);
394 394
 		} else {
395
-			$this->type = apply_filters( 'simcal_calendar_default_type', 'default-calendar' );
395
+			$this->type = apply_filters('simcal_calendar_default_type', 'default-calendar');
396 396
 		}
397 397
 		// Set feed type.
398
-		if ( $feed_type = wp_get_object_terms( $this->id, 'calendar_feed' ) ) {
399
-			$this->feed = sanitize_title( current( $feed_type )->name );
398
+		if ($feed_type = wp_get_object_terms($this->id, 'calendar_feed')) {
399
+			$this->feed = sanitize_title(current($feed_type)->name);
400 400
 		} else {
401
-			$this->feed = apply_filters( 'simcal_calendar_default_feed', 'google' );
401
+			$this->feed = apply_filters('simcal_calendar_default_feed', 'google');
402 402
 		}
403 403
 	}
404 404
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @return Events
411 411
 	 */
412 412
 	public function get_events() {
413
-		return new Events( $this->events, $this->timezone );
413
+		return new Events($this->events, $this->timezone);
414 414
 	}
415 415
 
416 416
 	/**
@@ -420,14 +420,14 @@  discard block
 block discarded – undo
420 420
 	 *
421 421
 	 * @param array $array
422 422
 	 */
423
-	public function set_events( array $array ) {
423
+	public function set_events(array $array) {
424 424
 
425 425
 		$events = array();
426 426
 
427
-		if ( ! empty( $array ) ) {
428
-			foreach ( $array as $tz => $e ) {
429
-				foreach ( $e as $event ) {
430
-					$events[ $tz ][] = $event instanceof Event ? $event : new Event( $event );
427
+		if ( ! empty($array)) {
428
+			foreach ($array as $tz => $e) {
429
+				foreach ($e as $event) {
430
+					$events[$tz][] = $event instanceof Event ? $event : new Event($event);
431 431
 				}
432 432
 			}
433 433
 		}
@@ -444,24 +444,24 @@  discard block
 block discarded – undo
444 444
 	 *
445 445
 	 * @return string
446 446
 	 */
447
-	public function set_events_template( $template = '' ) {
448
-		if ( empty( $template ) ) {
449
-			$template = isset( $this->post->post_content ) ? $this->post->post_content : '';
447
+	public function set_events_template($template = '') {
448
+		if (empty($template)) {
449
+			$template = isset($this->post->post_content) ? $this->post->post_content : '';
450 450
 		}
451 451
 
452 452
 		// TODO: Removed wpautop() call.
453 453
 
454
-		$event_formatting = get_post_meta( $this->id, '_event_formatting', true );
454
+		$event_formatting = get_post_meta($this->id, '_event_formatting', true);
455 455
 
456
-		switch( $event_formatting ) {
456
+		switch ($event_formatting) {
457 457
 			case 'none':
458
-				$this->events_template =  wp_kses_post( trim( $template ) );
458
+				$this->events_template = wp_kses_post(trim($template));
459 459
 				break;
460 460
 			case 'no_linebreaks':
461
-				$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), false );
461
+				$this->events_template = wpautop(wp_kses_post(trim($template)), false);
462 462
 				break;
463 463
 			default:
464
-				$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), true );
464
+				$this->events_template = wpautop(wp_kses_post(trim($template)), true);
465 465
 		}
466 466
 
467 467
 		//$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), true );
@@ -474,37 +474,37 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @param string $tz Timezone.
476 476
 	 */
477
-	public function set_timezone( $tz = '' ) {
477
+	public function set_timezone($tz = '') {
478 478
 
479
-		$site_tz = esc_attr( simcal_get_wp_timezone() );
479
+		$site_tz = esc_attr(simcal_get_wp_timezone());
480 480
 
481
-		if ( $this->feed === 'grouped-calendars' ) {
481
+		if ($this->feed === 'grouped-calendars') {
482 482
 			$this->timezone = $site_tz;
483 483
 			return;
484 484
 		}
485 485
 
486
-		if ( empty( $tz ) ) {
486
+		if (empty($tz)) {
487 487
 
488
-			$timezone_setting = get_post_meta( $this->id, '_feed_timezone_setting', true );
488
+			$timezone_setting = get_post_meta($this->id, '_feed_timezone_setting', true);
489 489
 
490
-			if ( 'use_site' == $timezone_setting ) {
490
+			if ('use_site' == $timezone_setting) {
491 491
 				$tz = $site_tz;
492
-			} elseif ( 'use_custom' == $timezone_setting ) {
493
-				$custom_timezone = esc_attr( get_post_meta( $this->id, '_feed_timezone', true ) );
492
+			} elseif ('use_custom' == $timezone_setting) {
493
+				$custom_timezone = esc_attr(get_post_meta($this->id, '_feed_timezone', true));
494 494
 				// One may be using a non standard timezone in GMT (UTC) offset format.
495
-				if ( ( strpos( $custom_timezone, 'UTC+' ) === 0 ) || ( strpos( $custom_timezone, 'UTC-' ) === 0 ) ) {
496
-					$tz = simcal_get_timezone_from_gmt_offset( substr( $custom_timezone, 3 ) );
495
+				if ((strpos($custom_timezone, 'UTC+') === 0) || (strpos($custom_timezone, 'UTC-') === 0)) {
496
+					$tz = simcal_get_timezone_from_gmt_offset(substr($custom_timezone, 3));
497 497
 				} else {
498
-					$tz = ! empty( $custom_timezone ) ? $custom_timezone : 'UTC';
498
+					$tz = ! empty($custom_timezone) ? $custom_timezone : 'UTC';
499 499
 				}
500 500
 			}
501 501
 
502
-			$this->timezone = empty( $tz ) ? 'UTC' : $tz;
502
+			$this->timezone = empty($tz) ? 'UTC' : $tz;
503 503
 			return;
504 504
 		}
505 505
 
506 506
 		$this->site_timezone = $site_tz;
507
-		$this->timezone = simcal_esc_timezone( $tz, $this->timezone );
507
+		$this->timezone = simcal_esc_timezone($tz, $this->timezone);
508 508
 	}
509 509
 
510 510
 	/**
@@ -514,20 +514,20 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @param string $format PHP datetime format.
516 516
 	 */
517
-	public function set_date_format( $format = '' ) {
517
+	public function set_date_format($format = '') {
518 518
 
519 519
 		$date_format_custom = $date_format_default = $format;
520 520
 
521
-		if ( empty( $date_format_custom ) ) {
521
+		if (empty($date_format_custom)) {
522 522
 
523
-			$date_format_option  = esc_attr( get_post_meta( $this->id, '_calendar_date_format_setting', true ) );
524
-			$date_format_default = esc_attr( get_option( 'date_format' ) );
523
+			$date_format_option  = esc_attr(get_post_meta($this->id, '_calendar_date_format_setting', true));
524
+			$date_format_default = esc_attr(get_option('date_format'));
525 525
 			$date_format_custom  = '';
526 526
 
527
-			if ( 'use_custom' == $date_format_option ) {
528
-				$date_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_date_format', true ) );
529
-			} elseif ( 'use_custom_php' == $date_format_option ) {
530
-				$date_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_date_format_php', true ) );
527
+			if ('use_custom' == $date_format_option) {
528
+				$date_format_custom = esc_attr(get_post_meta($this->id, '_calendar_date_format', true));
529
+			} elseif ('use_custom_php' == $date_format_option) {
530
+				$date_format_custom = esc_attr(get_post_meta($this->id, '_calendar_date_format_php', true));
531 531
 			}
532 532
 		}
533 533
 
@@ -541,20 +541,20 @@  discard block
 block discarded – undo
541 541
 	 *
542 542
 	 * @param string $format PHP datetime format.
543 543
 	 */
544
-	public function set_time_format( $format = '' ) {
544
+	public function set_time_format($format = '') {
545 545
 
546 546
 		$time_format_custom = $time_format_default = $format;
547 547
 
548
-		if ( empty( $time_format_custom ) ) {
548
+		if (empty($time_format_custom)) {
549 549
 
550
-			$time_format_option  = esc_attr( get_post_meta( $this->id, '_calendar_time_format_setting', true ) );
551
-			$time_format_default = esc_attr( get_option( 'time_format' ) );
550
+			$time_format_option  = esc_attr(get_post_meta($this->id, '_calendar_time_format_setting', true));
551
+			$time_format_default = esc_attr(get_option('time_format'));
552 552
 			$time_format_custom  = '';
553 553
 
554
-			if ( 'use_custom' == $time_format_option ) {
555
-				$time_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_time_format', true ) );
556
-			} elseif ( 'use_custom_php' == $time_format_option ) {
557
-				$time_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_time_format_php', true ) );
554
+			if ('use_custom' == $time_format_option) {
555
+				$time_format_custom = esc_attr(get_post_meta($this->id, '_calendar_time_format', true));
556
+			} elseif ('use_custom_php' == $time_format_option) {
557
+				$time_format_custom = esc_attr(get_post_meta($this->id, '_calendar_time_format_php', true));
558 558
 			}
559 559
 		}
560 560
 
@@ -568,13 +568,13 @@  discard block
 block discarded – undo
568 568
 	 *
569 569
 	 * @param string $separator A UTF8 character used as separator.
570 570
 	 */
571
-	public function set_datetime_separator( $separator = '' ) {
571
+	public function set_datetime_separator($separator = '') {
572 572
 
573
-		if ( empty( $separator ) ) {
574
-			$separator = get_post_meta( $this->id, '_calendar_datetime_separator', true );
573
+		if (empty($separator)) {
574
+			$separator = get_post_meta($this->id, '_calendar_datetime_separator', true);
575 575
 		}
576 576
 
577
-		$this->datetime_separator = esc_attr( $separator );
577
+		$this->datetime_separator = esc_attr($separator);
578 578
 	}
579 579
 
580 580
 	/**
@@ -584,18 +584,18 @@  discard block
 block discarded – undo
584 584
 	 *
585 585
 	 * @param int $weekday From 0 (Sunday) to 6 (Friday).
586 586
 	 */
587
-	public function set_start_of_week( $weekday = -1 ) {
587
+	public function set_start_of_week($weekday = -1) {
588 588
 
589
-		$week_starts = is_int( $weekday ) ? $weekday : -1;
589
+		$week_starts = is_int($weekday) ? $weekday : -1;
590 590
 
591
-		if ( $week_starts < 0 || $week_starts > 6 ) {
591
+		if ($week_starts < 0 || $week_starts > 6) {
592 592
 
593
-			$week_starts_setting = get_post_meta( $this->id, '_calendar_week_starts_on_setting', true );
594
-			$week_starts         = intval( get_option( 'start_of_week' ) );
593
+			$week_starts_setting = get_post_meta($this->id, '_calendar_week_starts_on_setting', true);
594
+			$week_starts         = intval(get_option('start_of_week'));
595 595
 
596
-			if ( 'use_custom' == $week_starts_setting ) {
597
-				$week_starts_on = get_post_meta( $this->id, '_calendar_week_starts_on', true );
598
-				$week_starts    = is_numeric( $week_starts_on ) ? intval( $week_starts_on ) : $week_starts;
596
+			if ('use_custom' == $week_starts_setting) {
597
+				$week_starts_on = get_post_meta($this->id, '_calendar_week_starts_on', true);
598
+				$week_starts    = is_numeric($week_starts_on) ? intval($week_starts_on) : $week_starts;
599 599
 			}
600 600
 		}
601 601
 
@@ -609,51 +609,51 @@  discard block
 block discarded – undo
609 609
 	 *
610 610
 	 * @param int $timestamp
611 611
 	 */
612
-	public function set_start( $timestamp = 0 ) {
612
+	public function set_start($timestamp = 0) {
613 613
 
614
-		if ( is_int( $timestamp ) && $timestamp !== 0 ) {
614
+		if (is_int($timestamp) && $timestamp !== 0) {
615 615
 			$this->start = $timestamp;
616 616
 			return;
617 617
 		}
618 618
 
619
-		$this->start = Carbon::now( $this->timezone )->getTimestamp();
619
+		$this->start = Carbon::now($this->timezone)->getTimestamp();
620 620
 
621
-		$calendar_begins = esc_attr( get_post_meta( $this->id, '_calendar_begins', true ) );
622
-		$nth = max( absint( get_post_meta( $this->id, '_calendar_begins_nth', true ) ), 1 );
621
+		$calendar_begins = esc_attr(get_post_meta($this->id, '_calendar_begins', true));
622
+		$nth = max(absint(get_post_meta($this->id, '_calendar_begins_nth', true)), 1);
623 623
 
624
-		if ( 'today' == $calendar_begins ) {
625
-			$this->start = Carbon::today( $this->timezone )->getTimestamp();
626
-		} elseif ( 'days_before' == $calendar_begins ) {
627
-			$this->start = Carbon::today( $this->timezone )->subDays( $nth )->getTimestamp();
628
-		} elseif ( 'days_after' == $calendar_begins ) {
629
-			$this->start = Carbon::today( $this->timezone )->addDays( $nth )->getTimestamp();
630
-		} elseif ( 'this_week' == $calendar_begins ) {
631
-			$week = new Carbon( 'now', $this->timezone );
632
-			$week->setWeekStartsAt( $this->week_starts );
624
+		if ('today' == $calendar_begins) {
625
+			$this->start = Carbon::today($this->timezone)->getTimestamp();
626
+		} elseif ('days_before' == $calendar_begins) {
627
+			$this->start = Carbon::today($this->timezone)->subDays($nth)->getTimestamp();
628
+		} elseif ('days_after' == $calendar_begins) {
629
+			$this->start = Carbon::today($this->timezone)->addDays($nth)->getTimestamp();
630
+		} elseif ('this_week' == $calendar_begins) {
631
+			$week = new Carbon('now', $this->timezone);
632
+			$week->setWeekStartsAt($this->week_starts);
633 633
 			$this->start = $week->startOfWeek()->getTimestamp();
634
-		} elseif ( 'weeks_before' == $calendar_begins ) {
635
-			$week = new Carbon( 'now', $this->timezone );
636
-			$week->setWeekStartsAt( $this->week_starts );
637
-			$this->start = $week->startOfWeek()->subWeeks( $nth )->getTimestamp();
638
-		} elseif ( 'weeks_after' == $calendar_begins ) {
639
-			$week = new Carbon( 'now', $this->timezone );
640
-			$week->setWeekStartsAt( $this->week_starts );
641
-			$this->start = $week->startOfWeek()->addWeeks( $nth )->getTimestamp();
642
-		} elseif ( 'this_month' == $calendar_begins ) {
643
-			$this->start = Carbon::today( $this->timezone )->startOfMonth()->getTimeStamp();
644
-		} elseif ( 'months_before' == $calendar_begins ) {
645
-			$this->start = Carbon::today( $this->timezone )->subMonths( $nth )->startOfMonth()->getTimeStamp();
646
-		} elseif ( 'months_after' == $calendar_begins ) {
647
-			$this->start = Carbon::today( $this->timezone )->addMonths( $nth )->startOfMonth()->getTimeStamp();
648
-		} elseif ( 'this_year' == $calendar_begins ) {
649
-			$this->start = Carbon::today( $this->timezone )->startOfYear()->getTimestamp();
650
-		} elseif ( 'years_before' == $calendar_begins ) {
651
-			$this->start = Carbon::today( $this->timezone )->subYears( $nth )->startOfYear()->getTimeStamp();
652
-		} elseif ( 'years_after' == $calendar_begins ) {
653
-			$this->start = Carbon::today( $this->timezone )->addYears( $nth )->startOfYear()->getTimeStamp();
654
-		} elseif ( 'custom_date' == $calendar_begins ) {
655
-			if ( $date = get_post_meta( $this->id, '_calendar_begins_custom_date', true ) ) {
656
-				$this->start = Carbon::createFromFormat( 'Y-m-d', esc_attr( $date ), $this->timezone )->setTimezone( $this->timezone )->startOfDay()->getTimestamp();
634
+		} elseif ('weeks_before' == $calendar_begins) {
635
+			$week = new Carbon('now', $this->timezone);
636
+			$week->setWeekStartsAt($this->week_starts);
637
+			$this->start = $week->startOfWeek()->subWeeks($nth)->getTimestamp();
638
+		} elseif ('weeks_after' == $calendar_begins) {
639
+			$week = new Carbon('now', $this->timezone);
640
+			$week->setWeekStartsAt($this->week_starts);
641
+			$this->start = $week->startOfWeek()->addWeeks($nth)->getTimestamp();
642
+		} elseif ('this_month' == $calendar_begins) {
643
+			$this->start = Carbon::today($this->timezone)->startOfMonth()->getTimeStamp();
644
+		} elseif ('months_before' == $calendar_begins) {
645
+			$this->start = Carbon::today($this->timezone)->subMonths($nth)->startOfMonth()->getTimeStamp();
646
+		} elseif ('months_after' == $calendar_begins) {
647
+			$this->start = Carbon::today($this->timezone)->addMonths($nth)->startOfMonth()->getTimeStamp();
648
+		} elseif ('this_year' == $calendar_begins) {
649
+			$this->start = Carbon::today($this->timezone)->startOfYear()->getTimestamp();
650
+		} elseif ('years_before' == $calendar_begins) {
651
+			$this->start = Carbon::today($this->timezone)->subYears($nth)->startOfYear()->getTimeStamp();
652
+		} elseif ('years_after' == $calendar_begins) {
653
+			$this->start = Carbon::today($this->timezone)->addYears($nth)->startOfYear()->getTimeStamp();
654
+		} elseif ('custom_date' == $calendar_begins) {
655
+			if ($date = get_post_meta($this->id, '_calendar_begins_custom_date', true)) {
656
+				$this->start = Carbon::createFromFormat('Y-m-d', esc_attr($date), $this->timezone)->setTimezone($this->timezone)->startOfDay()->getTimestamp();
657 657
 			}
658 658
 		}
659 659
 	}
@@ -665,8 +665,8 @@  discard block
 block discarded – undo
665 665
 	 *
666 666
 	 * @param int $timestamp
667 667
 	 */
668
-	public function set_end( $timestamp = 0 ) {
669
-		$latest = is_int( $timestamp ) && $timestamp !== 0 ? $timestamp : $this->latest_event;
668
+	public function set_end($timestamp = 0) {
669
+		$latest = is_int($timestamp) && $timestamp !== 0 ? $timestamp : $this->latest_event;
670 670
 		$this->end = $latest > $this->start ? $latest : $this->start;
671 671
 	}
672 672
 
@@ -677,14 +677,14 @@  discard block
 block discarded – undo
677 677
 	 *
678 678
 	 * @param string|bool $static
679 679
 	 */
680
-	public function set_static( $static = '' ) {
680
+	public function set_static($static = '') {
681 681
 
682
-		if ( ! empty( $static ) && is_bool( $static ) ) {
682
+		if ( ! empty($static) && is_bool($static)) {
683 683
 			$this->static = $static;
684 684
 			return;
685 685
 		}
686 686
 
687
-		if ( 'yes' == get_post_meta( $this->id, '_calendar_is_static', true ) ) {
687
+		if ('yes' == get_post_meta($this->id, '_calendar_is_static', true)) {
688 688
 			$this->static = true;
689 689
 			return;
690 690
 		}
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	 *
713 713
 	 * @return Calendar_View
714 714
 	 */
715
-	abstract public function get_view( $view = '' );
715
+	abstract public function get_view($view = '');
716 716
 
717 717
 	/**
718 718
 	 * Get event HTML parsed by template.
@@ -724,11 +724,11 @@  discard block
 block discarded – undo
724 724
 	 *
725 725
 	 * @return string
726 726
 	 */
727
-	public function get_event_html( Event $event, $template = '' ) {
728
-		$event_builder = new Event_Builder( $event, $this );
727
+	public function get_event_html(Event $event, $template = '') {
728
+		$event_builder = new Event_Builder($event, $this);
729 729
 		// Use the event template to parse tags; if empty, fallback to calendar post content.
730
-		$template = empty( $template ) ? ( empty( $event->template ) ? $this->events_template : $event->template ) : $template;
731
-		return $event_builder->parse_event_template_tags( $template );
730
+		$template = empty($template) ? (empty($event->template) ? $this->events_template : $event->template) : $template;
731
+		return $event_builder->parse_event_template_tags($template);
732 732
 	}
733 733
 
734 734
 	/**
@@ -738,58 +738,58 @@  discard block
 block discarded – undo
738 738
 	 *
739 739
 	 * @param string $view The calendar view to display.
740 740
 	 */
741
-	public function html( $view = '' ) {
741
+	public function html($view = '') {
742 742
 
743
-		$view = empty( $view ) ? $this->view : $this->get_view( $view );
743
+		$view = empty($view) ? $this->view : $this->get_view($view);
744 744
 
745
-		if ( $view instanceof Calendar_View ) {
745
+		if ($view instanceof Calendar_View) {
746 746
 
747
-			if ( ! empty( $this->errors ) ) {
747
+			if ( ! empty($this->errors)) {
748 748
 
749
-				if ( current_user_can( 'manage_options' )  ) {
749
+				if (current_user_can('manage_options')) {
750 750
 					echo '<pre><code>';
751
-					foreach ( $this->errors as $error ) { echo $error; }
751
+					foreach ($this->errors as $error) { echo $error; }
752 752
 					echo '</code></pre>';
753 753
 				}
754 754
 
755 755
 			} else {
756 756
 
757 757
 				// Get a CSS class from the class name of the calendar view (minus namespace part).
758
-				$view_name  = implode( '-', array_map( 'lcfirst', explode( '_', strtolower( get_class( $view ) ) ) ) );
759
-				$view_class = substr( $view_name, strrpos( $view_name, '\\' ) + 1 );
758
+				$view_name  = implode('-', array_map('lcfirst', explode('_', strtolower(get_class($view)))));
759
+				$view_class = substr($view_name, strrpos($view_name, '\\') + 1);
760 760
 
761
-				$calendar_class = trim( implode( ' simcal-', apply_filters( 'simcal_calendar_class', array(
761
+				$calendar_class = trim(implode(' simcal-', apply_filters('simcal_calendar_class', array(
762 762
 					'simcal-calendar',
763 763
 					$this->type,
764 764
 					$view_class,
765
-				), $this->id ) ) );
766
-
767
-				echo '<div class="' . $calendar_class . '" '
768
-									. 'data-calendar-id="'    . $this->id . '" '
769
-									. 'data-timezone="'       . $this->timezone . '" '
770
-									. 'data-offset="'         . $this->offset . '" '
771
-									. 'data-week-start="'     . $this->week_starts . '" '
772
-									. 'data-calendar-start="' . $this->start .'" '
773
-									. 'data-calendar-end="'   . $this->end . '" '
774
-									. 'data-events-first="'   . $this->earliest_event .'" '
775
-									. 'data-events-last="'    . $this->latest_event . '"'
765
+				), $this->id)));
766
+
767
+				echo '<div class="'.$calendar_class.'" '
768
+									. 'data-calendar-id="'.$this->id.'" '
769
+									. 'data-timezone="'.$this->timezone.'" '
770
+									. 'data-offset="'.$this->offset.'" '
771
+									. 'data-week-start="'.$this->week_starts.'" '
772
+									. 'data-calendar-start="'.$this->start.'" '
773
+									. 'data-calendar-end="'.$this->end.'" '
774
+									. 'data-events-first="'.$this->earliest_event.'" '
775
+									. 'data-events-last="'.$this->latest_event.'"'
776 776
 									. '>';
777 777
 
778
-				date_default_timezone_set( $this->timezone );
779
-				do_action( 'simcal_calendar_html_before', $this->id );
778
+				date_default_timezone_set($this->timezone);
779
+				do_action('simcal_calendar_html_before', $this->id);
780 780
 
781 781
 				$view->html();
782 782
 
783
-				do_action( 'simcal_calendar_html_after', $this->id );
784
-				date_default_timezone_set( $this->site_timezone );
783
+				do_action('simcal_calendar_html_after', $this->id);
784
+				date_default_timezone_set($this->site_timezone);
785 785
 
786
-				$settings = get_option( 'simple-calendar_settings_calendars' );
787
-				$poweredby = isset( $settings['poweredby']['opt_in'] ) ? $settings['poweredby']['opt_in'] : '';
786
+				$settings = get_option('simple-calendar_settings_calendars');
787
+				$poweredby = isset($settings['poweredby']['opt_in']) ? $settings['poweredby']['opt_in'] : '';
788 788
 
789
-				if ( 'yes' == $poweredby ) {
789
+				if ('yes' == $poweredby) {
790 790
 					$align = is_rtl() ? 'left' : 'right';
791
-					echo '<small class="simcal-powered simcal-align-' . $align .'">' .
792
-					     sprintf( __( 'Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events' ), simcal_get_url( 'home' ) ) .
791
+					echo '<small class="simcal-powered simcal-align-'.$align.'">'.
792
+					     sprintf(__('Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events'), simcal_get_url('home')).
793 793
 					     '</small>';
794 794
 				}
795 795
 
Please login to merge, or discard this patch.