Completed
Push — master ( a00b53...3dc4d8 )
by
unknown
21:18
created
includes/shortcodes.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Calendar;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function __construct() {
30 30
 
31 31
 		// Add shortcodes.
32
-		add_action( 'init', array( $this, 'register' ) );
32
+		add_action('init', array($this, 'register'));
33 33
 	}
34 34
 
35 35
 	/**
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function register() {
41 41
 
42
-		add_shortcode( 'calendar', array( $this, 'print_calendar' ) );
42
+		add_shortcode('calendar', array($this, 'print_calendar'));
43 43
 		// @deprecated legacy shortcode
44
-		add_shortcode( 'gcal', array( $this, 'print_calendar' ) );
44
+		add_shortcode('gcal', array($this, 'print_calendar'));
45 45
 
46
-		do_action( 'simcal_add_shortcodes' );
46
+		do_action('simcal_add_shortcodes');
47 47
 	}
48 48
 
49 49
 	/**
@@ -55,19 +55,19 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return string
57 57
 	 */
58
-	public function print_calendar( $attributes ) {
58
+	public function print_calendar($attributes) {
59 59
 
60
-		$args = shortcode_atts( array(
60
+		$args = shortcode_atts(array(
61 61
 			'id' => null,
62
-		), $attributes );
62
+		), $attributes);
63 63
 
64
-		$id = absint( $args['id'] );
64
+		$id = absint($args['id']);
65 65
 
66
-		if ( $id > 0 ) {
66
+		if ($id > 0) {
67 67
 
68
-			$calendar = simcal_get_calendar( $id );
68
+			$calendar = simcal_get_calendar($id);
69 69
 
70
-			if ( $calendar instanceof Calendar ) {
70
+			if ($calendar instanceof Calendar) {
71 71
 				ob_start();
72 72
 				$calendar->html();
73 73
 				return ob_get_clean();
Please login to merge, or discard this patch.
includes/updates/update-v210.php 1 patch
Spacing   +10 added lines, -10 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,21 +20,21 @@  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
-				$url = get_post_meta( $post->ID, 'gce_feed_url', true );
29
+				$url = get_post_meta($post->ID, 'gce_feed_url', true);
30 30
 
31
-				if ( $url ) {
31
+				if ($url) {
32 32
 
33
-					$url = str_replace( 'https://www.google.com/calendar/feeds/', '', $url );
34
-					$url = str_replace( '/public/basic', '', $url );
35
-					$url = str_replace( '%40', '@', $url );
33
+					$url = str_replace('https://www.google.com/calendar/feeds/', '', $url);
34
+					$url = str_replace('/public/basic', '', $url);
35
+					$url = str_replace('%40', '@', $url);
36 36
 
37
-					update_post_meta( $post->ID, 'gce_feed_url', $url );
37
+					update_post_meta($post->ID, 'gce_feed_url', $url);
38 38
 				}
39 39
 
40 40
 			}
Please login to merge, or discard this patch.
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 2 patches
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.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Widgets
4
- *
5
- * @package SimpleCalendar
6
- */
3
+	 * Widgets
4
+	 *
5
+	 * @package SimpleCalendar
6
+	 */
7 7
 namespace SimpleCalendar;
8 8
 
9 9
 if ( ! defined( 'ABSPATH' ) ) {
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/events/event.php 1 patch
Spacing   +75 added lines, -75 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
 
@@ -234,30 +234,30 @@  discard block
 block discarded – undo
234 234
 	 *
235 235
 	 * @param array $event
236 236
 	 */
237
-	public function __construct( array $event ) {
237
+	public function __construct(array $event) {
238 238
 
239 239
 		/* ================= *
240 240
 		 * Event Identifiers *
241 241
 		 * ================= */
242 242
 
243 243
 		// Event unique id.
244
-		if ( ! empty( $event['uid'] ) ) {
245
-			$this->uid = esc_attr( $event['uid'] );
244
+		if ( ! empty($event['uid'])) {
245
+			$this->uid = esc_attr($event['uid']);
246 246
 		}
247 247
 
248 248
 		// Event source.
249
-		if ( ! empty( $event['source'] ) ) {
250
-			$this->source = esc_attr( $event['source'] );
249
+		if ( ! empty($event['source'])) {
250
+			$this->source = esc_attr($event['source']);
251 251
 		}
252 252
 
253 253
 		// Event parent calendar id.
254
-		if ( ! empty( $event['calendar'] ) ) {
255
-			$this->calendar = max( intval( $event['calendar'] ), 0 );
254
+		if ( ! empty($event['calendar'])) {
255
+			$this->calendar = max(intval($event['calendar']), 0);
256 256
 		}
257 257
 
258 258
 		// Event parent calendar timezone.
259
-		if ( ! empty( $event['timezone'] ) ) {
260
-			$this->timezone = esc_attr( $event['timezone'] );
259
+		if ( ! empty($event['timezone'])) {
260
+			$this->timezone = esc_attr($event['timezone']);
261 261
 		}
262 262
 
263 263
 		/* ============= *
@@ -265,23 +265,23 @@  discard block
 block discarded – undo
265 265
 		 * ============= */
266 266
 
267 267
 		// Event title.
268
-		if ( ! empty( $event['title'] ) ) {
269
-			$this->title = esc_html( $event['title'] );
268
+		if ( ! empty($event['title'])) {
269
+			$this->title = esc_html($event['title']);
270 270
 		}
271 271
 
272 272
 		// Event description.
273
-		if ( ! empty( $event['description'] ) ) {
274
-			$this->description = wp_kses_post( $event['description'] );
273
+		if ( ! empty($event['description'])) {
274
+			$this->description = wp_kses_post($event['description']);
275 275
 		}
276 276
 
277 277
 		// Event link URL.
278
-		if ( ! empty( $event['link'] ) ) {
279
-			$this->link = esc_url_raw( $event['link'] );
278
+		if ( ! empty($event['link'])) {
279
+			$this->link = esc_url_raw($event['link']);
280 280
 		}
281 281
 
282 282
 		// Event visibility.
283
-		if ( ! empty( $event['visibility'] ) ) {
284
-			$this->visibility = esc_attr( $event['visibility'] );
283
+		if ( ! empty($event['visibility'])) {
284
+			$this->visibility = esc_attr($event['visibility']);
285 285
 			$this->public = $this->visibility == 'public' ? true : false;
286 286
 		}
287 287
 
@@ -289,34 +289,34 @@  discard block
 block discarded – undo
289 289
 		 * Event Start *
290 290
 		 * =========== */
291 291
 
292
-		if ( ! empty( $event['start'] ) ) {
293
-			$this->start = is_numeric( $event['start'] ) ? intval( $event['start'] ) : 0;
294
-			if ( ! empty( $event['start_utc'] ) ) {
295
-				$this->start_utc = is_numeric( $event['start_utc'] ) ? intval( $event['start_utc'] ) : 0;
292
+		if ( ! empty($event['start'])) {
293
+			$this->start = is_numeric($event['start']) ? intval($event['start']) : 0;
294
+			if ( ! empty($event['start_utc'])) {
295
+				$this->start_utc = is_numeric($event['start_utc']) ? intval($event['start_utc']) : 0;
296 296
 			}
297
-			if ( ! empty( $event['start_timezone'] ) ) {
298
-				$this->start_timezone = esc_attr( $event['start_timezone'] );
297
+			if ( ! empty($event['start_timezone'])) {
298
+				$this->start_timezone = esc_attr($event['start_timezone']);
299 299
 			}
300
-			$this->start_dt = Carbon::createFromTimestamp( $this->start, $this->start_timezone );
301
-			$start_location = isset( $event['start_location'] ) ? $event['start_location'] : '';
302
-			$this->start_location = $this->esc_location( $start_location );
300
+			$this->start_dt = Carbon::createFromTimestamp($this->start, $this->start_timezone);
301
+			$start_location = isset($event['start_location']) ? $event['start_location'] : '';
302
+			$this->start_location = $this->esc_location($start_location);
303 303
 		}
304 304
 
305 305
 		/* ========= *
306 306
 		 * Event End *
307 307
 		 * ========= */
308 308
 
309
-		if ( ! empty( $event['end'] ) ) {
310
-			$this->end = is_numeric( $event['end'] ) ? intval( $event['end'] ): false;
311
-			if ( ! empty( $event['end_timezone'] ) ) {
312
-				$this->end_timezone = esc_attr( $event['end_timezone'] );
309
+		if ( ! empty($event['end'])) {
310
+			$this->end = is_numeric($event['end']) ? intval($event['end']) : false;
311
+			if ( ! empty($event['end_timezone'])) {
312
+				$this->end_timezone = esc_attr($event['end_timezone']);
313 313
 			}
314
-			if ( ! empty( $event['end_utc'] ) ) {
315
-				$this->end_utc = is_numeric( $event['end_utc'] ) ? intval( $event['end_utc'] ) : false;
316
-				$this->end_dt = Carbon::createFromTimestamp( $this->end, $this->end_timezone );
314
+			if ( ! empty($event['end_utc'])) {
315
+				$this->end_utc = is_numeric($event['end_utc']) ? intval($event['end_utc']) : false;
316
+				$this->end_dt = Carbon::createFromTimestamp($this->end, $this->end_timezone);
317 317
 			}
318
-			$end_location = isset( $event['end_location'] ) ? $event['end_location'] : '';
319
-			$this->end_location = $this->esc_location( $end_location );
318
+			$end_location = isset($event['end_location']) ? $event['end_location'] : '';
319
+			$this->end_location = $this->esc_location($end_location);
320 320
 		}
321 321
 
322 322
 		/* ================== *
@@ -324,18 +324,18 @@  discard block
 block discarded – undo
324 324
 		 * ================== */
325 325
 
326 326
 		// Whole day event.
327
-		if ( ! empty( $event['whole_day'] ) ) {
328
-			$this->whole_day = true === $event['whole_day'] ? true: false;
327
+		if ( ! empty($event['whole_day'])) {
328
+			$this->whole_day = true === $event['whole_day'] ? true : false;
329 329
 		}
330 330
 
331 331
 		// Multi day event.
332
-		if ( ! empty( $event['multiple_days'] ) ) {
333
-			$this->multiple_days = max( absint( $event['multiple_days'] ), 1 );
332
+		if ( ! empty($event['multiple_days'])) {
333
+			$this->multiple_days = max(absint($event['multiple_days']), 1);
334 334
 		}
335 335
 
336 336
 		// Event recurrence.
337
-		if ( isset( $event['recurrence'] ) ) {
338
-			$this->recurrence = ! empty( $event['recurrence'] ) ? $event['recurrence'] : false;
337
+		if (isset($event['recurrence'])) {
338
+			$this->recurrence = ! empty($event['recurrence']) ? $event['recurrence'] : false;
339 339
 		}
340 340
 
341 341
 		/* ========== *
@@ -343,18 +343,18 @@  discard block
 block discarded – undo
343 343
 		 * ========== */
344 344
 
345 345
 		// Event has venue(s).
346
-		if ( $this->start_location['venue'] || $this->end_location['venue'] ) {
346
+		if ($this->start_location['venue'] || $this->end_location['venue']) {
347 347
 			$this->venue = true;
348 348
 		}
349 349
 
350 350
 		// Event meta.
351
-		if ( ! empty( $event['meta'] ) ) {
352
-			$this->meta = is_array( $event['meta'] ) ? $event['meta'] : array();
351
+		if ( ! empty($event['meta'])) {
352
+			$this->meta = is_array($event['meta']) ? $event['meta'] : array();
353 353
 		}
354 354
 
355 355
 		// Event template.
356
-		if ( ! empty( $event['template'] ) ) {
357
-			$this->template = wp_kses_post( $event['template'] );
356
+		if ( ! empty($event['template'])) {
357
+			$this->template = wp_kses_post($event['template']);
358 358
 		}
359 359
 
360 360
 	}
@@ -369,27 +369,27 @@  discard block
 block discarded – undo
369 369
 	 *
370 370
 	 * @return array
371 371
 	 */
372
-	private function esc_location( $var = '' ) {
372
+	private function esc_location($var = '') {
373 373
 
374 374
 		$location = array();
375 375
 
376
-		if ( is_string( $var ) ) {
376
+		if (is_string($var)) {
377 377
 			$var = array(
378 378
 				'name'    => $var,
379 379
 				'address' => $var,
380 380
 			);
381
-		} elseif ( is_bool( $var ) || is_null( $var ) ) {
381
+		} elseif (is_bool($var) || is_null($var)) {
382 382
 			$var = array();
383 383
 		} else {
384 384
 			$var = (array) $var;
385 385
 		}
386 386
 
387
-		$location['name']    = isset( $var['name'] )    ? esc_attr( strip_tags( $var['name'] ) ) : '';
388
-		$location['address'] = isset( $var['address'] ) ? esc_attr( strip_tags( $var['address'] ) ) : '';
389
-		$location['lat']     = isset( $var['lat'] )     ? $this->esc_coordinate( $var['lat'] ) : 0;
390
-		$location['lng']     = isset( $var['lng'] )     ? $this->esc_coordinate( $var['lng'] ) : 0;
387
+		$location['name']    = isset($var['name']) ? esc_attr(strip_tags($var['name'])) : '';
388
+		$location['address'] = isset($var['address']) ? esc_attr(strip_tags($var['address'])) : '';
389
+		$location['lat']     = isset($var['lat']) ? $this->esc_coordinate($var['lat']) : 0;
390
+		$location['lng']     = isset($var['lng']) ? $this->esc_coordinate($var['lng']) : 0;
391 391
 
392
-		if ( ! empty( $location['name'] ) || ! empty( $location['address'] ) ) {
392
+		if ( ! empty($location['name']) || ! empty($location['address'])) {
393 393
 			$location['venue'] = true;
394 394
 		} else {
395 395
 			$location['venue'] = false;
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @return int|float
410 410
 	 */
411
-	private function esc_coordinate( $latlng = 0 ) {
412
-		return is_numeric( $latlng ) ? floatval( $latlng ) : 0;
411
+	private function esc_coordinate($latlng = 0) {
412
+		return is_numeric($latlng) ? floatval($latlng) : 0;
413 413
 	}
414 414
 
415 415
 	/**
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 	 *
423 423
 	 * @return bool
424 424
 	 */
425
-	public function set_timezone( $tz ) {
426
-		if ( in_array( $tz, timezone_identifiers_list() ) ) {
425
+	public function set_timezone($tz) {
426
+		if (in_array($tz, timezone_identifiers_list())) {
427 427
 			$this->timezone = $tz;
428 428
 			return true;
429 429
 		}
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 	 * @return bool
450 450
 	 */
451 451
 	public function starts_today() {
452
-		return $this->start_dt->setTimezone( $this->timezone )->isToday();
452
+		return $this->start_dt->setTimezone($this->timezone)->isToday();
453 453
 	}
454 454
 
455 455
 	/**
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 * @return bool
461 461
 	 */
462 462
 	public function ends_today() {
463
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isToday() : true;
463
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isToday() : true;
464 464
 	}
465 465
 
466 466
 	/**
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 * @return bool
472 472
 	 */
473 473
 	public function starts_tomorrow() {
474
-		return $this->start_dt->setTimezone( $this->timezone )->isTomorrow();
474
+		return $this->start_dt->setTimezone($this->timezone)->isTomorrow();
475 475
 	}
476 476
 
477 477
 	/**
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	 * @return bool
483 483
 	 */
484 484
 	public function ends_tomorrow() {
485
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isTomorrow() : false;
485
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isTomorrow() : false;
486 486
 	}
487 487
 
488 488
 	/**
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	 * @return bool
494 494
 	 */
495 495
 	public function started_yesterday() {
496
-		return $this->start_dt->setTimezone( $this->timezone )->isYesterday();
496
+		return $this->start_dt->setTimezone($this->timezone)->isYesterday();
497 497
 	}
498 498
 
499 499
 	/**
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 * @return bool
505 505
 	 */
506 506
 	public function ended_yesterday() {
507
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isYesterday() : false;
507
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isYesterday() : false;
508 508
 	}
509 509
 
510 510
 	/**
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	 * @return bool
516 516
 	 */
517 517
 	public function starts_future() {
518
-		return $this->start_dt->setTimezone( $this->timezone )->isFuture();
518
+		return $this->start_dt->setTimezone($this->timezone)->isFuture();
519 519
 	}
520 520
 
521 521
 	/**
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 * @return bool
527 527
 	 */
528 528
 	public function ends_future() {
529
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isFuture() : false;
529
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isFuture() : false;
530 530
 	}
531 531
 
532 532
 	/**
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 	 * @return bool
538 538
 	 */
539 539
 	public function started_past() {
540
-		return $this->start_dt->setTimezone( $this->timezone )->isPast();
540
+		return $this->start_dt->setTimezone($this->timezone)->isPast();
541 541
 	}
542 542
 
543 543
 	/**
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	 * @return bool
549 549
 	 */
550 550
 	public function ended_past() {
551
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isPast() : false;
551
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isPast() : false;
552 552
 	}
553 553
 
554 554
 	/**
@@ -560,9 +560,9 @@  discard block
 block discarded – undo
560 560
 	 *
561 561
 	 * @return string
562 562
 	 */
563
-	public function get_color( $default = '' ) {
564
-		if ( isset( $this->meta['color'] ) ) {
565
-			return ! empty( $this->meta['color'] ) ? esc_attr( $this->meta['color'] ) : $default;
563
+	public function get_color($default = '') {
564
+		if (isset($this->meta['color'])) {
565
+			return ! empty($this->meta['color']) ? esc_attr($this->meta['color']) : $default;
566 566
 		}
567 567
 		return $default;
568 568
 	}
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	 * @return array
576 576
 	 */
577 577
 	public function get_attachments() {
578
-		return isset( $this->meta['attachments'] ) ? $this->meta['attachments'] : array();
578
+		return isset($this->meta['attachments']) ? $this->meta['attachments'] : array();
579 579
 	}
580 580
 
581 581
 	/**
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 	 * @return array
587 587
 	 */
588 588
 	public function get_attendees() {
589
-		return isset( $this->meta['attendees'] ) ? $this->meta['attendees'] : array();
589
+		return isset($this->meta['attendees']) ? $this->meta['attendees'] : array();
590 590
 	}
591 591
 
592 592
 	/**
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	 * @return array
598 598
 	 */
599 599
 	public function get_organizer() {
600
-		return isset( $this->meta['organizer'] ) ? $this->meta['organizer'] : array();
600
+		return isset($this->meta['organizer']) ? $this->meta['organizer'] : array();
601 601
 	}
602 602
 
603 603
 }
Please login to merge, or discard this patch.
includes/functions/admin.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Admin functions
4
- *
5
- * Functions for the admin back end components only.
6
- *
7
- * @package SimpleCalendar/Admin/Functions
8
- */
3
+	 * Admin functions
4
+	 *
5
+	 * Functions for the admin back end components only.
6
+	 *
7
+	 * @package SimpleCalendar/Admin/Functions
8
+	 */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11 11
 	exit;
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @package SimpleCalendar/Admin/Functions
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return null|\SimpleCalendar\Abstracts\Admin_Page
34 34
  */
35
-function simcal_get_admin_page( $page ) {
35
+function simcal_get_admin_page($page) {
36 36
 	$objects = \SimpleCalendar\plugin()->objects;
37
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_admin_page( $page ) : null;
37
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_admin_page($page) : null;
38 38
 }
39 39
 
40 40
 /**
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
  *
48 48
  * @return null|\SimpleCalendar\Abstracts\Field
49 49
  */
50
-function simcal_get_field( $args, $name = '' ) {
50
+function simcal_get_field($args, $name = '') {
51 51
 	$objects = \SimpleCalendar\plugin()->objects;
52
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_field( $args, $name ) : null;
52
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_field($args, $name) : null;
53 53
 }
54 54
 
55 55
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return void
64 64
  */
65
-function simcal_print_field( $args, $name = '' ) {
65
+function simcal_print_field($args, $name = '') {
66 66
 
67
-	$field = simcal_get_field( $args, $name );
67
+	$field = simcal_get_field($args, $name);
68 68
 
69
-	if ( $field instanceof \SimpleCalendar\Abstracts\Field ) {
69
+	if ($field instanceof \SimpleCalendar\Abstracts\Field) {
70 70
 		$field->html();
71 71
 	}
72 72
 }
@@ -84,33 +84,33 @@  discard block
 block discarded – undo
84 84
  *
85 85
  * @return array|string Sanitized variable
86 86
  */
87
-function simcal_sanitize_input( $var, $func = 'sanitize_text_field'  ) {
87
+function simcal_sanitize_input($var, $func = 'sanitize_text_field') {
88 88
 
89
-	if ( is_null( $var ) ) {
89
+	if (is_null($var)) {
90 90
 		return '';
91 91
 	}
92 92
 
93
-	if ( is_bool( $var ) ) {
94
-		if ( $var === true ) {
93
+	if (is_bool($var)) {
94
+		if ($var === true) {
95 95
 			return 'yes';
96 96
 		} else {
97 97
 			return 'no';
98 98
 		}
99 99
 	}
100 100
 
101
-	if ( is_string( $var ) || is_numeric( $var ) ) {
102
-		$func = is_string( $func ) && function_exists( $func ) ? $func : 'sanitize_text_field';
103
-		return call_user_func( $func, trim( strval( $var ) ) );
101
+	if (is_string($var) || is_numeric($var)) {
102
+		$func = is_string($func) && function_exists($func) ? $func : 'sanitize_text_field';
103
+		return call_user_func($func, trim(strval($var)));
104 104
 	}
105 105
 
106
-	if ( is_object( $var ) ) {
106
+	if (is_object($var)) {
107 107
 		$var = (array) $var;
108 108
 	}
109 109
 
110
-	if ( is_array( $var ) ) {
110
+	if (is_array($var)) {
111 111
 		$array = array();
112
-		foreach ( $var as $k => $v ) {
113
-			$array[ $k ] = simcal_sanitize_input( $v );
112
+		foreach ($var as $k => $v) {
113
+			$array[$k] = simcal_sanitize_input($v);
114 114
 		}
115 115
 		return $array;
116 116
 	}
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
  */
129 129
 function simcal_is_admin_screen() {
130 130
 
131
-	$view = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
131
+	$view = function_exists('get_current_screen') ? get_current_screen() : false;
132 132
 
133
-	if ( $view instanceof WP_Screen ) {
133
+	if ($view instanceof WP_Screen) {
134 134
 
135 135
 		// Screens used by this plugin.
136 136
 		$screens = array(
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'dashboard_page_simple-calendar_credits',
146 146
 			'dashboard_page_simple-calendar_translators',
147 147
 		);
148
-		if ( in_array( $view->id, $screens ) ) {
148
+		if (in_array($view->id, $screens)) {
149 149
 			return $view->id;
150 150
 		}
151 151
 	}
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
  *
165 165
  * @return \SimpleCalendar\Admin\Updater
166 166
  */
167
-function simcal_addon_updater( $_api_url, $_plugin_file, $_api_data = null ) {
168
-	return new \SimpleCalendar\Admin\Updater( $_api_url, $_plugin_file, $_api_data );
167
+function simcal_addon_updater($_api_url, $_plugin_file, $_api_data = null) {
168
+	return new \SimpleCalendar\Admin\Updater($_api_url, $_plugin_file, $_api_data);
169 169
 }
170 170
 
171 171
 /**
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return null|string
179 179
  */
180
-function simcal_get_license_key( $addon ) {
181
-	$licenses = get_option( 'simple-calendar_settings_licenses', array() );
182
-	if ( isset( $licenses['keys'][ $addon ] ) ) {
183
-		return empty( $licenses['keys'][ $addon ] ) ? null : $licenses['keys'][ $addon ];
180
+function simcal_get_license_key($addon) {
181
+	$licenses = get_option('simple-calendar_settings_licenses', array());
182
+	if (isset($licenses['keys'][$addon])) {
183
+		return empty($licenses['keys'][$addon]) ? null : $licenses['keys'][$addon];
184 184
 	}
185 185
 	return null;
186 186
 }
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
  *
197 197
  * @return array|string
198 198
  */
199
-function simcal_get_license_status( $addon = null ) {
200
-	$licenses = get_option( 'simple-calendar_licenses_status', array() );
201
-	return isset( $licenses[ $addon ] ) ? $licenses[ $addon ] : $licenses;
199
+function simcal_get_license_status($addon = null) {
200
+	$licenses = get_option('simple-calendar_licenses_status', array());
201
+	return isset($licenses[$addon]) ? $licenses[$addon] : $licenses;
202 202
 }
203 203
 
204 204
 /**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
  * @since 3.0.0
220 220
  */
221 221
 function simcal_delete_admin_notices() {
222
-	delete_option( 'simple-calendar_admin_notices' );
222
+	delete_option('simple-calendar_admin_notices');
223 223
 }
224 224
 
225 225
 /**
@@ -231,22 +231,22 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @return void
233 233
  */
234
-function simcal_print_shortcode_tip( $post_id ) {
234
+function simcal_print_shortcode_tip($post_id) {
235 235
 
236 236
 	$browser = new \Browser();
237
-	if ( $browser::PLATFORM_APPLE == $browser->getPlatform() ) {
237
+	if ($browser::PLATFORM_APPLE == $browser->getPlatform()) {
238 238
 		$cmd = '&#8984;&#43;C';
239 239
 	} else {
240 240
 		$cmd = 'Ctrl&#43;C';
241 241
 	}
242 242
 
243
-	$shortcut  = sprintf( __( 'Press %s to copy.', 'google-calendar-events' ), $cmd );
244
-	$shortcode = sprintf( '[calendar id="%s"]', $post_id );
243
+	$shortcut  = sprintf(__('Press %s to copy.', 'google-calendar-events'), $cmd);
244
+	$shortcode = sprintf('[calendar id="%s"]', $post_id);
245 245
 
246
-	echo "<input readonly='readonly' " .
247
-				"class='simcal-shortcode simcal-calendar-shortcode simcal-shortcode-tip' " .
248
-				"title='" . $shortcut . "' " .
249
-				"onclick='this.select();' value='" . $shortcode . "' />";
246
+	echo "<input readonly='readonly' ".
247
+				"class='simcal-shortcode simcal-calendar-shortcode simcal-shortcode-tip' ".
248
+				"title='".$shortcut."' ".
249
+				"onclick='this.select();' value='".$shortcode."' />";
250 250
 }
251 251
 
252 252
 /**
@@ -261,20 +261,20 @@  discard block
 block discarded – undo
261 261
  *
262 262
  * @return  string  $url        Full Google Analytics campaign URL
263 263
  */
264
-function simcal_ga_campaign_url( $base_url, $campaign, $content, $raw = false ) {
264
+function simcal_ga_campaign_url($base_url, $campaign, $content, $raw = false) {
265 265
 
266
-	$url = add_query_arg( array(
266
+	$url = add_query_arg(array(
267 267
 		'utm_source'   => 'inside-plugin',
268 268
 		'utm_medium'   => 'link',
269 269
 		'utm_campaign' => $campaign, // i.e. 'core-plugin', 'gcal-pro'
270 270
 		'utm_content'  => $content // i.e. 'sidebar-link', 'settings-link'
271
-	), $base_url );
271
+	), $base_url);
272 272
 
273
-	if ( $raw ) {
274
-		return esc_url_raw( $url );
273
+	if ($raw) {
274
+		return esc_url_raw($url);
275 275
 	}
276 276
 
277
-	return esc_url( $url );
277
+	return esc_url($url);
278 278
 }
279 279
 
280 280
 /**
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
  */
287 287
 function simcal_newsletter_signup() {
288 288
 
289
-	if ( $screen = simcal_is_admin_screen() ) {
289
+	if ($screen = simcal_is_admin_screen()) {
290 290
 
291 291
 		global $current_user;
292 292
 		get_currentuserinfo();
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 		<div id="simcal-drip" class="<?php echo $screen; ?>">
298 298
 			<div class="signup">
299 299
 				<p>
300
-					<?php _e( "Enter your name and email and we'll send you a coupon code for 20% off our Google Calendar Pro add-on.", 'google-calendar-events' ); ?>
300
+					<?php _e("Enter your name and email and we'll send you a coupon code for 20% off our Google Calendar Pro add-on.", 'google-calendar-events'); ?>
301 301
 				</p>
302 302
 
303 303
 				<p>
304
-					<label for="simcal-drip-field-email"><?php _e( 'Your Email', 'google-calendar-events' ); ?></label><br />
304
+					<label for="simcal-drip-field-email"><?php _e('Your Email', 'google-calendar-events'); ?></label><br />
305 305
 					<input type="email"
306 306
 					       id="simcal-drip-field-email"
307 307
 					       name="fields[email]"
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				</p>
310 310
 
311 311
 				<p>
312
-					<label for="simcal-drip-field-first_name"><?php _e( 'First Name', 'google-calendar-events' ); ?></label><br />
312
+					<label for="simcal-drip-field-first_name"><?php _e('First Name', 'google-calendar-events'); ?></label><br />
313 313
 					<input type="text"
314 314
 					       id="simcal-drip-field-first_name"
315 315
 					       name="fields[first_name]"
@@ -318,15 +318,15 @@  discard block
 block discarded – undo
318 318
 				<p class="textright">
319 319
 					<a href="#"
320 320
 					   id="simcal-drip-signup"
321
-					   class="button button-primary"><?php _e( 'Send me the coupon', 'google-calendar-events' ); ?></a>
321
+					   class="button button-primary"><?php _e('Send me the coupon', 'google-calendar-events'); ?></a>
322 322
 				</p>
323 323
 				<div class="textright">
324
-					<a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'gcal-pro' ), 'core-plugin', 'sidebar-link' ); ?>"
325
-					   target="_blank"><?php _e( 'Just take me to GCal Pro', 'google-calendar-events' ); ?></a>
324
+					<a href="<?php echo simcal_ga_campaign_url(simcal_get_url('gcal-pro'), 'core-plugin', 'sidebar-link'); ?>"
325
+					   target="_blank"><?php _e('Just take me to GCal Pro', 'google-calendar-events'); ?></a>
326 326
 				</div>
327 327
 			</div>
328 328
 			<div class="thank-you" style="display: none;">
329
-				<?php _e( 'Thank you!', 'google-calendar-events' ); ?>
329
+				<?php _e('Thank you!', 'google-calendar-events'); ?>
330 330
 			</div>
331 331
 			<div class="clear">
332 332
 			</div>
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
 }
339 339
 
340
-if ( ! function_exists( 'mb_detect_encoding' ) ) {
340
+if ( ! function_exists('mb_detect_encoding')) {
341 341
 
342 342
 	/**
343 343
 	 * Fallback function for `mb_detect_encoding()`,
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @return bool
353 353
 	 */
354
-	function mb_detect_encoding( $string, $enc = null, $ret = null ) {
354
+	function mb_detect_encoding($string, $enc = null, $ret = null) {
355 355
 
356 356
 		static $enclist = array(
357 357
 			'UTF-8',
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
 
378 378
 		$result = false;
379 379
 
380
-		foreach ( $enclist as $item ) {
381
-			$sample = iconv( $item, $item, $string );
382
-			if ( md5( $sample ) == md5( $string ) ) {
383
-				if ( $ret === null ) {
380
+		foreach ($enclist as $item) {
381
+			$sample = iconv($item, $item, $string);
382
+			if (md5($sample) == md5($string)) {
383
+				if ($ret === null) {
384 384
 					$result = $item;
385 385
 				} else {
386 386
 					$result = true;
Please login to merge, or discard this patch.