Completed
Push — master ( e47c17...035b95 )
by
unknown
04:49
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/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/default-calendar.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Calendars\Views;
14 14
 use SimpleCalendar\Events\Event;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -105,35 +105,35 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @param int|object|\WP_Post|Calendar $calendar
107 107
 	 */
108
-	public function __construct( $calendar ) {
108
+	public function __construct($calendar) {
109 109
 
110 110
 		$this->type = 'default-calendar';
111
-		$this->name = __( 'Default', 'google-calendar-events' );
112
-		$this->views = apply_filters( 'simcal_default_calendar_views', array(
113
-			'grid' => __( 'Grid', 'google-calendar-events' ),
114
-			'list' => __( 'List', 'google-calendar-events' ),
115
-		) );
111
+		$this->name = __('Default', 'google-calendar-events');
112
+		$this->views = apply_filters('simcal_default_calendar_views', array(
113
+			'grid' => __('Grid', 'google-calendar-events'),
114
+			'list' => __('List', 'google-calendar-events'),
115
+		));
116 116
 
117
-		parent::__construct( $calendar );
117
+		parent::__construct($calendar);
118 118
 
119
-		if ( ! is_null( $this->post ) ) {
119
+		if ( ! is_null($this->post)) {
120 120
 
121
-			$this->set_properties( $this->view->get_type() );
121
+			$this->set_properties($this->view->get_type());
122 122
 
123 123
 			$id = $this->id;
124 124
 			$theme = $this->theme;
125 125
 
126
-			add_filter( 'simcal_calendar_class', function( $class, $post_id ) use ( $theme, $id ) {
127
-				if ( in_array( 'default-calendar', $class ) && $post_id === $id ) {
128
-					array_push( $class, 'default-calendar-' . $theme );
126
+			add_filter('simcal_calendar_class', function($class, $post_id) use ($theme, $id) {
127
+				if (in_array('default-calendar', $class) && $post_id === $id) {
128
+					array_push($class, 'default-calendar-'.$theme);
129 129
 				}
130 130
 				return $class;
131
-			}, 10, 2 );
131
+			}, 10, 2);
132 132
 
133 133
 		}
134 134
 
135 135
 		// Calendar settings handling.
136
-		if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
136
+		if (is_admin() && ! defined('DOING_AJAX')) {
137 137
 			$admin = new Default_Calendar_Admin();
138 138
 			$this->settings = $admin->settings_fields();
139 139
 		}
@@ -147,49 +147,49 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @param  $view
149 149
 	 */
150
-	private function set_properties( $view ) {
150
+	private function set_properties($view) {
151 151
 
152 152
 		// Set styles.
153
-		if ( 'dark' == get_post_meta( $this->id, '_default_calendar_style_theme', true ) ) {
153
+		if ('dark' == get_post_meta($this->id, '_default_calendar_style_theme', true)) {
154 154
 			$this->theme = 'dark';
155 155
 		}
156
-		if ( $today_color = get_post_meta( $this->id, '_default_calendar_style_today', true ) ) {
157
-			$this->today_color = esc_attr( $today_color );
156
+		if ($today_color = get_post_meta($this->id, '_default_calendar_style_today', true)) {
157
+			$this->today_color = esc_attr($today_color);
158 158
 		}
159
-		if ( $day_events_color = get_post_meta( $this->id, '_default_calendar_style_days_events', true ) ) {
160
-			$this->days_events_color = esc_attr( $day_events_color );
159
+		if ($day_events_color = get_post_meta($this->id, '_default_calendar_style_days_events', true)) {
160
+			$this->days_events_color = esc_attr($day_events_color);
161 161
 		}
162 162
 
163 163
 		// Hide too many events.
164
-		if ( 'yes' == get_post_meta( $this->id, '_default_calendar_limit_visible_events', true ) ) {
165
-			$this->events_limit = absint( get_post_meta( $this->id, '_default_calendar_visible_events', true ) );
164
+		if ('yes' == get_post_meta($this->id, '_default_calendar_limit_visible_events', true)) {
165
+			$this->events_limit = absint(get_post_meta($this->id, '_default_calendar_visible_events', true));
166 166
 		}
167 167
 
168 168
 		// Expand multiple day events.
169
-		if ( 'yes' == get_post_meta( $this->id, '_default_calendar_expand_multi_day_events', true ) || ( 'list' == $view && 'current_day_only' == get_post_meta( $this->id, '_default_calendar_expand_multi_day_events', true ) ) ) {
169
+		if ('yes' == get_post_meta($this->id, '_default_calendar_expand_multi_day_events', true) || ('list' == $view && 'current_day_only' == get_post_meta($this->id, '_default_calendar_expand_multi_day_events', true))) {
170 170
 			$this->events = $this->expand_multiple_days_events();
171 171
 		}
172 172
 
173
-		if ( 'grid' == $view ) {
173
+		if ('grid' == $view) {
174 174
 
175 175
 			// Use hover to open event bubbles.
176
-			if ( 'hover' == get_post_meta( $this->id, '_default_calendar_event_bubble_trigger', true ) ) {
176
+			if ('hover' == get_post_meta($this->id, '_default_calendar_event_bubble_trigger', true)) {
177 177
 				$this->event_bubble_trigger = 'hover';
178 178
 			}
179 179
 
180 180
 			// Trim long event titles.
181
-			if ( 'yes' == get_post_meta( $this->id, '_default_calendar_trim_titles', true ) ) {
182
-				$this->trim_titles = max( absint( get_post_meta( $this->id, '_default_calendar_trim_titles_chars', true ) ), 1 );
181
+			if ('yes' == get_post_meta($this->id, '_default_calendar_trim_titles', true)) {
182
+				$this->trim_titles = max(absint(get_post_meta($this->id, '_default_calendar_trim_titles_chars', true)), 1);
183 183
 			}
184 184
 
185 185
 		} else {
186 186
 
187 187
 			// List range.
188
-			$this->group_type = esc_attr( get_post_meta( $this->id, '_default_calendar_list_range_type', true ) );
189
-			$this->group_span = max( absint( get_post_meta( $this->id, '_default_calendar_list_range_span', true ) ), 1 );
188
+			$this->group_type = esc_attr(get_post_meta($this->id, '_default_calendar_list_range_type', true));
189
+			$this->group_span = max(absint(get_post_meta($this->id, '_default_calendar_list_range_span', true)), 1);
190 190
 
191 191
 			// Make the list look more compact.
192
-			if ( 'yes' == get_post_meta( $this->id, '_default_calendar_compact_list', true ) ) {
192
+			if ('yes' == get_post_meta($this->id, '_default_calendar_compact_list', true)) {
193 193
 				$this->compact_list = true;
194 194
 			}
195 195
 
@@ -210,24 +210,24 @@  discard block
 block discarded – undo
210 210
 		$old_events = $this->events;
211 211
 		$new_events = array();
212 212
 
213
-		if ( ! empty( $old_events ) ) {
213
+		if ( ! empty($old_events)) {
214 214
 
215
-			foreach ( $old_events as $events ) {
216
-				foreach ( $events as $event ) {
217
-					if ( $event instanceof Event ) {
218
-						if ( false !== $event->multiple_days ) {
215
+			foreach ($old_events as $events) {
216
+				foreach ($events as $event) {
217
+					if ($event instanceof Event) {
218
+						if (false !== $event->multiple_days) {
219 219
 							$days = $event->multiple_days;
220 220
 
221
-							if ( $days == 1 ) {
222
-								$new_events[ intval( $event->start + ( DAY_IN_SECONDS ) - 1 ) ][] = $event;
221
+							if ($days == 1) {
222
+								$new_events[intval($event->start + (DAY_IN_SECONDS) - 1)][] = $event;
223 223
 							} else {
224 224
 
225 225
 								/*if ( ! empty( $event->whole_day ) ) {
226 226
 									$days--;
227 227
 								}*/
228 228
 
229
-								for ( $d = 1; $d <= $days; $d++ ) {
230
-									$new_events[ intval( $event->start + ( $d * DAY_IN_SECONDS ) - 1 ) ][] = $event;
229
+								for ($d = 1; $d <= $days; $d++) {
230
+									$new_events[intval($event->start + ($d * DAY_IN_SECONDS) - 1)][] = $event;
231 231
 								}
232 232
 							}
233 233
 						}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		}
240 240
 
241 241
 		$events = $old_events + $new_events;
242
-		ksort( $events, SORT_NUMERIC );
242
+		ksort($events, SORT_NUMERIC);
243 243
 		return $events;
244 244
 	}
245 245
 
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
 	 *
255 255
 	 * @return null|Calendar_View
256 256
 	 */
257
-	public function get_view( $view = '' ) {
257
+	public function get_view($view = '') {
258 258
 
259
-		$view = ! empty( $view ) ? $view : 'grid';
259
+		$view = ! empty($view) ? $view : 'grid';
260 260
 
261
-		do_action( 'simcal_calendar_get_view', $this->type, $view );
261
+		do_action('simcal_calendar_get_view', $this->type, $view);
262 262
 
263
-		if ( 'grid' == $view ) {
264
-			return new Views\Default_Calendar_Grid( $this );
265
-		} elseif ( 'list' == $view ) {
266
-			return new Views\Default_Calendar_List( $this );
263
+		if ('grid' == $view) {
264
+			return new Views\Default_Calendar_Grid($this);
265
+		} elseif ('list' == $view) {
266
+			return new Views\Default_Calendar_List($this);
267 267
 		}
268 268
 
269 269
 		return null;
Please login to merge, or discard this patch.
includes/wp-requirements.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @license GPL2+
12 12
  */
13 13
 
14
-if ( ! class_exists( 'SimCal_WP_Requirements' ) ) {
14
+if ( ! class_exists('SimCal_WP_Requirements')) {
15 15
 
16 16
 	class SimCal_WP_Requirements {
17 17
 
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 		 * @param string $plugin       Output of `plugin_basename( __FILE__ )`.
91 91
 		 * @param array  $requirements Associative array with requirements.
92 92
 		 */
93
-		public function __construct( $name, $plugin, $requirements ) {
93
+		public function __construct($name, $plugin, $requirements) {
94 94
 
95
-			$this->name = htmlspecialchars( strip_tags( $name ) );
95
+			$this->name = htmlspecialchars(strip_tags($name));
96 96
 			$this->plugin = $plugin;
97 97
 			$this->requirements = $requirements;
98 98
 
99
-			if ( ! empty( $requirements ) && is_array( $requirements ) ) {
99
+			if ( ! empty($requirements) && is_array($requirements)) {
100 100
 
101 101
 				$failures = $extensions = array();
102 102
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 				);
110 110
 
111 111
 				// Check for WordPress version.
112
-				if ( $requirements['WordPress'] && is_string( $requirements['WordPress'] ) ) {
113
-					if ( function_exists( 'get_bloginfo' ) ) {
114
-						$wp_version = get_bloginfo( 'version' );
115
-						if ( version_compare( $wp_version, $requirements['WordPress'] ) === - 1 ) {
112
+				if ($requirements['WordPress'] && is_string($requirements['WordPress'])) {
113
+					if (function_exists('get_bloginfo')) {
114
+						$wp_version = get_bloginfo('version');
115
+						if (version_compare($wp_version, $requirements['WordPress']) === - 1) {
116 116
 							$failures['WordPress'] = $wp_version;
117 117
 							$this->wp = false;
118 118
 						}
@@ -120,24 +120,24 @@  discard block
 block discarded – undo
120 120
 				}
121 121
 
122 122
 				// Check fo PHP version.
123
-				if ( $requirements['PHP'] && is_string( $requirements['PHP'] ) ) {
124
-					if ( version_compare( PHP_VERSION, $requirements['PHP'] ) === -1 ) {
123
+				if ($requirements['PHP'] && is_string($requirements['PHP'])) {
124
+					if (version_compare(PHP_VERSION, $requirements['PHP']) === -1) {
125 125
 						$failures['PHP'] = PHP_VERSION;
126 126
 						$this->php = false;
127 127
 					}
128 128
 				}
129 129
 
130 130
 				// Check fo PHP Extensions.
131
-				if ( $requirements['Extensions'] && is_array( $requirements['Extensions'] ) ) {
132
-					foreach ( $requirements['Extensions'] as $extension ) {
133
-						if ( $extension && is_string( $extension ) ) {
134
-							$extensions[ $extension ] = extension_loaded( $extension );
131
+				if ($requirements['Extensions'] && is_array($requirements['Extensions'])) {
132
+					foreach ($requirements['Extensions'] as $extension) {
133
+						if ($extension && is_string($extension)) {
134
+							$extensions[$extension] = extension_loaded($extension);
135 135
 						}
136 136
 					}
137
-					if ( in_array( false, $extensions ) ) {
138
-						foreach ( $extensions as $extension_name => $found  ) {
139
-							if ( $found === false ) {
140
-								$failures['Extensions'][ $extension_name ] = $extension_name;
137
+					if (in_array(false, $extensions)) {
138
+						foreach ($extensions as $extension_name => $found) {
139
+							if ($found === false) {
140
+								$failures['Extensions'][$extension_name] = $extension_name;
141 141
 							}
142 142
 						}
143 143
 						$this->extensions = false;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
 			} else {
150 150
 
151
-				trigger_error( 'WP Requirements: the requirements are invalid.', E_USER_ERROR );
151
+				trigger_error('WP Requirements: the requirements are invalid.', E_USER_ERROR);
152 152
 
153 153
 			}
154 154
 		}
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 		 * @return bool
169 169
 		 */
170 170
 		public function pass() {
171
-			if ( in_array( false, array(
171
+			if (in_array(false, array(
172 172
 				$this->wp,
173 173
 				$this->php,
174 174
 				$this->extensions,
175
-			) ) ) {
175
+			))) {
176 176
 				return false;
177 177
 			}
178 178
 			return true;
@@ -185,28 +185,28 @@  discard block
 block discarded – undo
185 185
 		 *
186 186
 		 * @return string
187 187
 		 */
188
-		public function get_notice( $message = '' ) {
188
+		public function get_notice($message = '') {
189 189
 
190 190
 			$notice   = '';
191 191
 			$name     = $this->name;
192 192
 			$failures = $this->failures;
193 193
 
194
-			if ( ! empty( $failures ) && is_array( $failures ) ) {
194
+			if ( ! empty($failures) && is_array($failures)) {
195 195
 
196
-				$notice  = '<div class="error">' . "\n";
197
-				$notice .= "\t" . '<p>' . "\n";
198
-				$notice .= '<strong>' . sprintf( '%s could not be activated.', $name ) . '</strong><br>';
196
+				$notice  = '<div class="error">'."\n";
197
+				$notice .= "\t".'<p>'."\n";
198
+				$notice .= '<strong>'.sprintf('%s could not be activated.', $name).'</strong><br>';
199 199
 
200
-				foreach ( $failures as $requirement => $found ) {
200
+				foreach ($failures as $requirement => $found) {
201 201
 
202
-					$required = $this->requirements[ $requirement ];
202
+					$required = $this->requirements[$requirement];
203 203
 
204
-					if ( 'Extensions' == $requirement ) {
205
-						if ( is_array( $found ) ) {
204
+					if ('Extensions' == $requirement) {
205
+						if (is_array($found)) {
206 206
 							$notice .= sprintf( 
207 207
 									'Required PHP Extension(s) not found: %s.', 
208
-									join( ', ', $found ) 
209
-								) . '<br>';
208
+									join(', ', $found) 
209
+								).'<br>';
210 210
 						}
211 211
 					} else {
212 212
 						$notice .= sprintf( 
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 								$requirement, 
215 215
 								$required, 
216 216
 								$found 
217
-							) . '<br>';
217
+							).'<br>';
218 218
 					}
219 219
 
220 220
 				}
221 221
 
222
-				$notice .= '<em>' . sprintf( 'Please update to meet %s requirements.', $name ) . '</em>' . "\n";
223
-				$notice .= "\t" . '</p>' . "\n";
224
-				if ( $message ) {
222
+				$notice .= '<em>'.sprintf('Please update to meet %s requirements.', $name).'</em>'."\n";
223
+				$notice .= "\t".'</p>'."\n";
224
+				if ($message) {
225 225
 					$notice .= $message;
226 226
 				}
227 227
 				$notice .= '</div>';
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 		 * Deactivate plugin.
242 242
 		 */
243 243
 		public function deactivate_plugin() {
244
-			if ( function_exists( 'deactivate_plugins' ) && function_exists( 'plugin_basename' ) ) {
245
-				deactivate_plugins( $this->plugin );
244
+			if (function_exists('deactivate_plugins') && function_exists('plugin_basename')) {
245
+				deactivate_plugins($this->plugin);
246 246
 			}
247 247
 		}
248 248
 
@@ -251,17 +251,17 @@  discard block
 block discarded – undo
251 251
 		 *
252 252
 		 * @param string $message An additional message in notice.
253 253
 		 */
254
-		public function halt( $message = '' ) {
254
+		public function halt($message = '') {
255 255
 
256
-			$this->notice = $this->get_notice( $message );
256
+			$this->notice = $this->get_notice($message);
257 257
 
258
-			if ( $this->notice && function_exists( 'add_action' ) ) {
258
+			if ($this->notice && function_exists('add_action')) {
259 259
 
260
-				add_action( 'admin_notices', array( $this, 'print_notice' ) );
261
-				add_action( 'admin_init', array( $this, 'deactivate_plugin' ) );
260
+				add_action('admin_notices', array($this, 'print_notice'));
261
+				add_action('admin_init', array($this, 'deactivate_plugin'));
262 262
 
263
-				if ( isset( $_GET['activate'] ) ) {
264
-					unset( $_GET['activate'] );
263
+				if (isset($_GET['activate'])) {
264
+					unset($_GET['activate']);
265 265
 				}
266 266
 			}
267 267
 		}
Please login to merge, or discard this patch.