Completed
Push — master ( f805dd...62b222 )
by
unknown
03:34
created
includes/abstracts/feed.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use Carbon\Carbon;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -132,22 +132,22 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @param string|Calendar $calendar
134 134
 	 */
135
-	public function __construct( $calendar = '' ) {
135
+	public function __construct($calendar = '') {
136 136
 
137
-		if ( $calendar instanceof Calendar ) {
137
+		if ($calendar instanceof Calendar) {
138 138
 
139
-			if ( isset( $calendar->id ) ) {
139
+			if (isset($calendar->id)) {
140 140
 				$this->post_id = $calendar->id;
141 141
 			}
142
-			if ( isset( $calendar->start ) ) {
142
+			if (isset($calendar->start)) {
143 143
 				$this->calendar_start = $calendar->start;
144 144
 			}
145
-			$this->week_starts      = isset( $calendar->week_starts ) ? $calendar->week_starts : get_option( 'start_of_week' );
146
-			$this->events_template  = ! empty( $calendar->events_template ) ? $calendar->events_template : simcal_default_event_template();
145
+			$this->week_starts      = isset($calendar->week_starts) ? $calendar->week_starts : get_option('start_of_week');
146
+			$this->events_template  = ! empty($calendar->events_template) ? $calendar->events_template : simcal_default_event_template();
147 147
 
148
-			if ( $this->post_id > 0 ) {
148
+			if ($this->post_id > 0) {
149 149
 				$this->set_cache();
150
-				$this->timezone_setting = get_post_meta( $this->post_id, '_feed_timezone_setting', true );
150
+				$this->timezone_setting = get_post_meta($this->post_id, '_feed_timezone_setting', true);
151 151
 				$this->timezone = $calendar->timezone;
152 152
 				$this->set_earliest_event();
153 153
 				$this->set_latest_event();
@@ -173,25 +173,25 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @param int $timestamp
175 175
 	 */
176
-	public function set_earliest_event( $timestamp = 0 ) {
176
+	public function set_earliest_event($timestamp = 0) {
177 177
 
178
-		$earliest = intval( $timestamp );
178
+		$earliest = intval($timestamp);
179 179
 
180
-		if ( $earliest === 0 ) {
180
+		if ($earliest === 0) {
181 181
 
182
-			$start = Carbon::createFromTimestamp( $this->calendar_start, $this->timezone );
182
+			$start = Carbon::createFromTimestamp($this->calendar_start, $this->timezone);
183 183
 
184
-			$earliest_date  = esc_attr( get_post_meta( $this->post_id, '_feed_earliest_event_date', true ) );
185
-			$earliest_range = max( absint( get_post_meta( $this->post_id, '_feed_earliest_event_date_range', true ) ), 1 );
184
+			$earliest_date  = esc_attr(get_post_meta($this->post_id, '_feed_earliest_event_date', true));
185
+			$earliest_range = max(absint(get_post_meta($this->post_id, '_feed_earliest_event_date_range', true)), 1);
186 186
 
187
-			if ( 'days_before' == $earliest_date ) {
188
-				$earliest = $start->subDays( $earliest_range )->getTimestamp();
189
-			} elseif ( 'weeks_before' == $earliest_date ) {
190
-				$earliest = $start->subWeeks( $earliest_range )->addDay()->getTimestamp();
191
-			} elseif ( 'months_before' == $earliest_date ) {
192
-				$earliest = $start->subMonths( $earliest_range )->addDay()->getTimestamp();
193
-			} elseif ( 'years_before' == $earliest_date ) {
194
-				$earliest = $start->subYears( $earliest_range )->addDay()->getTimestamp();
187
+			if ('days_before' == $earliest_date) {
188
+				$earliest = $start->subDays($earliest_range)->getTimestamp();
189
+			} elseif ('weeks_before' == $earliest_date) {
190
+				$earliest = $start->subWeeks($earliest_range)->addDay()->getTimestamp();
191
+			} elseif ('months_before' == $earliest_date) {
192
+				$earliest = $start->subMonths($earliest_range)->addDay()->getTimestamp();
193
+			} elseif ('years_before' == $earliest_date) {
194
+				$earliest = $start->subYears($earliest_range)->addDay()->getTimestamp();
195 195
 			} else {
196 196
 				$earliest = $start->getTimestamp();
197 197
 			}
@@ -207,25 +207,25 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param int $timestamp
209 209
 	 */
210
-	public function set_latest_event( $timestamp = 0 ) {
210
+	public function set_latest_event($timestamp = 0) {
211 211
 
212
-		$latest = intval( $timestamp );
212
+		$latest = intval($timestamp);
213 213
 
214
-		if ( $latest === 0 ) {
214
+		if ($latest === 0) {
215 215
 
216
-			$start = Carbon::createFromTimestamp( $this->calendar_start, $this->timezone )->endOfDay();
216
+			$start = Carbon::createFromTimestamp($this->calendar_start, $this->timezone)->endOfDay();
217 217
 
218
-			$latest_date  = esc_attr( get_post_meta( $this->post_id, '_feed_latest_event_date', true ) );
219
-			$latest_range = max( absint( get_post_meta( $this->post_id, '_feed_latest_event_date_range', true ) ), 1 );
218
+			$latest_date  = esc_attr(get_post_meta($this->post_id, '_feed_latest_event_date', true));
219
+			$latest_range = max(absint(get_post_meta($this->post_id, '_feed_latest_event_date_range', true)), 1);
220 220
 
221
-			if ( 'days_after' == $latest_date ) {
222
-				$latest = $start->addDays( $latest_range )->getTimestamp();
223
-			} elseif ( 'weeks_after' == $latest_date ) {
224
-				$latest = $start->addWeeks( $latest_range )->subDay()->getTimestamp();
225
-			} elseif ( 'months_after' == $latest_date ) {
226
-				$latest = $start->addMonths( $latest_range )->subDay()->getTimestamp();
227
-			} elseif ( 'years_after' == $latest_date ) {
228
-				$latest = $start->addYears( $latest_range )->subDay()->getTimestamp();
221
+			if ('days_after' == $latest_date) {
222
+				$latest = $start->addDays($latest_range)->getTimestamp();
223
+			} elseif ('weeks_after' == $latest_date) {
224
+				$latest = $start->addWeeks($latest_range)->subDay()->getTimestamp();
225
+			} elseif ('months_after' == $latest_date) {
226
+				$latest = $start->addMonths($latest_range)->subDay()->getTimestamp();
227
+			} elseif ('years_after' == $latest_date) {
228
+				$latest = $start->addYears($latest_range)->subDay()->getTimestamp();
229 229
 			} else {
230 230
 				$latest = $start->getTimestamp();
231 231
 			}
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @param int $time
244 244
 	 */
245
-	public function set_cache( $time = 0 ) {
246
-		if ( $time === 0 || ! is_numeric( $time ) ) {
247
-			$cache = get_post_meta( $this->post_id, '_feed_cache', true );
248
-			$time  = is_numeric( $cache ) && $cache >= 0 ? absint( $cache ) : $this->cache;
245
+	public function set_cache($time = 0) {
246
+		if ($time === 0 || ! is_numeric($time)) {
247
+			$cache = get_post_meta($this->post_id, '_feed_cache', true);
248
+			$time  = is_numeric($cache) && $cache >= 0 ? absint($cache) : $this->cache;
249 249
 		}
250
-		$this->cache = absint( $time );
250
+		$this->cache = absint($time);
251 251
 	}
252 252
 
253 253
 	/**
Please login to merge, or discard this patch.
includes/update.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @param string $version (optional) Current plugin version, defaults to value in plugin constant.
65 65
 	 */
66
-	public function __construct( $version = SIMPLE_CALENDAR_VERSION ) {
66
+	public function __construct($version = SIMPLE_CALENDAR_VERSION) {
67 67
 		// Look for previous version in current or legacy option, null for fresh install.
68
-		$installed = get_option( 'simple-calendar_version', null );
69
-		$this->installed_ver = is_null( $installed ) ? get_option( 'gce_version', null ) : $installed;
68
+		$installed = get_option('simple-calendar_version', null);
69
+		$this->installed_ver = is_null($installed) ? get_option('gce_version', null) : $installed;
70 70
 		$this->new_ver = $version;
71 71
 
72
-		if ( version_compare( $this->installed_ver, $this->new_ver, '<' ) ) {
72
+		if (version_compare($this->installed_ver, $this->new_ver, '<')) {
73 73
 			$this->run_updates();
74 74
 		}
75 75
 	}
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function run_updates() {
85 85
 
86
-		do_action( 'simcal_before_update', $this->installed_ver );
86
+		do_action('simcal_before_update', $this->installed_ver);
87 87
 
88
-		if ( ! is_null( $this->installed_ver ) ) {
88
+		if ( ! is_null($this->installed_ver)) {
89 89
 
90
-			if ( version_compare( $this->installed_ver, $this->new_ver ) === -1 ) {
90
+			if (version_compare($this->installed_ver, $this->new_ver) === -1) {
91 91
 
92
-				$post_type = version_compare( $this->installed_ver, '3.0.0' ) === -1 ? 'gce_feed' : 'calendar';
93
-				$this->posts = $this->get_posts( $post_type );
92
+				$post_type = version_compare($this->installed_ver, '3.0.0') === -1 ? 'gce_feed' : 'calendar';
93
+				$this->posts = $this->get_posts($post_type);
94 94
 
95
-				foreach ( $this->update_path as $update_to ) {
96
-					if ( version_compare( $this->installed_ver, $update_to, '<' ) ) {
97
-						$this->update( $update_to );
95
+				foreach ($this->update_path as $update_to) {
96
+					if (version_compare($this->installed_ver, $update_to, '<')) {
97
+						$this->update($update_to);
98 98
 					}
99 99
 				}
100 100
 
@@ -109,28 +109,28 @@  discard block
 block discarded – undo
109 109
 
110 110
 		}
111 111
 
112
-		do_action( 'simcal_updated', $this->new_ver );
112
+		do_action('simcal_updated', $this->new_ver);
113 113
 
114 114
 		// Redirect to a welcome page if new install or major update.
115
-		if ( is_null( $this->installed_ver ) ) {
116
-			set_transient( '_simple-calendar_activation_redirect', 'fresh', 60 );
115
+		if (is_null($this->installed_ver)) {
116
+			set_transient('_simple-calendar_activation_redirect', 'fresh', 60);
117 117
 		} else {
118
-			$major_new = substr( $this->new_ver, 0, strrpos( $this->new_ver, '.' ) );
119
-			$major_old = substr( $this->installed_ver, 0, strrpos( $this->installed_ver, '.' ) );
120
-			if ( version_compare( $major_new, $major_old, '>' ) ) {
121
-				set_transient( '_simple-calendar_activation_redirect', 'update', 60 );
122
-			} elseif ( $major_old == $major_new ) {
123
-				$version = explode( '.', $this->new_ver );
124
-				end( $version );
125
-				if ( 0 === intval( current( $version ) ) ) {
126
-					set_transient( '_simple-calendar_activation_redirect', 'update', 60 );
118
+			$major_new = substr($this->new_ver, 0, strrpos($this->new_ver, '.'));
119
+			$major_old = substr($this->installed_ver, 0, strrpos($this->installed_ver, '.'));
120
+			if (version_compare($major_new, $major_old, '>')) {
121
+				set_transient('_simple-calendar_activation_redirect', 'update', 60);
122
+			} elseif ($major_old == $major_new) {
123
+				$version = explode('.', $this->new_ver);
124
+				end($version);
125
+				if (0 === intval(current($version))) {
126
+					set_transient('_simple-calendar_activation_redirect', 'update', 60);
127 127
 				}
128 128
 			}
129 129
 		}
130 130
 
131 131
 		$this->admin_redirects();
132 132
 
133
-		update_option( 'simple-calendar_version', $this->new_ver );
133
+		update_option('simple-calendar_version', $this->new_ver);
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,25 +142,25 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public function admin_redirects() {
144 144
 
145
-		$transient = get_transient( '_simple-calendar_activation_redirect' );
145
+		$transient = get_transient('_simple-calendar_activation_redirect');
146 146
 
147
-		if ( ! $transient || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) {
147
+		if ( ! $transient || is_network_admin() || isset($_GET['activate-multi']) || ! current_user_can('manage_options')) {
148 148
 			return;
149 149
 		}
150 150
 
151
-		delete_transient( '_simple-calendar_activation_redirect' );
151
+		delete_transient('_simple-calendar_activation_redirect');
152 152
 
153 153
 		// Do not redirect if already on welcome page screen.
154
-		if ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'simple-calendar_about' ) ) ) {
154
+		if ( ! empty($_GET['page']) && in_array($_GET['page'], array('simple-calendar_about'))) {
155 155
 			return;
156 156
 		}
157 157
 
158 158
 		$url = add_query_arg(
159 159
 				'simcal_install',
160
-				esc_attr( $transient ),
161
-				admin_url( 'index.php?page=simple-calendar_about' )
160
+				esc_attr($transient),
161
+				admin_url('index.php?page=simple-calendar_about')
162 162
 		);
163
-		wp_safe_redirect( $url );
163
+		wp_safe_redirect($url);
164 164
 		exit;
165 165
 	}
166 166
 
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @return array
175 175
 	 */
176
-	private function get_posts( $post_type ) {
176
+	private function get_posts($post_type) {
177 177
 
178 178
 		$posts = array();
179 179
 
180
-		if ( ! empty( $post_type ) ) {
180
+		if ( ! empty($post_type)) {
181 181
 
182 182
 			// https://core.trac.wordpress.org/ticket/18408
183
-			$posts = get_posts( array(
183
+			$posts = get_posts(array(
184 184
 				'post_type'   => $post_type,
185 185
 				'post_status' => array(
186 186
 					'draft',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 					'trash',
192 192
 				),
193 193
 				'nopaging'    => true,
194
-			) );
194
+			));
195 195
 
196 196
 			wp_reset_postdata();
197 197
 		}
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @param string $version
210 210
 	 */
211
-	private function update( $version ) {
211
+	private function update($version) {
212 212
 
213
-		$update_v = '\\' . __NAMESPACE__ . '\Updates\\Update_V' . str_replace( '.', '', $version );
213
+		$update_v = '\\'.__NAMESPACE__.'\Updates\\Update_V'.str_replace('.', '', $version);
214 214
 
215
-		if ( class_exists( $update_v ) ) {
216
-			new $update_v( $this->posts );
215
+		if (class_exists($update_v)) {
216
+			new $update_v($this->posts);
217 217
 		}
218 218
 	}
219 219
 
Please login to merge, or discard this patch.
includes/updates/update-v3013.php 2 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -6,9 +6,6 @@
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Updates;
8 8
 
9
-use Carbon\Carbon;
10
-use SimpleCalendar\Post_Types;
11
-
12 9
 if ( ! defined( 'ABSPATH' ) ) {
13 10
 	exit;
14 11
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Carbon\Carbon;
10 10
 use SimpleCalendar\Post_Types;
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param array $posts
25 25
 	 */
26
-	public function __construct( $posts ) {
26
+	public function __construct($posts) {
27 27
 
28 28
 		$this->update_options();
29 29
 	}
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function update_options() {
36 36
 
37
-		$settings_advanced = get_option( 'simple-calendar_settings_advanced' );
37
+		$settings_advanced = get_option('simple-calendar_settings_advanced');
38 38
 		
39 39
 		// Remove stored always_enqueue value
40
-		if ( isset( $settings_advanced['assets']['always_enqueue'] ) ) {
41
-			unset( $settings_advanced['assets']['always_enqueue'] );
40
+		if (isset($settings_advanced['assets']['always_enqueue'])) {
41
+			unset($settings_advanced['assets']['always_enqueue']);
42 42
 		}
43 43
 
44 44
 		// Remove stored disable_js value
45
-		if ( isset( $settings_advanced['assets']['disable_js'] ) ) {
46
-			unset( $settings_advanced['assets']['disable_js'] );
45
+		if (isset($settings_advanced['assets']['disable_js'])) {
46
+			unset($settings_advanced['assets']['disable_js']);
47 47
 		}
48 48
 
49
-		update_option( 'simple-calendar_settings_advanced', $settings_advanced );
49
+		update_option('simple-calendar_settings_advanced', $settings_advanced);
50 50
 
51 51
 		// Delete legacy options.
52
-		delete_option( 'simple-calendar_defaults' );
52
+		delete_option('simple-calendar_defaults');
53 53
 	}
54 54
 
55 55
 }
Please login to merge, or discard this patch.
includes/calendars/admin/default-calendar-admin.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -298,8 +298,8 @@
 block discarded – undo
298 298
 						'name'    => '_default_calendar_expand_multi_day_events',
299 299
 						'id'      => '_default_calendar_expand_multi_day_events',
300 300
 						'tooltip' => __( 'For events spanning multiple days, you can display them on each day of the event, ' .
301
-						                 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
302
-						                 'Third option applies to list views only.', 'google-calendar-events' ),
301
+										 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
302
+										 'Third option applies to list views only.', 'google-calendar-events' ),
303 303
 						'value'   => $multi_day_value,
304 304
 						'options' => array(
305 305
 							'yes'              => __( 'Yes, display on all days of event', 'google-calendar-events' ),
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Calendars\Admin;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		if ( simcal_is_admin_screen() !== false ) {
28
-			add_action( 'simcal_settings_meta_calendar_panel', array( $this, 'add_settings_meta_calendar_panel' ), 10, 1 );
27
+		if (simcal_is_admin_screen() !== false) {
28
+			add_action('simcal_settings_meta_calendar_panel', array($this, 'add_settings_meta_calendar_panel'), 10, 1);
29 29
 		}
30
-		add_action( 'simcal_process_settings_meta', array( $this, 'process_meta' ), 10, 1 );
30
+		add_action('simcal_process_settings_meta', array($this, 'process_meta'), 10, 1);
31 31
 	}
32 32
 
33 33
 	/**
@@ -76,47 +76,47 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param int $post_id
78 78
 	 */
79
-	public function add_settings_meta_calendar_panel( $post_id ) {
79
+	public function add_settings_meta_calendar_panel($post_id) {
80 80
 
81 81
 		?>
82 82
 		<table id="default-calendar-settings">
83 83
 			<thead>
84
-			<tr><th colspan="2"><?php _e( 'Default Calendar', 'google-calendar-events' ); ?></th></tr>
84
+			<tr><th colspan="2"><?php _e('Default Calendar', 'google-calendar-events'); ?></th></tr>
85 85
 			</thead>
86 86
 			<tbody class="simcal-panel-section">
87 87
 
88 88
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
89
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Event Bubbles', 'google-calendar-events' ); ?></label></th>
89
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Event Bubbles', 'google-calendar-events'); ?></label></th>
90 90
 				<td>
91 91
 					<?php
92 92
 
93
-					$bubbles = get_post_meta( $post_id, '_default_calendar_event_bubble_trigger', true );
93
+					$bubbles = get_post_meta($post_id, '_default_calendar_event_bubble_trigger', true);
94 94
 
95
-					simcal_print_field( array(
95
+					simcal_print_field(array(
96 96
 						'type'    => 'radio',
97 97
 						'inline'  => 'inline',
98 98
 						'name'    => '_default_calendar_event_bubble_trigger',
99 99
 						'id'      => '_default_calendar_event_bubble_trigger',
100
-						'tooltip' => __( 'Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events' ),
100
+						'tooltip' => __('Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events'),
101 101
 						'value'   => $bubbles ? $bubbles : 'hover',
102 102
 						'default' => 'hover',
103 103
 						'options' => array(
104
-							'click' => __( 'Click', 'google-calendar-events' ),
105
-							'hover' => __( 'Hover', 'google-calendar-events' ),
104
+							'click' => __('Click', 'google-calendar-events'),
105
+							'hover' => __('Hover', 'google-calendar-events'),
106 106
 						),
107
-					) );
107
+					));
108 108
 
109 109
 					?>
110 110
 				</td>
111 111
 			</tr>
112 112
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
113
-				<th><label for="_default_calendar_trim_titles"><?php _e( 'Trim Event Titles', 'google-calendar-events' ); ?></label></th>
113
+				<th><label for="_default_calendar_trim_titles"><?php _e('Trim Event Titles', 'google-calendar-events'); ?></label></th>
114 114
 				<td>
115 115
 					<?php
116 116
 
117
-					$trim = get_post_meta( $post_id, '_default_calendar_trim_titles', true );
117
+					$trim = get_post_meta($post_id, '_default_calendar_trim_titles', true);
118 118
 
119
-					simcal_print_field( array(
119
+					simcal_print_field(array(
120 120
 						'type'        => 'checkbox',
121 121
 						'name'        => '_default_calendar_trim_titles',
122 122
 						'id'          => '_default_calendar_trim_titles',
@@ -127,34 +127,34 @@  discard block
 block discarded – undo
127 127
 						'attributes'  => array(
128 128
 							'data-show-next-if-value' => 'yes',
129 129
 						),
130
-					) );
130
+					));
131 131
 
132
-					simcal_print_field( array(
132
+					simcal_print_field(array(
133 133
 						'type'       => 'standard',
134 134
 						'subtype'    => 'number',
135 135
 						'name'       => '_default_calendar_trim_titles_chars',
136 136
 						'id'         => '_default_calendar_trim_titles_chars',
137
-						'tooltip'    => __( 'Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events' ),
137
+						'tooltip'    => __('Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events'),
138 138
 						'class'      => array(
139 139
 							'simcal-field-tiny',
140 140
 						),
141
-						'value'      => 'yes' == $trim ? strval( max( absint( get_post_meta( $post_id, '_default_calendar_trim_titles_chars', true ) ), 1 ) ) : '20',
141
+						'value'      => 'yes' == $trim ? strval(max(absint(get_post_meta($post_id, '_default_calendar_trim_titles_chars', true)), 1)) : '20',
142 142
 						'attributes' => array(
143 143
 							'min'     => '1',
144 144
 						),
145
-					) );
145
+					));
146 146
 
147 147
 					?>
148 148
 				</td>
149 149
 			</tr>
150 150
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
151
-				<th><label for="_default_calendar_list_grouped_span"><?php _e( 'Span', 'google-calendar-events' ); ?></label></th>
151
+				<th><label for="_default_calendar_list_grouped_span"><?php _e('Span', 'google-calendar-events'); ?></label></th>
152 152
 				<td>
153 153
 					<?php
154 154
 
155
-					$list_span = max( absint( get_post_meta( $post_id, '_default_calendar_list_range_span', true ) ), 1 );
155
+					$list_span = max(absint(get_post_meta($post_id, '_default_calendar_list_range_span', true)), 1);
156 156
 
157
-					simcal_print_field( array(
157
+					simcal_print_field(array(
158 158
 						'type'    => 'standard',
159 159
 						'subtype' => 'number',
160 160
 						'name'    => '_default_calendar_list_range_span',
@@ -163,78 +163,78 @@  discard block
 block discarded – undo
163 163
 							'simcal-field-tiny',
164 164
 							'simcal-field-inline',
165 165
 						),
166
-						'value'   => strval( $list_span ),
166
+						'value'   => strval($list_span),
167 167
 						'attributes'  => array(
168 168
 							'min' => '1',
169 169
 						),
170
-					) );
170
+					));
171 171
 
172
-					$list_type = get_post_meta( $post_id, '_default_calendar_list_range_type', true );
172
+					$list_type = get_post_meta($post_id, '_default_calendar_list_range_type', true);
173 173
 
174
-					simcal_print_field( array(
174
+					simcal_print_field(array(
175 175
 						'type'    => 'select',
176 176
 						'name'    => '_default_calendar_list_range_type',
177 177
 						'id'      => '_default_calendar_list_range_type',
178
-						'tooltip' => __( 'Range of events to show on each calendar page.', 'google-calendar-events' ),
178
+						'tooltip' => __('Range of events to show on each calendar page.', 'google-calendar-events'),
179 179
 						'class'   => array(
180 180
 							'simcal-field-inline',
181 181
 						),
182 182
 						'value'   => $list_type,
183 183
 						'options' => array(
184
-							'monthly' => __( 'Month(s)', 'google-calendar-events' ),
185
-							'weekly'  => __( 'Week(s)', 'google-calendar-events' ),
186
-							'daily'   => __( 'Day(s)', 'google-calendar-events' ),
187
-							'events'  => __( 'Event(s)', 'google-calendar-events' ),
184
+							'monthly' => __('Month(s)', 'google-calendar-events'),
185
+							'weekly'  => __('Week(s)', 'google-calendar-events'),
186
+							'daily'   => __('Day(s)', 'google-calendar-events'),
187
+							'events'  => __('Event(s)', 'google-calendar-events'),
188 188
 						),
189
-					) );
189
+					));
190 190
 
191 191
 					?>
192 192
 				</td>
193 193
 			</tr>
194 194
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
195
-				<th><label for="_default_calendar_list_header"><?php _e( 'Hide Header', 'google-calendar-events' ); ?></label></th>
195
+				<th><label for="_default_calendar_list_header"><?php _e('Hide Header', 'google-calendar-events'); ?></label></th>
196 196
 				<td>
197 197
 					<?php
198 198
 
199
-					$header = get_post_meta( $post_id, '_default_calendar_list_header', true );
199
+					$header = get_post_meta($post_id, '_default_calendar_list_header', true);
200 200
 
201
-					simcal_print_field( array(
201
+					simcal_print_field(array(
202 202
 						'type'    => 'checkbox',
203 203
 						'name'    => '_default_calendar_list_header',
204 204
 						'id'      => '_default_calendar_list_header',
205
-						'tooltip' => __( 'You can use this to hide the month header for this calendar.', 'google-calendar-events' ),
205
+						'tooltip' => __('You can use this to hide the month header for this calendar.', 'google-calendar-events'),
206 206
 						'value'   => 'yes' == $header ? 'yes' : 'no',
207
-					) );
207
+					));
208 208
 
209 209
 					?>
210 210
 				</td>
211 211
 			</tr>
212 212
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
213
-				<th><label for="_default_calendar_compact_list"><?php _e( 'Compact List', 'google-calendar-events' ); ?></label></th>
213
+				<th><label for="_default_calendar_compact_list"><?php _e('Compact List', 'google-calendar-events'); ?></label></th>
214 214
 				<td>
215 215
 					<?php
216 216
 
217
-					$compact = get_post_meta( $post_id, '_default_calendar_compact_list', true );
217
+					$compact = get_post_meta($post_id, '_default_calendar_compact_list', true);
218 218
 
219
-					simcal_print_field( array(
219
+					simcal_print_field(array(
220 220
 						'type'    => 'checkbox',
221 221
 						'name'    => '_default_calendar_compact_list',
222 222
 						'id'      => '_default_calendar_compact_list',
223
-						'tooltip' => __( 'Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events' ),
223
+						'tooltip' => __('Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events'),
224 224
 						'value'   => 'yes' == $compact ? 'yes' : 'no',
225
-					) );
225
+					));
226 226
 
227 227
 					?>
228 228
 				</td>
229 229
 			</tr>
230 230
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list"  style="display: none;">
231
-				<th><label for="_default_calendar_limit_visible_events"><?php _e( 'Limit Visible Events', 'google-calendar-events' ); ?></label></th>
231
+				<th><label for="_default_calendar_limit_visible_events"><?php _e('Limit Visible Events', 'google-calendar-events'); ?></label></th>
232 232
 				<td>
233 233
 					<?php
234 234
 
235
-					$limit = get_post_meta( $post_id, '_default_calendar_limit_visible_events', true );
235
+					$limit = get_post_meta($post_id, '_default_calendar_limit_visible_events', true);
236 236
 
237
-					simcal_print_field( array(
237
+					simcal_print_field(array(
238 238
 						'type'        => 'checkbox',
239 239
 						'name'        => '_default_calendar_limit_visible_events',
240 240
 						'id'          => '_default_calendar_limit_visible_events',
@@ -245,17 +245,17 @@  discard block
 block discarded – undo
245 245
 						'attributes'  => array(
246 246
 							'data-show-next-if-value' => 'yes',
247 247
 						)
248
-					) );
248
+					));
249 249
 
250
-					$visible_events = absint( get_post_meta( $post_id, '_default_calendar_visible_events', true ) );
250
+					$visible_events = absint(get_post_meta($post_id, '_default_calendar_visible_events', true));
251 251
 					$visible_events = $visible_events > 0 ? $visible_events : 3;
252 252
 
253
-					simcal_print_field( array(
253
+					simcal_print_field(array(
254 254
 						'type'       => 'standard',
255 255
 						'subtype'    => 'number',
256 256
 						'name'       => '_default_calendar_visible_events',
257 257
 						'id'         => '_default_calendar_visible_events',
258
-						'tooltip'    => __( 'Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events' ),
258
+						'tooltip'    => __('Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events'),
259 259
 						'class'      => array(
260 260
 							'simcal-field-tiny',
261 261
 						),
@@ -263,39 +263,39 @@  discard block
 block discarded – undo
263 263
 						'attributes' => array(
264 264
 							'min'     => '1',
265 265
 						)
266
-					) );
266
+					));
267 267
 
268 268
 					?>
269 269
 				</td>
270 270
 			</tr>
271 271
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
272
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Expand Multi-day Events', 'google-calendar-events' ); ?></label></th>
272
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Expand Multi-day Events', 'google-calendar-events'); ?></label></th>
273 273
 				<td>
274 274
 					<?php
275 275
 
276
-					$post_meta = get_post_meta( $post_id );
276
+					$post_meta = get_post_meta($post_id);
277 277
 
278
-					if ( ! is_array( $post_meta ) && ! empty( $post_meta ) ) {
278
+					if ( ! is_array($post_meta) && ! empty($post_meta)) {
279 279
 						$multi_day_value = 'current_day_only';
280 280
 					} else {
281
-						$multi_day_value = get_post_meta( $post_id, '_default_calendar_expand_multi_day_events', true );
281
+						$multi_day_value = get_post_meta($post_id, '_default_calendar_expand_multi_day_events', true);
282 282
 					}
283 283
 
284
-					simcal_print_field( array(
284
+					simcal_print_field(array(
285 285
 						'type'    => 'select',
286 286
 						'name'    => '_default_calendar_expand_multi_day_events',
287 287
 						'id'      => '_default_calendar_expand_multi_day_events',
288
-						'tooltip' => __( 'For events spanning multiple days, you can display them on each day of the event, ' .
289
-						                 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
290
-						                 'Third option applies to list views only.', 'google-calendar-events' ),
288
+						'tooltip' => __('For events spanning multiple days, you can display them on each day of the event, '.
289
+						                 'only on the first day of the event, or on all days of the event, but only up to the current day. '.
290
+						                 'Third option applies to list views only.', 'google-calendar-events'),
291 291
 						'value'   => $multi_day_value,
292 292
 						'options' => array(
293
-							'yes'              => __( 'Yes, display on all days of event', 'google-calendar-events' ),
294
-							'no'               => __( 'No, display only on first day of event', 'google-calendar-events' ),
295
-							'current_day_only' => __( 'No, display on all days of event up to current day (list view only)', 'google-calendar-events' ),
293
+							'yes'              => __('Yes, display on all days of event', 'google-calendar-events'),
294
+							'no'               => __('No, display only on first day of event', 'google-calendar-events'),
295
+							'current_day_only' => __('No, display on all days of event up to current day (list view only)', 'google-calendar-events'),
296 296
 						),
297 297
 						'default' => 'current_day_only',
298
-					) );
298
+					));
299 299
 
300 300
 					?>
301 301
 				</td>
@@ -303,72 +303,72 @@  discard block
 block discarded – undo
303 303
 			</tbody>
304 304
 			<?php
305 305
 
306
-			$settings                   = get_option( 'simple-calendar_settings_calendars' );
307
-			$default_theme              = isset( $settings['default-calendar']['theme'] ) ? $settings['default-calendar']['theme'] : 'light';
306
+			$settings                   = get_option('simple-calendar_settings_calendars');
307
+			$default_theme              = isset($settings['default-calendar']['theme']) ? $settings['default-calendar']['theme'] : 'light';
308 308
 			$default_today_color        = /*isset( $settings['default-calendar']['today_color'] ) ? $settings['default-calendar']['today_color'] :*/ '#1e73be';
309 309
 			$default_days_events_color  = /*isset( $settings['default-calendar']['days_events_color'] ) ? $settings['default-calendar']['days_events_color'] :*/ '#000000';
310 310
 
311 311
 			?>
312 312
 			<tbody class="simcal-panel-section">
313 313
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
314
-				<th><label for="_default_calendar_style_theme"><?php _e( 'Theme', 'google-calendar-events' ); ?></label></th>
314
+				<th><label for="_default_calendar_style_theme"><?php _e('Theme', 'google-calendar-events'); ?></label></th>
315 315
 				<td>
316 316
 					<?php
317 317
 
318
-					$saved = get_post_meta( $post_id, '_default_calendar_style_theme', true );
318
+					$saved = get_post_meta($post_id, '_default_calendar_style_theme', true);
319 319
 					$value = ! $saved ? $default_theme : $saved;
320 320
 
321
-					simcal_print_field( array(
321
+					simcal_print_field(array(
322 322
 						'type'    => 'select',
323 323
 						'name'    => '_default_calendar_style_theme',
324 324
 						'id'      => '_default_calendar_style_theme',
325 325
 						'value'   => $value,
326
-						'tooltip' => __( 'Choose a calendar theme to match your site theme.', 'google-calendar-events' ),
326
+						'tooltip' => __('Choose a calendar theme to match your site theme.', 'google-calendar-events'),
327 327
 						'options' => array(
328
-							'light' => __( 'Light', 'google-calendar-events' ),
329
-							'dark' => __( 'Dark', 'google-calendar-events' ),
328
+							'light' => __('Light', 'google-calendar-events'),
329
+							'dark' => __('Dark', 'google-calendar-events'),
330 330
 						),
331
-					) );
331
+					));
332 332
 
333 333
 					?>
334 334
 				</td>
335 335
 			</tr>
336 336
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
337
-				<th><label for="_default_calendar_style_today"><?php _e( 'Today', 'google-calendar-events' ); ?></label></th>
337
+				<th><label for="_default_calendar_style_today"><?php _e('Today', 'google-calendar-events'); ?></label></th>
338 338
 				<td>
339 339
 					<?php
340 340
 
341
-					$saved = get_post_meta( $post_id, '_default_calendar_style_today', true );
341
+					$saved = get_post_meta($post_id, '_default_calendar_style_today', true);
342 342
 					$value = ! $saved ? $default_today_color : $saved;
343 343
 
344
-					simcal_print_field( array(
344
+					simcal_print_field(array(
345 345
 						'type'    => 'standard',
346 346
 						'subtype' => 'color-picker',
347 347
 						'name'    => '_default_calendar_style_today',
348 348
 						'id'      => '_default_calendar_style_today',
349 349
 						'value'   => $value,
350
-						'tooltip' => __( "This option will set the background color for today's date. It will change the day number background and the border around the current day.", 'google-calendar-events' ),
351
-					) );
350
+						'tooltip' => __("This option will set the background color for today's date. It will change the day number background and the border around the current day.", 'google-calendar-events'),
351
+					));
352 352
 
353 353
 					?>
354 354
 				</td>
355 355
 			</tr>
356 356
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
357
-				<th><label for="_default_calendar_style_days_events"><?php _e( 'Days with Events', 'google-calendar-events' ); ?></label></th>
357
+				<th><label for="_default_calendar_style_days_events"><?php _e('Days with Events', 'google-calendar-events'); ?></label></th>
358 358
 				<td>
359 359
 					<?php
360 360
 
361
-					$saved = get_post_meta( $post_id, '_default_calendar_style_days_events', true );
361
+					$saved = get_post_meta($post_id, '_default_calendar_style_days_events', true);
362 362
 					$value = ! $saved ? $default_days_events_color : $saved;
363 363
 
364
-					simcal_print_field( array(
364
+					simcal_print_field(array(
365 365
 						'type'    => 'standard',
366 366
 						'subtype' => 'color-picker',
367 367
 						'name'    => '_default_calendar_style_days_events',
368 368
 						'id'      => '_default_calendar_style_days_events',
369 369
 						'value'   => $value,
370
-						'tooltip' => __( 'This setting will modify the day number background for any days that have events on them.', 'google-calendar-events' ),
371
-					) );
370
+						'tooltip' => __('This setting will modify the day number background for any days that have events on them.', 'google-calendar-events'),
371
+					));
372 372
 
373 373
 					?>
374 374
 				</td>
@@ -390,55 +390,55 @@  discard block
 block discarded – undo
390 390
 	 *
391 391
 	 * @param int $post_id
392 392
 	 */
393
-	public function process_meta( $post_id ) {
393
+	public function process_meta($post_id) {
394 394
 
395 395
 		// Theme.
396
-		$theme = isset( $_POST['_default_calendar_style_theme'] ) ? sanitize_key( $_POST['_default_calendar_style_theme'] ) : 'light';
397
-		update_post_meta( $post_id, '_default_calendar_style_theme', $theme );
396
+		$theme = isset($_POST['_default_calendar_style_theme']) ? sanitize_key($_POST['_default_calendar_style_theme']) : 'light';
397
+		update_post_meta($post_id, '_default_calendar_style_theme', $theme);
398 398
 
399 399
 		// Today color.
400
-		$today_color = isset( $_POST['_default_calendar_style_today'] ) ? sanitize_text_field( $_POST['_default_calendar_style_today'] ) : '#FF000';
401
-		update_post_meta( $post_id, '_default_calendar_style_today', $today_color );
400
+		$today_color = isset($_POST['_default_calendar_style_today']) ? sanitize_text_field($_POST['_default_calendar_style_today']) : '#FF000';
401
+		update_post_meta($post_id, '_default_calendar_style_today', $today_color);
402 402
 
403 403
 		// Days with events color.
404
-		$days_events_color = isset( $_POST['_default_calendar_style_days_events'] ) ? sanitize_text_field( $_POST['_default_calendar_style_days_events'] ) : '#000000';
405
-		update_post_meta( $post_id, '_default_calendar_style_days_events', $days_events_color );
404
+		$days_events_color = isset($_POST['_default_calendar_style_days_events']) ? sanitize_text_field($_POST['_default_calendar_style_days_events']) : '#000000';
405
+		update_post_meta($post_id, '_default_calendar_style_days_events', $days_events_color);
406 406
 
407 407
 		// List range span.
408
-		$span = isset( $_POST['_default_calendar_list_range_span'] ) ? max( absint( $_POST['_default_calendar_list_range_span'] ), 1 ) : 1;
409
-		update_post_meta( $post_id, '_default_calendar_list_range_span', $span );
408
+		$span = isset($_POST['_default_calendar_list_range_span']) ? max(absint($_POST['_default_calendar_list_range_span']), 1) : 1;
409
+		update_post_meta($post_id, '_default_calendar_list_range_span', $span);
410 410
 
411 411
 		// List range type.
412
-		$group = isset( $_POST['_default_calendar_list_range_type'] ) ? sanitize_key( $_POST['_default_calendar_list_range_type'] ) : 'monthly';
413
-		update_post_meta( $post_id, '_default_calendar_list_range_type', $group );
412
+		$group = isset($_POST['_default_calendar_list_range_type']) ? sanitize_key($_POST['_default_calendar_list_range_type']) : 'monthly';
413
+		update_post_meta($post_id, '_default_calendar_list_range_type', $group);
414 414
 
415 415
 		// Hide header.
416
-		$header = isset( $_POST['_default_calendar_list_header'] ) ? 'yes' : 'no';
417
-		update_post_meta( $post_id, '_default_calendar_list_header', $header );
416
+		$header = isset($_POST['_default_calendar_list_header']) ? 'yes' : 'no';
417
+		update_post_meta($post_id, '_default_calendar_list_header', $header);
418 418
 
419 419
 		// Compact list.
420
-		$compact = isset( $_POST['_default_calendar_compact_list'] ) ? 'yes' : 'no';
421
-		update_post_meta( $post_id, '_default_calendar_compact_list', $compact );
420
+		$compact = isset($_POST['_default_calendar_compact_list']) ? 'yes' : 'no';
421
+		update_post_meta($post_id, '_default_calendar_compact_list', $compact);
422 422
 
423 423
 		// Limit number of initially visible daily events.
424
-		$limit = isset( $_POST['_default_calendar_limit_visible_events'] ) ? 'yes' : 'no';
425
-		update_post_meta( $post_id, '_default_calendar_limit_visible_events', $limit );
426
-		$number = isset( $_POST['_default_calendar_visible_events'] ) ? absint( $_POST['_default_calendar_visible_events'] ) : 3;
427
-		update_post_meta( $post_id, '_default_calendar_visible_events', $number );
424
+		$limit = isset($_POST['_default_calendar_limit_visible_events']) ? 'yes' : 'no';
425
+		update_post_meta($post_id, '_default_calendar_limit_visible_events', $limit);
426
+		$number = isset($_POST['_default_calendar_visible_events']) ? absint($_POST['_default_calendar_visible_events']) : 3;
427
+		update_post_meta($post_id, '_default_calendar_visible_events', $number);
428 428
 
429 429
 		// Grid event bubbles action.
430
-		$bubbles = isset( $_POST['_default_calendar_event_bubble_trigger'] ) ? esc_attr( $_POST['_default_calendar_event_bubble_trigger'] ) : 'hover';
431
-		update_post_meta( $post_id, '_default_calendar_event_bubble_trigger', $bubbles );
430
+		$bubbles = isset($_POST['_default_calendar_event_bubble_trigger']) ? esc_attr($_POST['_default_calendar_event_bubble_trigger']) : 'hover';
431
+		update_post_meta($post_id, '_default_calendar_event_bubble_trigger', $bubbles);
432 432
 
433 433
 		// Trim event titles characters length.
434
-		$trim = isset( $_POST['_default_calendar_trim_titles'] ) ? 'yes' : 'no';
435
-		update_post_meta( $post_id, '_default_calendar_trim_titles', $trim );
436
-		$chars = isset( $_POST['_default_calendar_trim_titles_chars'] ) ? max( absint( $_POST['_default_calendar_trim_titles_chars'] ), 1 ) : 20;
437
-		update_post_meta( $post_id, '_default_calendar_trim_titles_chars', $chars );
434
+		$trim = isset($_POST['_default_calendar_trim_titles']) ? 'yes' : 'no';
435
+		update_post_meta($post_id, '_default_calendar_trim_titles', $trim);
436
+		$chars = isset($_POST['_default_calendar_trim_titles_chars']) ? max(absint($_POST['_default_calendar_trim_titles_chars']), 1) : 20;
437
+		update_post_meta($post_id, '_default_calendar_trim_titles_chars', $chars);
438 438
 
439 439
 		// Expand multiple day events on each day.
440
-		$multi_day = isset( $_POST['_default_calendar_expand_multi_day_events'] ) && ! empty( $_POST['_default_calendar_expand_multi_day_events'] ) ? sanitize_key( $_POST['_default_calendar_expand_multi_day_events'] ) : 'current_day_only';
441
-		update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', $multi_day );
440
+		$multi_day = isset($_POST['_default_calendar_expand_multi_day_events']) && ! empty($_POST['_default_calendar_expand_multi_day_events']) ? sanitize_key($_POST['_default_calendar_expand_multi_day_events']) : 'current_day_only';
441
+		update_post_meta($post_id, '_default_calendar_expand_multi_day_events', $multi_day);
442 442
 
443 443
 	}
444 444
 
Please login to merge, or discard this patch.
includes/wp-requirements.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @license GPL2+
12 12
  */
13 13
 
14
-if ( ! class_exists( 'SimCal_WP_Requirements' ) ) {
14
+if ( ! class_exists('SimCal_WP_Requirements')) {
15 15
 
16 16
 	class SimCal_WP_Requirements {
17 17
 
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 		 * @param string $plugin       Output of `plugin_basename( __FILE__ )`.
91 91
 		 * @param array  $requirements Associative array with requirements.
92 92
 		 */
93
-		public function __construct( $name, $plugin, $requirements ) {
93
+		public function __construct($name, $plugin, $requirements) {
94 94
 
95
-			$this->name = htmlspecialchars( strip_tags( $name ) );
95
+			$this->name = htmlspecialchars(strip_tags($name));
96 96
 			$this->plugin = $plugin;
97 97
 			$this->requirements = $requirements;
98 98
 
99
-			if ( ! empty( $requirements ) && is_array( $requirements ) ) {
99
+			if ( ! empty($requirements) && is_array($requirements)) {
100 100
 
101 101
 				$failures = $extensions = array();
102 102
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 				);
110 110
 
111 111
 				// Check for WordPress version.
112
-				if ( $requirements['WordPress'] && is_string( $requirements['WordPress'] ) ) {
113
-					if ( function_exists( 'get_bloginfo' ) ) {
114
-						$wp_version = get_bloginfo( 'version' );
115
-						if ( version_compare( $wp_version, $requirements['WordPress'] ) === - 1 ) {
112
+				if ($requirements['WordPress'] && is_string($requirements['WordPress'])) {
113
+					if (function_exists('get_bloginfo')) {
114
+						$wp_version = get_bloginfo('version');
115
+						if (version_compare($wp_version, $requirements['WordPress']) === - 1) {
116 116
 							$failures['WordPress'] = $wp_version;
117 117
 							$this->wp = false;
118 118
 						}
@@ -120,24 +120,24 @@  discard block
 block discarded – undo
120 120
 				}
121 121
 
122 122
 				// Check fo PHP version.
123
-				if ( $requirements['PHP'] && is_string( $requirements['PHP'] ) ) {
124
-					if ( version_compare( PHP_VERSION, $requirements['PHP'] ) === -1 ) {
123
+				if ($requirements['PHP'] && is_string($requirements['PHP'])) {
124
+					if (version_compare(PHP_VERSION, $requirements['PHP']) === -1) {
125 125
 						$failures['PHP'] = PHP_VERSION;
126 126
 						$this->php = false;
127 127
 					}
128 128
 				}
129 129
 
130 130
 				// Check fo PHP Extensions.
131
-				if ( $requirements['Extensions'] && is_array( $requirements['Extensions'] ) ) {
132
-					foreach ( $requirements['Extensions'] as $extension ) {
133
-						if ( $extension && is_string( $extension ) ) {
134
-							$extensions[ $extension ] = extension_loaded( $extension );
131
+				if ($requirements['Extensions'] && is_array($requirements['Extensions'])) {
132
+					foreach ($requirements['Extensions'] as $extension) {
133
+						if ($extension && is_string($extension)) {
134
+							$extensions[$extension] = extension_loaded($extension);
135 135
 						}
136 136
 					}
137
-					if ( in_array( false, $extensions ) ) {
138
-						foreach ( $extensions as $extension_name => $found  ) {
139
-							if ( $found === false ) {
140
-								$failures['Extensions'][ $extension_name ] = $extension_name;
137
+					if (in_array(false, $extensions)) {
138
+						foreach ($extensions as $extension_name => $found) {
139
+							if ($found === false) {
140
+								$failures['Extensions'][$extension_name] = $extension_name;
141 141
 							}
142 142
 						}
143 143
 						$this->extensions = false;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
 			} else {
150 150
 
151
-				trigger_error( 'WP Requirements: the requirements are invalid.', E_USER_ERROR );
151
+				trigger_error('WP Requirements: the requirements are invalid.', E_USER_ERROR);
152 152
 
153 153
 			}
154 154
 		}
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 		 * @return bool
169 169
 		 */
170 170
 		public function pass() {
171
-			if ( in_array( false, array(
171
+			if (in_array(false, array(
172 172
 				$this->wp,
173 173
 				$this->php,
174 174
 				$this->extensions,
175
-			) ) ) {
175
+			))) {
176 176
 				return false;
177 177
 			}
178 178
 			return true;
@@ -185,28 +185,28 @@  discard block
 block discarded – undo
185 185
 		 *
186 186
 		 * @return string
187 187
 		 */
188
-		public function get_notice( $message = '' ) {
188
+		public function get_notice($message = '') {
189 189
 
190 190
 			$notice   = '';
191 191
 			$name     = $this->name;
192 192
 			$failures = $this->failures;
193 193
 
194
-			if ( ! empty( $failures ) && is_array( $failures ) ) {
194
+			if ( ! empty($failures) && is_array($failures)) {
195 195
 
196
-				$notice  = '<div class="error">' . "\n";
197
-				$notice .= "\t" . '<p>' . "\n";
198
-				$notice .= '<strong>' . sprintf( '%s could not be activated.', $name ) . '</strong><br>';
196
+				$notice  = '<div class="error">'."\n";
197
+				$notice .= "\t".'<p>'."\n";
198
+				$notice .= '<strong>'.sprintf('%s could not be activated.', $name).'</strong><br>';
199 199
 
200
-				foreach ( $failures as $requirement => $found ) {
200
+				foreach ($failures as $requirement => $found) {
201 201
 
202
-					$required = $this->requirements[ $requirement ];
202
+					$required = $this->requirements[$requirement];
203 203
 
204
-					if ( 'Extensions' == $requirement ) {
205
-						if ( is_array( $found ) ) {
204
+					if ('Extensions' == $requirement) {
205
+						if (is_array($found)) {
206 206
 							$notice .= sprintf( 
207 207
 									'Required PHP Extension(s) not found: %s.', 
208
-									join( ', ', $found ) 
209
-								) . '<br>';
208
+									join(', ', $found) 
209
+								).'<br>';
210 210
 						}
211 211
 					} else {
212 212
 						$notice .= sprintf( 
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 								$requirement, 
215 215
 								$required, 
216 216
 								$found 
217
-							) . '<br>';
217
+							).'<br>';
218 218
 					}
219 219
 
220 220
 				}
221 221
 
222
-				$notice .= '<em>' . sprintf( 'Please update to meet %s requirements.', $name ) . '</em>' . "\n";
223
-				$notice .= "\t" . '</p>' . "\n";
224
-				if ( $message ) {
222
+				$notice .= '<em>'.sprintf('Please update to meet %s requirements.', $name).'</em>'."\n";
223
+				$notice .= "\t".'</p>'."\n";
224
+				if ($message) {
225 225
 					$notice .= $message;
226 226
 				}
227 227
 				$notice .= '</div>';
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 		 * Deactivate plugin.
242 242
 		 */
243 243
 		public function deactivate_plugin() {
244
-			if ( function_exists( 'deactivate_plugins' ) && function_exists( 'plugin_basename' ) ) {
245
-				deactivate_plugins( $this->plugin );
244
+			if (function_exists('deactivate_plugins') && function_exists('plugin_basename')) {
245
+				deactivate_plugins($this->plugin);
246 246
 			}
247 247
 		}
248 248
 
@@ -251,17 +251,17 @@  discard block
 block discarded – undo
251 251
 		 *
252 252
 		 * @param string $message An additional message in notice.
253 253
 		 */
254
-		public function halt( $message = '' ) {
254
+		public function halt($message = '') {
255 255
 
256
-			$this->notice = $this->get_notice( $message );
256
+			$this->notice = $this->get_notice($message);
257 257
 
258
-			if ( $this->notice && function_exists( 'add_action' ) ) {
258
+			if ($this->notice && function_exists('add_action')) {
259 259
 
260
-				add_action( 'admin_notices', array( $this, 'print_notice' ) );
261
-				add_action( 'admin_init', array( $this, 'deactivate_plugin' ) );
260
+				add_action('admin_notices', array($this, 'print_notice'));
261
+				add_action('admin_init', array($this, 'deactivate_plugin'));
262 262
 
263
-				if ( isset( $_GET['activate'] ) ) {
264
-					unset( $_GET['activate'] );
263
+				if (isset($_GET['activate'])) {
264
+					unset($_GET['activate']);
265 265
 				}
266 266
 			}
267 267
 		}
Please login to merge, or discard this patch.
includes/admin/assets.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Admin;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function __construct() {
36 36
 
37
-		$this->min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) ? '' : '.min';
37
+		$this->min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true) ? '' : '.min';
38 38
 
39
-		add_action( 'admin_enqueue_scripts', array( $this, 'load' ) );
39
+		add_action('admin_enqueue_scripts', array($this, 'load'));
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function load() {
48 48
 
49
-		$css_path        = SIMPLE_CALENDAR_ASSETS . 'css/';
50
-		$css_path_vendor = $css_path . 'vendor/';
51
-		$js_path         = SIMPLE_CALENDAR_ASSETS . 'js/';
52
-		$js_path_vendor  = $js_path . 'vendor/';
49
+		$css_path        = SIMPLE_CALENDAR_ASSETS.'css/';
50
+		$css_path_vendor = $css_path.'vendor/';
51
+		$js_path         = SIMPLE_CALENDAR_ASSETS.'js/';
52
+		$js_path_vendor  = $js_path.'vendor/';
53 53
 
54 54
 		/* ====================== *
55 55
 		 * Register Admin Scripts *
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
 		// TipTip uses ".minified.js" filename ending.
59 59
 		wp_register_script(
60 60
 			'simcal-tiptip',
61
-			$js_path_vendor . 'jquery.tipTip' . ( ( $this->min !== '' ) ? '.minified' : '' ) . '.js',
62
-			array( 'jquery' ),
61
+			$js_path_vendor.'jquery.tipTip'.(($this->min !== '') ? '.minified' : '').'.js',
62
+			array('jquery'),
63 63
 			'1.3',
64 64
 			true
65 65
 		);
66 66
 		wp_register_script(
67 67
 			'simcal-select2',
68
-			$js_path_vendor . 'select2' . $this->min . '.js',
68
+			$js_path_vendor.'select2'.$this->min.'.js',
69 69
 			array(),
70 70
 			'4.0',
71 71
 			true
72 72
 		);
73 73
 		wp_register_script(
74 74
 			'simcal-admin',
75
-			$js_path . 'admin' . $this->min . '.js',
75
+			$js_path.'admin'.$this->min.'.js',
76 76
 			array(
77 77
 				'jquery',
78 78
 				'jquery-ui-sortable',
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		);
87 87
 		wp_register_script(
88 88
 			'simcal-admin-add-calendar',
89
-			$js_path . 'admin-add-calendar' . $this->min . '.js',
90
-			array( 'simcal-select2' ),
89
+			$js_path.'admin-add-calendar'.$this->min.'.js',
90
+			array('simcal-select2'),
91 91
 			SIMPLE_CALENDAR_VERSION,
92 92
 			true
93 93
 		);
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 
99 99
 		wp_register_style(
100 100
 			'simcal-select2',
101
-			$css_path_vendor . 'select2' . $this->min . '.css',
101
+			$css_path_vendor.'select2'.$this->min.'.css',
102 102
 			array(),
103 103
 			'4.0.0'
104 104
 		);
105 105
 		wp_register_style(
106 106
 			'simcal-admin',
107
-			$css_path . 'admin' . $this->min . '.css',
107
+			$css_path.'admin'.$this->min.'.css',
108 108
 			array(
109 109
 				'wp-color-picker',
110 110
 				'simcal-select2',
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
 		);
114 114
 		wp_register_style(
115 115
 			'simcal-admin-add-calendar',
116
-			$css_path . 'admin-add-calendar' . $this->min . '.css',
117
-			array( 'simcal-select2' ),
116
+			$css_path.'admin-add-calendar'.$this->min.'.css',
117
+			array('simcal-select2'),
118 118
 			SIMPLE_CALENDAR_VERSION
119 119
 		);
120 120
 
121
-		if ( simcal_is_admin_screen() !== false ) {
121
+		if (simcal_is_admin_screen() !== false) {
122 122
 
123
-			wp_enqueue_script( 'simcal-admin' );
123
+			wp_enqueue_script('simcal-admin');
124 124
 			wp_localize_script(
125 125
 				'simcal-admin',
126 126
 				'simcal_admin',
127 127
 				simcal_common_scripts_variables()
128 128
 			);
129 129
 
130
-			wp_enqueue_style( 'simcal-admin' );
130
+			wp_enqueue_style('simcal-admin');
131 131
 
132 132
 		} else {
133 133
 
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 			$screen = get_current_screen();
136 136
 
137 137
 			$post_types = array();
138
-			$settings = get_option( 'simple-calendar_settings_calendars' );
139
-			if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
138
+			$settings = get_option('simple-calendar_settings_calendars');
139
+			if (isset($settings['general']['attach_calendars_posts'])) {
140 140
 				$post_types = $settings['general']['attach_calendars_posts'];
141 141
 			}
142 142
 
143 143
 			$conditions = array(
144
-				in_array( $post_type, (array) $post_types ),
144
+				in_array($post_type, (array) $post_types),
145 145
 				$screen->id == 'widgets',
146 146
 			);
147 147
 
148
-			if ( in_array( true, $conditions ) ) {
148
+			if (in_array(true, $conditions)) {
149 149
 
150
-				wp_enqueue_script( 'simcal-admin-add-calendar' );
151
-				wp_localize_script( 'simcal-admin-add-calendar', 'simcal_admin', array(
150
+				wp_enqueue_script('simcal-admin-add-calendar');
151
+				wp_localize_script('simcal-admin-add-calendar', 'simcal_admin', array(
152 152
 					'locale'   => get_locale(),
153 153
 					'text_dir' => is_rtl() ? 'rtl' : 'ltr',
154
-				) );
154
+				));
155 155
 
156
-				wp_enqueue_style( 'simcal-admin-add-calendar' );
156
+				wp_enqueue_style('simcal-admin-add-calendar');
157 157
 			}
158 158
 
159 159
 		}
Please login to merge, or discard this patch.
includes/admin/fields/select.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Field;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -51,32 +51,32 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @param array $field
53 53
 	 */
54
-	public function __construct( $field ) {
54
+	public function __construct($field) {
55 55
 
56 56
 		$class = 'simcal-field-select';
57 57
 
58
-		$enhanced = isset( $field['enhanced'] ) ? $field['enhanced'] : '';
59
-		if ( 'enhanced' == $enhanced )  {
58
+		$enhanced = isset($field['enhanced']) ? $field['enhanced'] : '';
59
+		if ('enhanced' == $enhanced) {
60 60
 			$this->enhanced = true;
61 61
 			$class .= ' simcal-field-select-enhanced';
62 62
 		}
63 63
 
64
-		$multiselect = isset( $field['multiselect'] ) ? $field['multiselect'] : '';
65
-		if ( 'multiselect' == $multiselect ) {
64
+		$multiselect = isset($field['multiselect']) ? $field['multiselect'] : '';
65
+		if ('multiselect' == $multiselect) {
66 66
 			$this->multiselect = true;
67 67
 			$class .= ' simcal-field-multiselect';
68 68
 		}
69 69
 
70
-		if ( isset( $field['default'] ) ) {
70
+		if (isset($field['default'])) {
71 71
 			$this->default = $field['default'];
72 72
 		}
73 73
 
74 74
 		$this->type_class = $class;
75 75
 
76
-		$allow_void = isset( $field['allow_void'] ) ? $field['allow_void'] : '';
76
+		$allow_void = isset($field['allow_void']) ? $field['allow_void'] : '';
77 77
 		$this->allow_void = 'allow_void' == $allow_void ? true : false;
78 78
 
79
-		parent::__construct( $field );
79
+		parent::__construct($field);
80 80
 	}
81 81
 
82 82
 	/**
@@ -86,36 +86,36 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function html() {
88 88
 
89
-		if ( $this->multiselect === true && ! is_array( $this->value ) ) {
90
-			$this->value = explode( ',', $this->value );
89
+		if ($this->multiselect === true && ! is_array($this->value)) {
90
+			$this->value = explode(',', $this->value);
91 91
 		}
92 92
 
93
-		if ( $this->default ) {
94
-			if ( empty( $this->value ) || $this->value == '' ) {
93
+		if ($this->default) {
94
+			if (empty($this->value) || $this->value == '') {
95 95
 				$this->value = $this->default;
96 96
 			}
97 97
 		}
98 98
 
99 99
 		?>
100
-		<select name="<?php echo $this->name; ?><?php if ( $this->multiselect === true ) { echo '[]'; } ?>"
100
+		<select name="<?php echo $this->name; ?><?php if ($this->multiselect === true) { echo '[]'; } ?>"
101 101
 		        id="<?php echo $this->id; ?>"
102 102
 		        style="<?php echo $this->style; ?>"
103 103
 		        class="<?php echo $this->class; ?>"
104 104
 				<?php echo $this->attributes; ?>
105
-				<?php echo ( $this->multiselect === true ) ? ' multiple="multiple"' : ''; ?>>
105
+				<?php echo ($this->multiselect === true) ? ' multiple="multiple"' : ''; ?>>
106 106
 			<?php
107 107
 
108
-			if ( $this->allow_void === true ) {
109
-				echo '<option value=""' . selected( '', $this->value, false ) . '></option>';
108
+			if ($this->allow_void === true) {
109
+				echo '<option value=""'.selected('', $this->value, false).'></option>';
110 110
 			}
111 111
 
112
-			foreach ( $this->options as $option => $name ) {
113
-				if ( is_array( $this->value ) ) {
114
-					$selected =	selected( in_array( $option, $this->value ), true, false );
112
+			foreach ($this->options as $option => $name) {
113
+				if (is_array($this->value)) {
114
+					$selected = selected(in_array($option, $this->value), true, false);
115 115
 				} else {
116
-					$selected = selected( $this->value, trim( strval( $option ) ), false );
116
+					$selected = selected($this->value, trim(strval($option)), false);
117 117
 				}
118
-				echo '<option value="' . $option . '" ' . $selected . '>' . esc_attr( $name ) . '</option>';
118
+				echo '<option value="'.$option.'" '.$selected.'>'.esc_attr($name).'</option>';
119 119
 			}
120 120
 
121 121
 			?>
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 
125 125
 		echo $this->tooltip;
126 126
 
127
-		if ( ! empty( $this->description ) ) {
128
-			echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>';
127
+		if ( ! empty($this->description)) {
128
+			echo '<p class="description">'.wp_kses_post($this->description).'</p>';
129 129
 		}
130 130
 
131 131
 	}
Please login to merge, or discard this patch.
includes/abstracts/calendar.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -784,8 +784,8 @@
 block discarded – undo
784 784
 				if ( 'yes' == $poweredby ) {
785 785
 					$align = is_rtl() ? 'left' : 'right';
786 786
 					echo '<small class="simcal-powered simcal-align-' . $align .'">' .
787
-					     sprintf( __( 'Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events' ), simcal_get_url( 'home' ) ) .
788
-					     '</small>';
787
+						 sprintf( __( 'Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events' ), simcal_get_url( 'home' ) ) .
788
+						 '</small>';
789 789
 				}
790 790
 
791 791
 				echo '</div>';
Please login to merge, or discard this patch.
Spacing   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 use SimpleCalendar\Events\Event_Builder;
12 12
 use SimpleCalendar\Events\Events;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 	 * @param int|object|\WP_Post|Calendar $calendar
235 235
 	 * @param string $view
236 236
 	 */
237
-	public function __construct( $calendar, $view = '' ) {
237
+	public function __construct($calendar, $view = '') {
238 238
 
239 239
 		// Set the post object.
240
-		$this->set_post_object( $calendar );
240
+		$this->set_post_object($calendar);
241 241
 
242
-		if ( ! is_null( $this->post ) ) {
242
+		if ( ! is_null($this->post)) {
243 243
 
244 244
 			// Set calendar type and events source.
245 245
 			$this->set_taxonomies();
@@ -256,23 +256,23 @@  discard block
 block discarded – undo
256 256
 			$this->set_events_template();
257 257
 
258 258
 			// Get events source data.
259
-			$feed = simcal_get_feed( $this );
260
-			if ( $feed instanceof Feed ) {
261
-				if ( ! empty( $feed->events ) ) {
262
-					if ( is_array( $feed->events ) ) {
263
-						$this->set_events( $feed->events );
264
-						if ( 'use_calendar' == get_post_meta( $this->id, '_feed_timezone_setting', true ) ) {
259
+			$feed = simcal_get_feed($this);
260
+			if ($feed instanceof Feed) {
261
+				if ( ! empty($feed->events)) {
262
+					if (is_array($feed->events)) {
263
+						$this->set_events($feed->events);
264
+						if ('use_calendar' == get_post_meta($this->id, '_feed_timezone_setting', true)) {
265 265
 							$this->timezone = $feed->timezone;
266 266
 							$this->set_start();
267 267
 						}
268
-					} elseif ( is_string( $feed->events ) ) {
268
+					} elseif (is_string($feed->events)) {
269 269
 						$this->errors[] = $feed->events;
270 270
 					}
271 271
 				}
272 272
 			}
273 273
 
274 274
 			// Set general purpose timestamps.
275
-			$now = Carbon::now( $this->timezone );
275
+			$now = Carbon::now($this->timezone);
276 276
 			$this->now    = $now->getTimestamp();
277 277
 			$this->today  = $now->startOfDay()->getTimestamp();
278 278
 			$this->offset = $now->getOffset();
@@ -283,26 +283,26 @@  discard block
 block discarded – undo
283 283
 			$this->set_datetime_separator();
284 284
 
285 285
 			// Set earliest and latest event timestamps.
286
-			if ( $this->events && is_array( $this->events ) ) {
287
-				$this->earliest_event = intval( current( array_keys( $this->events ) ) );
288
-				$this->latest_event   = intval( key( array_slice( $this->events, -1, 1, true ) ) );
286
+			if ($this->events && is_array($this->events)) {
287
+				$this->earliest_event = intval(current(array_keys($this->events)));
288
+				$this->latest_event   = intval(key(array_slice($this->events, -1, 1, true)));
289 289
 			}
290 290
 
291 291
 			// Set calendar end.
292 292
 			$this->set_end();
293 293
 
294 294
 			// Set view.
295
-			if ( ! $view ) {
295
+			if ( ! $view) {
296 296
 
297
-				$calendar_view = get_post_meta( $this->id, '_calendar_view', true );
298
-				$calendar_view = isset( $calendar_view[ $this->type ] ) ? $calendar_view[ $this->type ] : '';
297
+				$calendar_view = get_post_meta($this->id, '_calendar_view', true);
298
+				$calendar_view = isset($calendar_view[$this->type]) ? $calendar_view[$this->type] : '';
299 299
 
300
-				$view = esc_attr( $calendar_view );
300
+				$view = esc_attr($calendar_view);
301 301
 			}
302 302
 		}
303 303
 
304 304
 		// Get view.
305
-		$this->view = $this->get_view( $view );
305
+		$this->view = $this->get_view($view);
306 306
 	}
307 307
 
308 308
 	/**
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @return bool
316 316
 	 */
317
-	public function __isset( $key ) {
318
-		return metadata_exists( 'post', $this->id, '_' . $key );
317
+	public function __isset($key) {
318
+		return metadata_exists('post', $this->id, '_'.$key);
319 319
 	}
320 320
 
321 321
 	/**
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @return mixed
329 329
 	 */
330
-	public function __get( $key ) {
331
-		$value = get_post_meta( $this->id, '_' . $key, true );
332
-		if ( ! empty( $value ) ) {
330
+	public function __get($key) {
331
+		$value = get_post_meta($this->id, '_'.$key, true);
332
+		if ( ! empty($value)) {
333 333
 			$this->$key = $value;
334 334
 		}
335 335
 		return $value;
@@ -342,17 +342,17 @@  discard block
 block discarded – undo
342 342
 	 *
343 343
 	 * @param int|object|\WP_Post|Calendar $calendar
344 344
 	 */
345
-	public function set_post_object( $calendar ) {
346
-		if ( is_numeric( $calendar ) ) {
347
-			$this->id   = absint( $calendar );
348
-			$this->post = get_post( $this->id );
349
-		} elseif ( $calendar instanceof Calendar ) {
350
-			$this->id   = absint( $calendar->id );
345
+	public function set_post_object($calendar) {
346
+		if (is_numeric($calendar)) {
347
+			$this->id   = absint($calendar);
348
+			$this->post = get_post($this->id);
349
+		} elseif ($calendar instanceof Calendar) {
350
+			$this->id   = absint($calendar->id);
351 351
 			$this->post = $calendar->post;
352
-		} elseif ( $calendar instanceof \WP_Post ) {
353
-			$this->id   = absint( $calendar->ID );
352
+		} elseif ($calendar instanceof \WP_Post) {
353
+			$this->id   = absint($calendar->ID);
354 354
 			$this->post = $calendar;
355
-		} elseif ( isset( $calendar->id ) && isset( $calendar->post ) ) {
355
+		} elseif (isset($calendar->id) && isset($calendar->post)) {
356 356
 			$this->id   = $calendar->id;
357 357
 			$this->post = $calendar->post;
358 358
 		}
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 	 * @return string
367 367
 	 */
368 368
 	public function get_title() {
369
-		$title = isset( $this->post->post_title ) ? $this->post->post_title : '';
370
-		return apply_filters( 'simcal_calendar_title', $title );
369
+		$title = isset($this->post->post_title) ? $this->post->post_title : '';
370
+		return apply_filters('simcal_calendar_title', $title);
371 371
 	}
372 372
 
373 373
 	/**
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 	 */
390 390
 	protected function set_taxonomies() {
391 391
 		// Set calendar type.
392
-		if ( $type = wp_get_object_terms( $this->id, 'calendar_type' ) ) {
393
-			$this->type = sanitize_title( current( $type )->name );
392
+		if ($type = wp_get_object_terms($this->id, 'calendar_type')) {
393
+			$this->type = sanitize_title(current($type)->name);
394 394
 		} else {
395
-			$this->type = apply_filters( 'simcal_calendar_default_type', 'default-calendar' );
395
+			$this->type = apply_filters('simcal_calendar_default_type', 'default-calendar');
396 396
 		}
397 397
 		// Set feed type.
398
-		if ( $feed_type = wp_get_object_terms( $this->id, 'calendar_feed' ) ) {
399
-			$this->feed = sanitize_title( current( $feed_type )->name );
398
+		if ($feed_type = wp_get_object_terms($this->id, 'calendar_feed')) {
399
+			$this->feed = sanitize_title(current($feed_type)->name);
400 400
 		} else {
401
-			$this->feed = apply_filters( 'simcal_calendar_default_feed', 'google' );
401
+			$this->feed = apply_filters('simcal_calendar_default_feed', 'google');
402 402
 		}
403 403
 	}
404 404
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @return Events
411 411
 	 */
412 412
 	public function get_events() {
413
-		return new Events( $this->events, $this->timezone );
413
+		return new Events($this->events, $this->timezone);
414 414
 	}
415 415
 
416 416
 	/**
@@ -420,14 +420,14 @@  discard block
 block discarded – undo
420 420
 	 *
421 421
 	 * @param array $array
422 422
 	 */
423
-	public function set_events( array $array ) {
423
+	public function set_events(array $array) {
424 424
 
425 425
 		$events = array();
426 426
 
427
-		if ( ! empty( $array ) ) {
428
-			foreach ( $array as $tz => $e ) {
429
-				foreach ( $e as $event ) {
430
-					$events[ $tz ][] = $event instanceof Event ? $event : new Event( $event );
427
+		if ( ! empty($array)) {
428
+			foreach ($array as $tz => $e) {
429
+				foreach ($e as $event) {
430
+					$events[$tz][] = $event instanceof Event ? $event : new Event($event);
431 431
 				}
432 432
 			}
433 433
 		}
@@ -444,24 +444,24 @@  discard block
 block discarded – undo
444 444
 	 *
445 445
 	 * @return string
446 446
 	 */
447
-	public function set_events_template( $template = '' ) {
448
-		if ( empty( $template ) ) {
449
-			$template = isset( $this->post->post_content ) ? $this->post->post_content : '';
447
+	public function set_events_template($template = '') {
448
+		if (empty($template)) {
449
+			$template = isset($this->post->post_content) ? $this->post->post_content : '';
450 450
 		}
451 451
 
452 452
 		// TODO: Removed wpautop() call.
453 453
 
454
-		$event_formatting = get_post_meta( $this->id, '_event_formatting', true );
454
+		$event_formatting = get_post_meta($this->id, '_event_formatting', true);
455 455
 
456
-		switch( $event_formatting ) {
456
+		switch ($event_formatting) {
457 457
 			case 'none':
458
-				$this->events_template =  wp_kses_post( trim( $template ) );
458
+				$this->events_template = wp_kses_post(trim($template));
459 459
 				break;
460 460
 			case 'no_linebreaks':
461
-				$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), false );
461
+				$this->events_template = wpautop(wp_kses_post(trim($template)), false);
462 462
 				break;
463 463
 			default:
464
-				$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), true );
464
+				$this->events_template = wpautop(wp_kses_post(trim($template)), true);
465 465
 		}
466 466
 
467 467
 		//$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), true );
@@ -474,37 +474,37 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @param string $tz Timezone.
476 476
 	 */
477
-	public function set_timezone( $tz = '' ) {
477
+	public function set_timezone($tz = '') {
478 478
 
479
-		$site_tz = esc_attr( simcal_get_wp_timezone() );
479
+		$site_tz = esc_attr(simcal_get_wp_timezone());
480 480
 
481
-		if ( $this->feed === 'grouped-calendars' ) {
481
+		if ($this->feed === 'grouped-calendars') {
482 482
 			$this->timezone = $site_tz;
483 483
 			return;
484 484
 		}
485 485
 
486
-		if ( empty( $tz ) ) {
486
+		if (empty($tz)) {
487 487
 
488
-			$timezone_setting = get_post_meta( $this->id, '_feed_timezone_setting', true );
488
+			$timezone_setting = get_post_meta($this->id, '_feed_timezone_setting', true);
489 489
 
490
-			if ( 'use_site' == $timezone_setting ) {
490
+			if ('use_site' == $timezone_setting) {
491 491
 				$tz = $site_tz;
492
-			} elseif ( 'use_custom' == $timezone_setting ) {
493
-				$custom_timezone = esc_attr( get_post_meta( $this->id, '_feed_timezone', true ) );
492
+			} elseif ('use_custom' == $timezone_setting) {
493
+				$custom_timezone = esc_attr(get_post_meta($this->id, '_feed_timezone', true));
494 494
 				// One may be using a non standard timezone in GMT (UTC) offset format.
495
-				if ( ( strpos( $custom_timezone, 'UTC+' ) === 0 ) || ( strpos( $custom_timezone, 'UTC-' ) === 0 ) ) {
496
-					$tz = simcal_get_timezone_from_gmt_offset( substr( $custom_timezone, 3 ) );
495
+				if ((strpos($custom_timezone, 'UTC+') === 0) || (strpos($custom_timezone, 'UTC-') === 0)) {
496
+					$tz = simcal_get_timezone_from_gmt_offset(substr($custom_timezone, 3));
497 497
 				} else {
498
-					$tz = ! empty( $custom_timezone ) ? $custom_timezone : 'UTC';
498
+					$tz = ! empty($custom_timezone) ? $custom_timezone : 'UTC';
499 499
 				}
500 500
 			}
501 501
 
502
-			$this->timezone = empty( $tz ) ? 'UTC' : $tz;
502
+			$this->timezone = empty($tz) ? 'UTC' : $tz;
503 503
 			return;
504 504
 		}
505 505
 
506 506
 		$this->site_timezone = $site_tz;
507
-		$this->timezone = simcal_esc_timezone( $tz, $this->timezone );
507
+		$this->timezone = simcal_esc_timezone($tz, $this->timezone);
508 508
 	}
509 509
 
510 510
 	/**
@@ -514,20 +514,20 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @param string $format PHP datetime format.
516 516
 	 */
517
-	public function set_date_format( $format = '' ) {
517
+	public function set_date_format($format = '') {
518 518
 
519 519
 		$date_format_custom = $date_format_default = $format;
520 520
 
521
-		if ( empty( $date_format_custom ) ) {
521
+		if (empty($date_format_custom)) {
522 522
 
523
-			$date_format_option  = esc_attr( get_post_meta( $this->id, '_calendar_date_format_setting', true ) );
524
-			$date_format_default = esc_attr( get_option( 'date_format' ) );
523
+			$date_format_option  = esc_attr(get_post_meta($this->id, '_calendar_date_format_setting', true));
524
+			$date_format_default = esc_attr(get_option('date_format'));
525 525
 			$date_format_custom  = '';
526 526
 
527
-			if ( 'use_custom' == $date_format_option ) {
528
-				$date_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_date_format', true ) );
529
-			} elseif ( 'use_custom_php' == $date_format_option ) {
530
-				$date_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_date_format_php', true ) );
527
+			if ('use_custom' == $date_format_option) {
528
+				$date_format_custom = esc_attr(get_post_meta($this->id, '_calendar_date_format', true));
529
+			} elseif ('use_custom_php' == $date_format_option) {
530
+				$date_format_custom = esc_attr(get_post_meta($this->id, '_calendar_date_format_php', true));
531 531
 			}
532 532
 		}
533 533
 
@@ -541,20 +541,20 @@  discard block
 block discarded – undo
541 541
 	 *
542 542
 	 * @param string $format PHP datetime format.
543 543
 	 */
544
-	public function set_time_format( $format = '' ) {
544
+	public function set_time_format($format = '') {
545 545
 
546 546
 		$time_format_custom = $time_format_default = $format;
547 547
 
548
-		if ( empty( $time_format_custom ) ) {
548
+		if (empty($time_format_custom)) {
549 549
 
550
-			$time_format_option  = esc_attr( get_post_meta( $this->id, '_calendar_time_format_setting', true ) );
551
-			$time_format_default = esc_attr( get_option( 'time_format' ) );
550
+			$time_format_option  = esc_attr(get_post_meta($this->id, '_calendar_time_format_setting', true));
551
+			$time_format_default = esc_attr(get_option('time_format'));
552 552
 			$time_format_custom  = '';
553 553
 
554
-			if ( 'use_custom' == $time_format_option ) {
555
-				$time_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_time_format', true ) );
556
-			} elseif ( 'use_custom_php' == $time_format_option ) {
557
-				$time_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_time_format_php', true ) );
554
+			if ('use_custom' == $time_format_option) {
555
+				$time_format_custom = esc_attr(get_post_meta($this->id, '_calendar_time_format', true));
556
+			} elseif ('use_custom_php' == $time_format_option) {
557
+				$time_format_custom = esc_attr(get_post_meta($this->id, '_calendar_time_format_php', true));
558 558
 			}
559 559
 		}
560 560
 
@@ -568,13 +568,13 @@  discard block
 block discarded – undo
568 568
 	 *
569 569
 	 * @param string $separator A UTF8 character used as separator.
570 570
 	 */
571
-	public function set_datetime_separator( $separator = '' ) {
571
+	public function set_datetime_separator($separator = '') {
572 572
 
573
-		if ( empty( $separator ) ) {
574
-			$separator = get_post_meta( $this->id, '_calendar_datetime_separator', true );
573
+		if (empty($separator)) {
574
+			$separator = get_post_meta($this->id, '_calendar_datetime_separator', true);
575 575
 		}
576 576
 
577
-		$this->datetime_separator = esc_attr( $separator );
577
+		$this->datetime_separator = esc_attr($separator);
578 578
 	}
579 579
 
580 580
 	/**
@@ -584,18 +584,18 @@  discard block
 block discarded – undo
584 584
 	 *
585 585
 	 * @param int $weekday From 0 (Sunday) to 6 (Friday).
586 586
 	 */
587
-	public function set_start_of_week( $weekday = -1 ) {
587
+	public function set_start_of_week($weekday = -1) {
588 588
 
589
-		$week_starts = is_int( $weekday ) ? $weekday : -1;
589
+		$week_starts = is_int($weekday) ? $weekday : -1;
590 590
 
591
-		if ( $week_starts < 0 || $week_starts > 6 ) {
591
+		if ($week_starts < 0 || $week_starts > 6) {
592 592
 
593
-			$week_starts_setting = get_post_meta( $this->id, '_calendar_week_starts_on_setting', true );
594
-			$week_starts         = intval( get_option( 'start_of_week' ) );
593
+			$week_starts_setting = get_post_meta($this->id, '_calendar_week_starts_on_setting', true);
594
+			$week_starts         = intval(get_option('start_of_week'));
595 595
 
596
-			if ( 'use_custom' == $week_starts_setting ) {
597
-				$week_starts_on = get_post_meta( $this->id, '_calendar_week_starts_on', true );
598
-				$week_starts    = is_numeric( $week_starts_on ) ? intval( $week_starts_on ) : $week_starts;
596
+			if ('use_custom' == $week_starts_setting) {
597
+				$week_starts_on = get_post_meta($this->id, '_calendar_week_starts_on', true);
598
+				$week_starts    = is_numeric($week_starts_on) ? intval($week_starts_on) : $week_starts;
599 599
 			}
600 600
 		}
601 601
 
@@ -609,51 +609,51 @@  discard block
 block discarded – undo
609 609
 	 *
610 610
 	 * @param int $timestamp
611 611
 	 */
612
-	public function set_start( $timestamp = 0 ) {
612
+	public function set_start($timestamp = 0) {
613 613
 
614
-		if ( is_int( $timestamp ) && $timestamp !== 0 ) {
614
+		if (is_int($timestamp) && $timestamp !== 0) {
615 615
 			$this->start = $timestamp;
616 616
 			return;
617 617
 		}
618 618
 
619
-		$this->start = Carbon::now( $this->timezone )->getTimestamp();
619
+		$this->start = Carbon::now($this->timezone)->getTimestamp();
620 620
 
621
-		$calendar_begins = esc_attr( get_post_meta( $this->id, '_calendar_begins', true ) );
622
-		$nth = max( absint( get_post_meta( $this->id, '_calendar_begins_nth', true ) ), 1 );
621
+		$calendar_begins = esc_attr(get_post_meta($this->id, '_calendar_begins', true));
622
+		$nth = max(absint(get_post_meta($this->id, '_calendar_begins_nth', true)), 1);
623 623
 
624
-		if ( 'today' == $calendar_begins ) {
625
-			$this->start = Carbon::today( $this->timezone )->getTimestamp();
626
-		} elseif ( 'days_before' == $calendar_begins ) {
627
-			$this->start = Carbon::today( $this->timezone )->subDays( $nth )->getTimestamp();
628
-		} elseif ( 'days_after' == $calendar_begins ) {
629
-			$this->start = Carbon::today( $this->timezone )->addDays( $nth )->getTimestamp();
630
-		} elseif ( 'this_week' == $calendar_begins ) {
631
-			$week = new Carbon( 'now', $this->timezone );
632
-			$week->setWeekStartsAt( $this->week_starts );
624
+		if ('today' == $calendar_begins) {
625
+			$this->start = Carbon::today($this->timezone)->getTimestamp();
626
+		} elseif ('days_before' == $calendar_begins) {
627
+			$this->start = Carbon::today($this->timezone)->subDays($nth)->getTimestamp();
628
+		} elseif ('days_after' == $calendar_begins) {
629
+			$this->start = Carbon::today($this->timezone)->addDays($nth)->getTimestamp();
630
+		} elseif ('this_week' == $calendar_begins) {
631
+			$week = new Carbon('now', $this->timezone);
632
+			$week->setWeekStartsAt($this->week_starts);
633 633
 			$this->start = $week->startOfWeek()->getTimestamp();
634
-		} elseif ( 'weeks_before' == $calendar_begins ) {
635
-			$week = new Carbon( 'now', $this->timezone );
636
-			$week->setWeekStartsAt( $this->week_starts );
637
-			$this->start = $week->startOfWeek()->subWeeks( $nth )->getTimestamp();
638
-		} elseif ( 'weeks_after' == $calendar_begins ) {
639
-			$week = new Carbon( 'now', $this->timezone );
640
-			$week->setWeekStartsAt( $this->week_starts );
641
-			$this->start = $week->startOfWeek()->addWeeks( $nth )->getTimestamp();
642
-		} elseif ( 'this_month' == $calendar_begins ) {
643
-			$this->start = Carbon::today( $this->timezone )->startOfMonth()->getTimeStamp();
644
-		} elseif ( 'months_before' == $calendar_begins ) {
645
-			$this->start = Carbon::today( $this->timezone )->subMonths( $nth )->startOfMonth()->getTimeStamp();
646
-		} elseif ( 'months_after' == $calendar_begins ) {
647
-			$this->start = Carbon::today( $this->timezone )->addMonths( $nth )->startOfMonth()->getTimeStamp();
648
-		} elseif ( 'this_year' == $calendar_begins ) {
649
-			$this->start = Carbon::today( $this->timezone )->startOfYear()->getTimestamp();
650
-		} elseif ( 'years_before' == $calendar_begins ) {
651
-			$this->start = Carbon::today( $this->timezone )->subYears( $nth )->startOfYear()->getTimeStamp();
652
-		} elseif ( 'years_after' == $calendar_begins ) {
653
-			$this->start = Carbon::today( $this->timezone )->addYears( $nth )->startOfYear()->getTimeStamp();
654
-		} elseif ( 'custom_date' == $calendar_begins ) {
655
-			if ( $date = get_post_meta( $this->id, '_calendar_begins_custom_date', true ) ) {
656
-				$this->start = Carbon::createFromFormat( 'Y-m-d', esc_attr( $date ), $this->timezone )->setTimezone( $this->timezone )->startOfDay()->getTimestamp();
634
+		} elseif ('weeks_before' == $calendar_begins) {
635
+			$week = new Carbon('now', $this->timezone);
636
+			$week->setWeekStartsAt($this->week_starts);
637
+			$this->start = $week->startOfWeek()->subWeeks($nth)->getTimestamp();
638
+		} elseif ('weeks_after' == $calendar_begins) {
639
+			$week = new Carbon('now', $this->timezone);
640
+			$week->setWeekStartsAt($this->week_starts);
641
+			$this->start = $week->startOfWeek()->addWeeks($nth)->getTimestamp();
642
+		} elseif ('this_month' == $calendar_begins) {
643
+			$this->start = Carbon::today($this->timezone)->startOfMonth()->getTimeStamp();
644
+		} elseif ('months_before' == $calendar_begins) {
645
+			$this->start = Carbon::today($this->timezone)->subMonths($nth)->startOfMonth()->getTimeStamp();
646
+		} elseif ('months_after' == $calendar_begins) {
647
+			$this->start = Carbon::today($this->timezone)->addMonths($nth)->startOfMonth()->getTimeStamp();
648
+		} elseif ('this_year' == $calendar_begins) {
649
+			$this->start = Carbon::today($this->timezone)->startOfYear()->getTimestamp();
650
+		} elseif ('years_before' == $calendar_begins) {
651
+			$this->start = Carbon::today($this->timezone)->subYears($nth)->startOfYear()->getTimeStamp();
652
+		} elseif ('years_after' == $calendar_begins) {
653
+			$this->start = Carbon::today($this->timezone)->addYears($nth)->startOfYear()->getTimeStamp();
654
+		} elseif ('custom_date' == $calendar_begins) {
655
+			if ($date = get_post_meta($this->id, '_calendar_begins_custom_date', true)) {
656
+				$this->start = Carbon::createFromFormat('Y-m-d', esc_attr($date), $this->timezone)->setTimezone($this->timezone)->startOfDay()->getTimestamp();
657 657
 			}
658 658
 		}
659 659
 	}
@@ -665,8 +665,8 @@  discard block
 block discarded – undo
665 665
 	 *
666 666
 	 * @param int $timestamp
667 667
 	 */
668
-	public function set_end( $timestamp = 0 ) {
669
-		$latest = is_int( $timestamp ) && $timestamp !== 0 ? $timestamp : $this->latest_event;
668
+	public function set_end($timestamp = 0) {
669
+		$latest = is_int($timestamp) && $timestamp !== 0 ? $timestamp : $this->latest_event;
670 670
 		$this->end = $latest > $this->start ? $latest : $this->start;
671 671
 	}
672 672
 
@@ -677,14 +677,14 @@  discard block
 block discarded – undo
677 677
 	 *
678 678
 	 * @param string|bool $static
679 679
 	 */
680
-	public function set_static( $static = '' ) {
680
+	public function set_static($static = '') {
681 681
 
682
-		if ( ! empty( $static ) && is_bool( $static ) ) {
682
+		if ( ! empty($static) && is_bool($static)) {
683 683
 			$this->static = $static;
684 684
 			return;
685 685
 		}
686 686
 
687
-		if ( 'yes' == get_post_meta( $this->id, '_calendar_is_static', true ) ) {
687
+		if ('yes' == get_post_meta($this->id, '_calendar_is_static', true)) {
688 688
 			$this->static = true;
689 689
 			return;
690 690
 		}
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	 *
713 713
 	 * @return Calendar_View
714 714
 	 */
715
-	abstract public function get_view( $view = '' );
715
+	abstract public function get_view($view = '');
716 716
 
717 717
 	/**
718 718
 	 * Get event HTML parsed by template.
@@ -724,11 +724,11 @@  discard block
 block discarded – undo
724 724
 	 *
725 725
 	 * @return string
726 726
 	 */
727
-	public function get_event_html( Event $event, $template = '' ) {
728
-		$event_builder = new Event_Builder( $event, $this );
727
+	public function get_event_html(Event $event, $template = '') {
728
+		$event_builder = new Event_Builder($event, $this);
729 729
 		// Use the event template to parse tags; if empty, fallback to calendar post content.
730
-		$template = empty( $template ) ? ( empty( $event->template ) ? $this->events_template : $event->template ) : $template;
731
-		return $event_builder->parse_event_template_tags( $template );
730
+		$template = empty($template) ? (empty($event->template) ? $this->events_template : $event->template) : $template;
731
+		return $event_builder->parse_event_template_tags($template);
732 732
 	}
733 733
 
734 734
 	/**
@@ -738,58 +738,58 @@  discard block
 block discarded – undo
738 738
 	 *
739 739
 	 * @param string $view The calendar view to display.
740 740
 	 */
741
-	public function html( $view = '' ) {
741
+	public function html($view = '') {
742 742
 
743
-		$view = empty( $view ) ? $this->view : $this->get_view( $view );
743
+		$view = empty($view) ? $this->view : $this->get_view($view);
744 744
 
745
-		if ( $view instanceof Calendar_View ) {
745
+		if ($view instanceof Calendar_View) {
746 746
 
747
-			if ( ! empty( $this->errors ) ) {
747
+			if ( ! empty($this->errors)) {
748 748
 
749
-				if ( current_user_can( 'manage_options' )  ) {
749
+				if (current_user_can('manage_options')) {
750 750
 					echo '<pre><code>';
751
-					foreach ( $this->errors as $error ) { echo $error; }
751
+					foreach ($this->errors as $error) { echo $error; }
752 752
 					echo '</code></pre>';
753 753
 				}
754 754
 
755 755
 			} else {
756 756
 
757 757
 				// Get a CSS class from the class name of the calendar view (minus namespace part).
758
-				$view_name  = implode( '-', array_map( 'lcfirst', explode( '_', strtolower( get_class( $view ) ) ) ) );
759
-				$view_class = substr( $view_name, strrpos( $view_name, '\\' ) + 1 );
758
+				$view_name  = implode('-', array_map('lcfirst', explode('_', strtolower(get_class($view)))));
759
+				$view_class = substr($view_name, strrpos($view_name, '\\') + 1);
760 760
 
761
-				$calendar_class = trim( implode( ' simcal-', apply_filters( 'simcal_calendar_class', array(
761
+				$calendar_class = trim(implode(' simcal-', apply_filters('simcal_calendar_class', array(
762 762
 					'simcal-calendar',
763 763
 					$this->type,
764 764
 					$view_class,
765
-				), $this->id ) ) );
766
-
767
-				echo '<div class="' . $calendar_class . '" '
768
-									. 'data-calendar-id="'    . $this->id . '" '
769
-									. 'data-timezone="'       . $this->timezone . '" '
770
-									. 'data-offset="'         . $this->offset . '" '
771
-									. 'data-week-start="'     . $this->week_starts . '" '
772
-									. 'data-calendar-start="' . $this->start .'" '
773
-									. 'data-calendar-end="'   . $this->end . '" '
774
-									. 'data-events-first="'   . $this->earliest_event .'" '
775
-									. 'data-events-last="'    . $this->latest_event . '"'
765
+				), $this->id)));
766
+
767
+				echo '<div class="'.$calendar_class.'" '
768
+									. 'data-calendar-id="'.$this->id.'" '
769
+									. 'data-timezone="'.$this->timezone.'" '
770
+									. 'data-offset="'.$this->offset.'" '
771
+									. 'data-week-start="'.$this->week_starts.'" '
772
+									. 'data-calendar-start="'.$this->start.'" '
773
+									. 'data-calendar-end="'.$this->end.'" '
774
+									. 'data-events-first="'.$this->earliest_event.'" '
775
+									. 'data-events-last="'.$this->latest_event.'"'
776 776
 									. '>';
777 777
 
778
-				date_default_timezone_set( $this->timezone );
779
-				do_action( 'simcal_calendar_html_before', $this->id );
778
+				date_default_timezone_set($this->timezone);
779
+				do_action('simcal_calendar_html_before', $this->id);
780 780
 
781 781
 				$view->html();
782 782
 
783
-				do_action( 'simcal_calendar_html_after', $this->id );
784
-				date_default_timezone_set( $this->site_timezone );
783
+				do_action('simcal_calendar_html_after', $this->id);
784
+				date_default_timezone_set($this->site_timezone);
785 785
 
786 786
 				//$settings = get_option( 'simple-calendar_settings_calendars' );
787
-				$poweredby = get_post_meta( $this->id, '_poweredby', true );
787
+				$poweredby = get_post_meta($this->id, '_poweredby', true);
788 788
 
789
-				if ( 'yes' == $poweredby ) {
789
+				if ('yes' == $poweredby) {
790 790
 					$align = is_rtl() ? 'left' : 'right';
791
-					echo '<small class="simcal-powered simcal-align-' . $align .'">' .
792
-					     sprintf( __( 'Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events' ), simcal_get_url( 'home' ) ) .
791
+					echo '<small class="simcal-powered simcal-align-'.$align.'">'.
792
+					     sprintf(__('Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events'), simcal_get_url('home')).
793 793
 					     '</small>';
794 794
 				}
795 795
 
Please login to merge, or discard this patch.
includes/events/event-builder.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -594,21 +594,21 @@  discard block
 block discarded – undo
594 594
 		if ( ! $event->whole_day ) {
595 595
 
596 596
 			$time_start = $this->calendar->datetime_separator .
597
-			              ' <span class="simcal-event-start simcal-event-start-time" ' .
598
-			              'data-event-start="' . $start->getTimestamp() . '" ' .
599
-			              'data-event-format="' . $this->calendar->time_format . '" ' .
600
-			              'itemprop="startDate" data-content="' . $start->toIso8601String() . '">' .
601
-			              date_i18n( $this->calendar->time_format, $start->getTimestamp() ) .
602
-			              '</span> ';
597
+						  ' <span class="simcal-event-start simcal-event-start-time" ' .
598
+						  'data-event-start="' . $start->getTimestamp() . '" ' .
599
+						  'data-event-format="' . $this->calendar->time_format . '" ' .
600
+						  'itemprop="startDate" data-content="' . $start->toIso8601String() . '">' .
601
+						  date_i18n( $this->calendar->time_format, $start->getTimestamp() ) .
602
+						  '</span> ';
603 603
 
604 604
 			if ( $end instanceof Carbon ) {
605 605
 
606 606
 				$time_end = ' <span class="simcal-event-end simcal-event-end-time" ' .
607
-				            'data-event-end="' . $end->getTimestamp() . '" ' .
608
-				            'data-event-format="' . $this->calendar->time_format . '" ' .
609
-				            'itemprop="endDate" data-content="' . $end->toIso8601String() . '">' .
610
-				            date_i18n( $this->calendar->time_format, $end->getTimestamp() ) .
611
-				            '</span> ';
607
+							'data-event-end="' . $end->getTimestamp() . '" ' .
608
+							'data-event-format="' . $this->calendar->time_format . '" ' .
609
+							'itemprop="endDate" data-content="' . $end->toIso8601String() . '">' .
610
+							date_i18n( $this->calendar->time_format, $end->getTimestamp() ) .
611
+							'</span> ';
612 612
 
613 613
 			}
614 614
 
@@ -617,23 +617,23 @@  discard block
 block discarded – undo
617 617
 		if ( $event->multiple_days ) {
618 618
 
619 619
 			$output = ' <span class="simcal-event-start simcal-event-start-date" ' .
620
-			          'data-event-start="' . $start->getTimestamp() . '" ' .
621
-			          'data-event-format="' . $this->calendar->date_format . '" ' .
622
-			          'itemprop="startDate" data-content="' . $start->toIso8601String() . '">' .
623
-			          date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
624
-			          '</span> ' .
625
-			          $time_start;
620
+					  'data-event-start="' . $start->getTimestamp() . '" ' .
621
+					  'data-event-format="' . $this->calendar->date_format . '" ' .
622
+					  'itemprop="startDate" data-content="' . $start->toIso8601String() . '">' .
623
+					  date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
624
+					  '</span> ' .
625
+					  $time_start;
626 626
 
627 627
 			if ( $end instanceof Carbon ) {
628 628
 
629 629
 				$output .= '-' .
630
-				           ' <span class="simcal-event-start simcal-event-end-date" ' .
631
-				           'data-event-start="' . $end->getTimestamp() . '" ' .
632
-				           'data-event-format="' . $this->calendar->date_format . '" ' .
633
-				           'itemprop="endDate" data-content="' . $end->toIso8601String() . '">' .
634
-				           date_i18n( $this->calendar->date_format, $end->getTimestamp() ) .
635
-				           '</span> ' .
636
-				           $time_end;
630
+						   ' <span class="simcal-event-start simcal-event-end-date" ' .
631
+						   'data-event-start="' . $end->getTimestamp() . '" ' .
632
+						   'data-event-format="' . $this->calendar->date_format . '" ' .
633
+						   'itemprop="endDate" data-content="' . $end->toIso8601String() . '">' .
634
+						   date_i18n( $this->calendar->date_format, $end->getTimestamp() ) .
635
+						   '</span> ' .
636
+						   $time_end;
637 637
 			}
638 638
 
639 639
 		} else {
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
 			$time_end = ! empty( $time_start ) && ! empty( $time_end ) ? ' - ' . $time_end : '';
642 642
 
643 643
 			$output = ' <span class="simcal-event-start simcal-event-start-date" ' .
644
-			          'data-event-start="' . $start->getTimestamp() . '" ' .
645
-			          'data-event-format="' . $this->calendar->date_format . '">' .
646
-			          date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
647
-			          '</span> ' .
648
-			          $time_start .
649
-			          $time_end;
644
+					  'data-event-start="' . $start->getTimestamp() . '" ' .
645
+					  'data-event-format="' . $this->calendar->date_format . '">' .
646
+					  date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
647
+					  '</span> ' .
648
+					  $time_start .
649
+					  $time_end;
650 650
 
651 651
 		}
652 652
 
@@ -705,11 +705,11 @@  discard block
 block discarded – undo
705 705
 		}
706 706
 
707 707
 		return '<span class="simcal-event-' . $bound . ' ' . 'simcal-event-' . $bound . '-' . $format . '" ' .
708
-		       'data-event-' . $bound . '="' . $event_dt->getTimestamp() . '" ' .
709
-		       'data-event-format="' . $dt_format . '" ' .
710
-		       'itemprop="' . $bound . 'Date" data-content="' . $event_dt->toIso8601String() . '">' .
711
-		       $value .
712
-		       '</span>';
708
+			   'data-event-' . $bound . '="' . $event_dt->getTimestamp() . '" ' .
709
+			   'data-event-format="' . $dt_format . '" ' .
710
+			   'itemprop="' . $bound . 'Date" data-content="' . $event_dt->toIso8601String() . '">' .
711
+			   $value .
712
+			   '</span>';
713 713
 	}
714 714
 
715 715
 	/**
@@ -928,35 +928,35 @@  discard block
 block discarded – undo
928 928
 		$tagregexp = implode( '|', array_values( $this->tags ) );
929 929
 
930 930
 		return '/'
931
-		       . '\\['                              // Opening bracket
932
-		       . '(\\[?)'                           // 1: Optional second opening bracket for escaping tags: [[tag]]
933
-		       . "($tagregexp)"                     // 2: Tag name
934
-		       . '(?![\\w-])'                       // Not followed by word character or hyphen
935
-		       . '('                                // 3: Unroll the loop: Inside the opening tag
936
-		       .     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
937
-		       .     '(?:'
938
-		       .         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
939
-		       .         '[^\\]\\/]*'               // Not a closing bracket or forward slash
940
-		       .     ')*?'
941
-		       . ')'
942
-		       . '(?:'
943
-		       .     '(\\/)'                        // 4: Self closing tag ...
944
-		       .     '\\]'                          // ... and closing bracket
945
-		       . '|'
946
-		       .     '\\]'                          // Closing bracket
947
-		       .     '(?:'
948
-		       .         '('                        // 5: Unroll the loop: Optionally, anything between the opening and closing tags
949
-		       .             '[^\\[]*+'             // Not an opening bracket
950
-		       .             '(?:'
951
-		       .                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing tag
952
-		       .                 '[^\\[]*+'         // Not an opening bracket
953
-		       .             ')*+'
954
-		       .         ')'
955
-		       .         '\\[\\/\\2\\]'             // Closing tag
956
-		       .     ')?'
957
-		       . ')'
958
-		       . '(\\]?)'                           // 6: Optional second closing bracket for escaping tags: [[tag]]
959
-		       . '/s';
931
+			   . '\\['                              // Opening bracket
932
+			   . '(\\[?)'                           // 1: Optional second opening bracket for escaping tags: [[tag]]
933
+			   . "($tagregexp)"                     // 2: Tag name
934
+			   . '(?![\\w-])'                       // Not followed by word character or hyphen
935
+			   . '('                                // 3: Unroll the loop: Inside the opening tag
936
+			   .     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
937
+			   .     '(?:'
938
+			   .         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
939
+			   .         '[^\\]\\/]*'               // Not a closing bracket or forward slash
940
+			   .     ')*?'
941
+			   . ')'
942
+			   . '(?:'
943
+			   .     '(\\/)'                        // 4: Self closing tag ...
944
+			   .     '\\]'                          // ... and closing bracket
945
+			   . '|'
946
+			   .     '\\]'                          // Closing bracket
947
+			   .     '(?:'
948
+			   .         '('                        // 5: Unroll the loop: Optionally, anything between the opening and closing tags
949
+			   .             '[^\\[]*+'             // Not an opening bracket
950
+			   .             '(?:'
951
+			   .                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing tag
952
+			   .                 '[^\\[]*+'         // Not an opening bracket
953
+			   .             ')*+'
954
+			   .         ')'
955
+			   .         '\\[\\/\\2\\]'             // Closing tag
956
+			   .     ')?'
957
+			   . ')'
958
+			   . '(\\]?)'                           // 6: Optional second closing bracket for escaping tags: [[tag]]
959
+			   . '/s';
960 960
 	}
961 961
 
962 962
 }
Please login to merge, or discard this patch.
Spacing   +311 added lines, -311 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\Abstracts\Calendar;
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param Event    $event
55 55
 	 * @param Calendar $calendar
56 56
 	 */
57
-	public function __construct( Event $event, Calendar $calendar ) {
57
+	public function __construct(Event $event, Calendar $calendar) {
58 58
 		$this->event    = $event;
59 59
 		$this->calendar = $calendar;
60 60
 		$this->tags     = $this->get_content_tags();
@@ -74,85 +74,85 @@  discard block
 block discarded – undo
74 74
 			 * Content Tags *
75 75
 			 * ============ */
76 76
 
77
-			'title',                 // The event title.
78
-			'event-title',           // @deprecated An alias for 'title' tag.
79
-			'description',           // The event description.
80
-
81
-			'when',                  // Date and time of the event.
82
-			'start-time',            // Start time of the event.
83
-			'start-date',            // Start date of the event.
84
-			'start-custom',          // @deprecated Start time in a user defined format (set by tag 'format' attribute).
85
-			'start-human',           // Start time in a human friendly format.
86
-			'end-time',              // End time of the event.
87
-			'end-date',              // End date of the event.
88
-			'end-custom',            // @deprecated End date-time in a user defined format (set by tag 'format' attribute).
89
-			'end-human',             // End date-time in a human friendly format.
90
-
91
-			'duration',              // How long the events lasts, in a human-readable format.
92
-			'length',                // @deprecated An alias of 'duration' tag.
93
-
94
-			'location',              // Alias of start-location.
95
-			'start-location',        // Location name where the event starts.
96
-			'maps-link',             // @deprecated An alias for 'start-location-link' tag.
97
-			'start-location-link',   // Link to Google Maps querying the event start location address.
98
-			'end-location',          // Location name where the event ends.
99
-			'end-location-link',     // Link to Google Maps querying the event end location address.
100
-
101
-			'link',                  // An HTML link to the event URL.
102
-			'url',                   // A string with the raw event link URL.
103
-
104
-			'calendar',              // The title of the source calendar.
105
-			'feed-title',            // @deprecated An alias of 'calendar'.
106
-
107
-			'id',                    // The event unique ID.
108
-			'uid',                   // An alias of ID.
109
-			'ical-id',               // iCal ID.
110
-			'event-id',              // @deprecated An alias for 'id' tag.
111
-			'calendar-id',           // The calendar ID.
112
-			'feed-id',               // @deprecated An alias for 'calendar-id' tag.
113
-			'cal-id',                // @deprecated An alias for 'calendar-id' tag.
77
+			'title', // The event title.
78
+			'event-title', // @deprecated An alias for 'title' tag.
79
+			'description', // The event description.
80
+
81
+			'when', // Date and time of the event.
82
+			'start-time', // Start time of the event.
83
+			'start-date', // Start date of the event.
84
+			'start-custom', // @deprecated Start time in a user defined format (set by tag 'format' attribute).
85
+			'start-human', // Start time in a human friendly format.
86
+			'end-time', // End time of the event.
87
+			'end-date', // End date of the event.
88
+			'end-custom', // @deprecated End date-time in a user defined format (set by tag 'format' attribute).
89
+			'end-human', // End date-time in a human friendly format.
90
+
91
+			'duration', // How long the events lasts, in a human-readable format.
92
+			'length', // @deprecated An alias of 'duration' tag.
93
+
94
+			'location', // Alias of start-location.
95
+			'start-location', // Location name where the event starts.
96
+			'maps-link', // @deprecated An alias for 'start-location-link' tag.
97
+			'start-location-link', // Link to Google Maps querying the event start location address.
98
+			'end-location', // Location name where the event ends.
99
+			'end-location-link', // Link to Google Maps querying the event end location address.
100
+
101
+			'link', // An HTML link to the event URL.
102
+			'url', // A string with the raw event link URL.
103
+
104
+			'calendar', // The title of the source calendar.
105
+			'feed-title', // @deprecated An alias of 'calendar'.
106
+
107
+			'id', // The event unique ID.
108
+			'uid', // An alias of ID.
109
+			'ical-id', // iCal ID.
110
+			'event-id', // @deprecated An alias for 'id' tag.
111
+			'calendar-id', // The calendar ID.
112
+			'feed-id', // @deprecated An alias for 'calendar-id' tag.
113
+			'cal-id', // @deprecated An alias for 'calendar-id' tag.
114 114
 
115 115
 			/* ========= *
116 116
 			 * Meta Tags *
117 117
 			 * ========= */
118 118
 
119
-			'attachments',          // List of attachments.
120
-			'attendees',            // List of attendees.
121
-			'organizer',            // Creator info.
119
+			'attachments', // List of attachments.
120
+			'attendees', // List of attendees.
121
+			'organizer', // Creator info.
122 122
 
123 123
 			/* ================ *
124 124
 			 * Conditional Tags *
125 125
 			 * ================ */
126 126
 
127
-			'if-title',              // If the event has a title.
128
-			'if-description',        // If the event has a description.
129
-
130
-			'if-now',                // If the event is taking place now.
131
-			'if-not-now',            // If the event is not taking place now (may have ended or just not started yet).
132
-			'if-started',            // If the event has started (and may as well as ended).
133
-			'if-not-started',        // If the event has NOT started yet (event could be any time in the future).
134
-			'if-ended',              // If the event has ended (event could be any time in the past).
135
-			'if-not-ended',          // If the event has NOT ended (may as well as not started yet).
136
-
137
-			'if-whole-day',          // If the event lasts the whole day.
138
-			'if-all-day',            // @deprecated Alias for 'if-whole-day'.
139
-			'if-not-whole-day',      // If the event does NOT last the whole day.
140
-			'if-not-all-day',        // @deprecated Alias for 'if-not-whole-day'.
141
-			'if-end-time',           // If the event has a set end time.
142
-			'if-no-end-time',        // If the event has NOT a set end time.
143
-
144
-			'if-multi-day',          // If the event spans multiple days.
145
-			'if-single-day',         // If the event does not span multiple days.
146
-
147
-			'if-recurring',          // If the event is a recurring event.
148
-			'if-not-recurring',      // If the event is NOT a recurring event.
149
-
150
-			'if-location',           // @deprecated Alias for 'if-start-location'.
151
-			'if-start-location',     // Does the event has a start location?
152
-			'if-end-location',       // Does the event has an end location?
153
-			'if-not-location',       // @deprecated Alias for 'if-not-start-location'.
127
+			'if-title', // If the event has a title.
128
+			'if-description', // If the event has a description.
129
+
130
+			'if-now', // If the event is taking place now.
131
+			'if-not-now', // If the event is not taking place now (may have ended or just not started yet).
132
+			'if-started', // If the event has started (and may as well as ended).
133
+			'if-not-started', // If the event has NOT started yet (event could be any time in the future).
134
+			'if-ended', // If the event has ended (event could be any time in the past).
135
+			'if-not-ended', // If the event has NOT ended (may as well as not started yet).
136
+
137
+			'if-whole-day', // If the event lasts the whole day.
138
+			'if-all-day', // @deprecated Alias for 'if-whole-day'.
139
+			'if-not-whole-day', // If the event does NOT last the whole day.
140
+			'if-not-all-day', // @deprecated Alias for 'if-not-whole-day'.
141
+			'if-end-time', // If the event has a set end time.
142
+			'if-no-end-time', // If the event has NOT a set end time.
143
+
144
+			'if-multi-day', // If the event spans multiple days.
145
+			'if-single-day', // If the event does not span multiple days.
146
+
147
+			'if-recurring', // If the event is a recurring event.
148
+			'if-not-recurring', // If the event is NOT a recurring event.
149
+
150
+			'if-location', // @deprecated Alias for 'if-start-location'.
151
+			'if-start-location', // Does the event has a start location?
152
+			'if-end-location', // Does the event has an end location?
153
+			'if-not-location', // @deprecated Alias for 'if-not-start-location'.
154 154
 			'if-not-start-location', // Does the event has NOT a start location?
155
-			'if-not-end-location',   // Does the event has NOT an end location?
155
+			'if-not-end-location', // Does the event has NOT an end location?
156 156
 
157 157
 		);
158 158
 	}
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return string
168 168
 	 */
169
-	public function parse_event_template_tags( $template_tags = '' ) {
169
+	public function parse_event_template_tags($template_tags = '') {
170 170
 
171 171
 		// Process tags.
172 172
 		$result = preg_replace_callback(
173 173
 			$this->get_regex(),
174
-			array( $this, 'process_event_content' ),
174
+			array($this, 'process_event_content'),
175 175
 			$template_tags
176 176
 		);
177 177
 
178 178
 		// Removes extra consecutive <br> tags.
179 179
 		// TODO: Doesn't seem to work but going to remove it to allow multiple <br> tags in the editor
180 180
 		/*return preg_replace( '#(<br *//*?>\s*)+#i', '<br />', trim( $result ) );*/
181
-		return do_shortcode( trim( $result ) );
181
+		return do_shortcode(trim($result));
182 182
 	}
183 183
 
184 184
 	/**
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @return string
192 192
 	 */
193
-	public function process_event_content( $match ) {
193
+	public function process_event_content($match) {
194 194
 
195
-		if ( $match[1] == '[' && $match[6] == ']' ) {
196
-			return substr( $match[0], 1, - 1 );
195
+		if ($match[1] == '[' && $match[6] == ']') {
196
+			return substr($match[0], 1, - 1);
197 197
 		}
198 198
 
199 199
 		$tag     = $match[2]; // Tag name without square brackets.
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 		$calendar = $this->calendar;
206 206
 		$event    = $this->event;
207 207
 
208
-		if ( ( $calendar instanceof Calendar ) && ( $event instanceof Event ) ) {
208
+		if (($calendar instanceof Calendar) && ($event instanceof Event)) {
209 209
 
210
-			switch ( $tag ) {
210
+			switch ($tag) {
211 211
 
212 212
 				/* ============ *
213 213
 				 * Content Tags *
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
 
216 216
 				case 'title' :
217 217
 				case 'event-title' :
218
-					return $this->get_title( $event->title, $attr );
218
+					return $this->get_title($event->title, $attr);
219 219
 
220 220
 				case 'description' :
221
-					return $this->get_description( $event->description, $attr );
221
+					return $this->get_description($event->description, $attr);
222 222
 
223 223
 				case 'when' :
224
-					return $this->get_when( $event );
224
+					return $this->get_when($event);
225 225
 
226 226
 				case 'end-date' :
227 227
 				case 'end-custom' :
@@ -231,40 +231,40 @@  discard block
 block discarded – undo
231 231
 				case 'start-date' :
232 232
 				case 'start-human' :
233 233
 				case 'start-time' :
234
-					return $this->get_dt( $tag, $event, $attr );
234
+					return $this->get_dt($tag, $event, $attr);
235 235
 
236 236
 				case 'length' :
237 237
 				case 'duration' :
238
-					if ( false !== $event->end ) {
238
+					if (false !== $event->end) {
239 239
 						$duration = $event->start - $event->end;
240
-						$value    = human_time_diff( $event->start, $event->end );
240
+						$value    = human_time_diff($event->start, $event->end);
241 241
 					} else {
242 242
 						$duration = '-1';
243
-						$value    = __( 'No end time', 'google-calendar-events' );
243
+						$value    = __('No end time', 'google-calendar-events');
244 244
 					}
245
-					return ' <span class="simcal-event-duration" data-event-duration="' . $duration . '">' . $value . '</span>';
245
+					return ' <span class="simcal-event-duration" data-event-duration="'.$duration.'">'.$value.'</span>';
246 246
 
247 247
 				case 'location' :
248 248
 				case 'start-location' :
249 249
 				case 'end-location' :
250 250
 					$location = $tag == 'end-location' ? $event->end_location['address'] : $event->start_location['address'];
251 251
 					$location_class = $tag == 'end-location' ? 'end' : 'start';
252
-					return ' <span class="simcal-event-address simcal-event-' . $location_class . '-location" itemprop="location" itemscope itemtype="http://schema.org/Place">' . wp_strip_all_tags( $location ) . '</span>';
252
+					return ' <span class="simcal-event-address simcal-event-'.$location_class.'-location" itemprop="location" itemscope itemtype="http://schema.org/Place">'.wp_strip_all_tags($location).'</span>';
253 253
 
254 254
 				case 'start-location-link':
255 255
 				case 'end-location-link' :
256 256
 				case 'maps-link' :
257 257
 					$location = $tag == 'end-location-link' ? $event->end_location['address'] : $event->start_location['address'];
258
-					if ( ! empty( $location ) ) {
259
-						$url = '//maps.google.com?q=' . urlencode( $location );
260
-						return $this->make_link( $tag, $url, $calendar->get_event_html( $event, $partial ), $attr );
258
+					if ( ! empty($location)) {
259
+						$url = '//maps.google.com?q='.urlencode($location);
260
+						return $this->make_link($tag, $url, $calendar->get_event_html($event, $partial), $attr);
261 261
 					}
262 262
 					break;
263 263
 
264 264
 				case 'link' :
265 265
 				case 'url' :
266
-					$content = 'link' == $tag ? $calendar->get_event_html( $event, $partial ) : '';
267
-					return $this->make_link( $tag, $event->link, $content , $attr );
266
+					$content = 'link' == $tag ? $calendar->get_event_html($event, $partial) : '';
267
+					return $this->make_link($tag, $event->link, $content, $attr);
268 268
 
269 269
 				case 'calendar' :
270 270
 				case 'feed-title' :
@@ -289,22 +289,22 @@  discard block
 block discarded – undo
289 289
 
290 290
 				case 'attachments' :
291 291
 					$attachments = $event->get_attachments();
292
-					if ( ! empty( $attachments ) ) {
293
-						return $this->get_attachments( $attachments );
292
+					if ( ! empty($attachments)) {
293
+						return $this->get_attachments($attachments);
294 294
 					}
295 295
 					break;
296 296
 
297 297
 				case 'attendees' :
298 298
 					$attendees = $event->get_attendees();
299
-					if ( ! empty( $attendees ) ) {
300
-						return $this->get_attendees( $attendees, $attr );
299
+					if ( ! empty($attendees)) {
300
+						return $this->get_attendees($attendees, $attr);
301 301
 					}
302 302
 					break;
303 303
 
304 304
 				case 'organizer' :
305 305
 					$organizer = $event->get_organizer();
306
-					if ( ! empty( $organizer ) ) {
307
-						return $this->get_organizer( $organizer, $attr );
306
+					if ( ! empty($organizer)) {
307
+						return $this->get_organizer($organizer, $attr);
308 308
 					}
309 309
 					break;
310 310
 
@@ -313,35 +313,35 @@  discard block
 block discarded – undo
313 313
 				 * ================ */
314 314
 
315 315
 				case 'if-title':
316
-					if ( ! empty( $event->title ) ) {
317
-						return $calendar->get_event_html( $event, $partial );
316
+					if ( ! empty($event->title)) {
317
+						return $calendar->get_event_html($event, $partial);
318 318
 					}
319 319
 					break;
320 320
 
321 321
 				case 'if-description':
322
-					if ( ! empty( $event->description ) ) {
323
-						return $calendar->get_event_html( $event, $partial );
322
+					if ( ! empty($event->description)) {
323
+						return $calendar->get_event_html($event, $partial);
324 324
 					}
325 325
 					break;
326 326
 
327 327
 				case 'if-now' :
328 328
 				case 'if-not-now' :
329 329
 
330
-					$start_dt = $event->start_dt->setTimezone( $calendar->timezone );
330
+					$start_dt = $event->start_dt->setTimezone($calendar->timezone);
331 331
 					$start = $start_dt->getTimestamp();
332 332
 
333
-					if ( $event->end_dt instanceof Carbon ) {
334
-						$end = $event->end_dt->setTimezone( $calendar->timezone )->getTimestamp();
333
+					if ($event->end_dt instanceof Carbon) {
334
+						$end = $event->end_dt->setTimezone($calendar->timezone)->getTimestamp();
335 335
 					} else {
336 336
 						return '';
337 337
 					}
338 338
 
339
-					$now = ( $start <= $calendar->now ) && ( $end >= $calendar->now );
339
+					$now = ($start <= $calendar->now) && ($end >= $calendar->now);
340 340
 
341
-					if ( ( 'if-now' == $tag ) && $now ) {
342
-						return $calendar->get_event_html( $event, $partial );
343
-					} elseif ( ( 'if-not-now' == $tag ) && ( false == $now ) ) {
344
-						return $calendar->get_event_html( $event, $partial );
341
+					if (('if-now' == $tag) && $now) {
342
+						return $calendar->get_event_html($event, $partial);
343
+					} elseif (('if-not-now' == $tag) && (false == $now)) {
344
+						return $calendar->get_event_html($event, $partial);
345 345
 					}
346 346
 
347 347
 					break;
@@ -349,15 +349,15 @@  discard block
 block discarded – undo
349 349
 				case 'if-started' :
350 350
 				case 'if-not-started' :
351 351
 
352
-					$start = $event->start_dt->setTimezone( $calendar->timezone )->getTimestamp();
352
+					$start = $event->start_dt->setTimezone($calendar->timezone)->getTimestamp();
353 353
 
354
-					if ( 'if-started' == $tag ) {
355
-						if ( $start < $calendar->now ) {
356
-							return $calendar->get_event_html( $event, $partial );
354
+					if ('if-started' == $tag) {
355
+						if ($start < $calendar->now) {
356
+							return $calendar->get_event_html($event, $partial);
357 357
 						}
358
-					} elseif ( 'if-not-started' == $tag ) {
359
-						if ( $start > $calendar->now ) {
360
-							return $calendar->get_event_html( $event, $partial );
358
+					} elseif ('if-not-started' == $tag) {
359
+						if ($start > $calendar->now) {
360
+							return $calendar->get_event_html($event, $partial);
361 361
 						}
362 362
 					}
363 363
 
@@ -366,17 +366,17 @@  discard block
 block discarded – undo
366 366
 				case 'if-ended' :
367 367
 				case 'if-not-ended' :
368 368
 
369
-					if ( false !== $event->end ) {
369
+					if (false !== $event->end) {
370 370
 
371
-						$end = $event->end_dt->setTimezone( $calendar->timezone )->getTimestamp();
371
+						$end = $event->end_dt->setTimezone($calendar->timezone)->getTimestamp();
372 372
 
373
-						if ( 'if-ended' == $tag ) {
374
-							if ( $end < $calendar->now ) {
375
-								return $calendar->get_event_html( $event, $partial );
373
+						if ('if-ended' == $tag) {
374
+							if ($end < $calendar->now) {
375
+								return $calendar->get_event_html($event, $partial);
376 376
 							}
377
-						} elseif ( 'if-not-ended' == $tag ) {
378
-							if ( $end > $calendar->now ) {
379
-								return $calendar->get_event_html( $event, $partial );
377
+						} elseif ('if-not-ended' == $tag) {
378
+							if ($end > $calendar->now) {
379
+								return $calendar->get_event_html($event, $partial);
380 380
 							}
381 381
 						}
382 382
 
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
 					break;
386 386
 
387 387
 				case 'if-end-time' :
388
-					if ( false !== $event->end ) {
389
-						return $calendar->get_event_html( $event, $partial );
388
+					if (false !== $event->end) {
389
+						return $calendar->get_event_html($event, $partial);
390 390
 					}
391 391
 					break;
392 392
 
393 393
 				case 'if-no-end-time' :
394
-					if ( false === $event->end ) {
395
-						return $calendar->get_event_html( $event, $partial );
394
+					if (false === $event->end) {
395
+						return $calendar->get_event_html($event, $partial);
396 396
 					}
397 397
 					break;
398 398
 
@@ -400,59 +400,59 @@  discard block
 block discarded – undo
400 400
 				case 'if-whole-day' :
401 401
 				case 'if-not-all-day' :
402 402
 				case 'if-not-whole-day' :
403
-					$bool = strstr( $tag, 'not' ) ? false : true;
404
-					if ( $bool === $event->whole_day ) {
405
-						return $calendar->get_event_html( $event, $partial );
403
+					$bool = strstr($tag, 'not') ? false : true;
404
+					if ($bool === $event->whole_day) {
405
+						return $calendar->get_event_html($event, $partial);
406 406
 					}
407 407
 					break;
408 408
 
409 409
 				case 'if-recurring' :
410
-					if ( ! empty( $event->recurrence ) ) {
411
-						return $calendar->get_event_html( $event, $partial );
410
+					if ( ! empty($event->recurrence)) {
411
+						return $calendar->get_event_html($event, $partial);
412 412
 					}
413 413
 					break;
414 414
 
415 415
 				case 'if-not-recurring' :
416
-					if ( false === $event->recurrence ) {
417
-						return $calendar->get_event_html( $event, $partial );
416
+					if (false === $event->recurrence) {
417
+						return $calendar->get_event_html($event, $partial);
418 418
 					}
419 419
 					break;
420 420
 
421 421
 				case 'if-multi-day' :
422
-					if ( false !== $event->multiple_days ) {
423
-						return $calendar->get_event_html( $event, $partial );
422
+					if (false !== $event->multiple_days) {
423
+						return $calendar->get_event_html($event, $partial);
424 424
 					}
425 425
 					break;
426 426
 
427 427
 				case 'if-single-day' :
428
-					if ( false === $event->multiple_days ) {
429
-						return $calendar->get_event_html( $event, $partial );
428
+					if (false === $event->multiple_days) {
429
+						return $calendar->get_event_html($event, $partial);
430 430
 					}
431 431
 					break;
432 432
 
433 433
 				case 'if-location' :
434 434
 				case 'if-start-location' :
435
-					if ( ! empty( $event->start_location['address'] ) ) {
436
-						return $calendar->get_event_html( $event, $partial );
435
+					if ( ! empty($event->start_location['address'])) {
436
+						return $calendar->get_event_html($event, $partial);
437 437
 					}
438 438
 					return false;
439 439
 
440 440
 				case 'if-not-location' :
441 441
 				case 'if-not-start-location' :
442
-					if ( empty( $event->start_location['address'] ) ) {
443
-						return $calendar->get_event_html( $event, $partial );
442
+					if (empty($event->start_location['address'])) {
443
+						return $calendar->get_event_html($event, $partial);
444 444
 					}
445 445
 					return '';
446 446
 
447 447
 				case 'if-not-end-location' :
448
-					if ( empty( $event->end_location['address'] ) ) {
449
-						return $calendar->get_event_html( $event, $partial );
448
+					if (empty($event->end_location['address'])) {
449
+						return $calendar->get_event_html($event, $partial);
450 450
 					}
451 451
 					return '';
452 452
 
453 453
 				case 'if-end-location' :
454
-					if ( ! empty( $event->end_location['address'] ) ) {
455
-						return $calendar->get_event_html( $event, $partial );
454
+					if ( ! empty($event->end_location['address'])) {
455
+						return $calendar->get_event_html($event, $partial);
456 456
 					}
457 457
 					return '';
458 458
 
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 				 * ======= */
462 462
 
463 463
 				default :
464
-					return wp_kses_post( $before . $partial . $after );
464
+					return wp_kses_post($before.$partial.$after);
465 465
 			}
466 466
 		}
467 467
 
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
 	 *
480 480
 	 * @return string
481 481
 	 */
482
-	private function limit_words( $text, $limit ) {
482
+	private function limit_words($text, $limit) {
483 483
 
484
-		$limit = max( absint( $limit ), 0 );
484
+		$limit = max(absint($limit), 0);
485 485
 
486
-		if ( $limit > 0 && ( str_word_count( $text, 0 ) > $limit ) ) {
487
-			$words  = str_word_count( $text, 2 );
488
-			$pos    = array_keys( $words );
489
-			$text   = trim( substr( $text, 0, $pos[ $limit ] ) ) . '&hellip;';
486
+		if ($limit > 0 && (str_word_count($text, 0) > $limit)) {
487
+			$words  = str_word_count($text, 2);
488
+			$pos    = array_keys($words);
489
+			$text   = trim(substr($text, 0, $pos[$limit])).'&hellip;';
490 490
 		}
491 491
 
492 492
 		return $text;
@@ -503,26 +503,26 @@  discard block
 block discarded – undo
503 503
 	 *
504 504
 	 * @return string
505 505
 	 */
506
-	private function get_title( $title, $attr ) {
506
+	private function get_title($title, $attr) {
507 507
 
508
-		if ( empty( $title ) ) {
508
+		if (empty($title)) {
509 509
 			return '';
510 510
 		}
511 511
 
512
-		$attr = array_merge( array(
513
-			'html'  => '',  // Parse HTML
514
-			'limit' => 0,   // Trim length to amount of words
515
-		), (array) shortcode_parse_atts( $attr ) );
512
+		$attr = array_merge(array(
513
+			'html'  => '', // Parse HTML
514
+			'limit' => 0, // Trim length to amount of words
515
+		), (array) shortcode_parse_atts($attr));
516 516
 
517
-		if ( ! empty( $attr['html'] ) ) {
518
-			$title = wp_kses_post( $title );
517
+		if ( ! empty($attr['html'])) {
518
+			$title = wp_kses_post($title);
519 519
 			$tag = 'div';
520 520
 		} else {
521
-			$title = $this->limit_words( $title, $attr['limit'] );
521
+			$title = $this->limit_words($title, $attr['limit']);
522 522
 			$tag = 'span';
523 523
 		}
524 524
 
525
-		return '<' . $tag . ' class="simcal-event-title" itemprop="name">' . $title . '</' . $tag . '>';
525
+		return '<'.$tag.' class="simcal-event-title" itemprop="name">'.$title.'</'.$tag.'>';
526 526
 	}
527 527
 
528 528
 	/**
@@ -536,42 +536,42 @@  discard block
 block discarded – undo
536 536
 	 *
537 537
 	 * @return string
538 538
 	 */
539
-	private function get_description( $description, $attr ) {
539
+	private function get_description($description, $attr) {
540 540
 
541
-		if ( empty( $description ) ) {
541
+		if (empty($description)) {
542 542
 			return '';
543 543
 		}
544 544
 
545
-		$attr = array_merge( array(
546
-			'limit'     => 0,       // Trim length to number of words
547
-			'html'      => 'no',    // Parse HTML content
548
-			'markdown'  => 'no',    // Parse Markdown content
549
-			'autolink'  => 'no',    // Automatically convert plaintext URIs to anchors
550
-		), (array) shortcode_parse_atts( $attr ) );
545
+		$attr = array_merge(array(
546
+			'limit'     => 0, // Trim length to number of words
547
+			'html'      => 'no', // Parse HTML content
548
+			'markdown'  => 'no', // Parse Markdown content
549
+			'autolink'  => 'no', // Automatically convert plaintext URIs to anchors
550
+		), (array) shortcode_parse_atts($attr));
551 551
 
552
-		$allow_html = 'no' != $attr['html']     ? true : false;
552
+		$allow_html = 'no' != $attr['html'] ? true : false;
553 553
 		$allow_md   = 'no' != $attr['markdown'] ? true : false;
554 554
 
555 555
 		$html = '<div class="simcal-event-description" itemprop="description">';
556 556
 
557 557
 		// Markdown and HTML don't play well together, use one or the other in the same tag.
558
-		if ( $allow_html || $allow_md ) {
559
-			if ( $allow_html ) {
560
-				$description = wp_kses_post( $description );
561
-			} elseif ( $allow_md ) {
558
+		if ($allow_html || $allow_md) {
559
+			if ($allow_html) {
560
+				$description = wp_kses_post($description);
561
+			} elseif ($allow_md) {
562 562
 				$markdown = new \Parsedown();
563
-				$description = $markdown->text( wp_strip_all_tags( $description ) );
563
+				$description = $markdown->text(wp_strip_all_tags($description));
564 564
 			}
565 565
 		} else {
566
-			$description = wpautop( $description );
566
+			$description = wpautop($description);
567 567
 		}
568 568
 
569
-		$description = $this->limit_words( $description, $attr['limit'] );
569
+		$description = $this->limit_words($description, $attr['limit']);
570 570
 
571
-		$html .= $description . '</div>';
571
+		$html .= $description.'</div>';
572 572
 
573
-		if ( 'no' != $attr['autolink'] ) {
574
-			$html = ' ' . make_clickable( $html );
573
+		if ('no' != $attr['autolink']) {
574
+			$html = ' '.make_clickable($html);
575 575
 		}
576 576
 
577 577
 		return $html;
@@ -587,74 +587,74 @@  discard block
 block discarded – undo
587 587
 	 *
588 588
 	 * @return string
589 589
 	 */
590
-	private function get_when( Event $event ) {
590
+	private function get_when(Event $event) {
591 591
 
592
-		$start = $event->start_dt->setTimezone( $event->timezone );
593
-		$end = ! is_null( $event->end_dt ) ? $event->end_dt->setTimezone( $event->timezone ) : null;
592
+		$start = $event->start_dt->setTimezone($event->timezone);
593
+		$end = ! is_null($event->end_dt) ? $event->end_dt->setTimezone($event->timezone) : null;
594 594
 
595 595
 		$time_start = '';
596 596
 		$time_end = '';
597 597
 
598
-		if ( ! $event->whole_day ) {
598
+		if ( ! $event->whole_day) {
599 599
 
600
-			$time_start = $this->calendar->datetime_separator .
601
-			              ' <span class="simcal-event-start simcal-event-start-time" ' .
602
-			              'data-event-start="' . $start->getTimestamp() . '" ' .
603
-			              'data-event-format="' . $this->calendar->time_format . '" ' .
604
-			              'itemprop="startDate" data-content="' . $start->toIso8601String() . '">' .
605
-			              date_i18n( $this->calendar->time_format, $start->getTimestamp() ) .
600
+			$time_start = $this->calendar->datetime_separator.
601
+			              ' <span class="simcal-event-start simcal-event-start-time" '.
602
+			              'data-event-start="'.$start->getTimestamp().'" '.
603
+			              'data-event-format="'.$this->calendar->time_format.'" '.
604
+			              'itemprop="startDate" data-content="'.$start->toIso8601String().'">'.
605
+			              date_i18n($this->calendar->time_format, $start->getTimestamp()).
606 606
 			              '</span> ';
607 607
 
608
-			if ( $end instanceof Carbon ) {
608
+			if ($end instanceof Carbon) {
609 609
 
610
-				$time_end = ' <span class="simcal-event-end simcal-event-end-time" ' .
611
-				            'data-event-end="' . $end->getTimestamp() . '" ' .
612
-				            'data-event-format="' . $this->calendar->time_format . '" ' .
613
-				            'itemprop="endDate" data-content="' . $end->toIso8601String() . '">' .
614
-				            date_i18n( $this->calendar->time_format, $end->getTimestamp() ) .
610
+				$time_end = ' <span class="simcal-event-end simcal-event-end-time" '.
611
+				            'data-event-end="'.$end->getTimestamp().'" '.
612
+				            'data-event-format="'.$this->calendar->time_format.'" '.
613
+				            'itemprop="endDate" data-content="'.$end->toIso8601String().'">'.
614
+				            date_i18n($this->calendar->time_format, $end->getTimestamp()).
615 615
 				            '</span> ';
616 616
 
617 617
 			}
618 618
 
619 619
 		}
620 620
 
621
-		if ( $event->multiple_days ) {
621
+		if ($event->multiple_days) {
622 622
 
623
-			$output = ' <span class="simcal-event-start simcal-event-start-date" ' .
624
-			          'data-event-start="' . $start->getTimestamp() . '" ' .
625
-			          'data-event-format="' . $this->calendar->date_format . '" ' .
626
-			          'itemprop="startDate" data-content="' . $start->toIso8601String() . '">' .
627
-			          date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
628
-			          '</span> ' .
623
+			$output = ' <span class="simcal-event-start simcal-event-start-date" '.
624
+			          'data-event-start="'.$start->getTimestamp().'" '.
625
+			          'data-event-format="'.$this->calendar->date_format.'" '.
626
+			          'itemprop="startDate" data-content="'.$start->toIso8601String().'">'.
627
+			          date_i18n($this->calendar->date_format, $start->getTimestamp()).
628
+			          '</span> '.
629 629
 			          $time_start;
630 630
 
631
-			if ( $end instanceof Carbon ) {
631
+			if ($end instanceof Carbon) {
632 632
 
633
-				$output .= '-' .
634
-				           ' <span class="simcal-event-start simcal-event-end-date" ' .
635
-				           'data-event-start="' . $end->getTimestamp() . '" ' .
636
-				           'data-event-format="' . $this->calendar->date_format . '" ' .
637
-				           'itemprop="endDate" data-content="' . $end->toIso8601String() . '">' .
638
-				           date_i18n( $this->calendar->date_format, $end->getTimestamp() ) .
639
-				           '</span> ' .
633
+				$output .= '-'.
634
+				           ' <span class="simcal-event-start simcal-event-end-date" '.
635
+				           'data-event-start="'.$end->getTimestamp().'" '.
636
+				           'data-event-format="'.$this->calendar->date_format.'" '.
637
+				           'itemprop="endDate" data-content="'.$end->toIso8601String().'">'.
638
+				           date_i18n($this->calendar->date_format, $end->getTimestamp()).
639
+				           '</span> '.
640 640
 				           $time_end;
641 641
 			}
642 642
 
643 643
 		} else {
644 644
 
645
-			$time_end = ! empty( $time_start ) && ! empty( $time_end ) ? ' - ' . $time_end : '';
645
+			$time_end = ! empty($time_start) && ! empty($time_end) ? ' - '.$time_end : '';
646 646
 
647
-			$output = ' <span class="simcal-event-start simcal-event-start-date" ' .
648
-			          'data-event-start="' . $start->getTimestamp() . '" ' .
649
-			          'data-event-format="' . $this->calendar->date_format . '">' .
650
-			          date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
651
-			          '</span> ' .
652
-			          $time_start .
647
+			$output = ' <span class="simcal-event-start simcal-event-start-date" '.
648
+			          'data-event-start="'.$start->getTimestamp().'" '.
649
+			          'data-event-format="'.$this->calendar->date_format.'">'.
650
+			          date_i18n($this->calendar->date_format, $start->getTimestamp()).
651
+			          '</span> '.
652
+			          $time_start.
653 653
 			          $time_end;
654 654
 
655 655
 		}
656 656
 
657
-		return trim( $output );
657
+		return trim($output);
658 658
 	}
659 659
 
660 660
 	/**
@@ -669,50 +669,50 @@  discard block
 block discarded – undo
669 669
 	 *
670 670
 	 * @return string
671 671
 	 */
672
-	private function get_dt( $tag, Event $event, $attr ) {
672
+	private function get_dt($tag, Event $event, $attr) {
673 673
 
674
-		$bound = 0 === strpos( $tag, 'end' ) ? 'end' : 'start';
675
-		if ( ( 'end' == $bound ) && ( false === $event->end ) ) {
674
+		$bound = 0 === strpos($tag, 'end') ? 'end' : 'start';
675
+		if (('end' == $bound) && (false === $event->end)) {
676 676
 			return '';
677 677
 		}
678 678
 
679
-		$dt = $bound . '_dt';
680
-		if ( ! $event->$dt instanceof Carbon ) {
679
+		$dt = $bound.'_dt';
680
+		if ( ! $event->$dt instanceof Carbon) {
681 681
 			return '';
682 682
 		}
683
-		$event_dt = $event->$dt->setTimezone( $event->timezone );
683
+		$event_dt = $event->$dt->setTimezone($event->timezone);
684 684
 
685
-		$attr = array_merge( array(
685
+		$attr = array_merge(array(
686 686
 			'format'    => '',
687
-		), (array) shortcode_parse_atts( $attr ) );
687
+		), (array) shortcode_parse_atts($attr));
688 688
 
689
-		$format = ltrim( strstr( $tag, '-' ), '-' );
689
+		$format = ltrim(strstr($tag, '-'), '-');
690 690
 		$dt_format = '';
691
-		if ( ! empty( $attr['format'] ) ) {
692
-			$dt_format = esc_attr( wp_strip_all_tags( $attr['format'] ) );
693
-		} elseif ( 'date' == $format ) {
691
+		if ( ! empty($attr['format'])) {
692
+			$dt_format = esc_attr(wp_strip_all_tags($attr['format']));
693
+		} elseif ('date' == $format) {
694 694
 			$dt_format = $this->calendar->date_format;
695
-		} elseif ( 'time' == $format ) {
695
+		} elseif ('time' == $format) {
696 696
 			$dt_format = $this->calendar->time_format;
697 697
 		}
698 698
 
699
-		if ( 'human' == $format ) {
700
-			$value = human_time_diff( $event_dt->getTimestamp(), Carbon::now( $event->timezone )->getTimestamp() );
699
+		if ('human' == $format) {
700
+			$value = human_time_diff($event_dt->getTimestamp(), Carbon::now($event->timezone)->getTimestamp());
701 701
 
702
-			if ( $event_dt->getTimestamp() < Carbon::now( $event->timezone )->getTimestamp() ) {
703
-				$value .= ' ' . _x( 'ago', 'human date event builder code modifier', 'google-calendar-events' );
702
+			if ($event_dt->getTimestamp() < Carbon::now($event->timezone)->getTimestamp()) {
703
+				$value .= ' '._x('ago', 'human date event builder code modifier', 'google-calendar-events');
704 704
 			} else {
705
-				$value .= ' ' . _x( 'from now', 'human date event builder code modifier', 'google-calendar-events' );
705
+				$value .= ' '._x('from now', 'human date event builder code modifier', 'google-calendar-events');
706 706
 			}
707 707
 		} else {
708
-			$value = date_i18n( $dt_format, $event_dt->getTimestamp() );
708
+			$value = date_i18n($dt_format, $event_dt->getTimestamp());
709 709
 		}
710 710
 
711
-		return '<span class="simcal-event-' . $bound . ' ' . 'simcal-event-' . $bound . '-' . $format . '" ' .
712
-		       'data-event-' . $bound . '="' . $event_dt->getTimestamp() . '" ' .
713
-		       'data-event-format="' . $dt_format . '" ' .
714
-		       'itemprop="' . $bound . 'Date" data-content="' . $event_dt->toIso8601String() . '">' .
715
-		       $value .
711
+		return '<span class="simcal-event-'.$bound.' '.'simcal-event-'.$bound.'-'.$format.'" '.
712
+		       'data-event-'.$bound.'="'.$event_dt->getTimestamp().'" '.
713
+		       'data-event-format="'.$dt_format.'" '.
714
+		       'itemprop="'.$bound.'Date" data-content="'.$event_dt->toIso8601String().'">'.
715
+		       $value.
716 716
 		       '</span>';
717 717
 	}
718 718
 
@@ -729,23 +729,23 @@  discard block
 block discarded – undo
729 729
 	 *
730 730
 	 * @return string
731 731
 	 */
732
-	private function make_link( $tag, $url, $content, $attr ) {
732
+	private function make_link($tag, $url, $content, $attr) {
733 733
 
734
-		if ( empty( $url ) ) {
734
+		if (empty($url)) {
735 735
 			return '';
736 736
 		}
737 737
 
738
-		$text = empty( $content ) ? $url : $content;
738
+		$text = empty($content) ? $url : $content;
739 739
 
740
-		$attr = array_merge( array(
741
-			'autolink'  => false,   // Convert url to link anchor
742
-			'newwindow' => false,   // If autolink attribute is true, open link in new window
743
-		), (array) shortcode_parse_atts( $attr ) );
740
+		$attr = array_merge(array(
741
+			'autolink'  => false, // Convert url to link anchor
742
+			'newwindow' => false, // If autolink attribute is true, open link in new window
743
+		), (array) shortcode_parse_atts($attr));
744 744
 
745 745
 		$anchor = $tag != 'url' ? 'yes' : $attr['autolink'];
746 746
 		$target = $attr['newwindow'] !== false ? 'target="_blank"' : '';
747 747
 
748
-		return $anchor !== false ? ' <a href="' . esc_url( $url ) . '" ' . $target . '>' . $text . '</a>' : ' ' . $text;
748
+		return $anchor !== false ? ' <a href="'.esc_url($url).'" '.$target.'>'.$text.'</a>' : ' '.$text;
749 749
 	}
750 750
 
751 751
 	/**
@@ -758,20 +758,20 @@  discard block
 block discarded – undo
758 758
 	 *
759 759
 	 * @return string
760 760
 	 */
761
-	private function get_attachments( $attachments ) {
761
+	private function get_attachments($attachments) {
762 762
 
763
-		$html = '<ul class="simcal-attachments">' . "\n\t";
763
+		$html = '<ul class="simcal-attachments">'."\n\t";
764 764
 
765
-		foreach ( $attachments as $attachment ) {
765
+		foreach ($attachments as $attachment) {
766 766
 			$html .= '<li class="simcal-attachment">';
767
-			$html .= '<a href="' . $attachment['url'] . '" target="_blank">';
768
-			$html .= ! empty( $attachment['icon'] ) ? '<img src="' . $attachment['icon'] . '" />' : '';
769
-			$html .= '<span>' . $attachment['name'] . '</span>';
767
+			$html .= '<a href="'.$attachment['url'].'" target="_blank">';
768
+			$html .= ! empty($attachment['icon']) ? '<img src="'.$attachment['icon'].'" />' : '';
769
+			$html .= '<span>'.$attachment['name'].'</span>';
770 770
 			$html .= '</a>';
771
-			$html .= '</li>' . "\n";
771
+			$html .= '</li>'."\n";
772 772
 		}
773 773
 
774
-		$html .= '</ul>' . "\n";
774
+		$html .= '</ul>'."\n";
775 775
 
776 776
 		return $html;
777 777
 	}
@@ -787,41 +787,41 @@  discard block
 block discarded – undo
787 787
 	 *
788 788
 	 * @return string
789 789
 	 */
790
-	private function get_attendees( $attendees, $attr ) {
790
+	private function get_attendees($attendees, $attr) {
791 791
 
792
-		$attr = array_merge( array(
793
-			'photo'     => 'show',  // show/hide attendee photo
794
-			'email'     => 'hide',  // show/hide attendee email address
795
-			'rsvp'      => 'hide',  // show/hide rsvp response status
796
-			'response'  => '',      // filter attendees by rsvp response (yes/no/maybe)
797
-		), (array) shortcode_parse_atts( $attr ) );
792
+		$attr = array_merge(array(
793
+			'photo'     => 'show', // show/hide attendee photo
794
+			'email'     => 'hide', // show/hide attendee email address
795
+			'rsvp'      => 'hide', // show/hide rsvp response status
796
+			'response'  => '', // filter attendees by rsvp response (yes/no/maybe)
797
+		), (array) shortcode_parse_atts($attr));
798 798
 
799
-		$html = '<ul class="simcal-attendees" itemprop="attendees">' . "\n\t";
799
+		$html = '<ul class="simcal-attendees" itemprop="attendees">'."\n\t";
800 800
 
801 801
 		$known = 0;
802 802
 		$unknown = 0;
803 803
 
804
-		foreach ( $attendees as $attendee ) {
804
+		foreach ($attendees as $attendee) {
805 805
 
806
-			if ( 'yes' == $attr['response'] && 'yes' != $attendee['response'] ) {
806
+			if ('yes' == $attr['response'] && 'yes' != $attendee['response']) {
807 807
 				continue;
808
-			} elseif ( 'no' == $attr['response'] && 'no' != $attendee['response'] ) {
808
+			} elseif ('no' == $attr['response'] && 'no' != $attendee['response']) {
809 809
 				continue;
810
-			} elseif ( 'maybe' == $attr['response'] && ! in_array( $attendee['response'], array( 'yes', 'maybe' ) ) ) {
810
+			} elseif ('maybe' == $attr['response'] && ! in_array($attendee['response'], array('yes', 'maybe'))) {
811 811
 				continue;
812 812
 			}
813 813
 
814
-			if ( ! empty( $attendee['name'] ) ) {
814
+			if ( ! empty($attendee['name'])) {
815 815
 
816
-				$photo      = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="' . $attendee['photo'] . '" itemprop="image" />' : '';
817
-				$response   = 'hide' != $attr['rsvp'] ? $this->get_rsvp_response( $attendee['response'] ) : '';
818
-				$guest      = $photo . '<span itemprop="name">' . $attendee['name'] . $response . '</span>';
816
+				$photo      = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="'.$attendee['photo'].'" itemprop="image" />' : '';
817
+				$response   = 'hide' != $attr['rsvp'] ? $this->get_rsvp_response($attendee['response']) : '';
818
+				$guest      = $photo.'<span itemprop="name">'.$attendee['name'].$response.'</span>';
819 819
 
820
-				if ( ! empty( $attendee['email'] ) && ( 'show' == $attr['email'] ) ) {
821
-					$guest = sprintf( '<a href="mailto:' . $attendee['email'] . '" itemprop="email">%s</a>', $guest );
820
+				if ( ! empty($attendee['email']) && ('show' == $attr['email'])) {
821
+					$guest = sprintf('<a href="mailto:'.$attendee['email'].'" itemprop="email">%s</a>', $guest);
822 822
 				}
823 823
 
824
-				$html .= '<li class="simcal-attendee" itemprop="attendee" itemscope itemtype="http://schema.org/Person">' . $guest . '</li>' . "\n";
824
+				$html .= '<li class="simcal-attendee" itemprop="attendee" itemscope itemtype="http://schema.org/Person">'.$guest.'</li>'."\n";
825 825
 
826 826
 				$known++;
827 827
 
@@ -832,21 +832,21 @@  discard block
 block discarded – undo
832 832
 			}
833 833
 		}
834 834
 
835
-		if ( $unknown > 0 ) {
836
-			if ( $known > 0 ) {
835
+		if ($unknown > 0) {
836
+			if ($known > 0) {
837 837
 				/* translators: One more person attending the event. */
838
-				$others = sprintf( _n( '1 more attendee', '%s more attendees', $unknown, 'google-calendar-events' ), $unknown );
838
+				$others = sprintf(_n('1 more attendee', '%s more attendees', $unknown, 'google-calendar-events'), $unknown);
839 839
 			} else {
840 840
 				/* translators: One or more persons attending the event whose name is unknown. */
841
-				$others = sprintf( _n( '1 anonymous attendee', '%s anonymous attendees', $unknown, 'google-calendar-events' ), $unknown );
841
+				$others = sprintf(_n('1 anonymous attendee', '%s anonymous attendees', $unknown, 'google-calendar-events'), $unknown);
842 842
 			}
843
-			$photo = $attr['photo'] !== 'hide' ? get_avatar( '', 128 ) : '';
844
-			$html .= '<li class="simcal-attendee simcal-attendee-anonymous">' . $photo . '<span>' . $others . '</span></li>' . "\n";
845
-		} elseif ( $known === 0 ) {
846
-			$html .= '<li class="simcal-attendee">' . _x( 'No one yet', 'No one yet rsvp to attend the event.', 'google-calendar-events' ) . '</li>' . "\n";
843
+			$photo = $attr['photo'] !== 'hide' ? get_avatar('', 128) : '';
844
+			$html .= '<li class="simcal-attendee simcal-attendee-anonymous">'.$photo.'<span>'.$others.'</span></li>'."\n";
845
+		} elseif ($known === 0) {
846
+			$html .= '<li class="simcal-attendee">'._x('No one yet', 'No one yet rsvp to attend the event.', 'google-calendar-events').'</li>'."\n";
847 847
 		}
848 848
 
849
-		$html .= '</ul>' . "\n";
849
+		$html .= '</ul>'."\n";
850 850
 
851 851
 		return $html;
852 852
 	}
@@ -860,23 +860,23 @@  discard block
 block discarded – undo
860 860
 	 *
861 861
 	 * @return string
862 862
 	 */
863
-	private function get_rsvp_response( $response ) {
863
+	private function get_rsvp_response($response) {
864 864
 
865
-		if ( 'yes' == $response ) {
865
+		if ('yes' == $response) {
866 866
 			/* translators: Someone replied with 'yes' to a rsvp request. */
867
-			$rsvp = __( 'Attending', 'google-calendar-events' );
868
-		} elseif ( 'no' == $response ) {
867
+			$rsvp = __('Attending', 'google-calendar-events');
868
+		} elseif ('no' == $response) {
869 869
 			/* translators: Someone replied with 'no' to a rsvp request. */
870
-			$rsvp = __( 'Not attending', 'google-calendar-events' );
871
-		} elseif ( 'maybe' == $response ) {
870
+			$rsvp = __('Not attending', 'google-calendar-events');
871
+		} elseif ('maybe' == $response) {
872 872
 			/* translators: Someone replied with 'maybe' to a rsvp request. */
873
-			$rsvp = __( 'Maybe attending', 'google-calendar-events' );
873
+			$rsvp = __('Maybe attending', 'google-calendar-events');
874 874
 		} else {
875 875
 			/* translators: Someone did not send yet a rsvp confirmation to join an event. */
876
-			$rsvp = __( 'Response pending', 'google-calendar-events' );
876
+			$rsvp = __('Response pending', 'google-calendar-events');
877 877
 		}
878 878
 
879
-		return ' <small>(' . $rsvp . ')</small>';
879
+		return ' <small>('.$rsvp.')</small>';
880 880
 	}
881 881
 
882 882
 	/**
@@ -890,21 +890,21 @@  discard block
 block discarded – undo
890 890
 	 *
891 891
 	 * @return string
892 892
 	 */
893
-	private function get_organizer( $organizer, $attr ) {
893
+	private function get_organizer($organizer, $attr) {
894 894
 
895
-		$attr = array_merge( array(
896
-			'photo' => 'show',  // show/hide attendee photo
897
-			'email' => 'hide',  // show/hide attendee email address
898
-		), (array) shortcode_parse_atts( $attr ) );
895
+		$attr = array_merge(array(
896
+			'photo' => 'show', // show/hide attendee photo
897
+			'email' => 'hide', // show/hide attendee email address
898
+		), (array) shortcode_parse_atts($attr));
899 899
 
900
-		$photo           = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="' . $organizer['photo'] . '" itemprop="image"  />' : '';
901
-		$organizer_html  = $photo . '<span itemprop="name">' . $organizer['name'] . '</span>';
900
+		$photo           = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="'.$organizer['photo'].'" itemprop="image"  />' : '';
901
+		$organizer_html  = $photo.'<span itemprop="name">'.$organizer['name'].'</span>';
902 902
 
903
-		if ( ! empty( $organizer['email'] ) && ( 'show' == $attr['email'] ) ) {
904
-			$organizer_html = sprintf( '<a href="mailto:' . $organizer['email'] . '" itemprop="email">%s</a>', $organizer_html );
903
+		if ( ! empty($organizer['email']) && ('show' == $attr['email'])) {
904
+			$organizer_html = sprintf('<a href="mailto:'.$organizer['email'].'" itemprop="email">%s</a>', $organizer_html);
905 905
 		}
906 906
 
907
-		return '<div class="simcal-organizer" itemprop="organizer" itemscope itemtype="https://schema.org/Person">' . $organizer_html . '</div>';
907
+		return '<div class="simcal-organizer" itemprop="organizer" itemscope itemtype="https://schema.org/Person">'.$organizer_html.'</div>';
908 908
 	}
909 909
 
910 910
 	/**
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 		// This is largely borrowed on get_shortcode_regex() from WordPress Core.
930 930
 		// @see /wp-includes/shortcodes.php (with some modification)
931 931
 
932
-		$tagregexp = implode( '|', array_values( $this->tags ) );
932
+		$tagregexp = implode('|', array_values($this->tags));
933 933
 
934 934
 		return '/'
935 935
 		       . '\\['                              // Opening bracket
Please login to merge, or discard this patch.