Completed
Push — master ( 62b222...3fdac6 )
by
unknown
07:01
created
includes/updates/update-v220.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Updates;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -20,28 +20,28 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @param array $posts
22 22
 	 */
23
-	public function __construct( $posts ) {
23
+	public function __construct($posts) {
24 24
 
25
-		if ( ! empty( $posts ) && is_array( $posts ) ) {
25
+		if ( ! empty($posts) && is_array($posts)) {
26 26
 
27
-			foreach ( $posts as $post ) {
27
+			foreach ($posts as $post) {
28 28
 
29
-				$gce_list_max_num        = get_post_meta( $post->ID, 'gce_list_max_num', true );
30
-				$gce_list_max_length     = get_post_meta( $post->ID, 'gce_list_max_length', true );
31
-				$gce_feed_start_interval = get_post_meta( $post->ID, 'gce_feed_start_interval', true );
32
-				$gce_feed_start          = get_post_meta( $post->ID, 'gce_feed_start', true );
33
-				$gce_feed_end_interval   = get_post_meta( $post->ID, 'gce_feed_end_interval', true );
34
-				$gce_feed_end            = get_post_meta( $post->ID, 'gce_feed_end', true );
29
+				$gce_list_max_num        = get_post_meta($post->ID, 'gce_list_max_num', true);
30
+				$gce_list_max_length     = get_post_meta($post->ID, 'gce_list_max_length', true);
31
+				$gce_feed_start_interval = get_post_meta($post->ID, 'gce_feed_start_interval', true);
32
+				$gce_feed_start          = get_post_meta($post->ID, 'gce_feed_start', true);
33
+				$gce_feed_end_interval   = get_post_meta($post->ID, 'gce_feed_end_interval', true);
34
+				$gce_feed_end            = get_post_meta($post->ID, 'gce_feed_end', true);
35 35
 
36
-				update_post_meta( $post->ID, 'gce_per_page_num', $gce_list_max_num );
37
-				update_post_meta( $post->ID, 'gce_events_per_page', $gce_list_max_length );
38
-				update_post_meta( $post->ID, 'gce_feed_start', $gce_feed_start_interval );
39
-				update_post_meta( $post->ID, 'gce_feed_start_num', $gce_feed_start );
40
-				update_post_meta( $post->ID, 'gce_feed_end', $gce_feed_end_interval );
41
-				update_post_meta( $post->ID, 'gce_feed_end_num', $gce_feed_end );
36
+				update_post_meta($post->ID, 'gce_per_page_num', $gce_list_max_num);
37
+				update_post_meta($post->ID, 'gce_events_per_page', $gce_list_max_length);
38
+				update_post_meta($post->ID, 'gce_feed_start', $gce_feed_start_interval);
39
+				update_post_meta($post->ID, 'gce_feed_start_num', $gce_feed_start);
40
+				update_post_meta($post->ID, 'gce_feed_end', $gce_feed_end_interval);
41
+				update_post_meta($post->ID, 'gce_feed_end_num', $gce_feed_end);
42 42
 
43 43
 				// Add new show tooltips option checked as default.
44
-				update_post_meta( $post->ID, 'gce_show_tooltips', 1 );
44
+				update_post_meta($post->ID, 'gce_show_tooltips', 1);
45 45
 			}
46 46
 
47 47
 		}
Please login to merge, or discard this patch.
includes/updates/update-v300.php 1 patch
Spacing   +123 added lines, -123 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,13 +23,13 @@  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
 		Post_Types::register_taxonomies();
29 29
 		Post_Types::register_post_types();
30 30
 
31
-		if ( ! empty( $posts ) && is_array( $posts ) ) {
32
-			$this->update_posts( $posts );
31
+		if ( ! empty($posts) && is_array($posts)) {
32
+			$this->update_posts($posts);
33 33
 			$this->update_post_type();
34 34
 			$this->update_widgets();
35 35
 		}
@@ -43,201 +43,201 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @param $posts
45 45
 	 */
46
-	public function update_posts( $posts ) {
46
+	public function update_posts($posts) {
47 47
 
48
-		foreach ( $posts as $post ) {
48
+		foreach ($posts as $post) {
49 49
 
50 50
 			$post_id = $post->ID;
51 51
 
52 52
 			// Assign a feed taxonomy term (feed type) to legacy posts.
53
-			wp_set_object_terms( $post_id, 'google', 'calendar_feed' );
53
+			wp_set_object_terms($post_id, 'google', 'calendar_feed');
54 54
 
55 55
 			// Assign a calendar taxonomy term (calendar type) to legacy posts.
56
-			wp_set_object_terms( $post_id, 'default-calendar', 'calendar_type' );
56
+			wp_set_object_terms($post_id, 'default-calendar', 'calendar_type');
57 57
 
58 58
 			// Convert legacy list/grid view to default calendar view.
59
-			$display = get_post_meta( $post_id, 'gce_display_mode', true );
59
+			$display = get_post_meta($post_id, 'gce_display_mode', true);
60 60
 			$views = array();
61 61
 			$range = false;
62
-			if ( 'list' == $display ) {
62
+			if ('list' == $display) {
63 63
 				$views['default-calendar'] = 'list';
64
-			} elseif ( 'list-grouped' == $display ) {
64
+			} elseif ('list-grouped' == $display) {
65 65
 				$views['default-calendar'] = 'list';
66
-			} elseif ( 'date-range-list' == $display ) {
66
+			} elseif ('date-range-list' == $display) {
67 67
 				$views['default-calendar'] = 'list';
68 68
 				$range                     = true;
69
-			} elseif ( 'date-range-grid' == $display ) {
69
+			} elseif ('date-range-grid' == $display) {
70 70
 				$views['default-calendar'] = 'grid';
71 71
 				$range                     = true;
72 72
 			} else {
73 73
 				$views['default-calendar'] = 'grid';
74 74
 			}
75
-			update_post_meta( $post_id, '_calendar_view', $views );
75
+			update_post_meta($post_id, '_calendar_view', $views);
76 76
 
77 77
 			// List calendar settings.
78
-			$list_span  = get_post_meta( $post_id, 'gce_events_per_page', true );
79
-			$list_range = max( absint( get_post_meta( $post_id, 'gce_per_page_num', true ) ), 1 );
80
-			if ( 'days' == $list_span ) {
78
+			$list_span  = get_post_meta($post_id, 'gce_events_per_page', true);
79
+			$list_range = max(absint(get_post_meta($post_id, 'gce_per_page_num', true)), 1);
80
+			if ('days' == $list_span) {
81 81
 				$list_type = 'daily';
82
-			} elseif ( 'week' == $list_span ) {
82
+			} elseif ('week' == $list_span) {
83 83
 				$list_type = 'weekly';
84 84
 				$list_range = 1;
85
-			} elseif ( 'month' == $list_span ) {
85
+			} elseif ('month' == $list_span) {
86 86
 				$list_type = 'monthly';
87 87
 				$list_range = 1;
88 88
 			} else {
89 89
 				$list_type = 'events';
90 90
 			}
91
-			update_post_meta( $post_id, '_default_calendar_list_range_type', $list_type );
92
-			update_post_meta( $post_id, '_default_calendar_list_range_span', $list_range );
91
+			update_post_meta($post_id, '_default_calendar_list_range_type', $list_type);
92
+			update_post_meta($post_id, '_default_calendar_list_range_span', $list_range);
93 93
 
94 94
 			$calendar_begins = 'today';
95 95
 
96 96
 			// Custom calendar range.
97
-			if ( $range === true ) {
97
+			if ($range === true) {
98 98
 
99
-				$begins = get_post_meta( $post_id, 'gce_feed_range_start', true );
100
-				$ends   = get_post_meta( $post_id, 'gce_feed_range_end', true );
99
+				$begins = get_post_meta($post_id, 'gce_feed_range_start', true);
100
+				$ends   = get_post_meta($post_id, 'gce_feed_range_end', true);
101 101
 
102
-				if ( $begins && $ends ) {
103
-					update_post_meta( $post_id, '_calendar_begins', 'custom_date' );
104
-					update_post_meta( $post_id, '_calendar_begins_custom_date', $this->convert_legacy_range( $begins ) );
102
+				if ($begins && $ends) {
103
+					update_post_meta($post_id, '_calendar_begins', 'custom_date');
104
+					update_post_meta($post_id, '_calendar_begins_custom_date', $this->convert_legacy_range($begins));
105 105
 				} else {
106
-					update_post_meta( $post_id, '_calendar_begins', $calendar_begins );
106
+					update_post_meta($post_id, '_calendar_begins', $calendar_begins);
107 107
 				}
108 108
 
109 109
 			} else {
110 110
 
111 111
 				// Legacy list calendars may have a start offset.
112
-				$offset = absint( get_post_meta( $post_id, 'gce_list_start_offset_num', true ) );
113
-				if ( 'list' == $display && $offset > 0 ) {
114
-					$calendar_begins = 'back' == get_post_meta( $post_id, 'gce_list_start_offset_direction', true ) ? 'days_before' : 'days_after';
115
-					update_post_meta( $post_id, '_calendar_begins_nth', $offset );
112
+				$offset = absint(get_post_meta($post_id, 'gce_list_start_offset_num', true));
113
+				if ('list' == $display && $offset > 0) {
114
+					$calendar_begins = 'back' == get_post_meta($post_id, 'gce_list_start_offset_direction', true) ? 'days_before' : 'days_after';
115
+					update_post_meta($post_id, '_calendar_begins_nth', $offset);
116 116
 				}
117 117
 
118
-				update_post_meta( $post_id, '_calendar_begins', $calendar_begins );
118
+				update_post_meta($post_id, '_calendar_begins', $calendar_begins);
119 119
 			}
120 120
 
121 121
 			// Earliest event.
122
-			$start_before = get_post_meta( $post_id, 'gce_feed_start', true );
123
-			$start_amt = absint( get_post_meta( $post_id, 'gce_feed_start_num', true ) );
124
-			if ( $start_amt > 0 ) {
125
-				if ( 'years' == $start_before ) {
122
+			$start_before = get_post_meta($post_id, 'gce_feed_start', true);
123
+			$start_amt = absint(get_post_meta($post_id, 'gce_feed_start_num', true));
124
+			if ($start_amt > 0) {
125
+				if ('years' == $start_before) {
126 126
 					$earliest = 'years_before';
127
-				} elseif ( 'months' == $start_before ) {
127
+				} elseif ('months' == $start_before) {
128 128
 					$earliest = 'months_before';
129 129
 				} else {
130 130
 					$earliest = 'days_before';
131 131
 				}
132
-				update_post_meta( $post_id, '_feed_earliest_event_date', $earliest );
133
-				update_post_meta( $post_id, '_feed_earliest_event_date_range', $start_amt );
132
+				update_post_meta($post_id, '_feed_earliest_event_date', $earliest);
133
+				update_post_meta($post_id, '_feed_earliest_event_date_range', $start_amt);
134 134
 			} else {
135
-				update_post_meta( $post_id, '_feed_earliest_event_date', 'calendar_start' );
136
-				update_post_meta( $post_id, '_feed_earliest_event_date_range', 1 );
135
+				update_post_meta($post_id, '_feed_earliest_event_date', 'calendar_start');
136
+				update_post_meta($post_id, '_feed_earliest_event_date_range', 1);
137 137
 			}
138 138
 
139 139
 			// Latest event.
140
-			$end_after = get_post_meta( $post_id, 'gce_feed_end', true );
141
-			$end_amt   = absint( get_post_meta( $post_id, 'gce_feed_end_num', true ) );
142
-			if ( $end_amt > 0 ) {
143
-				if ( 'years' == $end_after ) {
140
+			$end_after = get_post_meta($post_id, 'gce_feed_end', true);
141
+			$end_amt   = absint(get_post_meta($post_id, 'gce_feed_end_num', true));
142
+			if ($end_amt > 0) {
143
+				if ('years' == $end_after) {
144 144
 					$latest = 'years_after';
145
-				} elseif ( 'months' == $end_after ) {
145
+				} elseif ('months' == $end_after) {
146 146
 					$latest = 'months_after';
147 147
 				} else {
148 148
 					$latest = 'days_after';
149 149
 				}
150
-				update_post_meta( $post_id, '_feed_latest_event_date', $latest );
151
-				update_post_meta( $post_id, '_feed_latest_event_date_range', $end_amt );
150
+				update_post_meta($post_id, '_feed_latest_event_date', $latest);
151
+				update_post_meta($post_id, '_feed_latest_event_date_range', $end_amt);
152 152
 			} else {
153
-				update_post_meta( $post_id, '_feed_latest_event_date', 'calendar_start' );
154
-				update_post_meta( $post_id, '_feed_latest_event_date_range', 1 );
153
+				update_post_meta($post_id, '_feed_latest_event_date', 'calendar_start');
154
+				update_post_meta($post_id, '_feed_latest_event_date_range', 1);
155 155
 			}
156 156
 
157 157
 			// Static calendar.
158
-			if ( false === get_post_meta( $post_id, 'gce_paging', true ) ) {
159
-				update_post_meta( $post_id, '_calendar_is_static', 'yes' );
158
+			if (false === get_post_meta($post_id, 'gce_paging', true)) {
159
+				update_post_meta($post_id, '_calendar_is_static', 'yes');
160 160
 			}
161 161
 
162 162
 			// Default calendar bubble trigger (click was unavailable before 3.0.0).
163
-			update_post_meta( $post_id, '_default_calendar_event_bubble_trigger', 'hover' );
163
+			update_post_meta($post_id, '_default_calendar_event_bubble_trigger', 'hover');
164 164
 
165 165
 			// Default calendar multiple day events.
166
-			if ( get_post_meta( $post_id, 'gce_multi_day_events', true ) ) {
167
-				update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', 'yes' );
166
+			if (get_post_meta($post_id, 'gce_multi_day_events', true)) {
167
+				update_post_meta($post_id, '_default_calendar_expand_multi_day_events', 'yes');
168 168
 			} else {
169
-				update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', 'no' );
169
+				update_post_meta($post_id, '_default_calendar_expand_multi_day_events', 'no');
170 170
 			}
171 171
 
172 172
 			// Google Calendar ID.
173
-			$google_id = get_post_meta( $post_id, 'gce_feed_url', true );
174
-			update_post_meta( $post_id, '_google_calendar_id', base64_encode( trim( $google_id ) ) );
173
+			$google_id = get_post_meta($post_id, 'gce_feed_url', true);
174
+			update_post_meta($post_id, '_google_calendar_id', base64_encode(trim($google_id)));
175 175
 
176 176
 			// Google max results.
177
-			update_post_meta( $post_id, '_google_events_max_results', 2500 );
177
+			update_post_meta($post_id, '_google_events_max_results', 2500);
178 178
 
179 179
 			// Google calendar feed search terms.
180
-			$google_search = get_post_meta( $post_id, 'gce_search_query', true );
181
-			if ( ! empty( $google_search ) ) {
182
-				update_post_meta( $post_id, '_google_events_search_query', trim( $google_search ) );
180
+			$google_search = get_post_meta($post_id, 'gce_search_query', true);
181
+			if ( ! empty($google_search)) {
182
+				update_post_meta($post_id, '_google_events_search_query', trim($google_search));
183 183
 			}
184 184
 
185 185
 			// Google recurring events.
186
-			if ( get_post_meta( $post_id, 'gce_expand_recurring', true ) ) {
187
-				update_post_meta( $post_id, '_google_events_recurring', 'show' );
186
+			if (get_post_meta($post_id, 'gce_expand_recurring', true)) {
187
+				update_post_meta($post_id, '_google_events_recurring', 'show');
188 188
 			} else {
189
-				update_post_meta( $post_id, '_google_events_recurring', 'first-only' );
189
+				update_post_meta($post_id, '_google_events_recurring', 'first-only');
190 190
 			}
191 191
 
192 192
 			// Date and time format.
193
-			$date_format = get_post_meta( $post_id, 'gce_date_format', true );
194
-			if ( ! empty( $date_format ) ) {
195
-				update_post_meta( $post_id, '_calendar_date_format_setting', 'use_custom_php' );
196
-				update_post_meta( $post_id, '_calendar_date_format_php', $date_format );
193
+			$date_format = get_post_meta($post_id, 'gce_date_format', true);
194
+			if ( ! empty($date_format)) {
195
+				update_post_meta($post_id, '_calendar_date_format_setting', 'use_custom_php');
196
+				update_post_meta($post_id, '_calendar_date_format_php', $date_format);
197 197
 			} else {
198
-				update_post_meta( $post_id, '_calendar_date_format_setting', 'use_site' );
198
+				update_post_meta($post_id, '_calendar_date_format_setting', 'use_site');
199 199
 			}
200
-			$time_format = get_post_meta( $post_id, 'gce_time_format', true );
201
-			if ( ! empty( $time_format ) ) {
202
-				update_post_meta( $post_id, '_calendar_time_format_setting', 'use_custom_php' );
203
-				update_post_meta( $post_id, '_calendar_time_format_php', $time_format );
200
+			$time_format = get_post_meta($post_id, 'gce_time_format', true);
201
+			if ( ! empty($time_format)) {
202
+				update_post_meta($post_id, '_calendar_time_format_setting', 'use_custom_php');
203
+				update_post_meta($post_id, '_calendar_time_format_php', $time_format);
204 204
 			} else {
205
-				update_post_meta( $post_id, '_calendar_time_format_setting', 'use_site' );
205
+				update_post_meta($post_id, '_calendar_time_format_setting', 'use_site');
206 206
 			}
207
-			update_post_meta( $post_id, '_calendar_datetime_separator', '@' );
208
-			update_post_meta( $post_id, '_calendar_week_starts_on_setting', 'use_site' );
207
+			update_post_meta($post_id, '_calendar_datetime_separator', '@');
208
+			update_post_meta($post_id, '_calendar_week_starts_on_setting', 'use_site');
209 209
 
210 210
 			// Feed transient cache duration.
211
-			$cache = get_post_meta( $post_id, 'gce_cache', true );
212
-			if ( is_numeric( $cache ) ) {
213
-				$seconds = absint( $cache );
214
-				if ( $seconds < 3600 ) {
211
+			$cache = get_post_meta($post_id, 'gce_cache', true);
212
+			if (is_numeric($cache)) {
213
+				$seconds = absint($cache);
214
+				if ($seconds < 3600) {
215 215
 					$amount = $seconds / 60;
216 216
 					$unit   = 60;
217
-				} elseif ( $seconds < 86400 ) {
217
+				} elseif ($seconds < 86400) {
218 218
 					$amount = $seconds / 3600;
219 219
 					$unit   = 3600;
220
-				} elseif ( $seconds < 604800 ) {
220
+				} elseif ($seconds < 604800) {
221 221
 					$amount = $seconds / 86400;
222 222
 					$unit   = 86400;
223 223
 				} else {
224 224
 					$amount = $seconds / 604800;
225 225
 					$unit   = 604800;
226 226
 				}
227
-				$amount = max( ceil( $amount ), 1 );
228
-				update_post_meta( $post_id, '_feed_cache_user_unit', $unit );
229
-				update_post_meta( $post_id, '_feed_cache_user_amount', $amount );
230
-				update_post_meta( $post_id, '_feed_cache', $unit * $amount );
227
+				$amount = max(ceil($amount), 1);
228
+				update_post_meta($post_id, '_feed_cache_user_unit', $unit);
229
+				update_post_meta($post_id, '_feed_cache_user_amount', $amount);
230
+				update_post_meta($post_id, '_feed_cache', $unit * $amount);
231 231
 			} else {
232
-				update_post_meta( $post_id, '_feed_cache_user_unit', 2 );
233
-				update_post_meta( $post_id, '_feed_cache_user_amount', 3600 );
234
-				update_post_meta( $post_id, '_feed_cache', 7200 );
232
+				update_post_meta($post_id, '_feed_cache_user_unit', 2);
233
+				update_post_meta($post_id, '_feed_cache_user_amount', 3600);
234
+				update_post_meta($post_id, '_feed_cache', 7200);
235 235
 			}
236 236
 
237
-			$this->delete_post_meta( $post_id );
237
+			$this->delete_post_meta($post_id);
238 238
 
239 239
 			// Post updated.
240
-			update_post_meta( $post_id, '_calendar_version', '3.0.0' );
240
+			update_post_meta($post_id, '_calendar_version', '3.0.0');
241 241
 		}
242 242
 
243 243
 	}
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 *
248 248
 	 * @param int $post_id
249 249
 	 */
250
-	public function delete_post_meta( $post_id ) {
250
+	public function delete_post_meta($post_id) {
251 251
 
252 252
 		$post_meta = array(
253 253
 			'gce_cache',
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 			'gce_time_format',
296 296
 		);
297 297
 
298
-		foreach ( $post_meta as $meta_key ) {
299
-			delete_post_meta( $post_id, $meta_key );
298
+		foreach ($post_meta as $meta_key) {
299
+			delete_post_meta($post_id, $meta_key);
300 300
 		}
301 301
 	}
302 302
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	public function update_post_type() {
307 307
 
308 308
 		global $wpdb;
309
-		$table = $wpdb->prefix . 'posts';
309
+		$table = $wpdb->prefix.'posts';
310 310
 
311 311
 		$wpdb->query(
312 312
 			"
@@ -320,23 +320,23 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	public function update_options() {
322 322
 
323
-		$old_settings          = get_option( 'gce_settings_general' );
324
-		$new_settings_feeds    = get_option( 'simple-calendar_settings_feeds' );
325
-		$new_settings_advanced = get_option( 'simple-calendar_settings_advanced' );
323
+		$old_settings          = get_option('gce_settings_general');
324
+		$new_settings_feeds    = get_option('simple-calendar_settings_feeds');
325
+		$new_settings_advanced = get_option('simple-calendar_settings_advanced');
326 326
 
327 327
 		// If empty probably using a legacy hardcoded key (no longer recommended).
328
-		$new_settings_feeds['google']['api_key'] = ! empty( $old_settings['api_key'] ) ? $old_settings['api_key'] : '';
329
-		update_option( 'simple-calendar_settings_feeds', $new_settings_feeds );
328
+		$new_settings_feeds['google']['api_key'] = ! empty($old_settings['api_key']) ? $old_settings['api_key'] : '';
329
+		update_option('simple-calendar_settings_feeds', $new_settings_feeds);
330 330
 
331
-		$new_settings_advanced['assets']['disable_css'] = ! empty( $old_settings['disable_css'] ) ? 'yes' : '';
332
-		update_option( 'simple-calendar_settings_advanced', $new_settings_advanced );
331
+		$new_settings_advanced['assets']['disable_css'] = ! empty($old_settings['disable_css']) ? 'yes' : '';
332
+		update_option('simple-calendar_settings_advanced', $new_settings_advanced);
333 333
 
334 334
 		// Delete legacy options.
335
-		delete_option( 'gce_version' );
336
-		delete_option( 'gce_options' );
337
-		delete_option( 'gce_upgrade_has_run' );
338
-		delete_option( 'gce_v240_update_notices' );
339
-		delete_option( 'gce_show_admin_install_notice' );
335
+		delete_option('gce_version');
336
+		delete_option('gce_options');
337
+		delete_option('gce_upgrade_has_run');
338
+		delete_option('gce_v240_update_notices');
339
+		delete_option('gce_show_admin_install_notice');
340 340
 	}
341 341
 
342 342
 	/**
@@ -344,26 +344,26 @@  discard block
 block discarded – undo
344 344
 	 */
345 345
 	public function update_widgets() {
346 346
 
347
-		$old_widgets = get_option( 'widget_gce_widget' );
347
+		$old_widgets = get_option('widget_gce_widget');
348 348
 
349
-		if ( ! empty( $old_widgets ) && is_array( $old_widgets ) ) {
349
+		if ( ! empty($old_widgets) && is_array($old_widgets)) {
350 350
 
351 351
 			$new_widgets = array();
352 352
 
353
-			foreach ( $old_widgets as $i => $old_widget ) {
354
-				if ( isset( $old_widget['id'] ) ) {
353
+			foreach ($old_widgets as $i => $old_widget) {
354
+				if (isset($old_widget['id'])) {
355 355
 
356
-					$id = absint( substr( $old_widget['id'], 0, strspn( $old_widget['id'], '0123456789' ) ) );
356
+					$id = absint(substr($old_widget['id'], 0, strspn($old_widget['id'], '0123456789')));
357 357
 
358
-					if ( $id > 0 ) {
359
-						$new_widgets[ $i ]['title']       = isset( $old_widget['name'] ) ? $old_widget['name'] : 'Simple Calendar';
360
-						$new_widgets[ $i ]['calendar_id'] = $id;
358
+					if ($id > 0) {
359
+						$new_widgets[$i]['title']       = isset($old_widget['name']) ? $old_widget['name'] : 'Simple Calendar';
360
+						$new_widgets[$i]['calendar_id'] = $id;
361 361
 					}
362 362
 				}
363 363
 			}
364 364
 
365
-			if ( ! empty( $new_widgets ) ) {
366
-				update_option( 'widget_gce_widget', $new_widgets );
365
+			if ( ! empty($new_widgets)) {
366
+				update_option('widget_gce_widget', $new_widgets);
367 367
 			}
368 368
 		}
369 369
 	}
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
 	 *
378 378
 	 * @return string
379 379
 	 */
380
-	private function convert_legacy_range( $date ) {
381
-		$date = empty( $date ) ? date( 'm/d/Y', time() ) : $date;
382
-		$timestamp = Carbon::createFromFormat( 'm/d/Y', $date )->getTimestamp();
383
-		return date( 'Y-m-d', $timestamp );
380
+	private function convert_legacy_range($date) {
381
+		$date = empty($date) ? date('m/d/Y', time()) : $date;
382
+		$timestamp = Carbon::createFromFormat('m/d/Y', $date)->getTimestamp();
383
+		return date('Y-m-d', $timestamp);
384 384
 	}
385 385
 
386 386
 }
Please login to merge, or discard this patch.
includes/widgets.php 1 patch
Spacing   +8 added lines, -8 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
 
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function __construct() {
36 36
 
37
-		$this->widgets = apply_filters( 'simcal_get_widgets', array(
37
+		$this->widgets = apply_filters('simcal_get_widgets', array(
38 38
 			'SimpleCalendar\Widgets\Calendar'
39
-		), array() );
39
+		), array());
40 40
 
41
-		add_action( 'widgets_init', array( $this, 'register' ) );
41
+		add_action('widgets_init', array($this, 'register'));
42 42
 	}
43 43
 
44 44
 	/**
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
 		$widgets = $this->widgets;
52 52
 
53
-		if ( ! empty( $widgets ) && is_array( $widgets ) ) {
54
-			foreach ( $widgets as $widget ) {
55
-				register_widget( $widget );
53
+		if ( ! empty($widgets) && is_array($widgets)) {
54
+			foreach ($widgets as $widget) {
55
+				register_widget($widget);
56 56
 			}
57 57
 		}
58 58
 
59
-		do_action( 'simcal_register_widgets' );
59
+		do_action('simcal_register_widgets');
60 60
 	}
61 61
 
62 62
 }
Please login to merge, or discard this patch.
includes/widgets/calendar.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use SimpleCalendar\Abstracts\Calendar_View;
10 10
 use SimpleCalendar\Abstracts\Widget;
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -46,18 +46,18 @@  discard block
 block discarded – undo
46 46
 	public function __construct() {
47 47
 
48 48
 		$id_base        = 'gce_widget'; // old id kept for legacy reasons
49
-		$name           = __( 'Simple Calendar', 'google-calendar-events' );
49
+		$name           = __('Simple Calendar', 'google-calendar-events');
50 50
 		$widget_options = array(
51
-			'description' => __( 'Display a calendar of events from one of your calendar feeds.', 'google-calendar-events' )
51
+			'description' => __('Display a calendar of events from one of your calendar feeds.', 'google-calendar-events')
52 52
 		);
53 53
 
54
-		parent::__construct( $id_base, $name, $widget_options );
54
+		parent::__construct($id_base, $name, $widget_options);
55 55
 
56
-		if ( is_admin() ) {
57
-			if ( ! defined( 'DOING_AJAX' ) ) {
56
+		if (is_admin()) {
57
+			if ( ! defined('DOING_AJAX')) {
58 58
 				$this->calendars = simcal_get_calendars();
59 59
 			} else {
60
-				$this->calendars = get_transient( '_simple-calendar_feed_ids' );
60
+				$this->calendars = get_transient('_simple-calendar_feed_ids');
61 61
 			}
62 62
 		}
63 63
 	}
@@ -70,18 +70,18 @@  discard block
 block discarded – undo
70 70
 	 * @param array $args     Display arguments.
71 71
 	 * @param array $instance The settings for the particular instance of the widget.
72 72
 	 */
73
-	public function widget( $args, $instance ) {
73
+	public function widget($args, $instance) {
74 74
 
75 75
 		echo $args['before_widget'];
76 76
 
77
-		if ( ! empty( $instance['title'] ) ) {
77
+		if ( ! empty($instance['title'])) {
78 78
 
79
-			echo $args['before_title']  . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
79
+			echo $args['before_title'].apply_filters('widget_title', $instance['title']).$args['after_title'];
80 80
 		}
81 81
 
82
-		$id = isset( $instance['calendar_id'] ) ? absint( $instance['calendar_id'] ) : 0;
83
-		if ( $id > 0 ) {
84
-			simcal_print_calendar( $id );
82
+		$id = isset($instance['calendar_id']) ? absint($instance['calendar_id']) : 0;
83
+		if ($id > 0) {
84
+			simcal_print_calendar($id);
85 85
 		}
86 86
 
87 87
 		echo $args['after_widget'];
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return array Settings to save or bool false to cancel saving.
103 103
 	 */
104
-	public function update( $new_instance, $old_instance ) {
104
+	public function update($new_instance, $old_instance) {
105 105
 
106 106
 		$instance = array();
107 107
 
108
-		$instance['title']          = ( ! empty( $new_instance['title'] ) )        ? sanitize_text_field( $new_instance['title'] ) : '';
109
-		$instance['calendar_id']    = ( ! empty( $new_instance['calendar_id'] ) )  ? absint( $new_instance['calendar_id'] ) : '';
108
+		$instance['title']          = ( ! empty($new_instance['title'])) ? sanitize_text_field($new_instance['title']) : '';
109
+		$instance['calendar_id']    = ( ! empty($new_instance['calendar_id'])) ? absint($new_instance['calendar_id']) : '';
110 110
 
111 111
 		return $instance;
112 112
 	}
@@ -120,34 +120,34 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @return string
122 122
 	 */
123
-	public function form( $instance ) {
123
+	public function form($instance) {
124 124
 
125
-		$title          = isset( $instance['title'] )       ? esc_attr( $instance['title'] ) : __( 'Calendar', 'google-calendar-events' );
126
-		$calendar_id    = isset( $instance['calendar_id'] ) ? esc_attr( $instance['calendar_id'] ) : '';
125
+		$title          = isset($instance['title']) ? esc_attr($instance['title']) : __('Calendar', 'google-calendar-events');
126
+		$calendar_id    = isset($instance['calendar_id']) ? esc_attr($instance['calendar_id']) : '';
127 127
 
128 128
 		?>
129 129
 		<div class="simcal-calendar-widget-settings">
130 130
 
131 131
 			<p>
132
-				<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'google-calendar-events' ); ?></label>
132
+				<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'google-calendar-events'); ?></label>
133 133
 				<br>
134 134
 				<input type="text"
135
-				       name="<?php echo $this->get_field_name( 'title' ); ?>"
136
-				       id="<?php echo $this->get_field_id( 'title' ); ?>"
135
+				       name="<?php echo $this->get_field_name('title'); ?>"
136
+				       id="<?php echo $this->get_field_id('title'); ?>"
137 137
 				       class="widefat simcal-field simcal-field-standard simcal-field-text"
138 138
 				       value="<?php echo $title; ?>">
139 139
 			</p>
140 140
 
141 141
 			<p>
142
-				<label for="<?php echo $this->get_field_id( 'calendar_id' ); ?>"><?php _e( 'Calendar:', 'google-calendar-events' ); ?></label>
142
+				<label for="<?php echo $this->get_field_id('calendar_id'); ?>"><?php _e('Calendar:', 'google-calendar-events'); ?></label>
143 143
 				<br>
144
-				<?php $multiselect = count( $this->calendars ) > 15 ? ' simcal-field-select-enhanced' : ''; ?>
145
-				<select name="<?php echo $this->get_field_name( 'calendar_id' ) ?>"
146
-				        id="<?php echo $this->get_field_id( 'calendar_id' ) ?>"
144
+				<?php $multiselect = count($this->calendars) > 15 ? ' simcal-field-select-enhanced' : ''; ?>
145
+				<select name="<?php echo $this->get_field_name('calendar_id') ?>"
146
+				        id="<?php echo $this->get_field_id('calendar_id') ?>"
147 147
 						class="simcal-field simcal-field-select<?php echo $multiselect; ?>"
148
-						data-noresults="<?php __( 'No calendars found.', 'google-calendar-events' ); ?>">
149
-						<?php foreach ( $this->calendars as $id => $name ) : ?>
150
-							<option value="<?php echo $id; ?>" <?php selected( $id, $calendar_id, true ); ?>><?php echo $name; ?></option>
148
+						data-noresults="<?php __('No calendars found.', 'google-calendar-events'); ?>">
149
+						<?php foreach ($this->calendars as $id => $name) : ?>
150
+							<option value="<?php echo $id; ?>" <?php selected($id, $calendar_id, true); ?>><?php echo $name; ?></option>
151 151
 						<?php endforeach; ?>
152 152
 				</select>
153 153
 			</p>
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Exit if not uninstalling from WordPress.
9
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
9
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 // Get user options whether to delete settings and/or data.
14
-$settings = get_option( 'simple-calendar_settings_advanced' );
14
+$settings = get_option('simple-calendar_settings_advanced');
15 15
 
16
-if ( isset( $settings['installation']['delete_settings'] ) ) {
16
+if (isset($settings['installation']['delete_settings'])) {
17 17
 	$delete_settings = 'yes' == $settings['installation']['delete_settings'] ? true : false;
18 18
 } else {
19 19
 	$delete_settings = false;
20 20
 }
21 21
 
22
-if ( isset( $settings['installation']['erase_data'] ) ) {
22
+if (isset($settings['installation']['erase_data'])) {
23 23
 	$erase_data = 'yes' == $settings['installation']['erase_data'] ? true : false;
24 24
 } else {
25 25
 	$erase_data = false;
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 global $wpdb;
29 29
 
30 30
 // Delete settings.
31
-if ( ( $delete_settings === true ) || ( $erase_data === true ) ) {
31
+if (($delete_settings === true) || ($erase_data === true)) {
32 32
 	$wpdb->query(
33 33
 		"
34 34
 DELETE FROM $wpdb->options WHERE option_name LIKE '%simple-calendar%';
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 // Delete calendar data.
40
-if ( $erase_data === true ) {
40
+if ($erase_data === true) {
41 41
 
42 42
 	// Delete calendar posts.
43 43
 	$wpdb->query(
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
 	);
48 48
 
49 49
 	// Delete calendar postmeta.
50
-	$wpdb->query( "
50
+	$wpdb->query("
51 51
 DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;
52 52
 "
53 53
 	);
54 54
 
55 55
 	// Delete calendar terms.
56
-	$terms = get_terms( array(
56
+	$terms = get_terms(array(
57 57
 		'calendar_category',
58 58
 		'calendar_feed',
59 59
 		'calendar_type',
60
-	) );
61
-	if ( ! empty( $terms ) && is_array( $terms ) ) {
62
-		foreach ( $terms as $term ) {
63
-			wp_delete_term( $term->term_id, $term->taxonomy );
60
+	));
61
+	if ( ! empty($terms) && is_array($terms)) {
62
+		foreach ($terms as $term) {
63
+			wp_delete_term($term->term_id, $term->taxonomy);
64 64
 		}
65 65
 	}
66 66
 
Please login to merge, or discard this patch.
includes/feeds/admin/google-admin.php 3 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.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @param  string $api_key Google API key.
113 113
 	 *
114
-	 * @return true|string
114
+	 * @return string
115 115
 	 */
116 116
 	public function check_google_api_key( $api_key = '' ) {
117 117
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @param  string $google_calendar_id
242 242
 	 *
243
-	 * @return true|string
243
+	 * @return string
244 244
 	 */
245 245
 	public function test_api_key_connection( $google_calendar_id ) {
246 246
 
Please login to merge, or discard this patch.
includes/abstracts/feed.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use Carbon\Carbon;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -132,22 +132,22 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @param string|Calendar $calendar
134 134
 	 */
135
-	public function __construct( $calendar = '' ) {
135
+	public function __construct($calendar = '') {
136 136
 
137
-		if ( $calendar instanceof Calendar ) {
137
+		if ($calendar instanceof Calendar) {
138 138
 
139
-			if ( isset( $calendar->id ) ) {
139
+			if (isset($calendar->id)) {
140 140
 				$this->post_id = $calendar->id;
141 141
 			}
142
-			if ( isset( $calendar->start ) ) {
142
+			if (isset($calendar->start)) {
143 143
 				$this->calendar_start = $calendar->start;
144 144
 			}
145
-			$this->week_starts      = isset( $calendar->week_starts ) ? $calendar->week_starts : get_option( 'start_of_week' );
146
-			$this->events_template  = ! empty( $calendar->events_template ) ? $calendar->events_template : simcal_default_event_template();
145
+			$this->week_starts      = isset($calendar->week_starts) ? $calendar->week_starts : get_option('start_of_week');
146
+			$this->events_template  = ! empty($calendar->events_template) ? $calendar->events_template : simcal_default_event_template();
147 147
 
148
-			if ( $this->post_id > 0 ) {
148
+			if ($this->post_id > 0) {
149 149
 				$this->set_cache();
150
-				$this->timezone_setting = get_post_meta( $this->post_id, '_feed_timezone_setting', true );
150
+				$this->timezone_setting = get_post_meta($this->post_id, '_feed_timezone_setting', true);
151 151
 				$this->timezone = $calendar->timezone;
152 152
 				$this->set_earliest_event();
153 153
 				$this->set_latest_event();
@@ -173,25 +173,25 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @param int $timestamp
175 175
 	 */
176
-	public function set_earliest_event( $timestamp = 0 ) {
176
+	public function set_earliest_event($timestamp = 0) {
177 177
 
178
-		$earliest = intval( $timestamp );
178
+		$earliest = intval($timestamp);
179 179
 
180
-		if ( $earliest === 0 ) {
180
+		if ($earliest === 0) {
181 181
 
182
-			$start = Carbon::createFromTimestamp( $this->calendar_start, $this->timezone );
182
+			$start = Carbon::createFromTimestamp($this->calendar_start, $this->timezone);
183 183
 
184
-			$earliest_date  = esc_attr( get_post_meta( $this->post_id, '_feed_earliest_event_date', true ) );
185
-			$earliest_range = max( absint( get_post_meta( $this->post_id, '_feed_earliest_event_date_range', true ) ), 1 );
184
+			$earliest_date  = esc_attr(get_post_meta($this->post_id, '_feed_earliest_event_date', true));
185
+			$earliest_range = max(absint(get_post_meta($this->post_id, '_feed_earliest_event_date_range', true)), 1);
186 186
 
187
-			if ( 'days_before' == $earliest_date ) {
188
-				$earliest = $start->subDays( $earliest_range )->getTimestamp();
189
-			} elseif ( 'weeks_before' == $earliest_date ) {
190
-				$earliest = $start->subWeeks( $earliest_range )->addDay()->getTimestamp();
191
-			} elseif ( 'months_before' == $earliest_date ) {
192
-				$earliest = $start->subMonths( $earliest_range )->addDay()->getTimestamp();
193
-			} elseif ( 'years_before' == $earliest_date ) {
194
-				$earliest = $start->subYears( $earliest_range )->addDay()->getTimestamp();
187
+			if ('days_before' == $earliest_date) {
188
+				$earliest = $start->subDays($earliest_range)->getTimestamp();
189
+			} elseif ('weeks_before' == $earliest_date) {
190
+				$earliest = $start->subWeeks($earliest_range)->addDay()->getTimestamp();
191
+			} elseif ('months_before' == $earliest_date) {
192
+				$earliest = $start->subMonths($earliest_range)->addDay()->getTimestamp();
193
+			} elseif ('years_before' == $earliest_date) {
194
+				$earliest = $start->subYears($earliest_range)->addDay()->getTimestamp();
195 195
 			} else {
196 196
 				$earliest = $start->getTimestamp();
197 197
 			}
@@ -207,25 +207,25 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param int $timestamp
209 209
 	 */
210
-	public function set_latest_event( $timestamp = 0 ) {
210
+	public function set_latest_event($timestamp = 0) {
211 211
 
212
-		$latest = intval( $timestamp );
212
+		$latest = intval($timestamp);
213 213
 
214
-		if ( $latest === 0 ) {
214
+		if ($latest === 0) {
215 215
 
216
-			$start = Carbon::createFromTimestamp( $this->calendar_start, $this->timezone )->endOfDay();
216
+			$start = Carbon::createFromTimestamp($this->calendar_start, $this->timezone)->endOfDay();
217 217
 
218
-			$latest_date  = esc_attr( get_post_meta( $this->post_id, '_feed_latest_event_date', true ) );
219
-			$latest_range = max( absint( get_post_meta( $this->post_id, '_feed_latest_event_date_range', true ) ), 1 );
218
+			$latest_date  = esc_attr(get_post_meta($this->post_id, '_feed_latest_event_date', true));
219
+			$latest_range = max(absint(get_post_meta($this->post_id, '_feed_latest_event_date_range', true)), 1);
220 220
 
221
-			if ( 'days_after' == $latest_date ) {
222
-				$latest = $start->addDays( $latest_range )->getTimestamp();
223
-			} elseif ( 'weeks_after' == $latest_date ) {
224
-				$latest = $start->addWeeks( $latest_range )->subDay()->getTimestamp();
225
-			} elseif ( 'months_after' == $latest_date ) {
226
-				$latest = $start->addMonths( $latest_range )->subDay()->getTimestamp();
227
-			} elseif ( 'years_after' == $latest_date ) {
228
-				$latest = $start->addYears( $latest_range )->subDay()->getTimestamp();
221
+			if ('days_after' == $latest_date) {
222
+				$latest = $start->addDays($latest_range)->getTimestamp();
223
+			} elseif ('weeks_after' == $latest_date) {
224
+				$latest = $start->addWeeks($latest_range)->subDay()->getTimestamp();
225
+			} elseif ('months_after' == $latest_date) {
226
+				$latest = $start->addMonths($latest_range)->subDay()->getTimestamp();
227
+			} elseif ('years_after' == $latest_date) {
228
+				$latest = $start->addYears($latest_range)->subDay()->getTimestamp();
229 229
 			} else {
230 230
 				$latest = $start->getTimestamp();
231 231
 			}
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @param int $time
244 244
 	 */
245
-	public function set_cache( $time = 0 ) {
246
-		if ( $time === 0 || ! is_numeric( $time ) ) {
247
-			$cache = get_post_meta( $this->post_id, '_feed_cache', true );
248
-			$time  = is_numeric( $cache ) && $cache >= 0 ? absint( $cache ) : $this->cache;
245
+	public function set_cache($time = 0) {
246
+		if ($time === 0 || ! is_numeric($time)) {
247
+			$cache = get_post_meta($this->post_id, '_feed_cache', true);
248
+			$time  = is_numeric($cache) && $cache >= 0 ? absint($cache) : $this->cache;
249 249
 		}
250
-		$this->cache = absint( $time );
250
+		$this->cache = absint($time);
251 251
 	}
252 252
 
253 253
 	/**
Please login to merge, or discard this patch.
includes/update.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @param string $version (optional) Current plugin version, defaults to value in plugin constant.
65 65
 	 */
66
-	public function __construct( $version = SIMPLE_CALENDAR_VERSION ) {
66
+	public function __construct($version = SIMPLE_CALENDAR_VERSION) {
67 67
 		// Look for previous version in current or legacy option, null for fresh install.
68
-		$installed = get_option( 'simple-calendar_version', null );
69
-		$this->installed_ver = is_null( $installed ) ? get_option( 'gce_version', null ) : $installed;
68
+		$installed = get_option('simple-calendar_version', null);
69
+		$this->installed_ver = is_null($installed) ? get_option('gce_version', null) : $installed;
70 70
 		$this->new_ver = $version;
71 71
 
72
-		if ( version_compare( $this->installed_ver, $this->new_ver, '<' ) ) {
72
+		if (version_compare($this->installed_ver, $this->new_ver, '<')) {
73 73
 			$this->run_updates();
74 74
 		}
75 75
 	}
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function run_updates() {
85 85
 
86
-		do_action( 'simcal_before_update', $this->installed_ver );
86
+		do_action('simcal_before_update', $this->installed_ver);
87 87
 
88
-		if ( ! is_null( $this->installed_ver ) ) {
88
+		if ( ! is_null($this->installed_ver)) {
89 89
 
90
-			if ( version_compare( $this->installed_ver, $this->new_ver ) === -1 ) {
90
+			if (version_compare($this->installed_ver, $this->new_ver) === -1) {
91 91
 
92
-				$post_type = version_compare( $this->installed_ver, '3.0.0' ) === -1 ? 'gce_feed' : 'calendar';
93
-				$this->posts = $this->get_posts( $post_type );
92
+				$post_type = version_compare($this->installed_ver, '3.0.0') === -1 ? 'gce_feed' : 'calendar';
93
+				$this->posts = $this->get_posts($post_type);
94 94
 
95
-				foreach ( $this->update_path as $update_to ) {
96
-					if ( version_compare( $this->installed_ver, $update_to, '<' ) ) {
97
-						$this->update( $update_to );
95
+				foreach ($this->update_path as $update_to) {
96
+					if (version_compare($this->installed_ver, $update_to, '<')) {
97
+						$this->update($update_to);
98 98
 					}
99 99
 				}
100 100
 
@@ -109,28 +109,28 @@  discard block
 block discarded – undo
109 109
 
110 110
 		}
111 111
 
112
-		do_action( 'simcal_updated', $this->new_ver );
112
+		do_action('simcal_updated', $this->new_ver);
113 113
 
114 114
 		// Redirect to a welcome page if new install or major update.
115
-		if ( is_null( $this->installed_ver ) ) {
116
-			set_transient( '_simple-calendar_activation_redirect', 'fresh', 60 );
115
+		if (is_null($this->installed_ver)) {
116
+			set_transient('_simple-calendar_activation_redirect', 'fresh', 60);
117 117
 		} else {
118
-			$major_new = substr( $this->new_ver, 0, strrpos( $this->new_ver, '.' ) );
119
-			$major_old = substr( $this->installed_ver, 0, strrpos( $this->installed_ver, '.' ) );
120
-			if ( version_compare( $major_new, $major_old, '>' ) ) {
121
-				set_transient( '_simple-calendar_activation_redirect', 'update', 60 );
122
-			} elseif ( $major_old == $major_new ) {
123
-				$version = explode( '.', $this->new_ver );
124
-				end( $version );
125
-				if ( 0 === intval( current( $version ) ) ) {
126
-					set_transient( '_simple-calendar_activation_redirect', 'update', 60 );
118
+			$major_new = substr($this->new_ver, 0, strrpos($this->new_ver, '.'));
119
+			$major_old = substr($this->installed_ver, 0, strrpos($this->installed_ver, '.'));
120
+			if (version_compare($major_new, $major_old, '>')) {
121
+				set_transient('_simple-calendar_activation_redirect', 'update', 60);
122
+			} elseif ($major_old == $major_new) {
123
+				$version = explode('.', $this->new_ver);
124
+				end($version);
125
+				if (0 === intval(current($version))) {
126
+					set_transient('_simple-calendar_activation_redirect', 'update', 60);
127 127
 				}
128 128
 			}
129 129
 		}
130 130
 
131 131
 		$this->admin_redirects();
132 132
 
133
-		update_option( 'simple-calendar_version', $this->new_ver );
133
+		update_option('simple-calendar_version', $this->new_ver);
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,25 +142,25 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public function admin_redirects() {
144 144
 
145
-		$transient = get_transient( '_simple-calendar_activation_redirect' );
145
+		$transient = get_transient('_simple-calendar_activation_redirect');
146 146
 
147
-		if ( ! $transient || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) {
147
+		if ( ! $transient || is_network_admin() || isset($_GET['activate-multi']) || ! current_user_can('manage_options')) {
148 148
 			return;
149 149
 		}
150 150
 
151
-		delete_transient( '_simple-calendar_activation_redirect' );
151
+		delete_transient('_simple-calendar_activation_redirect');
152 152
 
153 153
 		// Do not redirect if already on welcome page screen.
154
-		if ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'simple-calendar_about' ) ) ) {
154
+		if ( ! empty($_GET['page']) && in_array($_GET['page'], array('simple-calendar_about'))) {
155 155
 			return;
156 156
 		}
157 157
 
158 158
 		$url = add_query_arg(
159 159
 				'simcal_install',
160
-				esc_attr( $transient ),
161
-				admin_url( 'index.php?page=simple-calendar_about' )
160
+				esc_attr($transient),
161
+				admin_url('index.php?page=simple-calendar_about')
162 162
 		);
163
-		wp_safe_redirect( $url );
163
+		wp_safe_redirect($url);
164 164
 		exit;
165 165
 	}
166 166
 
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @return array
175 175
 	 */
176
-	private function get_posts( $post_type ) {
176
+	private function get_posts($post_type) {
177 177
 
178 178
 		$posts = array();
179 179
 
180
-		if ( ! empty( $post_type ) ) {
180
+		if ( ! empty($post_type)) {
181 181
 
182 182
 			// https://core.trac.wordpress.org/ticket/18408
183
-			$posts = get_posts( array(
183
+			$posts = get_posts(array(
184 184
 				'post_type'   => $post_type,
185 185
 				'post_status' => array(
186 186
 					'draft',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 					'trash',
192 192
 				),
193 193
 				'nopaging'    => true,
194
-			) );
194
+			));
195 195
 
196 196
 			wp_reset_postdata();
197 197
 		}
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @param string $version
210 210
 	 */
211
-	private function update( $version ) {
211
+	private function update($version) {
212 212
 
213
-		$update_v = '\\' . __NAMESPACE__ . '\Updates\\Update_V' . str_replace( '.', '', $version );
213
+		$update_v = '\\'.__NAMESPACE__.'\Updates\\Update_V'.str_replace('.', '', $version);
214 214
 
215
-		if ( class_exists( $update_v ) ) {
216
-			new $update_v( $this->posts );
215
+		if (class_exists($update_v)) {
216
+			new $update_v($this->posts);
217 217
 		}
218 218
 	}
219 219
 
Please login to merge, or discard this patch.
includes/calendars/admin/default-calendar-admin.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -298,8 +298,8 @@
 block discarded – undo
298 298
 						'name'    => '_default_calendar_expand_multi_day_events',
299 299
 						'id'      => '_default_calendar_expand_multi_day_events',
300 300
 						'tooltip' => __( 'For events spanning multiple days, you can display them on each day of the event, ' .
301
-						                 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
302
-						                 'Third option applies to list views only.', 'google-calendar-events' ),
301
+										 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
302
+										 'Third option applies to list views only.', 'google-calendar-events' ),
303 303
 						'value'   => $multi_day_value,
304 304
 						'options' => array(
305 305
 							'yes'              => __( 'Yes, display on all days of event', 'google-calendar-events' ),
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Calendars\Admin;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		if ( simcal_is_admin_screen() !== false ) {
28
-			add_action( 'simcal_settings_meta_calendar_panel', array( $this, 'add_settings_meta_calendar_panel' ), 10, 1 );
27
+		if (simcal_is_admin_screen() !== false) {
28
+			add_action('simcal_settings_meta_calendar_panel', array($this, 'add_settings_meta_calendar_panel'), 10, 1);
29 29
 		}
30
-		add_action( 'simcal_process_settings_meta', array( $this, 'process_meta' ), 10, 1 );
30
+		add_action('simcal_process_settings_meta', array($this, 'process_meta'), 10, 1);
31 31
 	}
32 32
 
33 33
 	/**
@@ -76,47 +76,47 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param int $post_id
78 78
 	 */
79
-	public function add_settings_meta_calendar_panel( $post_id ) {
79
+	public function add_settings_meta_calendar_panel($post_id) {
80 80
 
81 81
 		?>
82 82
 		<table id="default-calendar-settings">
83 83
 			<thead>
84
-			<tr><th colspan="2"><?php _e( 'Default Calendar', 'google-calendar-events' ); ?></th></tr>
84
+			<tr><th colspan="2"><?php _e('Default Calendar', 'google-calendar-events'); ?></th></tr>
85 85
 			</thead>
86 86
 			<tbody class="simcal-panel-section">
87 87
 
88 88
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
89
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Event Bubbles', 'google-calendar-events' ); ?></label></th>
89
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Event Bubbles', 'google-calendar-events'); ?></label></th>
90 90
 				<td>
91 91
 					<?php
92 92
 
93
-					$bubbles = get_post_meta( $post_id, '_default_calendar_event_bubble_trigger', true );
93
+					$bubbles = get_post_meta($post_id, '_default_calendar_event_bubble_trigger', true);
94 94
 
95
-					simcal_print_field( array(
95
+					simcal_print_field(array(
96 96
 						'type'    => 'radio',
97 97
 						'inline'  => 'inline',
98 98
 						'name'    => '_default_calendar_event_bubble_trigger',
99 99
 						'id'      => '_default_calendar_event_bubble_trigger',
100
-						'tooltip' => __( 'Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events' ),
100
+						'tooltip' => __('Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events'),
101 101
 						'value'   => $bubbles ? $bubbles : 'hover',
102 102
 						'default' => 'hover',
103 103
 						'options' => array(
104
-							'click' => __( 'Click', 'google-calendar-events' ),
105
-							'hover' => __( 'Hover', 'google-calendar-events' ),
104
+							'click' => __('Click', 'google-calendar-events'),
105
+							'hover' => __('Hover', 'google-calendar-events'),
106 106
 						),
107
-					) );
107
+					));
108 108
 
109 109
 					?>
110 110
 				</td>
111 111
 			</tr>
112 112
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
113
-				<th><label for="_default_calendar_trim_titles"><?php _e( 'Trim Event Titles', 'google-calendar-events' ); ?></label></th>
113
+				<th><label for="_default_calendar_trim_titles"><?php _e('Trim Event Titles', 'google-calendar-events'); ?></label></th>
114 114
 				<td>
115 115
 					<?php
116 116
 
117
-					$trim = get_post_meta( $post_id, '_default_calendar_trim_titles', true );
117
+					$trim = get_post_meta($post_id, '_default_calendar_trim_titles', true);
118 118
 
119
-					simcal_print_field( array(
119
+					simcal_print_field(array(
120 120
 						'type'        => 'checkbox',
121 121
 						'name'        => '_default_calendar_trim_titles',
122 122
 						'id'          => '_default_calendar_trim_titles',
@@ -127,34 +127,34 @@  discard block
 block discarded – undo
127 127
 						'attributes'  => array(
128 128
 							'data-show-next-if-value' => 'yes',
129 129
 						),
130
-					) );
130
+					));
131 131
 
132
-					simcal_print_field( array(
132
+					simcal_print_field(array(
133 133
 						'type'       => 'standard',
134 134
 						'subtype'    => 'number',
135 135
 						'name'       => '_default_calendar_trim_titles_chars',
136 136
 						'id'         => '_default_calendar_trim_titles_chars',
137
-						'tooltip'    => __( 'Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events' ),
137
+						'tooltip'    => __('Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events'),
138 138
 						'class'      => array(
139 139
 							'simcal-field-tiny',
140 140
 						),
141
-						'value'      => 'yes' == $trim ? strval( max( absint( get_post_meta( $post_id, '_default_calendar_trim_titles_chars', true ) ), 1 ) ) : '20',
141
+						'value'      => 'yes' == $trim ? strval(max(absint(get_post_meta($post_id, '_default_calendar_trim_titles_chars', true)), 1)) : '20',
142 142
 						'attributes' => array(
143 143
 							'min'     => '1',
144 144
 						),
145
-					) );
145
+					));
146 146
 
147 147
 					?>
148 148
 				</td>
149 149
 			</tr>
150 150
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
151
-				<th><label for="_default_calendar_list_grouped_span"><?php _e( 'Span', 'google-calendar-events' ); ?></label></th>
151
+				<th><label for="_default_calendar_list_grouped_span"><?php _e('Span', 'google-calendar-events'); ?></label></th>
152 152
 				<td>
153 153
 					<?php
154 154
 
155
-					$list_span = max( absint( get_post_meta( $post_id, '_default_calendar_list_range_span', true ) ), 1 );
155
+					$list_span = max(absint(get_post_meta($post_id, '_default_calendar_list_range_span', true)), 1);
156 156
 
157
-					simcal_print_field( array(
157
+					simcal_print_field(array(
158 158
 						'type'    => 'standard',
159 159
 						'subtype' => 'number',
160 160
 						'name'    => '_default_calendar_list_range_span',
@@ -163,78 +163,78 @@  discard block
 block discarded – undo
163 163
 							'simcal-field-tiny',
164 164
 							'simcal-field-inline',
165 165
 						),
166
-						'value'   => strval( $list_span ),
166
+						'value'   => strval($list_span),
167 167
 						'attributes'  => array(
168 168
 							'min' => '1',
169 169
 						),
170
-					) );
170
+					));
171 171
 
172
-					$list_type = get_post_meta( $post_id, '_default_calendar_list_range_type', true );
172
+					$list_type = get_post_meta($post_id, '_default_calendar_list_range_type', true);
173 173
 
174
-					simcal_print_field( array(
174
+					simcal_print_field(array(
175 175
 						'type'    => 'select',
176 176
 						'name'    => '_default_calendar_list_range_type',
177 177
 						'id'      => '_default_calendar_list_range_type',
178
-						'tooltip' => __( 'Range of events to show on each calendar page.', 'google-calendar-events' ),
178
+						'tooltip' => __('Range of events to show on each calendar page.', 'google-calendar-events'),
179 179
 						'class'   => array(
180 180
 							'simcal-field-inline',
181 181
 						),
182 182
 						'value'   => $list_type,
183 183
 						'options' => array(
184
-							'monthly' => __( 'Month(s)', 'google-calendar-events' ),
185
-							'weekly'  => __( 'Week(s)', 'google-calendar-events' ),
186
-							'daily'   => __( 'Day(s)', 'google-calendar-events' ),
187
-							'events'  => __( 'Event(s)', 'google-calendar-events' ),
184
+							'monthly' => __('Month(s)', 'google-calendar-events'),
185
+							'weekly'  => __('Week(s)', 'google-calendar-events'),
186
+							'daily'   => __('Day(s)', 'google-calendar-events'),
187
+							'events'  => __('Event(s)', 'google-calendar-events'),
188 188
 						),
189
-					) );
189
+					));
190 190
 
191 191
 					?>
192 192
 				</td>
193 193
 			</tr>
194 194
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
195
-				<th><label for="_default_calendar_list_header"><?php _e( 'Hide Header', 'google-calendar-events' ); ?></label></th>
195
+				<th><label for="_default_calendar_list_header"><?php _e('Hide Header', 'google-calendar-events'); ?></label></th>
196 196
 				<td>
197 197
 					<?php
198 198
 
199
-					$header = get_post_meta( $post_id, '_default_calendar_list_header', true );
199
+					$header = get_post_meta($post_id, '_default_calendar_list_header', true);
200 200
 
201
-					simcal_print_field( array(
201
+					simcal_print_field(array(
202 202
 						'type'    => 'checkbox',
203 203
 						'name'    => '_default_calendar_list_header',
204 204
 						'id'      => '_default_calendar_list_header',
205
-						'tooltip' => __( 'You can use this to hide the month header for this calendar.', 'google-calendar-events' ),
205
+						'tooltip' => __('You can use this to hide the month header for this calendar.', 'google-calendar-events'),
206 206
 						'value'   => 'yes' == $header ? 'yes' : 'no',
207
-					) );
207
+					));
208 208
 
209 209
 					?>
210 210
 				</td>
211 211
 			</tr>
212 212
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
213
-				<th><label for="_default_calendar_compact_list"><?php _e( 'Compact List', 'google-calendar-events' ); ?></label></th>
213
+				<th><label for="_default_calendar_compact_list"><?php _e('Compact List', 'google-calendar-events'); ?></label></th>
214 214
 				<td>
215 215
 					<?php
216 216
 
217
-					$compact = get_post_meta( $post_id, '_default_calendar_compact_list', true );
217
+					$compact = get_post_meta($post_id, '_default_calendar_compact_list', true);
218 218
 
219
-					simcal_print_field( array(
219
+					simcal_print_field(array(
220 220
 						'type'    => 'checkbox',
221 221
 						'name'    => '_default_calendar_compact_list',
222 222
 						'id'      => '_default_calendar_compact_list',
223
-						'tooltip' => __( 'Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events' ),
223
+						'tooltip' => __('Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events'),
224 224
 						'value'   => 'yes' == $compact ? 'yes' : 'no',
225
-					) );
225
+					));
226 226
 
227 227
 					?>
228 228
 				</td>
229 229
 			</tr>
230 230
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list"  style="display: none;">
231
-				<th><label for="_default_calendar_limit_visible_events"><?php _e( 'Limit Visible Events', 'google-calendar-events' ); ?></label></th>
231
+				<th><label for="_default_calendar_limit_visible_events"><?php _e('Limit Visible Events', 'google-calendar-events'); ?></label></th>
232 232
 				<td>
233 233
 					<?php
234 234
 
235
-					$limit = get_post_meta( $post_id, '_default_calendar_limit_visible_events', true );
235
+					$limit = get_post_meta($post_id, '_default_calendar_limit_visible_events', true);
236 236
 
237
-					simcal_print_field( array(
237
+					simcal_print_field(array(
238 238
 						'type'        => 'checkbox',
239 239
 						'name'        => '_default_calendar_limit_visible_events',
240 240
 						'id'          => '_default_calendar_limit_visible_events',
@@ -245,17 +245,17 @@  discard block
 block discarded – undo
245 245
 						'attributes'  => array(
246 246
 							'data-show-next-if-value' => 'yes',
247 247
 						)
248
-					) );
248
+					));
249 249
 
250
-					$visible_events = absint( get_post_meta( $post_id, '_default_calendar_visible_events', true ) );
250
+					$visible_events = absint(get_post_meta($post_id, '_default_calendar_visible_events', true));
251 251
 					$visible_events = $visible_events > 0 ? $visible_events : 3;
252 252
 
253
-					simcal_print_field( array(
253
+					simcal_print_field(array(
254 254
 						'type'       => 'standard',
255 255
 						'subtype'    => 'number',
256 256
 						'name'       => '_default_calendar_visible_events',
257 257
 						'id'         => '_default_calendar_visible_events',
258
-						'tooltip'    => __( 'Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events' ),
258
+						'tooltip'    => __('Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events'),
259 259
 						'class'      => array(
260 260
 							'simcal-field-tiny',
261 261
 						),
@@ -263,39 +263,39 @@  discard block
 block discarded – undo
263 263
 						'attributes' => array(
264 264
 							'min'     => '1',
265 265
 						)
266
-					) );
266
+					));
267 267
 
268 268
 					?>
269 269
 				</td>
270 270
 			</tr>
271 271
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
272
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Expand Multi-day Events', 'google-calendar-events' ); ?></label></th>
272
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Expand Multi-day Events', 'google-calendar-events'); ?></label></th>
273 273
 				<td>
274 274
 					<?php
275 275
 
276
-					$post_meta = get_post_meta( $post_id );
276
+					$post_meta = get_post_meta($post_id);
277 277
 
278
-					if ( ! is_array( $post_meta ) && ! empty( $post_meta ) ) {
278
+					if ( ! is_array($post_meta) && ! empty($post_meta)) {
279 279
 						$multi_day_value = 'current_day_only';
280 280
 					} else {
281
-						$multi_day_value = get_post_meta( $post_id, '_default_calendar_expand_multi_day_events', true );
281
+						$multi_day_value = get_post_meta($post_id, '_default_calendar_expand_multi_day_events', true);
282 282
 					}
283 283
 
284
-					simcal_print_field( array(
284
+					simcal_print_field(array(
285 285
 						'type'    => 'select',
286 286
 						'name'    => '_default_calendar_expand_multi_day_events',
287 287
 						'id'      => '_default_calendar_expand_multi_day_events',
288
-						'tooltip' => __( 'For events spanning multiple days, you can display them on each day of the event, ' .
289
-						                 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
290
-						                 'Third option applies to list views only.', 'google-calendar-events' ),
288
+						'tooltip' => __('For events spanning multiple days, you can display them on each day of the event, '.
289
+						                 'only on the first day of the event, or on all days of the event, but only up to the current day. '.
290
+						                 'Third option applies to list views only.', 'google-calendar-events'),
291 291
 						'value'   => $multi_day_value,
292 292
 						'options' => array(
293
-							'yes'              => __( 'Yes, display on all days of event', 'google-calendar-events' ),
294
-							'no'               => __( 'No, display only on first day of event', 'google-calendar-events' ),
295
-							'current_day_only' => __( 'No, display on all days of event up to current day (list view only)', 'google-calendar-events' ),
293
+							'yes'              => __('Yes, display on all days of event', 'google-calendar-events'),
294
+							'no'               => __('No, display only on first day of event', 'google-calendar-events'),
295
+							'current_day_only' => __('No, display on all days of event up to current day (list view only)', 'google-calendar-events'),
296 296
 						),
297 297
 						'default' => 'current_day_only',
298
-					) );
298
+					));
299 299
 
300 300
 					?>
301 301
 				</td>
@@ -303,72 +303,72 @@  discard block
 block discarded – undo
303 303
 			</tbody>
304 304
 			<?php
305 305
 
306
-			$settings                   = get_option( 'simple-calendar_settings_calendars' );
307
-			$default_theme              = isset( $settings['default-calendar']['theme'] ) ? $settings['default-calendar']['theme'] : 'light';
306
+			$settings                   = get_option('simple-calendar_settings_calendars');
307
+			$default_theme              = isset($settings['default-calendar']['theme']) ? $settings['default-calendar']['theme'] : 'light';
308 308
 			$default_today_color        = /*isset( $settings['default-calendar']['today_color'] ) ? $settings['default-calendar']['today_color'] :*/ '#1e73be';
309 309
 			$default_days_events_color  = /*isset( $settings['default-calendar']['days_events_color'] ) ? $settings['default-calendar']['days_events_color'] :*/ '#000000';
310 310
 
311 311
 			?>
312 312
 			<tbody class="simcal-panel-section">
313 313
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
314
-				<th><label for="_default_calendar_style_theme"><?php _e( 'Theme', 'google-calendar-events' ); ?></label></th>
314
+				<th><label for="_default_calendar_style_theme"><?php _e('Theme', 'google-calendar-events'); ?></label></th>
315 315
 				<td>
316 316
 					<?php
317 317
 
318
-					$saved = get_post_meta( $post_id, '_default_calendar_style_theme', true );
318
+					$saved = get_post_meta($post_id, '_default_calendar_style_theme', true);
319 319
 					$value = ! $saved ? $default_theme : $saved;
320 320
 
321
-					simcal_print_field( array(
321
+					simcal_print_field(array(
322 322
 						'type'    => 'select',
323 323
 						'name'    => '_default_calendar_style_theme',
324 324
 						'id'      => '_default_calendar_style_theme',
325 325
 						'value'   => $value,
326
-						'tooltip' => __( 'Choose a calendar theme to match your site theme.', 'google-calendar-events' ),
326
+						'tooltip' => __('Choose a calendar theme to match your site theme.', 'google-calendar-events'),
327 327
 						'options' => array(
328
-							'light' => __( 'Light', 'google-calendar-events' ),
329
-							'dark' => __( 'Dark', 'google-calendar-events' ),
328
+							'light' => __('Light', 'google-calendar-events'),
329
+							'dark' => __('Dark', 'google-calendar-events'),
330 330
 						),
331
-					) );
331
+					));
332 332
 
333 333
 					?>
334 334
 				</td>
335 335
 			</tr>
336 336
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
337
-				<th><label for="_default_calendar_style_today"><?php _e( 'Today', 'google-calendar-events' ); ?></label></th>
337
+				<th><label for="_default_calendar_style_today"><?php _e('Today', 'google-calendar-events'); ?></label></th>
338 338
 				<td>
339 339
 					<?php
340 340
 
341
-					$saved = get_post_meta( $post_id, '_default_calendar_style_today', true );
341
+					$saved = get_post_meta($post_id, '_default_calendar_style_today', true);
342 342
 					$value = ! $saved ? $default_today_color : $saved;
343 343
 
344
-					simcal_print_field( array(
344
+					simcal_print_field(array(
345 345
 						'type'    => 'standard',
346 346
 						'subtype' => 'color-picker',
347 347
 						'name'    => '_default_calendar_style_today',
348 348
 						'id'      => '_default_calendar_style_today',
349 349
 						'value'   => $value,
350
-						'tooltip' => __( "This option will set the background color for today's date. It will change the day number background and the border around the current day.", 'google-calendar-events' ),
351
-					) );
350
+						'tooltip' => __("This option will set the background color for today's date. It will change the day number background and the border around the current day.", 'google-calendar-events'),
351
+					));
352 352
 
353 353
 					?>
354 354
 				</td>
355 355
 			</tr>
356 356
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
357
-				<th><label for="_default_calendar_style_days_events"><?php _e( 'Days with Events', 'google-calendar-events' ); ?></label></th>
357
+				<th><label for="_default_calendar_style_days_events"><?php _e('Days with Events', 'google-calendar-events'); ?></label></th>
358 358
 				<td>
359 359
 					<?php
360 360
 
361
-					$saved = get_post_meta( $post_id, '_default_calendar_style_days_events', true );
361
+					$saved = get_post_meta($post_id, '_default_calendar_style_days_events', true);
362 362
 					$value = ! $saved ? $default_days_events_color : $saved;
363 363
 
364
-					simcal_print_field( array(
364
+					simcal_print_field(array(
365 365
 						'type'    => 'standard',
366 366
 						'subtype' => 'color-picker',
367 367
 						'name'    => '_default_calendar_style_days_events',
368 368
 						'id'      => '_default_calendar_style_days_events',
369 369
 						'value'   => $value,
370
-						'tooltip' => __( 'This setting will modify the day number background for any days that have events on them.', 'google-calendar-events' ),
371
-					) );
370
+						'tooltip' => __('This setting will modify the day number background for any days that have events on them.', 'google-calendar-events'),
371
+					));
372 372
 
373 373
 					?>
374 374
 				</td>
@@ -390,55 +390,55 @@  discard block
 block discarded – undo
390 390
 	 *
391 391
 	 * @param int $post_id
392 392
 	 */
393
-	public function process_meta( $post_id ) {
393
+	public function process_meta($post_id) {
394 394
 
395 395
 		// Theme.
396
-		$theme = isset( $_POST['_default_calendar_style_theme'] ) ? sanitize_key( $_POST['_default_calendar_style_theme'] ) : 'light';
397
-		update_post_meta( $post_id, '_default_calendar_style_theme', $theme );
396
+		$theme = isset($_POST['_default_calendar_style_theme']) ? sanitize_key($_POST['_default_calendar_style_theme']) : 'light';
397
+		update_post_meta($post_id, '_default_calendar_style_theme', $theme);
398 398
 
399 399
 		// Today color.
400
-		$today_color = isset( $_POST['_default_calendar_style_today'] ) ? sanitize_text_field( $_POST['_default_calendar_style_today'] ) : '#FF000';
401
-		update_post_meta( $post_id, '_default_calendar_style_today', $today_color );
400
+		$today_color = isset($_POST['_default_calendar_style_today']) ? sanitize_text_field($_POST['_default_calendar_style_today']) : '#FF000';
401
+		update_post_meta($post_id, '_default_calendar_style_today', $today_color);
402 402
 
403 403
 		// Days with events color.
404
-		$days_events_color = isset( $_POST['_default_calendar_style_days_events'] ) ? sanitize_text_field( $_POST['_default_calendar_style_days_events'] ) : '#000000';
405
-		update_post_meta( $post_id, '_default_calendar_style_days_events', $days_events_color );
404
+		$days_events_color = isset($_POST['_default_calendar_style_days_events']) ? sanitize_text_field($_POST['_default_calendar_style_days_events']) : '#000000';
405
+		update_post_meta($post_id, '_default_calendar_style_days_events', $days_events_color);
406 406
 
407 407
 		// List range span.
408
-		$span = isset( $_POST['_default_calendar_list_range_span'] ) ? max( absint( $_POST['_default_calendar_list_range_span'] ), 1 ) : 1;
409
-		update_post_meta( $post_id, '_default_calendar_list_range_span', $span );
408
+		$span = isset($_POST['_default_calendar_list_range_span']) ? max(absint($_POST['_default_calendar_list_range_span']), 1) : 1;
409
+		update_post_meta($post_id, '_default_calendar_list_range_span', $span);
410 410
 
411 411
 		// List range type.
412
-		$group = isset( $_POST['_default_calendar_list_range_type'] ) ? sanitize_key( $_POST['_default_calendar_list_range_type'] ) : 'monthly';
413
-		update_post_meta( $post_id, '_default_calendar_list_range_type', $group );
412
+		$group = isset($_POST['_default_calendar_list_range_type']) ? sanitize_key($_POST['_default_calendar_list_range_type']) : 'monthly';
413
+		update_post_meta($post_id, '_default_calendar_list_range_type', $group);
414 414
 
415 415
 		// Hide header.
416
-		$header = isset( $_POST['_default_calendar_list_header'] ) ? 'yes' : 'no';
417
-		update_post_meta( $post_id, '_default_calendar_list_header', $header );
416
+		$header = isset($_POST['_default_calendar_list_header']) ? 'yes' : 'no';
417
+		update_post_meta($post_id, '_default_calendar_list_header', $header);
418 418
 
419 419
 		// Compact list.
420
-		$compact = isset( $_POST['_default_calendar_compact_list'] ) ? 'yes' : 'no';
421
-		update_post_meta( $post_id, '_default_calendar_compact_list', $compact );
420
+		$compact = isset($_POST['_default_calendar_compact_list']) ? 'yes' : 'no';
421
+		update_post_meta($post_id, '_default_calendar_compact_list', $compact);
422 422
 
423 423
 		// Limit number of initially visible daily events.
424
-		$limit = isset( $_POST['_default_calendar_limit_visible_events'] ) ? 'yes' : 'no';
425
-		update_post_meta( $post_id, '_default_calendar_limit_visible_events', $limit );
426
-		$number = isset( $_POST['_default_calendar_visible_events'] ) ? absint( $_POST['_default_calendar_visible_events'] ) : 3;
427
-		update_post_meta( $post_id, '_default_calendar_visible_events', $number );
424
+		$limit = isset($_POST['_default_calendar_limit_visible_events']) ? 'yes' : 'no';
425
+		update_post_meta($post_id, '_default_calendar_limit_visible_events', $limit);
426
+		$number = isset($_POST['_default_calendar_visible_events']) ? absint($_POST['_default_calendar_visible_events']) : 3;
427
+		update_post_meta($post_id, '_default_calendar_visible_events', $number);
428 428
 
429 429
 		// Grid event bubbles action.
430
-		$bubbles = isset( $_POST['_default_calendar_event_bubble_trigger'] ) ? esc_attr( $_POST['_default_calendar_event_bubble_trigger'] ) : 'hover';
431
-		update_post_meta( $post_id, '_default_calendar_event_bubble_trigger', $bubbles );
430
+		$bubbles = isset($_POST['_default_calendar_event_bubble_trigger']) ? esc_attr($_POST['_default_calendar_event_bubble_trigger']) : 'hover';
431
+		update_post_meta($post_id, '_default_calendar_event_bubble_trigger', $bubbles);
432 432
 
433 433
 		// Trim event titles characters length.
434
-		$trim = isset( $_POST['_default_calendar_trim_titles'] ) ? 'yes' : 'no';
435
-		update_post_meta( $post_id, '_default_calendar_trim_titles', $trim );
436
-		$chars = isset( $_POST['_default_calendar_trim_titles_chars'] ) ? max( absint( $_POST['_default_calendar_trim_titles_chars'] ), 1 ) : 20;
437
-		update_post_meta( $post_id, '_default_calendar_trim_titles_chars', $chars );
434
+		$trim = isset($_POST['_default_calendar_trim_titles']) ? 'yes' : 'no';
435
+		update_post_meta($post_id, '_default_calendar_trim_titles', $trim);
436
+		$chars = isset($_POST['_default_calendar_trim_titles_chars']) ? max(absint($_POST['_default_calendar_trim_titles_chars']), 1) : 20;
437
+		update_post_meta($post_id, '_default_calendar_trim_titles_chars', $chars);
438 438
 
439 439
 		// Expand multiple day events on each day.
440
-		$multi_day = isset( $_POST['_default_calendar_expand_multi_day_events'] ) && ! empty( $_POST['_default_calendar_expand_multi_day_events'] ) ? sanitize_key( $_POST['_default_calendar_expand_multi_day_events'] ) : 'current_day_only';
441
-		update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', $multi_day );
440
+		$multi_day = isset($_POST['_default_calendar_expand_multi_day_events']) && ! empty($_POST['_default_calendar_expand_multi_day_events']) ? sanitize_key($_POST['_default_calendar_expand_multi_day_events']) : 'current_day_only';
441
+		update_post_meta($post_id, '_default_calendar_expand_multi_day_events', $multi_day);
442 442
 
443 443
 	}
444 444
 
Please login to merge, or discard this patch.