Completed
Push — master ( a00b53...3dc4d8 )
by
unknown
21:18
created
includes/admin/fields/checkbox.php 1 patch
Spacing   +21 added lines, -21 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; // Exit if accessed directly.
13 13
 }
14 14
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param array $field
30 30
 	 */
31
-	public function __construct( $field ) {
31
+	public function __construct($field) {
32 32
 		$this->type_class = 'simcal-field-checkboxes';
33
-		parent::__construct( $field );
33
+		parent::__construct($field);
34 34
 	}
35 35
 
36 36
 	/**
@@ -40,33 +40,33 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function html() {
42 42
 
43
-		if ( ! empty( $this->options ) && count( (array) $this->options ) > 1 ) {
43
+		if ( ! empty($this->options) && count((array) $this->options) > 1) {
44 44
 
45
-			if ( ! empty( $this->description ) ) {
46
-				echo '<p class="description">' . wp_kses_post( $this->description ) . ' ' . $this->tooltip . '</p>';
45
+			if ( ! empty($this->description)) {
46
+				echo '<p class="description">'.wp_kses_post($this->description).' '.$this->tooltip.'</p>';
47 47
 			}
48 48
 
49 49
 			?>
50
-			<fieldset class="<?php echo $this->class; ?>" <?php echo ! empty( $this->style ) ? 'style="' . $this->style . '"' : ''; ?>>
50
+			<fieldset class="<?php echo $this->class; ?>" <?php echo ! empty($this->style) ? 'style="'.$this->style.'"' : ''; ?>>
51 51
 				<?php
52 52
 
53
-				if ( ! empty( $this->title ) ) {
54
-					echo '<legend class="screen-reader-text"><span>' . $this->title . '</span></legend>';
53
+				if ( ! empty($this->title)) {
54
+					echo '<legend class="screen-reader-text"><span>'.$this->title.'</span></legend>';
55 55
 				}
56 56
 
57 57
 				?>
58 58
 				<ul>
59
-					<?php foreach ( $this->options as $option => $name ) : ?>
59
+					<?php foreach ($this->options as $option => $name) : ?>
60 60
 						<li>
61
-							<label for="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>">
61
+							<label for="<?php echo $this->id.'-'.trim(strval($option)); ?>">
62 62
 								<input name="<?php echo $this->name; ?>"
63
-								       id="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>"
63
+								       id="<?php echo $this->id.'-'.trim(strval($option)); ?>"
64 64
 								       class="simcal-field simcal-field-checkbox"
65 65
 								       type="checkbox"
66
-								       value="<?php echo trim( strval( $option ) ); ?>"
67
-										<?php checked( $this->value, 'yes', true ); ?>
66
+								       value="<?php echo trim(strval($option)); ?>"
67
+										<?php checked($this->value, 'yes', true); ?>
68 68
 									<?php echo $this->attributes; ?>
69
-									/><?php echo esc_attr( $name ); ?>
69
+									/><?php echo esc_attr($name); ?>
70 70
 							</label>
71 71
 						</li>
72 72
 					<?php endforeach; ?>
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 		} else {
78 78
 
79 79
 			?>
80
-			<span class="simcal-field-bool" <?php echo $this->style ? 'style="' . $this->style . '"' : ''; ?>>
81
-				<?php if ( ! empty( $this->title ) ) : ?>
80
+			<span class="simcal-field-bool" <?php echo $this->style ? 'style="'.$this->style.'"' : ''; ?>>
81
+				<?php if ( ! empty($this->title)) : ?>
82 82
 					<span class="screen-reader-text"><?php echo $this->title; ?></span>
83 83
 				<?php endif; ?>
84 84
 				<input name="<?php echo $this->name; ?>"
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 				       id="<?php echo $this->id; ?>"
87 87
 				       class="simcal-field simcal-field-checkbox <?php echo $this->class; ?>"
88 88
 				       value="yes"
89
-					<?php checked( $this->value, 'yes', true ); ?>
90
-					<?php echo $this->attributes; ?>/><?php _e( 'Yes', 'google-calendar-events' ); ?>
89
+					<?php checked($this->value, 'yes', true); ?>
90
+					<?php echo $this->attributes; ?>/><?php _e('Yes', 'google-calendar-events'); ?>
91 91
 			</span>
92 92
 			<?php
93 93
 
94 94
 			echo $this->tooltip;
95 95
 
96
-			if ( ! empty( $this->description ) ) {
97
-				echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>';
96
+			if ( ! empty($this->description)) {
97
+				echo '<p class="description">'.wp_kses_post($this->description).'</p>';
98 98
 			}
99 99
 
100 100
 		}
Please login to merge, or discard this patch.
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/functions/shared.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @package SimpleCalendar/Functions
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function is_simple_calendar() {
22 22
 
23
-	if ( is_singular() ) {
23
+	if (is_singular()) {
24 24
 
25 25
 		global $post, $post_type;
26 26
 
27
-		if ( 'calendar' == $post_type ) {
27
+		if ('calendar' == $post_type) {
28 28
 			return true;
29 29
 		} else {
30
-			if ( false !== get_post_meta( $post->ID, '_simcal_attach_calendar_id', true ) ) {
30
+			if (false !== get_post_meta($post->ID, '_simcal_attach_calendar_id', true)) {
31 31
 				return true;
32 32
 			}
33
-			if ( has_shortcode( $post->post_content, 'calendar' ) ) {
33
+			if (has_shortcode($post->post_content, 'calendar')) {
34 34
 				return true;
35 35
 			}
36 36
 		}
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return string
48 48
  */
49
-function simcal_get_url( $url ) {
50
-	return \SimpleCalendar\plugin()->get_url( $url );
49
+function simcal_get_url($url) {
50
+	return \SimpleCalendar\plugin()->get_url($url);
51 51
 }
52 52
 
53 53
 /**
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
  *
72 72
  * @return null|\SimpleCalendar\Abstracts\Feed
73 73
  */
74
-function simcal_get_feed( $object ) {
74
+function simcal_get_feed($object) {
75 75
 	$objects = \SimpleCalendar\plugin()->objects;
76
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_feed( $object ) : null;
76
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_feed($object) : null;
77 77
 }
78 78
 
79 79
 /**
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
  *
98 98
  * @return null|\SimpleCalendar\Abstracts\Calendar
99 99
  */
100
-function simcal_get_calendar( $object ) {
100
+function simcal_get_calendar($object) {
101 101
 	$objects = \SimpleCalendar\plugin()->objects;
102
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_calendar( $object ) : null;
102
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_calendar($object) : null;
103 103
 }
104 104
 
105 105
 /**
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
  *
113 113
  * @return mixed
114 114
  */
115
-function simcal_get_calendar_view( $id = 0, $name = '' ) {
115
+function simcal_get_calendar_view($id = 0, $name = '') {
116 116
 	$objects = \SimpleCalendar\plugin()->objects;
117
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_calendar_view( $id, $name ) : false;
117
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_calendar_view($id, $name) : false;
118 118
 }
119 119
 
120 120
 /**
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
  *
127 127
  * @return void
128 128
  */
129
-function simcal_print_calendar( $object ) {
129
+function simcal_print_calendar($object) {
130 130
 
131
-	$calendar = simcal_get_calendar( $object );
131
+	$calendar = simcal_get_calendar($object);
132 132
 
133
-	if ( $calendar instanceof \SimpleCalendar\Abstracts\Calendar ) {
133
+	if ($calendar instanceof \SimpleCalendar\Abstracts\Calendar) {
134 134
 		$calendar->html();
135 135
 	}
136 136
 }
@@ -148,21 +148,21 @@  discard block
 block discarded – undo
148 148
 
149 149
 	$vars = array(
150 150
 		'ajax_url'  => \SimpleCalendar\plugin()->ajax_url(),
151
-		'nonce'     => wp_create_nonce( 'simcal' ),
151
+		'nonce'     => wp_create_nonce('simcal'),
152 152
 		'locale'    => \SimpleCalendar\plugin()->locale,
153 153
 		'text_dir'  => is_rtl() ? 'rtl' : 'ltr',
154 154
 		'months'    => array(
155
-			'full'  => simcal_get_calendar_names_i18n( 'month', 'full' ),
156
-			'short' => simcal_get_calendar_names_i18n( 'month', 'short' ),
155
+			'full'  => simcal_get_calendar_names_i18n('month', 'full'),
156
+			'short' => simcal_get_calendar_names_i18n('month', 'short'),
157 157
 		),
158 158
 		'days'      => array(
159
-			'full'  => simcal_get_calendar_names_i18n( 'day', 'full' ),
160
-			'short' => simcal_get_calendar_names_i18n( 'day', 'short' ),
159
+			'full'  => simcal_get_calendar_names_i18n('day', 'full'),
160
+			'short' => simcal_get_calendar_names_i18n('day', 'short'),
161 161
 		),
162
-		'meridiem' => simcal_get_calendar_names_i18n( 'meridiem' ),
162
+		'meridiem' => simcal_get_calendar_names_i18n('meridiem'),
163 163
 	);
164 164
 
165
-	return array_merge( $vars, apply_filters( 'simcal_common_scripts_variables', array() ) );
165
+	return array_merge($vars, apply_filters('simcal_common_scripts_variables', array()));
166 166
 }
167 167
 
168 168
 /**
@@ -175,31 +175,31 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return array Associative array with ids as keys and feed titles as values.
177 177
  */
178
-function simcal_get_calendars( $exclude = '', $cached = true ) {
178
+function simcal_get_calendars($exclude = '', $cached = true) {
179 179
 
180
-	$calendars = get_transient( '_simple-calendar_feed_ids' );
180
+	$calendars = get_transient('_simple-calendar_feed_ids');
181 181
 
182
-	if ( ! $calendars || $cached === false ) {
182
+	if ( ! $calendars || $cached === false) {
183 183
 
184
-		$posts = get_posts( array(
184
+		$posts = get_posts(array(
185 185
 			'post_type' => 'calendar',
186 186
 			'nopaging'  => true,
187
-		) );
187
+		));
188 188
 
189 189
 		$calendars = array();
190
-		foreach ( $posts as $post ) {
191
-			$calendars[ $post->ID ] = $post->post_title;
190
+		foreach ($posts as $post) {
191
+			$calendars[$post->ID] = $post->post_title;
192 192
 		}
193
-		asort( $calendars );
193
+		asort($calendars);
194 194
 
195
-		set_transient( '_simple-calendar_feed_ids', $calendars, 604800 );
195
+		set_transient('_simple-calendar_feed_ids', $calendars, 604800);
196 196
 	}
197 197
 
198
-	if ( ! empty( $exclude ) ) {
199
-		if ( is_numeric( $exclude ) ) {
200
-			unset( $calendars[ intval( $exclude ) ] );
201
-		} elseif ( is_array( $exclude ) ) {
202
-			array_diff_key( $calendars, array_map( 'intval', array_keys( $exclude ) ) );
198
+	if ( ! empty($exclude)) {
199
+		if (is_numeric($exclude)) {
200
+			unset($calendars[intval($exclude)]);
201
+		} elseif (is_array($exclude)) {
202
+			array_diff_key($calendars, array_map('intval', array_keys($exclude)));
203 203
 		}
204 204
 	}
205 205
 
@@ -218,45 +218,45 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @return array
220 220
  */
221
-function simcal_get_calendar_names_i18n( $group, $style = 'full' ) {
221
+function simcal_get_calendar_names_i18n($group, $style = 'full') {
222 222
 
223 223
 	$names = array();
224 224
 
225
-	if ( in_array( $group, array( 'month', 'day', 'meridiem' ) ) ) {
225
+	if (in_array($group, array('month', 'day', 'meridiem'))) {
226 226
 
227 227
 		$format = '';
228 228
 		$length = 0;
229 229
 
230 230
 		$date = Carbon\Carbon::now();
231 231
 
232
-		if ( 'month' == $group ) {
233
-			$date->month( 0 )->startOfMonth();
232
+		if ('month' == $group) {
233
+			$date->month(0)->startOfMonth();
234 234
 			$format = 'short' == $style ? 'M' : 'F';
235 235
 			$length = 11;
236
-		} elseif ( 'day' == $group ) {
237
-			$date->next( 6 );
236
+		} elseif ('day' == $group) {
237
+			$date->next(6);
238 238
 			$format = 'short' == $style ? 'D' : 'l';
239 239
 			$length = 6;
240
-		} elseif ( 'meridiem' == $group ) {
240
+		} elseif ('meridiem' == $group) {
241 241
 			$date->startOfDay();
242
-			$am = $date->addHour( 1 )->getTimestamp();
243
-			$pm = $date->addHours( 13 )->getTimestamp();
242
+			$am = $date->addHour(1)->getTimestamp();
243
+			$pm = $date->addHours(13)->getTimestamp();
244 244
 			return array(
245
-				'AM' => date_i18n( 'A', $am ),
246
-				'am' => date_i18n( 'a', $am ),
247
-				'PM' => date_i18n( 'A', $pm ),
248
-				'pm' => date_i18n( 'a', $pm ),
245
+				'AM' => date_i18n('A', $am),
246
+				'am' => date_i18n('a', $am),
247
+				'PM' => date_i18n('A', $pm),
248
+				'pm' => date_i18n('a', $pm),
249 249
 			);
250 250
 		}
251 251
 
252 252
 		$i = 0;
253
-		while ( $i <= $length ) {
254
-			if ( 'month' == $group ) {
255
-				$date->addMonths( 1 );
253
+		while ($i <= $length) {
254
+			if ('month' == $group) {
255
+				$date->addMonths(1);
256 256
 			} else {
257
-				$date->addDays( 1 );
257
+				$date->addDays(1);
258 258
 			}
259
-			$names[ strval( $i ) ] = date_i18n( $format, $date->getTimestamp() );
259
+			$names[strval($i)] = date_i18n($format, $date->getTimestamp());
260 260
 			$i++;
261 261
 		}
262 262
 
@@ -274,15 +274,15 @@  discard block
 block discarded – undo
274 274
  */
275 275
 function simcal_default_event_template() {
276 276
 
277
-	$content  = '<strong>' . '[title]' . '</strong>';
277
+	$content  = '<strong>'.'[title]'.'</strong>';
278 278
 	$content .= '<p>';
279
-	$content .= '[when]' . "\n";
279
+	$content .= '[when]'."\n";
280 280
 	$content .= '[location]';
281 281
 	$content .= '</p>';
282
-	$content .= '<div>' . '[description]' . '</div>';
283
-	$content .= '<p>' . '[link newwindow="yes"]' . __( 'See more details', 'google-calendar-events' ) . '[/link]' . '</p>';
282
+	$content .= '<div>'.'[description]'.'</div>';
283
+	$content .= '<p>'.'[link newwindow="yes"]'.__('See more details', 'google-calendar-events').'[/link]'.'</p>';
284 284
 
285
-	return apply_filters( 'simcal_default_event_template', $content );
285
+	return apply_filters('simcal_default_event_template', $content);
286 286
 }
287 287
 
288 288
 /**
@@ -297,21 +297,21 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @return array
299 299
  */
300
-function simcal_get_date_format_order( $date_format ) {
300
+function simcal_get_date_format_order($date_format) {
301 301
 
302 302
 	$pos = array(
303
-		'd' => strpos( $date_format, strpbrk( $date_format, 'Dj' ) ),
304
-		'm' => strpos( $date_format, strpbrk( $date_format, 'FMmn' ) ),
305
-		'y' => strpos( $date_format, strpbrk( $date_format, 'Yy' ) ),
303
+		'd' => strpos($date_format, strpbrk($date_format, 'Dj')),
304
+		'm' => strpos($date_format, strpbrk($date_format, 'FMmn')),
305
+		'y' => strpos($date_format, strpbrk($date_format, 'Yy')),
306 306
 	);
307 307
 
308 308
 	// @TODO When one date piece is not found, perhaps fallback to ISO standard position.
309 309
 
310 310
 	$order = array();
311
-	foreach ( $pos as $k => $v ) {
312
-		$order[ $k ] = $v;
311
+	foreach ($pos as $k => $v) {
312
+		$order[$k] = $v;
313 313
 	}
314
-	ksort( $order );
314
+	ksort($order);
315 315
 
316 316
 	return $order;
317 317
 }
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function simcal_get_wp_timezone() {
329 329
 
330
-	$timezone = get_option( 'timezone_string' );
330
+	$timezone = get_option('timezone_string');
331 331
 
332
-	if ( empty( $timezone ) ) {
333
-		$gmt = get_option( 'gmt_offset' );
334
-		$timezone = simcal_get_timezone_from_gmt_offset( $gmt );
332
+	if (empty($timezone)) {
333
+		$gmt = get_option('gmt_offset');
334
+		$timezone = simcal_get_timezone_from_gmt_offset($gmt);
335 335
 	}
336 336
 
337 337
 	return $timezone;
@@ -348,26 +348,26 @@  discard block
 block discarded – undo
348 348
  *
349 349
  * @return null|string
350 350
  */
351
-function simcal_get_timezone_from_gmt_offset( $offset ) {
351
+function simcal_get_timezone_from_gmt_offset($offset) {
352 352
 
353
-	if ( is_numeric( $offset ) ) {
353
+	if (is_numeric($offset)) {
354 354
 
355
-		if ( 0 === intval( $offset ) ) {
355
+		if (0 === intval($offset)) {
356 356
 			return 'UTC';
357 357
 		} else {
358
-			$offset = floatval( $offset ) * 3600;
358
+			$offset = floatval($offset) * 3600;
359 359
 		}
360 360
 
361
-		$timezone = timezone_name_from_abbr( null, $offset, false );
361
+		$timezone = timezone_name_from_abbr(null, $offset, false);
362 362
 		// This is buggy and might return false:
363 363
 		// @see http://php.net/manual/en/function.timezone-name-from-abbr.php#86928
364 364
 		// Therefore:
365
-		if ( false == $timezone ) {
365
+		if (false == $timezone) {
366 366
 
367 367
 			$list = timezone_abbreviations_list();
368
-			foreach ( $list as $abbr ) {
369
-				foreach ( $abbr as $city ) {
370
-					if ( $offset == $city['offset'] ) {
368
+			foreach ($list as $abbr) {
369
+				foreach ($abbr as $city) {
370
+					if ($offset == $city['offset']) {
371 371
 						return $city['timezone_id'];
372 372
 					}
373 373
 				}
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @return int Unix time offset
392 392
  */
393
-function simcal_get_timezone_offset( $timezone ) {
394
-	return \Carbon\Carbon::now( $timezone )->offset;
393
+function simcal_get_timezone_offset($timezone) {
394
+	return \Carbon\Carbon::now($timezone)->offset;
395 395
 }
396 396
 
397 397
 /**
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
  *
405 405
  * @return mixed|string
406 406
  */
407
-function simcal_esc_timezone( $tz, $default = 'UTC' ) {
408
-	return in_array( $tz, timezone_identifiers_list() ) ? $tz : $default;
407
+function simcal_esc_timezone($tz, $default = 'UTC') {
408
+	return in_array($tz, timezone_identifiers_list()) ? $tz : $default;
409 409
 }
410 410
 
411 411
 /**
@@ -417,57 +417,57 @@  discard block
 block discarded – undo
417 417
  *
418 418
  * @return bool
419 419
  */
420
-function simcal_delete_feed_transients( $id = '' ) {
420
+function simcal_delete_feed_transients($id = '') {
421 421
 
422
-	$grouped_ids = get_post_meta( $id, '_grouped_calendars_ids', true );
422
+	$grouped_ids = get_post_meta($id, '_grouped_calendars_ids', true);
423 423
 
424 424
 	// If there are group IDs we need to construct an array to pass along with the grouped IDs + the original $post_id
425
-	if ( is_array( $grouped_ids ) ) {
425
+	if (is_array($grouped_ids)) {
426 426
 		$temp_id = $id;
427 427
 		$id = $grouped_ids;
428 428
 		$id[] = $temp_id;
429 429
 	}
430 430
 
431
-	if ( is_numeric( $id ) ) {
432
-		$id = intval( $id ) > 0 ? absint( $id ) : simcal_get_calendars();
433
-	} elseif ( $id instanceof WP_Post ) {
431
+	if (is_numeric($id)) {
432
+		$id = intval($id) > 0 ? absint($id) : simcal_get_calendars();
433
+	} elseif ($id instanceof WP_Post) {
434 434
 		$id = $id->ID;
435
-	} elseif ( is_array( $id ) ) {
436
-		$id = array_map( 'absint', $id );
435
+	} elseif (is_array($id)) {
436
+		$id = array_map('absint', $id);
437 437
 	} else {
438
-		$id = simcal_get_calendars( '', true );
438
+		$id = simcal_get_calendars('', true);
439 439
 	}
440 440
 
441 441
 	$feed_types = simcal_get_feed_types();
442 442
 
443
-	if ( is_array( $id ) ) {
443
+	if (is_array($id)) {
444 444
 
445
-		$posts = get_posts( array(
445
+		$posts = get_posts(array(
446 446
 				'post_type' => 'calendar',
447 447
 				'fields'    => 'ids',
448 448
 				'post__in'  => $id,
449 449
 				'nopaging'  => true,
450
-		) );
450
+		));
451 451
 
452
-		foreach ( $posts as $post ) {
453
-			$calendar = simcal_get_calendar( $post );
454
-			if ( $calendar instanceof \SimpleCalendar\Abstracts\Calendar ) {
455
-				foreach ( $feed_types as $feed_type ) {
456
-					delete_transient( '_simple-calendar_feed_id_' . strval( $calendar->id ) . '_' . $feed_type );
452
+		foreach ($posts as $post) {
453
+			$calendar = simcal_get_calendar($post);
454
+			if ($calendar instanceof \SimpleCalendar\Abstracts\Calendar) {
455
+				foreach ($feed_types as $feed_type) {
456
+					delete_transient('_simple-calendar_feed_id_'.strval($calendar->id).'_'.$feed_type);
457 457
 				}
458 458
 			}
459 459
 		}
460 460
 
461 461
 	} else {
462 462
 
463
-		$post = get_post( $id );
464
-		$calendar = simcal_get_calendar( $post );
465
-		if ( $calendar instanceof \SimpleCalendar\Abstracts\Calendar ) {
466
-			foreach ( $feed_types as $feed_type ) {
467
-				delete_transient( '_simple-calendar_feed_id_' . strval( $calendar->id ) . '_' . $feed_type );
463
+		$post = get_post($id);
464
+		$calendar = simcal_get_calendar($post);
465
+		if ($calendar instanceof \SimpleCalendar\Abstracts\Calendar) {
466
+			foreach ($feed_types as $feed_type) {
467
+				delete_transient('_simple-calendar_feed_id_'.strval($calendar->id).'_'.$feed_type);
468 468
 			}
469 469
 		}
470 470
 	}
471 471
 
472
-	return delete_transient( '_simple-calendar_feed_ids' );
472
+	return delete_transient('_simple-calendar_feed_ids');
473 473
 }
474 474
\ No newline at end of file
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/admin/ajax.php 1 patch
Spacing   +46 added lines, -46 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
 
@@ -25,19 +25,19 @@  discard block
 block discarded – undo
25 25
 	public function __construct() {
26 26
 
27 27
 		// Set an option if the user rated the plugin.
28
-		add_action( 'wp_ajax_simcal_rated', array( $this, 'rate_plugin' ) );
28
+		add_action('wp_ajax_simcal_rated', array($this, 'rate_plugin'));
29 29
 
30 30
 		// Set an option if the user rated the plugin.
31
-		add_action( 'wp_ajax_simcal_clear_cache', array( $this, 'clear_cache' ) );
31
+		add_action('wp_ajax_simcal_clear_cache', array($this, 'clear_cache'));
32 32
 
33 33
 		// Convert a datetime format.
34
-		add_action( 'wp_ajax_simcal_date_i18n_input_preview', array( $this, 'date_i18n' ) );
34
+		add_action('wp_ajax_simcal_date_i18n_input_preview', array($this, 'date_i18n'));
35 35
 
36 36
 		// Manage an add-on license activation or deactivation.
37
-		add_action( 'wp_ajax_simcal_manage_add_on_license', array( $this, 'manage_add_on_license' ) );
37
+		add_action('wp_ajax_simcal_manage_add_on_license', array($this, 'manage_add_on_license'));
38 38
 
39 39
 		// Reset add-ons licenses.
40
-		add_action( 'wp_ajax_simcal_reset_add_ons_licenses', array( $this, 'reset_licenses' ) );
40
+		add_action('wp_ajax_simcal_reset_add_ons_licenses', array($this, 'reset_licenses'));
41 41
 
42 42
 	}
43 43
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function clear_cache() {
50 50
 
51
-		$id = isset( $_POST['id'] ) ? ( is_array( $_POST['id'] ) ? array_map( 'intval', $_POST['id'] ) : intval( $_POST['id'] ) ) : '';
51
+		$id = isset($_POST['id']) ? (is_array($_POST['id']) ? array_map('intval', $_POST['id']) : intval($_POST['id'])) : '';
52 52
 
53
-		if ( ! empty( $id ) ) {
54
-			simcal_delete_feed_transients( $id );
53
+		if ( ! empty($id)) {
54
+			simcal_delete_feed_transients($id);
55 55
 		}
56 56
 	}
57 57
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @since 3.0.0
62 62
 	 */
63 63
 	public function rate_plugin() {
64
-		update_option( 'simple-calendar_admin_footer_text_rated', date( 'Y-m-d', time() ) );
64
+		update_option('simple-calendar_admin_footer_text_rated', date('Y-m-d', time()));
65 65
 	}
66 66
 
67 67
 	/**
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function date_i18n() {
73 73
 
74
-		$value     = isset( $_POST['value'] ) ? esc_attr( $_POST['value'] ) : ' ';
75
-		$timestamp = isset( $_POST['timestamp'] ) ? absint( $_POST['timestamp'] ) : time();
74
+		$value     = isset($_POST['value']) ? esc_attr($_POST['value']) : ' ';
75
+		$timestamp = isset($_POST['timestamp']) ? absint($_POST['timestamp']) : time();
76 76
 
77
-		wp_send_json_success( date_i18n( $value, $timestamp ) );
77
+		wp_send_json_success(date_i18n($value, $timestamp));
78 78
 	}
79 79
 
80 80
 	/**
@@ -86,35 +86,35 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function manage_add_on_license() {
88 88
 
89
-		$addon  = isset( $_POST['add_on'] )         ? sanitize_key( $_POST['add_on'] ) : false;
90
-		$action = isset( $_POST['license_action'] ) ? esc_attr( $_POST['license_action'] ) : false;
91
-		$key    = isset( $_POST['license_key'] )    ? esc_attr( $_POST['license_key'] ) : '';
92
-		$nonce  = isset( $_POST['nonce'] )          ? esc_attr( $_POST['nonce'] ) : '';
89
+		$addon  = isset($_POST['add_on']) ? sanitize_key($_POST['add_on']) : false;
90
+		$action = isset($_POST['license_action']) ? esc_attr($_POST['license_action']) : false;
91
+		$key    = isset($_POST['license_key']) ? esc_attr($_POST['license_key']) : '';
92
+		$nonce  = isset($_POST['nonce']) ? esc_attr($_POST['nonce']) : '';
93 93
 
94 94
 		// Verify that there are valid variables to process.
95
-		if ( false === $addon || ! in_array( $action, array( 'activate_license', 'deactivate_license' ) ) ) {
96
-			wp_send_json_error( __( 'Add-on unspecified or invalid action.', 'google-calendar-events' ) );
95
+		if (false === $addon || ! in_array($action, array('activate_license', 'deactivate_license'))) {
96
+			wp_send_json_error(__('Add-on unspecified or invalid action.', 'google-calendar-events'));
97 97
 		}
98 98
 
99 99
 		// Verify this request comes from the add-ons licenses activation settings page.
100
-		if ( ! wp_verify_nonce( $nonce, 'simcal_license_manager' ) ) {
101
-			wp_send_json_error( sprintf( __( 'An error occurred: %s', 'google-calendar-events' ), 'Nonce verification failed.' ) );
100
+		if ( ! wp_verify_nonce($nonce, 'simcal_license_manager')) {
101
+			wp_send_json_error(sprintf(__('An error occurred: %s', 'google-calendar-events'), 'Nonce verification failed.'));
102 102
 		}
103 103
 
104 104
 		// Removes the prefix and converts simcal_{id_no} to {id_no}.
105
-		$id = intval( substr( $addon, 7 ) );
105
+		$id = intval(substr($addon, 7));
106 106
 
107 107
 		// Data to send in API request.
108 108
 		$api_request = array(
109 109
 			'edd_action' => $action,
110 110
 			'license'    => $key,
111
-			'item_id'    => urlencode( $id ),
111
+			'item_id'    => urlencode($id),
112 112
 			'url'        => home_url()
113 113
 		);
114 114
 
115 115
 		// Call the custom API.
116 116
 		$response = wp_remote_post(
117
-			defined( 'SIMPLE_CALENDAR_STORE_URL' ) ? SIMPLE_CALENDAR_STORE_URL : simcal_get_url( 'home' ),
117
+			defined('SIMPLE_CALENDAR_STORE_URL') ? SIMPLE_CALENDAR_STORE_URL : simcal_get_url('home'),
118 118
 			array(
119 119
 				'timeout' => 15,
120 120
 				'sslverify' => false,
@@ -123,29 +123,29 @@  discard block
 block discarded – undo
123 123
 		);
124 124
 
125 125
 		// Update license in db.
126
-		$keys = get_option( 'simple-calendar_settings_licenses', array() );
127
-		$new_keys = array_merge( (array) $keys, array( 'keys' => array( $addon => $key ) ) );
128
-		update_option( 'simple-calendar_settings_licenses', $new_keys );
126
+		$keys = get_option('simple-calendar_settings_licenses', array());
127
+		$new_keys = array_merge((array) $keys, array('keys' => array($addon => $key)));
128
+		update_option('simple-calendar_settings_licenses', $new_keys);
129 129
 
130 130
 		// Make sure there is a response.
131
-		if ( is_wp_error( $response ) ) {
132
-			wp_send_json_error( sprintf( __( 'There was an error processing your request: %s', 'google-calendar-events' ), $response->get_error_message() ) );
131
+		if (is_wp_error($response)) {
132
+			wp_send_json_error(sprintf(__('There was an error processing your request: %s', 'google-calendar-events'), $response->get_error_message()));
133 133
 		}
134 134
 
135 135
 		// Decode the license data and save.
136
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
136
+		$license_data = json_decode(wp_remote_retrieve_body($response));
137 137
 		$status = simcal_get_license_status();
138
-		if ( 'deactivated' == $license_data->license  ) {
139
-			unset( $status[ $addon ] );
140
-			update_option( 'simple-calendar_licenses_status', $status );
141
-			wp_send_json_success( $license_data->license );
142
- 		} elseif ( in_array( $license_data->license, array( 'valid', 'invalid' ) ) ) {
143
-			$status[ $addon ] = $license_data->license;
144
-			update_option( 'simple-calendar_licenses_status', $status );
145
-			$message = 'valid' == $license_data->license ? 'valid' : __( 'License key is invalid.', 'google-calendar-events' );
146
-			wp_send_json_success( $message );
138
+		if ('deactivated' == $license_data->license) {
139
+			unset($status[$addon]);
140
+			update_option('simple-calendar_licenses_status', $status);
141
+			wp_send_json_success($license_data->license);
142
+ 		} elseif (in_array($license_data->license, array('valid', 'invalid'))) {
143
+			$status[$addon] = $license_data->license;
144
+			update_option('simple-calendar_licenses_status', $status);
145
+			$message = 'valid' == $license_data->license ? 'valid' : __('License key is invalid.', 'google-calendar-events');
146
+			wp_send_json_success($message);
147 147
 		} else {
148
-			wp_send_json_error( '' );
148
+			wp_send_json_error('');
149 149
 		}
150 150
 	}
151 151
 
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public function reset_licenses() {
158 158
 
159
-		$nonce  = isset( $_POST['nonce'] ) ? esc_attr( $_POST['nonce'] ) : '';
159
+		$nonce = isset($_POST['nonce']) ? esc_attr($_POST['nonce']) : '';
160 160
 
161 161
 		// Verify this request comes from the add-ons licenses activation settings page.
162
-		if ( empty ( $nonce ) || ! wp_verify_nonce( $nonce, 'simcal_license_manager' ) ) {
163
-			wp_send_json_error( sprintf( __( 'An error occurred: %s', 'google-calendar-events' ), 'Nonce verification failed.' ) );
162
+		if (empty ($nonce) || ! wp_verify_nonce($nonce, 'simcal_license_manager')) {
163
+			wp_send_json_error(sprintf(__('An error occurred: %s', 'google-calendar-events'), 'Nonce verification failed.'));
164 164
 		}
165 165
 
166
-		delete_option( 'simple-calendar_settings_licenses' );
167
-		delete_option( 'simple-calendar_licenses_status' );
166
+		delete_option('simple-calendar_settings_licenses');
167
+		delete_option('simple-calendar_licenses_status');
168 168
 
169
-		wp_send_json_success( 'success' );
169
+		wp_send_json_success('success');
170 170
 	}
171 171
 
172 172
 }
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.
google-calendar-events.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 16
 // Exit if accessed directly.
17
-if ( ! defined( 'ABSPATH' ) ) {
17
+if ( ! defined('ABSPATH')) {
18 18
 	exit;
19 19
 }
20 20
 
21 21
 // Composer fallback for PHP < 5.3.0.
22
-if ( version_compare( PHP_VERSION, '5.3.0' ) === -1 ) {
22
+if (version_compare(PHP_VERSION, '5.3.0') === -1) {
23 23
 	include_once 'vendor/autoload_52.php';
24 24
 } else {
25 25
 	include_once 'vendor/autoload.php';
26 26
 }
27 27
 
28 28
 // Plugin constants.
29
-$this_plugin_path      = trailingslashit( dirname( __FILE__ ) );
30
-$this_plugin_dir       = plugin_dir_url( __FILE__ );
29
+$this_plugin_path      = trailingslashit(dirname(__FILE__));
30
+$this_plugin_dir       = plugin_dir_url(__FILE__);
31 31
 $this_plugin_constants = array(
32 32
 	'SIMPLE_CALENDAR_VERSION'   => '3.0.13',
33 33
 	'SIMPLE_CALENDAR_MAIN_FILE' => __FILE__,
34 34
 	'SIMPLE_CALENDAR_URL'       => $this_plugin_dir,
35
-	'SIMPLE_CALENDAR_ASSETS'    => $this_plugin_dir . 'assets/',
35
+	'SIMPLE_CALENDAR_ASSETS'    => $this_plugin_dir.'assets/',
36 36
 	'SIMPLE_CALENDAR_PATH'      => $this_plugin_path,
37
-	'SIMPLE_CALENDAR_INC'       => $this_plugin_path . 'includes/',
37
+	'SIMPLE_CALENDAR_INC'       => $this_plugin_path.'includes/',
38 38
 );
39
-foreach ( $this_plugin_constants as $constant => $value ) {
40
-	if ( ! defined( $constant ) ) {
41
-		define( $constant, $value );
39
+foreach ($this_plugin_constants as $constant => $value) {
40
+	if ( ! defined($constant)) {
41
+		define($constant, $value);
42 42
 	}
43 43
 }
44 44
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 include_once 'includes/wp-requirements.php';
48 48
 
49 49
 // Check plugin requirements before loading plugin.
50
-$this_plugin_checks = new SimCal_WP_Requirements( 'Simple Calendar', plugin_basename( __FILE__ ), array(
50
+$this_plugin_checks = new SimCal_WP_Requirements('Simple Calendar', plugin_basename(__FILE__), array(
51 51
 		'PHP'        => '5.3.3',
52 52
 		'WordPress'  => '4.0.0',
53 53
 		'Extensions' => array(
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 			'json',
57 57
 			'mbstring',
58 58
 		),
59
-	) );
60
-if ( $this_plugin_checks->pass() === false ) {
59
+	));
60
+if ($this_plugin_checks->pass() === false) {
61 61
 	$this_plugin_checks->halt();
62 62
 
63 63
 	return;
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   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\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,12 +76,12 @@  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
 
@@ -89,46 +89,46 @@  discard block
 block discarded – undo
89 89
 				<th></th>
90 90
 				<td>
91 91
 					<p class="description">
92
-						<?php _e( "Tip: If calendar styles appear to be missing and/or navigation isn't working, try going to", 'google-calendar-events' ); ?>
93
-						<a href="<?php echo esc_url( add_query_arg( array ( 'page' => 'simple-calendar_settings', 'tab' => 'advanced' ), admin_url( 'admin.php' ) ) ); ?>">
94
-							<?php _e( 'Calendars &rarr; Settings &rarr; Advanced', 'google-calendar-events' ); ?></a>
95
-						<?php _e( 'and enable', 'google-calendar-events' ); ?> <strong><?php _e( 'Always Enqueue', 'google-calendar-events' ); ?></strong>.
92
+						<?php _e("Tip: If calendar styles appear to be missing and/or navigation isn't working, try going to", 'google-calendar-events'); ?>
93
+						<a href="<?php echo esc_url(add_query_arg(array('page' => 'simple-calendar_settings', 'tab' => 'advanced'), admin_url('admin.php'))); ?>">
94
+							<?php _e('Calendars &rarr; Settings &rarr; Advanced', 'google-calendar-events'); ?></a>
95
+						<?php _e('and enable', 'google-calendar-events'); ?> <strong><?php _e('Always Enqueue', 'google-calendar-events'); ?></strong>.
96 96
 					</p>
97 97
 				</td>
98 98
 			</tr>
99 99
 			
100 100
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
101
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Event bubbles', 'google-calendar-events' ); ?></label></th>
101
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Event bubbles', 'google-calendar-events'); ?></label></th>
102 102
 				<td>
103 103
 					<?php
104 104
 
105
-					$bubbles = get_post_meta( $post_id, '_default_calendar_event_bubble_trigger', true );
105
+					$bubbles = get_post_meta($post_id, '_default_calendar_event_bubble_trigger', true);
106 106
 
107
-					simcal_print_field( array(
107
+					simcal_print_field(array(
108 108
 						'type'    => 'radio',
109 109
 						'inline'  => 'inline',
110 110
 						'name'    => '_default_calendar_event_bubble_trigger',
111 111
 						'id'      => '_default_calendar_event_bubble_trigger',
112
-						'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' ),
112
+						'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'),
113 113
 						'value'   => $bubbles ? $bubbles : 'hover',
114 114
 						'default' => 'hover',
115 115
 						'options' => array(
116
-							'click' => __( 'Click', 'google-calendar-events' ),
117
-							'hover' => __( 'Hover', 'google-calendar-events' ),
116
+							'click' => __('Click', 'google-calendar-events'),
117
+							'hover' => __('Hover', 'google-calendar-events'),
118 118
 						),
119
-					) );
119
+					));
120 120
 
121 121
 					?>
122 122
 				</td>
123 123
 			</tr>
124 124
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
125
-				<th><label for="_default_calendar_trim_titles"><?php _e( 'Trim event titles', 'google-calendar-events' ); ?></label></th>
125
+				<th><label for="_default_calendar_trim_titles"><?php _e('Trim event titles', 'google-calendar-events'); ?></label></th>
126 126
 				<td>
127 127
 					<?php
128 128
 
129
-					$trim = get_post_meta( $post_id, '_default_calendar_trim_titles', true );
129
+					$trim = get_post_meta($post_id, '_default_calendar_trim_titles', true);
130 130
 
131
-					simcal_print_field( array(
131
+					simcal_print_field(array(
132 132
 						'type'        => 'checkbox',
133 133
 						'name'        => '_default_calendar_trim_titles',
134 134
 						'id'          => '_default_calendar_trim_titles',
@@ -139,34 +139,34 @@  discard block
 block discarded – undo
139 139
 						'attributes'  => array(
140 140
 							'data-show-next-if-value' => 'yes',
141 141
 						),
142
-					) );
142
+					));
143 143
 
144
-					simcal_print_field( array(
144
+					simcal_print_field(array(
145 145
 						'type'       => 'standard',
146 146
 						'subtype'    => 'number',
147 147
 						'name'       => '_default_calendar_trim_titles_chars',
148 148
 						'id'         => '_default_calendar_trim_titles_chars',
149
-						'tooltip'    => __( 'Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events' ),
149
+						'tooltip'    => __('Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events'),
150 150
 						'class'      => array(
151 151
 							'simcal-field-tiny',
152 152
 						),
153
-						'value'      => 'yes' == $trim ? strval( max( absint( get_post_meta( $post_id, '_default_calendar_trim_titles_chars', true ) ), 1 ) ) : '20',
153
+						'value'      => 'yes' == $trim ? strval(max(absint(get_post_meta($post_id, '_default_calendar_trim_titles_chars', true)), 1)) : '20',
154 154
 						'attributes' => array(
155 155
 							'min'     => '1',
156 156
 						),
157
-					) );
157
+					));
158 158
 
159 159
 					?>
160 160
 				</td>
161 161
 			</tr>
162 162
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
163
-				<th><label for="_default_calendar_list_grouped_span"><?php _e( 'Span', 'google-calendar-events' ); ?></label></th>
163
+				<th><label for="_default_calendar_list_grouped_span"><?php _e('Span', 'google-calendar-events'); ?></label></th>
164 164
 				<td>
165 165
 					<?php
166 166
 
167
-					$list_span = max( absint( get_post_meta( $post_id, '_default_calendar_list_range_span', true ) ), 1 );
167
+					$list_span = max(absint(get_post_meta($post_id, '_default_calendar_list_range_span', true)), 1);
168 168
 
169
-					simcal_print_field( array(
169
+					simcal_print_field(array(
170 170
 						'type'    => 'standard',
171 171
 						'subtype' => 'number',
172 172
 						'name'    => '_default_calendar_list_range_span',
@@ -175,78 +175,78 @@  discard block
 block discarded – undo
175 175
 							'simcal-field-tiny',
176 176
 							'simcal-field-inline',
177 177
 						),
178
-						'value'   => strval( $list_span ),
178
+						'value'   => strval($list_span),
179 179
 						'attributes'  => array(
180 180
 							'min' => '1',
181 181
 						),
182
-					) );
182
+					));
183 183
 
184
-					$list_type = get_post_meta( $post_id, '_default_calendar_list_range_type', true );
184
+					$list_type = get_post_meta($post_id, '_default_calendar_list_range_type', true);
185 185
 
186
-					simcal_print_field( array(
186
+					simcal_print_field(array(
187 187
 						'type'    => 'select',
188 188
 						'name'    => '_default_calendar_list_range_type',
189 189
 						'id'      => '_default_calendar_list_range_type',
190
-						'tooltip' => __( 'Range of events to show on each calendar page.', 'google-calendar-events' ),
190
+						'tooltip' => __('Range of events to show on each calendar page.', 'google-calendar-events'),
191 191
 						'class'   => array(
192 192
 							'simcal-field-inline',
193 193
 						),
194 194
 						'value'   => $list_type,
195 195
 						'options' => array(
196
-							'monthly' => __( 'Month(s)', 'google-calendar-events' ),
197
-							'weekly'  => __( 'Week(s)', 'google-calendar-events' ),
198
-							'daily'   => __( 'Day(s)', 'google-calendar-events' ),
199
-							'events'  => __( 'Event(s)', 'google-calendar-events' ),
196
+							'monthly' => __('Month(s)', 'google-calendar-events'),
197
+							'weekly'  => __('Week(s)', 'google-calendar-events'),
198
+							'daily'   => __('Day(s)', 'google-calendar-events'),
199
+							'events'  => __('Event(s)', 'google-calendar-events'),
200 200
 						),
201
-					) );
201
+					));
202 202
 
203 203
 					?>
204 204
 				</td>
205 205
 			</tr>
206 206
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
207
-				<th><label for="_default_calendar_list_header"><?php _e( 'Hide header', 'google-calendar-events' ); ?></label></th>
207
+				<th><label for="_default_calendar_list_header"><?php _e('Hide header', 'google-calendar-events'); ?></label></th>
208 208
 				<td>
209 209
 					<?php
210 210
 
211
-					$header = get_post_meta( $post_id, '_default_calendar_list_header', true );
211
+					$header = get_post_meta($post_id, '_default_calendar_list_header', true);
212 212
 
213
-					simcal_print_field( array(
213
+					simcal_print_field(array(
214 214
 						'type'    => 'checkbox',
215 215
 						'name'    => '_default_calendar_list_header',
216 216
 						'id'      => '_default_calendar_list_header',
217
-						'tooltip' => __( 'You can use this to hide the month header for this calendar.', 'google-calendar-events' ),
217
+						'tooltip' => __('You can use this to hide the month header for this calendar.', 'google-calendar-events'),
218 218
 						'value'   => 'yes' == $header ? 'yes' : 'no',
219
-					) );
219
+					));
220 220
 
221 221
 					?>
222 222
 				</td>
223 223
 			</tr>
224 224
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
225
-				<th><label for="_default_calendar_compact_list"><?php _e( 'Compact list', 'google-calendar-events' ); ?></label></th>
225
+				<th><label for="_default_calendar_compact_list"><?php _e('Compact list', 'google-calendar-events'); ?></label></th>
226 226
 				<td>
227 227
 					<?php
228 228
 
229
-					$compact = get_post_meta( $post_id, '_default_calendar_compact_list', true );
229
+					$compact = get_post_meta($post_id, '_default_calendar_compact_list', true);
230 230
 
231
-					simcal_print_field( array(
231
+					simcal_print_field(array(
232 232
 						'type'    => 'checkbox',
233 233
 						'name'    => '_default_calendar_compact_list',
234 234
 						'id'      => '_default_calendar_compact_list',
235
-						'tooltip' => __( 'Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events' ),
235
+						'tooltip' => __('Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events'),
236 236
 						'value'   => 'yes' == $compact ? 'yes' : 'no',
237
-					) );
237
+					));
238 238
 
239 239
 					?>
240 240
 				</td>
241 241
 			</tr>
242 242
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list"  style="display: none;">
243
-				<th><label for="_default_calendar_limit_visible_events"><?php _e( 'Limit visible events', 'google-calendar-events' ); ?></label></th>
243
+				<th><label for="_default_calendar_limit_visible_events"><?php _e('Limit visible events', 'google-calendar-events'); ?></label></th>
244 244
 				<td>
245 245
 					<?php
246 246
 
247
-					$limit = get_post_meta( $post_id, '_default_calendar_limit_visible_events', true );
247
+					$limit = get_post_meta($post_id, '_default_calendar_limit_visible_events', true);
248 248
 
249
-					simcal_print_field( array(
249
+					simcal_print_field(array(
250 250
 						'type'        => 'checkbox',
251 251
 						'name'        => '_default_calendar_limit_visible_events',
252 252
 						'id'          => '_default_calendar_limit_visible_events',
@@ -257,17 +257,17 @@  discard block
 block discarded – undo
257 257
 						'attributes'  => array(
258 258
 							'data-show-next-if-value' => 'yes',
259 259
 						)
260
-					) );
260
+					));
261 261
 
262
-					$visible_events = absint( get_post_meta( $post_id, '_default_calendar_visible_events', true ) );
262
+					$visible_events = absint(get_post_meta($post_id, '_default_calendar_visible_events', true));
263 263
 					$visible_events = $visible_events > 0 ? $visible_events : 3;
264 264
 
265
-					simcal_print_field( array(
265
+					simcal_print_field(array(
266 266
 						'type'       => 'standard',
267 267
 						'subtype'    => 'number',
268 268
 						'name'       => '_default_calendar_visible_events',
269 269
 						'id'         => '_default_calendar_visible_events',
270
-						'tooltip'    => __( 'Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events' ),
270
+						'tooltip'    => __('Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events'),
271 271
 						'class'      => array(
272 272
 							'simcal-field-tiny',
273 273
 						),
@@ -275,39 +275,39 @@  discard block
 block discarded – undo
275 275
 						'attributes' => array(
276 276
 							'min'     => '1',
277 277
 						)
278
-					) );
278
+					));
279 279
 
280 280
 					?>
281 281
 				</td>
282 282
 			</tr>
283 283
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
284
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Expand multi-day events', 'google-calendar-events' ); ?></label></th>
284
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Expand multi-day events', 'google-calendar-events'); ?></label></th>
285 285
 				<td>
286 286
 					<?php
287 287
 
288
-					$post_meta = get_post_meta( $post_id );
288
+					$post_meta = get_post_meta($post_id);
289 289
 
290
-					if ( ! is_array( $post_meta ) && ! empty( $post_meta ) ) {
290
+					if ( ! is_array($post_meta) && ! empty($post_meta)) {
291 291
 						$multi_day_value = 'current_day_only';
292 292
 					} else {
293
-						$multi_day_value = get_post_meta( $post_id, '_default_calendar_expand_multi_day_events', true );
293
+						$multi_day_value = get_post_meta($post_id, '_default_calendar_expand_multi_day_events', true);
294 294
 					}
295 295
 
296
-					simcal_print_field( array(
296
+					simcal_print_field(array(
297 297
 						'type'    => 'select',
298 298
 						'name'    => '_default_calendar_expand_multi_day_events',
299 299
 						'id'      => '_default_calendar_expand_multi_day_events',
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' ),
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'),
303 303
 						'value'   => $multi_day_value,
304 304
 						'options' => array(
305
-							'yes'              => __( 'Yes, display on all days of event', 'google-calendar-events' ),
306
-							'no'               => __( 'No, display only on first day of event', 'google-calendar-events' ),
307
-							'current_day_only' => __( 'No, display on all days of event up to current day (list view only)', 'google-calendar-events' ),
305
+							'yes'              => __('Yes, display on all days of event', 'google-calendar-events'),
306
+							'no'               => __('No, display only on first day of event', 'google-calendar-events'),
307
+							'current_day_only' => __('No, display on all days of event up to current day (list view only)', 'google-calendar-events'),
308 308
 						),
309 309
 						'default' => 'current_day_only',
310
-					) );
310
+					));
311 311
 
312 312
 					?>
313 313
 				</td>
@@ -315,70 +315,70 @@  discard block
 block discarded – undo
315 315
 			</tbody>
316 316
 			<?php
317 317
 
318
-			$settings                   = get_option( 'simple-calendar_settings_calendars' );
319
-			$default_theme              = isset( $settings['default-calendar']['theme'] ) ? $settings['default-calendar']['theme'] : 'light';
318
+			$settings                   = get_option('simple-calendar_settings_calendars');
319
+			$default_theme              = isset($settings['default-calendar']['theme']) ? $settings['default-calendar']['theme'] : 'light';
320 320
 			$default_today_color        = /*isset( $settings['default-calendar']['today_color'] ) ? $settings['default-calendar']['today_color'] :*/ '#1e73be';
321 321
 			$default_days_events_color  = /*isset( $settings['default-calendar']['days_events_color'] ) ? $settings['default-calendar']['days_events_color'] :*/ '#000000';
322 322
 
323 323
 			?>
324 324
 			<tbody class="simcal-panel-section">
325 325
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
326
-				<th><label for="_default_calendar_style_theme"><?php _e( 'Theme', 'google-calendar-events' ); ?></label></th>
326
+				<th><label for="_default_calendar_style_theme"><?php _e('Theme', 'google-calendar-events'); ?></label></th>
327 327
 				<td>
328 328
 					<?php
329 329
 
330
-					$saved = get_post_meta( $post_id, '_default_calendar_style_theme', true );
330
+					$saved = get_post_meta($post_id, '_default_calendar_style_theme', true);
331 331
 					$value = ! $saved ? $default_theme : $saved;
332 332
 
333
-					simcal_print_field( array(
333
+					simcal_print_field(array(
334 334
 						'type'    => 'select',
335 335
 						'name'    => '_default_calendar_style_theme',
336 336
 						'id'      => '_default_calendar_style_theme',
337 337
 						'value'   => $value,
338
-						'tooltip' => __( 'Choose a calendar theme to match your site theme.', 'google-calendar-events' ),
338
+						'tooltip' => __('Choose a calendar theme to match your site theme.', 'google-calendar-events'),
339 339
 						'options' => array(
340
-							'light' => __( 'Light', 'google-calendar-events' ),
341
-							'dark' => __( 'Dark', 'google-calendar-events' ),
340
+							'light' => __('Light', 'google-calendar-events'),
341
+							'dark' => __('Dark', 'google-calendar-events'),
342 342
 						),
343
-					) );
343
+					));
344 344
 
345 345
 					?>
346 346
 				</td>
347 347
 			</tr>
348 348
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
349
-				<th><label for="_default_calendar_style_today"><?php _e( 'Today', 'google-calendar-events' ); ?></label></th>
349
+				<th><label for="_default_calendar_style_today"><?php _e('Today', 'google-calendar-events'); ?></label></th>
350 350
 				<td>
351 351
 					<?php
352 352
 
353
-					$saved = get_post_meta( $post_id, '_default_calendar_style_today', true );
353
+					$saved = get_post_meta($post_id, '_default_calendar_style_today', true);
354 354
 					$value = ! $saved ? $default_today_color : $saved;
355 355
 
356
-					simcal_print_field( array(
356
+					simcal_print_field(array(
357 357
 						'type'    => 'standard',
358 358
 						'subtype' => 'color-picker',
359 359
 						'name'    => '_default_calendar_style_today',
360 360
 						'id'      => '_default_calendar_style_today',
361 361
 						'value'   => $value,
362
-					) );
362
+					));
363 363
 
364 364
 					?>
365 365
 				</td>
366 366
 			</tr>
367 367
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
368
-				<th><label for="_default_calendar_style_days_events"><?php _e( 'Days with events', 'google-calendar-events' ); ?></label></th>
368
+				<th><label for="_default_calendar_style_days_events"><?php _e('Days with events', 'google-calendar-events'); ?></label></th>
369 369
 				<td>
370 370
 					<?php
371 371
 
372
-					$saved = get_post_meta( $post_id, '_default_calendar_style_days_events', true );
372
+					$saved = get_post_meta($post_id, '_default_calendar_style_days_events', true);
373 373
 					$value = ! $saved ? $default_days_events_color : $saved;
374 374
 
375
-					simcal_print_field( array(
375
+					simcal_print_field(array(
376 376
 						'type'    => 'standard',
377 377
 						'subtype' => 'color-picker',
378 378
 						'name'    => '_default_calendar_style_days_events',
379 379
 						'id'      => '_default_calendar_style_days_events',
380 380
 						'value'   => $value,
381
-					) );
381
+					));
382 382
 
383 383
 					?>
384 384
 				</td>
@@ -400,55 +400,55 @@  discard block
 block discarded – undo
400 400
 	 *
401 401
 	 * @param int $post_id
402 402
 	 */
403
-	public function process_meta( $post_id ) {
403
+	public function process_meta($post_id) {
404 404
 
405 405
 		// Theme.
406
-		$theme = isset( $_POST['_default_calendar_style_theme'] ) ? sanitize_key( $_POST['_default_calendar_style_theme'] ) : 'light';
407
-		update_post_meta( $post_id, '_default_calendar_style_theme', $theme );
406
+		$theme = isset($_POST['_default_calendar_style_theme']) ? sanitize_key($_POST['_default_calendar_style_theme']) : 'light';
407
+		update_post_meta($post_id, '_default_calendar_style_theme', $theme);
408 408
 
409 409
 		// Today color.
410
-		$today_color = isset( $_POST['_default_calendar_style_today'] ) ? sanitize_text_field( $_POST['_default_calendar_style_today'] ) : '#FF000';
411
-		update_post_meta( $post_id, '_default_calendar_style_today', $today_color );
410
+		$today_color = isset($_POST['_default_calendar_style_today']) ? sanitize_text_field($_POST['_default_calendar_style_today']) : '#FF000';
411
+		update_post_meta($post_id, '_default_calendar_style_today', $today_color);
412 412
 
413 413
 		// Days with events color.
414
-		$days_events_color = isset( $_POST['_default_calendar_style_days_events'] ) ? sanitize_text_field( $_POST['_default_calendar_style_days_events'] ) : '#000000';
415
-		update_post_meta( $post_id, '_default_calendar_style_days_events', $days_events_color );
414
+		$days_events_color = isset($_POST['_default_calendar_style_days_events']) ? sanitize_text_field($_POST['_default_calendar_style_days_events']) : '#000000';
415
+		update_post_meta($post_id, '_default_calendar_style_days_events', $days_events_color);
416 416
 
417 417
 		// List range span.
418
-		$span = isset( $_POST['_default_calendar_list_range_span'] ) ? max( absint( $_POST['_default_calendar_list_range_span'] ), 1 ) : 1;
419
-		update_post_meta( $post_id, '_default_calendar_list_range_span', $span );
418
+		$span = isset($_POST['_default_calendar_list_range_span']) ? max(absint($_POST['_default_calendar_list_range_span']), 1) : 1;
419
+		update_post_meta($post_id, '_default_calendar_list_range_span', $span);
420 420
 
421 421
 		// List range type.
422
-		$group = isset( $_POST['_default_calendar_list_range_type'] ) ? sanitize_key( $_POST['_default_calendar_list_range_type'] ) : 'monthly';
423
-		update_post_meta( $post_id, '_default_calendar_list_range_type', $group );
422
+		$group = isset($_POST['_default_calendar_list_range_type']) ? sanitize_key($_POST['_default_calendar_list_range_type']) : 'monthly';
423
+		update_post_meta($post_id, '_default_calendar_list_range_type', $group);
424 424
 
425 425
 		// Hide header.
426
-		$header = isset( $_POST['_default_calendar_list_header'] ) ? 'yes' : 'no';
427
-		update_post_meta( $post_id, '_default_calendar_list_header', $header );
426
+		$header = isset($_POST['_default_calendar_list_header']) ? 'yes' : 'no';
427
+		update_post_meta($post_id, '_default_calendar_list_header', $header);
428 428
 
429 429
 		// Compact list.
430
-		$compact = isset( $_POST['_default_calendar_compact_list'] ) ? 'yes' : 'no';
431
-		update_post_meta( $post_id, '_default_calendar_compact_list', $compact );
430
+		$compact = isset($_POST['_default_calendar_compact_list']) ? 'yes' : 'no';
431
+		update_post_meta($post_id, '_default_calendar_compact_list', $compact);
432 432
 
433 433
 		// Limit number of initially visible daily events.
434
-		$limit = isset( $_POST['_default_calendar_limit_visible_events'] ) ? 'yes' : 'no';
435
-		update_post_meta( $post_id, '_default_calendar_limit_visible_events', $limit );
436
-		$number = isset( $_POST['_default_calendar_visible_events'] ) ? absint( $_POST['_default_calendar_visible_events'] ) : 3;
437
-		update_post_meta( $post_id, '_default_calendar_visible_events', $number );
434
+		$limit = isset($_POST['_default_calendar_limit_visible_events']) ? 'yes' : 'no';
435
+		update_post_meta($post_id, '_default_calendar_limit_visible_events', $limit);
436
+		$number = isset($_POST['_default_calendar_visible_events']) ? absint($_POST['_default_calendar_visible_events']) : 3;
437
+		update_post_meta($post_id, '_default_calendar_visible_events', $number);
438 438
 
439 439
 		// Grid event bubbles action.
440
-		$bubbles = isset( $_POST['_default_calendar_event_bubble_trigger'] ) ? esc_attr( $_POST['_default_calendar_event_bubble_trigger'] ) : 'hover';
441
-		update_post_meta( $post_id, '_default_calendar_event_bubble_trigger', $bubbles );
440
+		$bubbles = isset($_POST['_default_calendar_event_bubble_trigger']) ? esc_attr($_POST['_default_calendar_event_bubble_trigger']) : 'hover';
441
+		update_post_meta($post_id, '_default_calendar_event_bubble_trigger', $bubbles);
442 442
 
443 443
 		// Trim event titles characters length.
444
-		$trim = isset( $_POST['_default_calendar_trim_titles'] ) ? 'yes' : 'no';
445
-		update_post_meta( $post_id, '_default_calendar_trim_titles', $trim );
446
-		$chars = isset( $_POST['_default_calendar_trim_titles_chars'] ) ? max( absint( $_POST['_default_calendar_trim_titles_chars'] ), 1 ) : 20;
447
-		update_post_meta( $post_id, '_default_calendar_trim_titles_chars', $chars );
444
+		$trim = isset($_POST['_default_calendar_trim_titles']) ? 'yes' : 'no';
445
+		update_post_meta($post_id, '_default_calendar_trim_titles', $trim);
446
+		$chars = isset($_POST['_default_calendar_trim_titles_chars']) ? max(absint($_POST['_default_calendar_trim_titles_chars']), 1) : 20;
447
+		update_post_meta($post_id, '_default_calendar_trim_titles_chars', $chars);
448 448
 
449 449
 		// Expand multiple day events on each day.
450
-		$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';
451
-		update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', $multi_day );
450
+		$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';
451
+		update_post_meta($post_id, '_default_calendar_expand_multi_day_events', $multi_day);
452 452
 
453 453
 	}
454 454
 
Please login to merge, or discard this patch.