Completed
Push — master ( f805dd...62b222 )
by
unknown
03:34
created
includes/admin/pages/licenses.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@
 block discarded – undo
75 75
 			'keys' => array(
76 76
 				'title' => __( 'Premium Add-on License Keys', 'google-calendar-events' ),
77 77
 				'description' => __( 'Enter your add-on license keys below, making sure to activate each one to ensure they are valid.', 'google-calendar-events' ) .
78
-				                 '<br/><br/>' .
79
-				                 '<em>' . __( 'Your license keys are used for access to automatic upgrades and premium support.', 'google-calendar-events' ) . '</em>',
78
+								 '<br/><br/>' .
79
+								 '<em>' . __( 'Your license keys are used for access to automatic upgrades and premium support.', 'google-calendar-events' ) . '</em>',
80 80
 			),
81 81
 		);
82 82
 		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', $sections );
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Admin_Page;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$this->id           = $tab = 'licenses';
32 32
 		$this->option_group = $page = 'settings';
33
-		$this->label        = __( 'Add-on Licenses', 'google-calendar-events' );
33
+		$this->label        = __('Add-on Licenses', 'google-calendar-events');
34 34
 		//$this->description  = __( 'Manage your premium add-on license keys.', 'google-calendar-events' );
35 35
 		$this->sections     = $this->add_sections();
36 36
 		$this->fields       = $this->add_fields();
37 37
 
38 38
 		// Disabled the 'save changes' button for this page.
39
-		add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } );
39
+		add_filter('simcal_admin_page_'.$page.'_'.$tab.'_submit', function() { return false; } );
40 40
 
41 41
 		// Add html to page.
42
-		add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( __CLASS__, 'html' ) );
42
+		add_action('simcal_admin_page_'.$page.'_'.$tab.'_end', array(__CLASS__, 'html'));
43 43
 	}
44 44
 
45 45
 	/**
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @return void
51 51
 	 */
52
-	public static function html()  {
52
+	public static function html() {
53 53
 		// Add a nonce field used in ajax.
54
-		wp_nonce_field( 'simcal_license_manager', 'simcal_license_manager' );
54
+		wp_nonce_field('simcal_license_manager', 'simcal_license_manager');
55 55
 		// Add a license 'reset' button.
56 56
 		?>
57 57
 		<br><br>
58
-		<a href="#" id="simcal-reset-licenses" data-dialog="<?php _e( 'WARNING: Are you sure you want to start over and delete all license keys from the settings?', 'google-calendar-events' ) ?>">
59
-			<?php _e( 'Delete your license keys', 'google-calendar-events' ) ?>
58
+		<a href="#" id="simcal-reset-licenses" data-dialog="<?php _e('WARNING: Are you sure you want to start over and delete all license keys from the settings?', 'google-calendar-events') ?>">
59
+			<?php _e('Delete your license keys', 'google-calendar-events') ?>
60 60
 			<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i>
61 61
 		</a>
62 62
 		<?php
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
 	public function add_sections() {
74 74
 		$sections = array(
75 75
 			'keys' => array(
76
-				'title' => __( 'Premium Add-on License Keys', 'google-calendar-events' ),
77
-				'description' => __( 'Enter your add-on license keys below, making sure to activate each one to ensure they are valid.', 'google-calendar-events' ) .
78
-				                 '<br/><br/>' .
79
-				                 '<em>' . __( 'Your license keys are used for access to automatic upgrades and premium support.', 'google-calendar-events' ) . '</em>',
76
+				'title' => __('Premium Add-on License Keys', 'google-calendar-events'),
77
+				'description' => __('Enter your add-on license keys below, making sure to activate each one to ensure they are valid.', 'google-calendar-events').
78
+				                 '<br/><br/>'.
79
+				                 '<em>'.__('Your license keys are used for access to automatic upgrades and premium support.', 'google-calendar-events').'</em>',
80 80
 			),
81 81
 		);
82
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', $sections );
82
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', $sections);
83 83
 	}
84 84
 
85 85
 	/**
@@ -92,25 +92,25 @@  discard block
 block discarded – undo
92 92
 	public function add_fields() {
93 93
 
94 94
 		$fields = array();
95
-		$this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id );
95
+		$this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id);
96 96
 
97
-		foreach ( $this->sections as $section => $contents ) {
97
+		foreach ($this->sections as $section => $contents) {
98 98
 
99
-			if ( 'keys' == $section ) {
99
+			if ('keys' == $section) {
100 100
 
101
-				$addons = apply_filters( 'simcal_installed_addons', array() );
101
+				$addons = apply_filters('simcal_installed_addons', array());
102 102
 
103
-				if ( ! empty( $addons ) && is_array( $addons ) ) {
103
+				if ( ! empty($addons) && is_array($addons)) {
104 104
 
105
-					foreach ( $addons as $addon_id => $addon_name ) {
105
+					foreach ($addons as $addon_id => $addon_name) {
106 106
 
107
-						$fields[ $section ][ $addon_id ] = array(
107
+						$fields[$section][$addon_id] = array(
108 108
 							'type'      => 'license',
109 109
 							'addon'     => $addon_id,
110
-							'title'     => esc_attr( $addon_name ),
111
-							'name'      => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][' . $addon_id . ']',
112
-							'id'        => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-' . sanitize_key( $addon_id ),
113
-							'value'     => $this->get_option_value( $section, $addon_id ),
110
+							'title'     => esc_attr($addon_name),
111
+							'name'      => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.']['.$addon_id.']',
112
+							'id'        => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-'.sanitize_key($addon_id),
113
+							'value'     => $this->get_option_value($section, $addon_id),
114 114
 							'class'     => array(
115 115
 								'regular-text',
116 116
 								'ltr',
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 		}
127 127
 
128
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields );
128
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields);
129 129
 	}
130 130
 
131 131
 }
Please login to merge, or discard this patch.
includes/admin/pages/system-status.php 1 patch
Spacing   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Admin_Page;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$this->id           = $tab = 'system-status';
32 32
 		$this->option_group = $page = 'tools';
33
-		$this->label        = __( 'System Report', 'google-calendar-events' );
33
+		$this->label        = __('System Report', 'google-calendar-events');
34 34
 		$this->description  = '';
35 35
 		$this->sections     = $this->add_sections();
36 36
 		$this->fields       = $this->add_fields();
37 37
 
38 38
 		// Disable the submit button for this page.
39
-		add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } );
39
+		add_filter('simcal_admin_page_'.$page.'_'.$tab.'_submit', function() { return false; } );
40 40
 
41 41
 		// Add html.
42
-		add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( $this, 'html' ) );
42
+		add_action('simcal_admin_page_'.$page.'_'.$tab.'_end', array($this, 'html'));
43 43
 	}
44 44
 
45 45
 	/**
@@ -51,37 +51,37 @@  discard block
 block discarded – undo
51 51
 
52 52
 		?>
53 53
 		<div id="simcal-system-status-report">
54
-			<p><?php _e( 'Please copy and paste this information when contacting support:', 'google-calendar-events' ); ?> </p>
54
+			<p><?php _e('Please copy and paste this information when contacting support:', 'google-calendar-events'); ?> </p>
55 55
 			<textarea readonly="readonly" onclick="this.select();"></textarea>
56
-			<p><?php _e( 'You can also download your information as a text file to attach, or simply view it below.', 'google-calendar-events' ); ?></p>
57
-			<p><a href="#" id="simcal-system-status-report-download" class="button button-primary"><?php _e( 'Download System Report', 'google-calendar-events' ); ?></a></p>
56
+			<p><?php _e('You can also download your information as a text file to attach, or simply view it below.', 'google-calendar-events'); ?></p>
57
+			<p><a href="#" id="simcal-system-status-report-download" class="button button-primary"><?php _e('Download System Report', 'google-calendar-events'); ?></a></p>
58 58
 		</div>
59 59
 		<hr>
60 60
 		<?php
61 61
 
62 62
 		global $wpdb;
63
-		$wp_version = get_bloginfo( 'version' );
63
+		$wp_version = get_bloginfo('version');
64 64
 
65 65
 		$sections = array();
66 66
 		$panels   = array(
67 67
 			'wordpress' => array(
68
-				'label'  => __( 'WordPress Installation', 'google-calendar-events' ),
68
+				'label'  => __('WordPress Installation', 'google-calendar-events'),
69 69
 				'export' => 'WordPress Installation',
70 70
 			),
71 71
 			'theme'     => array(
72
-				'label'  => __( 'Active Theme', 'google-calendar-events' ),
72
+				'label'  => __('Active Theme', 'google-calendar-events'),
73 73
 				'export' => 'Active Theme',
74 74
 			),
75 75
 			'plugins'   => array(
76
-				'label'  => __( 'Active Plugins', 'google-calendar-events' ),
76
+				'label'  => __('Active Plugins', 'google-calendar-events'),
77 77
 				'export' => 'Active Plugins',
78 78
 			),
79 79
 			'server'    => array(
80
-				'label'  => __( 'Server Environment', 'google-calendar-events' ),
80
+				'label'  => __('Server Environment', 'google-calendar-events'),
81 81
 				'export' => 'Server Environment',
82 82
 			),
83 83
 			'client'    => array(
84
-				'label'  => __( 'Client Information', 'google-calendar-events' ),
84
+				'label'  => __('Client Information', 'google-calendar-events'),
85 85
 				'export' => 'Client Information',
86 86
 			)
87 87
 		);
@@ -98,68 +98,68 @@  discard block
 block discarded – undo
98 98
 		 * ======================
99 99
 		 */
100 100
 
101
-		$debug_mode = $script_debug = __( 'No', 'google-calendar-events' );
102
-		if ( defined( 'WP_DEBUG' ) ) {
103
-			$debug_mode = true === WP_DEBUG ? __( 'Yes', 'google-calendar-events' ) : $debug_mode;
101
+		$debug_mode = $script_debug = __('No', 'google-calendar-events');
102
+		if (defined('WP_DEBUG')) {
103
+			$debug_mode = true === WP_DEBUG ? __('Yes', 'google-calendar-events') : $debug_mode;
104 104
 		}
105
-		if ( defined( 'SCRIPT_DEBUG' ) ) {
106
-			$script_debug = true === SCRIPT_DEBUG ? __( 'Yes', 'google-calendar-events' ) : $script_debug;
105
+		if (defined('SCRIPT_DEBUG')) {
106
+			$script_debug = true === SCRIPT_DEBUG ? __('Yes', 'google-calendar-events') : $script_debug;
107 107
 		}
108 108
 
109
-		$memory = $this->let_to_num( WP_MEMORY_LIMIT );
110
-		$memory_export = size_format( $memory );
111
-		if ( $memory < 67108864 ) {
112
-			$memory = '<mark class="error">' . sprintf( __( '%1$s - It is recomendend to set memory to at least 64MB. See: <a href="%2$s" target="_blank">Increasing memory allocated to PHP</a>', 'google-calendar-events' ), $memory_export, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>';
109
+		$memory = $this->let_to_num(WP_MEMORY_LIMIT);
110
+		$memory_export = size_format($memory);
111
+		if ($memory < 67108864) {
112
+			$memory = '<mark class="error">'.sprintf(__('%1$s - It is recomendend to set memory to at least 64MB. See: <a href="%2$s" target="_blank">Increasing memory allocated to PHP</a>', 'google-calendar-events'), $memory_export, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP').'</mark>';
113 113
 		} else {
114
-			$memory = '<mark class="ok">' . $memory_export . '</mark>';
114
+			$memory = '<mark class="ok">'.$memory_export.'</mark>';
115 115
 		}
116 116
 
117
-		$permalinks = get_option( 'permalink_structure' );
118
-		$permalinks = empty( $permalinks ) ? '/?' : $permalinks;
117
+		$permalinks = get_option('permalink_structure');
118
+		$permalinks = empty($permalinks) ? '/?' : $permalinks;
119 119
 
120 120
 		$is_multisite = is_multisite();
121 121
 
122 122
 		$sections['wordpress'] = array(
123 123
 			'name'          => array(
124
-				'label'  => __( 'Site Name', 'google-calendar-events' ),
124
+				'label'  => __('Site Name', 'google-calendar-events'),
125 125
 				'label_export' => 'Site Name',
126
-				'result' => get_bloginfo( 'name' ),
126
+				'result' => get_bloginfo('name'),
127 127
 			),
128 128
 			'home_url'      => array(
129
-				'label'  => __( 'Home URL', 'google-calendar-events' ),
129
+				'label'  => __('Home URL', 'google-calendar-events'),
130 130
 				'label_export' => 'Home URL',
131 131
 				'result' => home_url(),
132 132
 			),
133 133
 			'site_url'      => array(
134
-				'label'  => __( 'Site URL', 'google-calendar-events' ),
134
+				'label'  => __('Site URL', 'google-calendar-events'),
135 135
 				'label_export' => 'Site URL',
136 136
 				'result' => site_url(),
137 137
 			),
138 138
 			'version'       => array(
139
-				'label'  => __( 'Version', 'google-calendar-events' ),
139
+				'label'  => __('Version', 'google-calendar-events'),
140 140
 				'label_export' => 'Version',
141 141
 				'result' => $wp_version,
142 142
 			),
143 143
 			'locale'        => array(
144
-				'label'  => __( 'Locale', 'google-calendar-events' ),
144
+				'label'  => __('Locale', 'google-calendar-events'),
145 145
 				'label_export' => 'Locale',
146 146
 				'result' => get_locale(),
147 147
 			),
148 148
 			'wp_timezone'   => array(
149
-				'label'  => __( 'Timezone', 'google-calendar-events' ),
149
+				'label'  => __('Timezone', 'google-calendar-events'),
150 150
 				'label_export' => 'Timezone',
151 151
 				'result' => simcal_get_wp_timezone(),
152 152
 			),
153 153
 			'multisite'     => array(
154
-				'label'  => __( 'Multisite', 'google-calendar-events' ),
154
+				'label'  => __('Multisite', 'google-calendar-events'),
155 155
 				'label_export' => 'Multisite',
156
-				'result' => $is_multisite ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
156
+				'result' => $is_multisite ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
157 157
 				'result_export' => $is_multisite ? 'Yes' : 'No'
158 158
 			),
159 159
 			'permalink'     => array(
160
-				'label'  => __( 'Permalinks', 'google-calendar-events' ),
160
+				'label'  => __('Permalinks', 'google-calendar-events'),
161 161
 				'label_export' => 'Permalinks',
162
-				'result' => '<code>' . $permalinks . '</code>',
162
+				'result' => '<code>'.$permalinks.'</code>',
163 163
 				'result_export' => $permalinks,
164 164
 			),
165 165
 			'memory_limit'  => array(
@@ -182,86 +182,86 @@  discard block
 block discarded – undo
182 182
 		 * ============
183 183
 		 */
184 184
 
185
-		include_once ABSPATH . 'wp-admin/includes/theme-install.php';
185
+		include_once ABSPATH.'wp-admin/includes/theme-install.php';
186 186
 
187
-		if ( version_compare( $wp_version, '3.4', '<' ) ) {
188
-			$active_theme  = get_theme_data( get_stylesheet_directory() . '/style.css' );
189
-			$theme_name    = '<a href="' . $active_theme['URI'] . '" target="_blank">' . $active_theme['Name'] . '</a>';
187
+		if (version_compare($wp_version, '3.4', '<')) {
188
+			$active_theme  = get_theme_data(get_stylesheet_directory().'/style.css');
189
+			$theme_name    = '<a href="'.$active_theme['URI'].'" target="_blank">'.$active_theme['Name'].'</a>';
190 190
 			$theme_version = $active_theme['Version'];
191
-			$theme_author  = '<a href="' . $active_theme['AuthorURI'] . '" target="_blank">' . $active_theme['Author'] . '</a>';
192
-			$theme_export  = $active_theme['Name'] . ' - ' . $theme_version;
191
+			$theme_author  = '<a href="'.$active_theme['AuthorURI'].'" target="_blank">'.$active_theme['Author'].'</a>';
192
+			$theme_export  = $active_theme['Name'].' - '.$theme_version;
193 193
 		} else {
194 194
 			$active_theme  = wp_get_theme();
195
-			$theme_name    = '<a href="' . $active_theme->ThemeURI . '" target="_blank">' . $active_theme->Name . '</a>';
195
+			$theme_name    = '<a href="'.$active_theme->ThemeURI.'" target="_blank">'.$active_theme->Name.'</a>';
196 196
 			$theme_version = $active_theme->Version;
197 197
 			$theme_author  = $active_theme->Author;
198
-			$theme_export  = $active_theme->Name . ' - ' . $theme_version;
198
+			$theme_export  = $active_theme->Name.' - '.$theme_version;
199 199
 		}
200 200
 
201 201
 		$theme_update_version = $theme_version;
202 202
 
203
-		$api = themes_api( 'theme_information', array(
203
+		$api = themes_api('theme_information', array(
204 204
 			'slug'   => get_template(),
205
-			'fields' => array( 'sections' => false, 'tags' => false ),
206
-		) );
207
-		if ( $api && ! is_wp_error( $api ) ) {
205
+			'fields' => array('sections' => false, 'tags' => false),
206
+		));
207
+		if ($api && ! is_wp_error($api)) {
208 208
 			$theme_update_version = $api->version;
209 209
 		}
210 210
 
211
-		if ( version_compare( $theme_version, $theme_update_version, '<' ) ) {
212
-			$theme_version = '<mark class="error">' . $theme_version . ' (' . sprintf( __( '%s is available', 'google-calendar-events' ), esc_html( $theme_update_version ) ) . ')</mark>';
211
+		if (version_compare($theme_version, $theme_update_version, '<')) {
212
+			$theme_version = '<mark class="error">'.$theme_version.' ('.sprintf(__('%s is available', 'google-calendar-events'), esc_html($theme_update_version)).')</mark>';
213 213
 		} else {
214
-			$theme_version = '<mark class="ok">' . $theme_version . '</mark>';
214
+			$theme_version = '<mark class="ok">'.$theme_version.'</mark>';
215 215
 		}
216 216
 
217 217
 		$theme  = '<dl>';
218
-		$theme .= '<dt>' . __( 'Name', 'google-calendar-events' ) . '</dt>';
219
-		$theme .= '<dd>' . $theme_name . '</dd>';
220
-		$theme .= '<dt>' . __( 'Author', 'google-calendar-events' ) . '</dt>';
221
-		$theme .= '<dd>' . $theme_author . '</dd>';
222
-		$theme .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>';
223
-		$theme .= '<dd>' . $theme_version . '</dd>';
218
+		$theme .= '<dt>'.__('Name', 'google-calendar-events').'</dt>';
219
+		$theme .= '<dd>'.$theme_name.'</dd>';
220
+		$theme .= '<dt>'.__('Author', 'google-calendar-events').'</dt>';
221
+		$theme .= '<dd>'.$theme_author.'</dd>';
222
+		$theme .= '<dt>'.__('Version', 'google-calendar-events').'</dt>';
223
+		$theme .= '<dd>'.$theme_version.'</dd>';
224 224
 		$theme .= '</dl>';
225 225
 
226 226
 		$is_child_theme = is_child_theme();
227 227
 		$parent_theme = $parent_theme_export = '-';
228 228
 
229
-		if ( $is_child_theme ) {
230
-			if ( version_compare( $wp_version, '3.4', '<' ) ) {
229
+		if ($is_child_theme) {
230
+			if (version_compare($wp_version, '3.4', '<')) {
231 231
 
232 232
 				$parent_theme = $parent_theme_export = $active_theme['Template'];
233 233
 
234 234
 			} else {
235 235
 
236
-				$parent = wp_get_theme( $active_theme->Template );
236
+				$parent = wp_get_theme($active_theme->Template);
237 237
 				$parent_theme  = '<dl>';
238
-				$parent_theme .= '<dt>' . __( 'Name', 'google-calendar-events' ) .    '</dt>';
239
-				$parent_theme .= '<dd>' . $parent->Name .          '</dd>';
240
-				$parent_theme .= '<dt>' . __( 'Author', 'google-calendar-events' ) .  '</dt>';
241
-				$parent_theme .= '<dd>' . $parent->Author .        '</dd>';
242
-				$parent_theme .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>';
243
-				$parent_theme .= '<dd>' . $parent->Version .       '</dd>';
238
+				$parent_theme .= '<dt>'.__('Name', 'google-calendar-events').'</dt>';
239
+				$parent_theme .= '<dd>'.$parent->Name.'</dd>';
240
+				$parent_theme .= '<dt>'.__('Author', 'google-calendar-events').'</dt>';
241
+				$parent_theme .= '<dd>'.$parent->Author.'</dd>';
242
+				$parent_theme .= '<dt>'.__('Version', 'google-calendar-events').'</dt>';
243
+				$parent_theme .= '<dd>'.$parent->Version.'</dd>';
244 244
 				$parent_theme .= '</dl>';
245 245
 
246
-				$parent_theme_export = strip_tags( $parent->Name ) . ' - ' .  $parent->Version;
246
+				$parent_theme_export = strip_tags($parent->Name).' - '.$parent->Version;
247 247
 			}
248 248
 		}
249 249
 
250 250
 		$sections['theme'] = array(
251 251
 			'theme'    => array(
252
-				'label'  => __( 'Theme Information', 'google-calendar-events' ),
252
+				'label'  => __('Theme Information', 'google-calendar-events'),
253 253
 				'label_export' => 'Theme',
254 254
 				'result' => $theme,
255 255
 				'result_export' => $theme_export,
256 256
 			),
257 257
 			'theme_child'   => array(
258
-				'label'  => __( 'Child Theme', 'google-calendar-events' ),
258
+				'label'  => __('Child Theme', 'google-calendar-events'),
259 259
 				'label_export' => 'Child Theme',
260
-				'result' => $is_child_theme ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
260
+				'result' => $is_child_theme ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
261 261
 				'result_export' => $is_child_theme ? 'Yes' : 'No',
262 262
 			),
263 263
 			'theme_parent'   => array(
264
-				'label'  => __( 'Parent Theme', 'google-calendar-events' ),
264
+				'label'  => __('Parent Theme', 'google-calendar-events'),
265 265
 				'label_export' => 'Parent Theme',
266 266
 				'result' => $parent_theme,
267 267
 				'result_export' => $parent_theme_export,
@@ -273,61 +273,61 @@  discard block
 block discarded – undo
273 273
 		 * ==============
274 274
 		 */
275 275
 
276
-		include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
276
+		include_once ABSPATH.'wp-admin/includes/plugin-install.php';
277 277
 
278
-		$active_plugins = (array) get_option( 'active_plugins', array() );
279
-		if ( is_multisite() ) {
280
-			$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
278
+		$active_plugins = (array) get_option('active_plugins', array());
279
+		if (is_multisite()) {
280
+			$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
281 281
 		}
282 282
 
283
-		foreach ( $active_plugins as $plugin ) {
283
+		foreach ($active_plugins as $plugin) {
284 284
 
285
-			$plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
285
+			$plugin_data = @get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin);
286 286
 
287
-			if ( ! empty( $plugin_data['Name'] ) ) {
287
+			if ( ! empty($plugin_data['Name'])) {
288 288
 
289 289
 				$plugin_name    = $plugin_data['Title'];
290 290
 				$plugin_author  = $plugin_data['Author'];
291 291
 				$plugin_version = $plugin_update_version = $plugin_data['Version'];
292 292
 
293 293
 				// Afraid that querying many plugins may risk a timeout.
294
-				if ( count( $active_plugins ) <= 10 ) {
295
-					$api = plugins_api( 'plugin_information', array(
294
+				if (count($active_plugins) <= 10) {
295
+					$api = plugins_api('plugin_information', array(
296 296
 						'slug'   => $plugin_data['Name'],
297 297
 						'fields' => array(
298 298
 							'version' => true,
299 299
 						),
300
-					) );
301
-					if ( $api && ! is_wp_error( $api ) ) {
302
-						if ( ! empty( $api->version ) ) {
300
+					));
301
+					if ($api && ! is_wp_error($api)) {
302
+						if ( ! empty($api->version)) {
303 303
 							$plugin_update_version = $api->version;
304
-							if ( version_compare( $plugin_version, $plugin_update_version, '<' ) ) {
305
-								$plugin_version = '<mark class="error">' . $plugin_version . ' (' . sprintf( __( '%s is available', 'google-calendar-events' ), esc_html( $plugin_update_version ) ) . ')</mark>';
304
+							if (version_compare($plugin_version, $plugin_update_version, '<')) {
305
+								$plugin_version = '<mark class="error">'.$plugin_version.' ('.sprintf(__('%s is available', 'google-calendar-events'), esc_html($plugin_update_version)).')</mark>';
306 306
 							} else {
307
-								$plugin_version = '<mark class="ok">' . $plugin_version . '</mark>';
307
+								$plugin_version = '<mark class="ok">'.$plugin_version.'</mark>';
308 308
 							}
309 309
 						}
310 310
 					}
311 311
 				}
312 312
 
313 313
 				$plugin  = '<dl>';
314
-				$plugin .= '<dt>' . __( 'Author', 'google-calendar-events' ) .  '</dt>';
315
-				$plugin .= '<dd>' . $plugin_author .         '</dd>';
316
-				$plugin .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>';
317
-				$plugin .= '<dd>' . $plugin_version .        '</dd>';
314
+				$plugin .= '<dt>'.__('Author', 'google-calendar-events').'</dt>';
315
+				$plugin .= '<dd>'.$plugin_author.'</dd>';
316
+				$plugin .= '<dt>'.__('Version', 'google-calendar-events').'</dt>';
317
+				$plugin .= '<dd>'.$plugin_version.'</dd>';
318 318
 				$plugin .= '</dl>';
319 319
 
320
-				$sections['plugins'][ sanitize_key( strip_tags( $plugin_name ) ) ] = array(
320
+				$sections['plugins'][sanitize_key(strip_tags($plugin_name))] = array(
321 321
 					'label'  => $plugin_name,
322
-					'label_export' => strip_tags( $plugin_data['Title'] ),
322
+					'label_export' => strip_tags($plugin_data['Title']),
323 323
 					'result' => $plugin,
324 324
 					'result_export' => $plugin_data['Version'],
325 325
 				);
326 326
 			}
327 327
 		}
328 328
 
329
-		if ( isset( $sections['plugins'] ) ) {
330
-			rsort( $sections['plugins'] );
329
+		if (isset($sections['plugins'])) {
330
+			rsort($sections['plugins']);
331 331
 		}
332 332
 
333 333
 		/**
@@ -335,51 +335,51 @@  discard block
 block discarded – undo
335 335
 		 * ==================
336 336
 		 */
337 337
 
338
-		if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
339
-			$php = '<mark class="error">' . sprintf( __( '%1$s - It is recomendend to upgrade at least to PHP version 5.4 for security reasons. <a href="%2$s" target="_blank">Read more.</a>', 'google-calendar-events' ), PHP_VERSION, 'http://www.wpupdatephp.com/update/' ) . '</mark>';
338
+		if (version_compare(PHP_VERSION, '5.4', '<')) {
339
+			$php = '<mark class="error">'.sprintf(__('%1$s - It is recomendend to upgrade at least to PHP version 5.4 for security reasons. <a href="%2$s" target="_blank">Read more.</a>', 'google-calendar-events'), PHP_VERSION, 'http://www.wpupdatephp.com/update/').'</mark>';
340 340
 		} else {
341
-			$php = '<mark class="ok">' . PHP_VERSION . '</mark>';
341
+			$php = '<mark class="ok">'.PHP_VERSION.'</mark>';
342 342
 		}
343 343
 
344
-		if ( $wpdb->use_mysqli ) {
345
-			$mysql = @mysqli_get_server_info( $wpdb->dbh );
344
+		if ($wpdb->use_mysqli) {
345
+			$mysql = @mysqli_get_server_info($wpdb->dbh);
346 346
 		} else {
347 347
 			$mysql = @mysql_get_server_info();
348 348
 		}
349 349
 
350 350
 		$host = $_SERVER['SERVER_SOFTWARE'];
351
-		if ( defined( 'WPE_APIKEY' ) ) {
351
+		if (defined('WPE_APIKEY')) {
352 352
 			$host .= ' (WP Engine)';
353
-		} elseif ( defined( 'PAGELYBIN' ) ) {
353
+		} elseif (defined('PAGELYBIN')) {
354 354
 			$host .= ' (Pagely)';
355 355
 		}
356 356
 
357 357
 		$default_timezone = $server_timezone_export = date_default_timezone_get();
358
-		if ( 'UTC' !== $default_timezone ) {
359
-			$server_timezone = '<mark class="error">' . sprintf( __( 'Server default timezone is %s - it should be UTC', 'google-calendar-events' ), $default_timezone ) . '</mark>';
358
+		if ('UTC' !== $default_timezone) {
359
+			$server_timezone = '<mark class="error">'.sprintf(__('Server default timezone is %s - it should be UTC', 'google-calendar-events'), $default_timezone).'</mark>';
360 360
 		} else {
361 361
 			$server_timezone = '<mark class="ok">UTC</mark>';
362 362
 		}
363 363
 
364 364
 		// WP Remote POST test.
365
-		$response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array(
365
+		$response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array(
366 366
 			'timeout'    => 60,
367 367
 			'body'       => array(
368 368
 				'cmd'    => '_notify-validate',
369 369
 			),
370
-		) );
371
-		if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
370
+		));
371
+		if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
372 372
 			$wp_post_export = 'Yes';
373
-			$wp_post = '<mark class="ok">' . __( 'Yes', 'google-calendar-events' ) . '</mark>';
373
+			$wp_post = '<mark class="ok">'.__('Yes', 'google-calendar-events').'</mark>';
374 374
 		} else {
375 375
 			$wp_post_export = 'No';
376
-			$wp_post = '<mark class="error">' . __( 'No', 'google-calendar-events' );
377
-			if ( is_wp_error( $response ) ) {
378
-				$error = ' (' . $response->get_error_message() . ')';
376
+			$wp_post = '<mark class="error">'.__('No', 'google-calendar-events');
377
+			if (is_wp_error($response)) {
378
+				$error = ' ('.$response->get_error_message().')';
379 379
 				$wp_post .= $error;
380 380
 				$wp_post_export .= $error;
381 381
 			} else {
382
-				$error = ' (' . $response['response']['code'] . ')';
382
+				$error = ' ('.$response['response']['code'].')';
383 383
 				$wp_post .= $error;
384 384
 				$wp_post_export .= $error;
385 385
 			}
@@ -387,64 +387,64 @@  discard block
 block discarded – undo
387 387
 		}
388 388
 
389 389
 		// WP Remote GET test.
390
-		$response = wp_safe_remote_get( get_home_url( '/?p=1' ) );
391
-		if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
390
+		$response = wp_safe_remote_get(get_home_url('/?p=1'));
391
+		if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
392 392
 			$wp_get_export = 'Yes';
393
-			$wp_get = '<mark class="ok">' . __( 'Yes', 'google-calendar-events' ) . '</mark>';
393
+			$wp_get = '<mark class="ok">'.__('Yes', 'google-calendar-events').'</mark>';
394 394
 		} else {
395 395
 			$wp_get_export = 'No';
396
-			$wp_get = '<mark class="error">' . __( 'No', 'google-calendar-events' );
397
-			if ( is_wp_error( $response ) ) {
398
-				$error = ' (' . $response->get_error_message() . ')';
396
+			$wp_get = '<mark class="error">'.__('No', 'google-calendar-events');
397
+			if (is_wp_error($response)) {
398
+				$error = ' ('.$response->get_error_message().')';
399 399
 				$wp_get .= $error;
400 400
 				$wp_get_export .= $error;
401 401
 			} else {
402
-				$error = ' (' . $response['response']['code'] . ')';
402
+				$error = ' ('.$response['response']['code'].')';
403 403
 				$wp_get .= $error;
404 404
 				$wp_get_export .= $error;
405 405
 			}
406 406
 			$wp_get .= '</mark>';
407 407
 		}
408 408
 
409
-		$php_memory_limit        = ini_get( 'memory_limit' );
410
-		$php_max_upload_filesize = ini_get( 'upload_max_filesize' );
411
-		$php_post_max_size       = ini_get( 'post_max_size' );
412
-		$php_max_execution_time  = ini_get( 'max_execution_time' );
413
-		$php_max_input_vars      = ini_get( 'max_input_vars' );
409
+		$php_memory_limit        = ini_get('memory_limit');
410
+		$php_max_upload_filesize = ini_get('upload_max_filesize');
411
+		$php_post_max_size       = ini_get('post_max_size');
412
+		$php_max_execution_time  = ini_get('max_execution_time');
413
+		$php_max_input_vars      = ini_get('max_input_vars');
414 414
 
415 415
 		$sections['server'] = array(
416 416
 			'host'                => array(
417
-				'label'  => __( 'Web Server', 'google-calendar-events' ),
417
+				'label'  => __('Web Server', 'google-calendar-events'),
418 418
 				'label_export' => 'Web Server',
419 419
 				'result' => $host,
420 420
 			),
421 421
 			'php_version'         => array(
422
-				'label'  => __( 'PHP Version', 'google-calendar-events' ),
422
+				'label'  => __('PHP Version', 'google-calendar-events'),
423 423
 				'label_export' => 'PHP Version',
424 424
 				'result' => $php,
425 425
 				'result_export' => PHP_VERSION,
426 426
 			),
427 427
 			'mysql_version'       => array(
428
-				'label'  => __( 'MySQL Version', 'google-calendar-events' ),
428
+				'label'  => __('MySQL Version', 'google-calendar-events'),
429 429
 				'label_export' => 'MySQL Version',
430
-				'result' => version_compare( $mysql, '5.5', '>' ) ? '<mark class="ok">' . $mysql . '</mark>' : $mysql,
430
+				'result' => version_compare($mysql, '5.5', '>') ? '<mark class="ok">'.$mysql.'</mark>' : $mysql,
431 431
 				'result_export' => $mysql,
432 432
 			),
433 433
 			'server_timezone'     => array(
434
-				'label'  => __( 'Server Timezone', 'google-calendar-events' ),
434
+				'label'  => __('Server Timezone', 'google-calendar-events'),
435 435
 				'label_export' => 'Server Timezone',
436 436
 				'result' => $server_timezone,
437 437
 				'result_export' => $server_timezone_export,
438 438
 			),
439 439
 			'display_errors'      => array(
440 440
 				'label'  => 'Display Errors',
441
-				'result' => ( ini_get( 'display_errors' ) ) ? __( 'Yes', 'google-calendar-events' ) . ' (' . ini_get( 'display_errors' ) . ')' : '-',
442
-				'result_export' => ( ini_get( 'display_errors' ) ) ? 'Yes' : 'No',
441
+				'result' => (ini_get('display_errors')) ? __('Yes', 'google-calendar-events').' ('.ini_get('display_errors').')' : '-',
442
+				'result_export' => (ini_get('display_errors')) ? 'Yes' : 'No',
443 443
 			),
444 444
 			'php_safe_mode'       => array(
445 445
 				'label'  => 'Safe Mode',
446
-				'result' => ( ini_get( 'safe_mode' ) ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
447
-				'result_export' => ( ini_get( 'safe_mode' ) ) ? 'Yes' : 'No',
446
+				'result' => (ini_get('safe_mode')) ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
447
+				'result_export' => (ini_get('safe_mode')) ? 'Yes' : 'No',
448 448
 			),
449 449
 			'php_memory_limit'    => array(
450 450
 				'label'  => 'Memory Limit',
@@ -468,23 +468,23 @@  discard block
 block discarded – undo
468 468
 			),
469 469
 			'fsockopen'           => array(
470 470
 				'label'  => 'fsockopen',
471
-				'result' => function_exists( 'fsockopen' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
472
-				'result_export' => function_exists( 'fsockopen' ) ? 'Yes' : 'No',
471
+				'result' => function_exists('fsockopen') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
472
+				'result_export' => function_exists('fsockopen') ? 'Yes' : 'No',
473 473
 			),
474 474
 			'curl_init'           => array(
475 475
 				'label'  => 'cURL',
476
-				'result' => function_exists( 'curl_init' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
477
-				'result_export' => function_exists( 'curl_init' ) ? 'Yes' : 'No',
476
+				'result' => function_exists('curl_init') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
477
+				'result_export' => function_exists('curl_init') ? 'Yes' : 'No',
478 478
 			),
479 479
 			'soap'                => array(
480 480
 				'label'  => 'SOAP',
481
-				'result' => class_exists( 'SoapClient' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
482
-				'result_export' => class_exists( 'SoapClient' ) ? 'Yes' : 'No',
481
+				'result' => class_exists('SoapClient') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
482
+				'result_export' => class_exists('SoapClient') ? 'Yes' : 'No',
483 483
 			),
484 484
 			'suhosin'             => array(
485 485
 				'label'  => 'SUHOSIN',
486
-				'result' => extension_loaded( 'suhosin' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ),
487
-				'result_export' => extension_loaded( 'suhosin' ) ? 'Yes' : 'No',
486
+				'result' => extension_loaded('suhosin') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'),
487
+				'result_export' => extension_loaded('suhosin') ? 'Yes' : 'No',
488 488
 			),
489 489
 			'wp_remote_post'      => array(
490 490
 				'label'  => 'WP Remote POST',
@@ -506,26 +506,26 @@  discard block
 block discarded – undo
506 506
 		$user_client = new \Browser();
507 507
 
508 508
 		$browser  = '<dl>';
509
-		$browser .= '<dt>' . __( 'Name:', 'google-calendar-events' ) .         '</dt>';
510
-		$browser .= '<dd>' . $user_client->getBrowser() .   '</dd>';
511
-		$browser .= '<dt>' . __( 'Version:', 'google-calendar-events' ) .      '</dt>';
512
-		$browser .= '<dd>' . $user_client->getVersion() .   '</dd>';
513
-		$browser .= '<dt>' . __( 'User Agent:', 'google-calendar-events' ) .   '</dt>';
514
-		$browser .= '<dd>' . $user_client->getUserAgent() . '</dd>';
515
-		$browser .= '<dt>' . __( 'Platform:', 'google-calendar-events' ) .     '</dt>';
516
-		$browser .= '<dd>' . $user_client->getPlatform() .  '</dd>';
509
+		$browser .= '<dt>'.__('Name:', 'google-calendar-events').'</dt>';
510
+		$browser .= '<dd>'.$user_client->getBrowser().'</dd>';
511
+		$browser .= '<dt>'.__('Version:', 'google-calendar-events').'</dt>';
512
+		$browser .= '<dd>'.$user_client->getVersion().'</dd>';
513
+		$browser .= '<dt>'.__('User Agent:', 'google-calendar-events').'</dt>';
514
+		$browser .= '<dd>'.$user_client->getUserAgent().'</dd>';
515
+		$browser .= '<dt>'.__('Platform:', 'google-calendar-events').'</dt>';
516
+		$browser .= '<dd>'.$user_client->getPlatform().'</dd>';
517 517
 		$browser .= '</dl>';
518 518
 
519
-		$browser_export = $user_client->getBrowser() . ' ' . $user_client->getVersion() . ' (' . $user_client->getPlatform() . ')';
519
+		$browser_export = $user_client->getBrowser().' '.$user_client->getVersion().' ('.$user_client->getPlatform().')';
520 520
 
521 521
 		$sections['client'] = array(
522 522
 			'user_ip' => array(
523
-				'label'  => __( 'IP Address', 'google-calendar-events' ),
523
+				'label'  => __('IP Address', 'google-calendar-events'),
524 524
 				'label_export' => 'IP Address',
525 525
 				'result' => $_SERVER['SERVER_ADDR'],
526 526
 			),
527 527
 			'browser' => array(
528
-				'label'  => __( 'Browser', 'google-calendar-events' ),
528
+				'label'  => __('Browser', 'google-calendar-events'),
529 529
 				'result' => $browser,
530 530
 				'result_export' => $browser_export,
531 531
 			)
@@ -536,12 +536,12 @@  discard block
 block discarded – undo
536 536
 		 * ============
537 537
 		 */
538 538
 
539
-		$panels   = apply_filters( 'simcal_system_status_report_panels', $panels );
540
-		$sections = apply_filters( 'simcal_system_status_report_sections', $sections );
539
+		$panels   = apply_filters('simcal_system_status_report_panels', $panels);
540
+		$sections = apply_filters('simcal_system_status_report_sections', $sections);
541 541
 
542
-		foreach ( $panels as $panel => $v ) :
542
+		foreach ($panels as $panel => $v) :
543 543
 
544
-			if ( isset( $sections[ $panel ] ) ) :
544
+			if (isset($sections[$panel])) :
545 545
 
546 546
 				?>
547 547
 				<table class="widefat simcal-system-status-report-panel">
@@ -551,15 +551,15 @@  discard block
 block discarded – undo
551 551
 						</tr>
552 552
 					</thead>
553 553
 					<tbody>
554
-						<?php foreach ( $sections[ $panel ] as $row => $cell ) : ?>
554
+						<?php foreach ($sections[$panel] as $row => $cell) : ?>
555 555
 							<tr>
556 556
 								<?php
557
-								$label_export  = isset( $cell['label_export']  ) ? $cell['label_export']  : $cell['label'];
558
-								$result_export = isset( $cell['result_export'] ) ? $cell['result_export'] : $cell['result'];
557
+								$label_export  = isset($cell['label_export']) ? $cell['label_export'] : $cell['label'];
558
+								$result_export = isset($cell['result_export']) ? $cell['result_export'] : $cell['result'];
559 559
 								?>
560
-								<td class="tooltip"><?php echo isset( $cell['tooltip'] ) ? ' <i class="simcal-icon-help simcal-help-tip" data-tip="' . $cell['tooltip'] . '"></i> ' : ''; ?></td>
561
-								<td class="label" data-export="<?php echo trim( $label_export ); ?>"><?php echo $cell['label']; ?></td>
562
-								<td class="result" data-export="<?php echo trim( $result_export ); ?>"><?php echo $cell['result']; ?></td>
560
+								<td class="tooltip"><?php echo isset($cell['tooltip']) ? ' <i class="simcal-icon-help simcal-help-tip" data-tip="'.$cell['tooltip'].'"></i> ' : ''; ?></td>
561
+								<td class="label" data-export="<?php echo trim($label_export); ?>"><?php echo $cell['label']; ?></td>
562
+								<td class="result" data-export="<?php echo trim($result_export); ?>"><?php echo $cell['result']; ?></td>
563 563
 							</tr>
564 564
 						<?php endforeach; ?>
565 565
 					</tbody>
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 			jQuery( '#simcal-system-status-report-download' ).on( 'click', function() {
638 638
 				var file = new Blob( [ report ], { type: 'text/plain' } );
639 639
 				jQuery( this ).attr( 'href', URL.createObjectURL( file ) );
640
-				jQuery( this ).attr( 'download', '<?php echo sanitize_title( str_replace( array( 'http://', 'https://' ), '', get_bloginfo( 'url' ) ) . '-system-report-' . date( 'Y-m-d', time() ) ); ?>' );
640
+				jQuery( this ).attr( 'download', '<?php echo sanitize_title(str_replace(array('http://', 'https://'), '', get_bloginfo('url')).'-system-report-'.date('Y-m-d', time())); ?>' );
641 641
 			} );
642 642
 
643 643
 		</script>
@@ -657,13 +657,13 @@  discard block
 block discarded – undo
657 657
 	 *
658 658
 	 * @return int|double|string
659 659
 	 */
660
-	private function let_to_num( $size ) {
660
+	private function let_to_num($size) {
661 661
 
662
-		$l   = substr( $size, -1 );
663
-		$ret = substr( $size, 0, -1 );
662
+		$l   = substr($size, -1);
663
+		$ret = substr($size, 0, -1);
664 664
 
665 665
 		// Note: do not insert break or default in this switch loop.
666
-		switch ( strtoupper( $l ) ) {
666
+		switch (strtoupper($l)) {
667 667
 			case 'P':
668 668
 				$ret *= 1024;
669 669
 				// no break
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 				$ret *= 1024;
678 678
 				// no break
679 679
 			case 'K':
680
-				$ret *= 1024;;
680
+				$ret *= 1024; ;
681 681
 				// no break
682 682
 		}
683 683
 
Please login to merge, or discard this patch.
includes/admin/post-types.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -272,9 +272,9 @@
 block discarded – undo
272 272
 
273 273
 		if ( $post_type == 'calendar' && isset( $post->ID ) ) {
274 274
 			echo '<a id="simcal-clear-cache" class="button" data-id="' . $post->ID . ' ">' .
275
-			     '<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i> ' .
276
-			     __( 'Clear cache', 'google-calendar-events' ) .
277
-			     '</a>';
275
+				 '<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i> ' .
276
+				 __( 'Clear cache', 'google-calendar-events' ) .
277
+				 '</a>';
278 278
 		}
279 279
 	}
280 280
 
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Calendar;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -32,26 +32,26 @@  discard block
 block discarded – undo
32 32
 		new Meta_Boxes();
33 33
 
34 34
 		// Add column headers in calendar feeds admin archives.
35
-		add_filter( 'manage_calendar_posts_columns', array( $this, 'add_calendar_feed_column_headers' ) );
35
+		add_filter('manage_calendar_posts_columns', array($this, 'add_calendar_feed_column_headers'));
36 36
 		// Process column contents for calendar feeds.
37
-		add_action( 'manage_calendar_posts_custom_column', array( $this, 'calendar_feed_column_content' ), 10, 2 );
37
+		add_action('manage_calendar_posts_custom_column', array($this, 'calendar_feed_column_content'), 10, 2);
38 38
 
39 39
 		// Add actions in calendar feed rows.
40
-		add_filter( 'post_row_actions', array( $this, 'row_actions' ), 10, 2 );
40
+		add_filter('post_row_actions', array($this, 'row_actions'), 10, 2);
41 41
 		// Add bulk actions.
42
-		add_action( 'admin_init', array( $this, 'bulk_actions' ) );
42
+		add_action('admin_init', array($this, 'bulk_actions'));
43 43
 		// Add content to edit calendars page.
44
-		add_action( 'load-edit.php', array( $this, 'edit_table_hooks' ) );
44
+		add_action('load-edit.php', array($this, 'edit_table_hooks'));
45 45
 
46 46
 		// Default calendar post type content (default event template).
47
-		add_filter( 'default_content', array( $this, 'default_event_template' ), 10, 2 );
47
+		add_filter('default_content', array($this, 'default_event_template'), 10, 2);
48 48
 
49 49
 		// Add a clear cache link in submit post box.
50
-		add_action( 'post_submitbox_misc_actions', array( $this, 'clear_cache_button' ) );
50
+		add_action('post_submitbox_misc_actions', array($this, 'clear_cache_button'));
51 51
 
52 52
 		// Add media button to post editor for adding a shortcode.
53
-		add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 100 );
54
-		add_action( 'edit_form_after_editor', array( $this, 'add_shortcode_panel' ), 100 );
53
+		add_action('media_buttons', array($this, 'add_shortcode_button'), 100);
54
+		add_action('edit_form_after_editor', array($this, 'add_shortcode_panel'), 100);
55 55
 	}
56 56
 
57 57
 	/**
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return array Filtered output.
65 65
 	 */
66
-	public function add_calendar_feed_column_headers( $columns ) {
66
+	public function add_calendar_feed_column_headers($columns) {
67 67
 
68 68
 		// New columns.
69
-		$feed_info = array( 'feed' => __( 'Events Source', 'google-calendar-events' ) );
70
-		$calendar_info = array( 'calendar' => __( 'Calendar Type', 'google-calendar-events' ) );
71
-		$shortcode = array( 'shortcode' => __( 'Shortcode', 'google-calendar-events' ) );
69
+		$feed_info = array('feed' => __('Events Source', 'google-calendar-events'));
70
+		$calendar_info = array('calendar' => __('Calendar Type', 'google-calendar-events'));
71
+		$shortcode = array('shortcode' => __('Shortcode', 'google-calendar-events'));
72 72
 
73 73
 		// Merge with existing columns and rearrange.
74
-		$columns = array_slice( $columns, 0, 2, true ) + $feed_info + $calendar_info + $shortcode + array_slice( $columns, 2, null, true );
74
+		$columns = array_slice($columns, 0, 2, true) + $feed_info + $calendar_info + $shortcode + array_slice($columns, 2, null, true);
75 75
 
76 76
 		return $columns;
77 77
 	}
@@ -86,32 +86,32 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return void
88 88
 	 */
89
-	public function calendar_feed_column_content( $column_name, $post_id ) {
89
+	public function calendar_feed_column_content($column_name, $post_id) {
90 90
 
91
-		switch ( $column_name ) {
91
+		switch ($column_name) {
92 92
 
93 93
 			case 'feed':
94 94
 
95
-				$feed = simcal_get_feed( $post_id );
96
-				echo isset( $feed->name ) ? $feed->name : '&mdash;';
95
+				$feed = simcal_get_feed($post_id);
96
+				echo isset($feed->name) ? $feed->name : '&mdash;';
97 97
 				break;
98 98
 
99 99
 			case 'calendar':
100 100
 
101 101
 				$info = '&mdash;';
102 102
 
103
-				if ( $terms = wp_get_object_terms( $post_id, 'calendar_type' ) ) {
103
+				if ($terms = wp_get_object_terms($post_id, 'calendar_type')) {
104 104
 
105
-					$calendar_type  = sanitize_title( current( $terms )->name );
106
-					$calendar       = simcal_get_calendar( $calendar_type );
105
+					$calendar_type  = sanitize_title(current($terms)->name);
106
+					$calendar       = simcal_get_calendar($calendar_type);
107 107
 
108
-					if ( $calendar instanceof Calendar ) {
108
+					if ($calendar instanceof Calendar) {
109 109
 						$info = $calendar->name;
110
-						$views = get_post_meta( $post_id, '_calendar_view', true );;
111
-						$view = isset( $views[ $calendar->type ] ) ? $views[ $calendar->type ] : '';
110
+						$views = get_post_meta($post_id, '_calendar_view', true); ;
111
+						$view = isset($views[$calendar->type]) ? $views[$calendar->type] : '';
112 112
 
113
-						if ( isset( $calendar->views[ $view ] ) ) {
114
-							$info .= ' &rarr; ' . $calendar->views[ $view ];
113
+						if (isset($calendar->views[$view])) {
114
+							$info .= ' &rarr; '.$calendar->views[$view];
115 115
 						}
116 116
 					}
117 117
 				}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 			case 'shortcode' :
123 123
 
124
-				simcal_print_shortcode_tip( $post_id );
124
+				simcal_print_shortcode_tip($post_id);
125 125
 				break;
126 126
 		}
127 127
 	}
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return array Filtered output.
138 138
 	 */
139
-	public function row_actions( $actions, $post ) {
139
+	public function row_actions($actions, $post) {
140 140
 
141 141
 		// Add a clear feed cache action link.
142
-		if ( $post->post_type == 'calendar' ) {
143
-			$actions['duplicate_feed'] = '<a href="' . esc_url( add_query_arg( array( 'duplicate_feed' => $post->ID ) ) ) . '">' . __( 'Clone', 'google-calendar-events' )       . '</a>';
144
-			$actions['clear_cache']    = '<a href="' . esc_url( add_query_arg( array( 'clear_cache' => $post->ID ) ) ) . '">'    . __( 'Clear Cache', 'google-calendar-events' ) . '</a>';
142
+		if ($post->post_type == 'calendar') {
143
+			$actions['duplicate_feed'] = '<a href="'.esc_url(add_query_arg(array('duplicate_feed' => $post->ID))).'">'.__('Clone', 'google-calendar-events').'</a>';
144
+			$actions['clear_cache']    = '<a href="'.esc_url(add_query_arg(array('clear_cache' => $post->ID))).'">'.__('Clear Cache', 'google-calendar-events').'</a>';
145 145
 		}
146 146
 
147 147
 		return $actions;
@@ -156,38 +156,38 @@  discard block
 block discarded – undo
156 156
 
157 157
 		// Clear an individual feed cache.
158 158
 		// @todo Convert the clear cache request to ajax.
159
-		if ( isset( $_REQUEST['clear_cache'] ) ) {
159
+		if (isset($_REQUEST['clear_cache'])) {
160 160
 
161
-			$id = intval( $_REQUEST['clear_cache'] );
161
+			$id = intval($_REQUEST['clear_cache']);
162 162
 
163
-			if ( $id > 0 ) {
164
-				simcal_delete_feed_transients( $id );
163
+			if ($id > 0) {
164
+				simcal_delete_feed_transients($id);
165 165
 			}
166 166
 
167
-			wp_redirect( remove_query_arg( 'clear_cache' ) );
167
+			wp_redirect(remove_query_arg('clear_cache'));
168 168
 		}
169 169
 
170 170
 		// Duplicate a feed post type.
171
-		if ( isset( $_REQUEST['duplicate_feed'] ) ) {
171
+		if (isset($_REQUEST['duplicate_feed'])) {
172 172
 
173
-			$id = intval( $_REQUEST['duplicate_feed'] );
173
+			$id = intval($_REQUEST['duplicate_feed']);
174 174
 
175
-			if ( $id > 0 ) {
176
-				$this->duplicate_feed( $id );
175
+			if ($id > 0) {
176
+				$this->duplicate_feed($id);
177 177
 			}
178 178
 
179
-			wp_redirect( remove_query_arg( 'duplicate_feed' ) );
179
+			wp_redirect(remove_query_arg('duplicate_feed'));
180 180
 		}
181 181
 
182
-		$bulk_actions = new Bulk_Actions( 'calendar' );
182
+		$bulk_actions = new Bulk_Actions('calendar');
183 183
 
184
-		$bulk_actions->register_bulk_action( array(
185
-			'menu_text'     => __( 'Clear cache', 'google-calendar-events' ),
184
+		$bulk_actions->register_bulk_action(array(
185
+			'menu_text'     => __('Clear cache', 'google-calendar-events'),
186 186
 			'action_name'   => 'clear_calendars_cache',
187
-			'callback'      => function( $post_ids ) {
188
-				simcal_delete_feed_transients( $post_ids );
187
+			'callback'      => function($post_ids) {
188
+				simcal_delete_feed_transients($post_ids);
189 189
 			},
190
-			'admin_notice'  => __( 'Cache cleared.', 'google-calendar-events' ),
190
+			'admin_notice'  => __('Cache cleared.', 'google-calendar-events'),
191 191
 			)
192 192
 		);
193 193
 
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 
205 205
 		$screen = simcal_is_admin_screen();
206 206
 
207
-		if ( 'edit-calendar' == $screen ) {
208
-			add_action( 'in_admin_footer', function() {
207
+		if ('edit-calendar' == $screen) {
208
+			add_action('in_admin_footer', function() {
209 209
 
210 210
 			} );
211 211
 		}
@@ -218,29 +218,29 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @param int $post_id
220 220
 	 */
221
-	private function duplicate_feed( $post_id ) {
221
+	private function duplicate_feed($post_id) {
222 222
 
223
-		if ( $duplicate = get_post( intval( $post_id ), 'ARRAY_A' ) ) {
223
+		if ($duplicate = get_post(intval($post_id), 'ARRAY_A')) {
224 224
 
225
-			if ( 'calendar' == $duplicate['post_type'] ) {
225
+			if ('calendar' == $duplicate['post_type']) {
226 226
 
227
-				$duplicate['post_title'] = $duplicate['post_title'] . ' (' . __( 'Copy', 'google-calendar-events' ) . ')';
227
+				$duplicate['post_title'] = $duplicate['post_title'].' ('.__('Copy', 'google-calendar-events').')';
228 228
 
229
-				unset( $duplicate['ID'] );
230
-				unset( $duplicate['guid'] );
231
-				unset( $duplicate['comment_count'] );
229
+				unset($duplicate['ID']);
230
+				unset($duplicate['guid']);
231
+				unset($duplicate['comment_count']);
232 232
 
233
-				$duplicate_id = wp_insert_post( $duplicate );
233
+				$duplicate_id = wp_insert_post($duplicate);
234 234
 
235
-				$taxonomies = get_object_taxonomies( $duplicate['post_type'] );
236
-				foreach ( $taxonomies as $taxonomy ) {
237
-					$terms = wp_get_post_terms( $post_id, $taxonomy, array( 'fields' => 'names' ) );
238
-					wp_set_object_terms( $duplicate_id, $terms, $taxonomy );
235
+				$taxonomies = get_object_taxonomies($duplicate['post_type']);
236
+				foreach ($taxonomies as $taxonomy) {
237
+					$terms = wp_get_post_terms($post_id, $taxonomy, array('fields' => 'names'));
238
+					wp_set_object_terms($duplicate_id, $terms, $taxonomy);
239 239
 				}
240 240
 
241
-				$custom_fields = get_post_custom( $post_id );
242
-				foreach ( $custom_fields as $key => $value ) {
243
-					add_post_meta( $duplicate_id, $key, maybe_unserialize( $value[0] ) );
241
+				$custom_fields = get_post_custom($post_id);
242
+				foreach ($custom_fields as $key => $value) {
243
+					add_post_meta($duplicate_id, $key, maybe_unserialize($value[0]));
244 244
 				}
245 245
 			}
246 246
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @return string
259 259
 	 */
260
-	public function default_event_template( $content, $post ) {
260
+	public function default_event_template($content, $post) {
261 261
 		return 'calendar' == $post->post_type ? simcal_default_event_template() : $content;
262 262
 	}
263 263
 
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
 
271 271
 		global $post, $post_type;
272 272
 
273
-		if ( $post_type == 'calendar' && isset( $post->ID ) ) {
274
-			echo '<a id="simcal-clear-cache" class="button" data-id="' . $post->ID . ' ">' .
275
-			     '<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i> ' .
276
-			     __( 'Clear cache', 'google-calendar-events' ) .
273
+		if ($post_type == 'calendar' && isset($post->ID)) {
274
+			echo '<a id="simcal-clear-cache" class="button" data-id="'.$post->ID.' ">'.
275
+			     '<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i> '.
276
+			     __('Clear cache', 'google-calendar-events').
277 277
 			     '</a>';
278 278
 		}
279 279
 	}
@@ -290,20 +290,20 @@  discard block
 block discarded – undo
290 290
 
291 291
 		$post_types = array();
292 292
 
293
-		$settings = get_option( 'simple-calendar_settings_calendars' );
294
-		if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
293
+		$settings = get_option('simple-calendar_settings_calendars');
294
+		if (isset($settings['general']['attach_calendars_posts'])) {
295 295
 			$post_types = $settings['general']['attach_calendars_posts'];
296 296
 		}
297 297
 
298 298
 		global $post_type;
299 299
 
300
-		if ( in_array( $post_type, $post_types ) ) {
300
+		if (in_array($post_type, $post_types)) {
301 301
 
302 302
 			// Thickbox will ignore height and width, will adjust these in js.
303 303
 			// @see https://core.trac.wordpress.org/ticket/17249
304 304
 			?>
305 305
 			<a href="#TB_inline?height=250&width=500&inlineId=simcal-insert-shortcode-panel" id="simcal-insert-shortcode-button" class="thickbox button insert-calendar add_calendar">
306
-				<span class="wp-media-buttons-icon dashicons-before dashicons-calendar-alt"></span> <?php _e( 'Add Calendar', 'google-calendar-events' ); ?>
306
+				<span class="wp-media-buttons-icon dashicons-before dashicons-calendar-alt"></span> <?php _e('Add Calendar', 'google-calendar-events'); ?>
307 307
 			</a>
308 308
 			<?php
309 309
 
@@ -325,25 +325,25 @@  discard block
 block discarded – undo
325 325
 		?>
326 326
 		<div id="simcal-insert-shortcode-panel" style="display:none;">
327 327
 			<div class="simcal-insert-shortcode-panel">
328
-				<h1><?php _e( 'Add Calendar', 'google-calendar-events' ); ?></h1>
329
-				<?php _e( 'Add a calendar to your post.', 'google-calendar-events' ); ?>
330
-				<?php if ( ! empty( $calendars ) && is_array( $calendars ) ) : ?>
328
+				<h1><?php _e('Add Calendar', 'google-calendar-events'); ?></h1>
329
+				<?php _e('Add a calendar to your post.', 'google-calendar-events'); ?>
330
+				<?php if ( ! empty($calendars) && is_array($calendars)) : ?>
331 331
 					<p>
332 332
 						<label for="simcal-choose-calendar">
333
-							<?php $multiselect = count( $calendars ) > 15 ? ' simcal-field-select-enhanced' : ''; ?>
333
+							<?php $multiselect = count($calendars) > 15 ? ' simcal-field-select-enhanced' : ''; ?>
334 334
 							<select id="simcal-choose-calendar"
335 335
 							        class="simcal-field simcal-field-select<?php echo $multiselect; ?>"
336 336
 							        name="">
337
-								<?php foreach ( $calendars as $id => $title ) : ?>
337
+								<?php foreach ($calendars as $id => $title) : ?>
338 338
 									<option value="<?php echo $id ?>"><?php echo $title ?></option>
339 339
 								<?php endforeach; ?>
340 340
 							</select>
341 341
 						</label>
342 342
 					</p>
343
-					<p><input type="button" value="<?php _e( 'Insert Calendar', 'google-calendar-events' ); ?>" id="simcal-insert-shortcode" class="button button-primary button-large" name="" /></p>
343
+					<p><input type="button" value="<?php _e('Insert Calendar', 'google-calendar-events'); ?>" id="simcal-insert-shortcode" class="button button-primary button-large" name="" /></p>
344 344
 				<?php else : ?>
345
-					<p><em><?php _e( 'Could not find any calendars to add to this post.', 'google-calendar-events' ); ?></em></p>
346
-					<strong><a href="post-new.php?post_type=calendar"><?php _e( 'Please add and configure new calendar first.', 'google-calendar-events' ); ?></a></strong>
345
+					<p><em><?php _e('Could not find any calendars to add to this post.', 'google-calendar-events'); ?></em></p>
346
+					<strong><a href="post-new.php?post_type=calendar"><?php _e('Please add and configure new calendar first.', 'google-calendar-events'); ?></a></strong>
347 347
 				<?php endif; ?>
348 348
 			</div>
349 349
 		</div>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -341,8 +341,11 @@
 block discarded – undo
341 341
 						</label>
342 342
 					</p>
343 343
 					<p><input type="button" value="<?php _e( 'Insert Calendar', 'google-calendar-events' ); ?>" id="simcal-insert-shortcode" class="button button-primary button-large" name="" /></p>
344
-				<?php else : ?>
345
-					<p><em><?php _e( 'Could not find any calendars to add to this post.', 'google-calendar-events' ); ?></em></p>
344
+				<?php else {
345
+	: ?>
346
+					<p><em><?php _e( 'Could not find any calendars to add to this post.', 'google-calendar-events' );
347
+}
348
+?></em></p>
346 349
 					<strong><a href="post-new.php?post_type=calendar"><?php _e( 'Please add and configure new calendar first.', 'google-calendar-events' ); ?></a></strong>
347 350
 				<?php endif; ?>
348 351
 			</div>
Please login to merge, or discard this patch.
includes/admin/updater.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
 	 * @param string $_plugin_file Path to the plugin file.
63 63
 	 * @param array  $_api_data    Optional data to send with API calls.
64 64
 	 */
65
-	public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
65
+	public function __construct($_api_url, $_plugin_file, $_api_data = null) {
66 66
 
67
-		$this->api_url  = trailingslashit( $_api_url );
67
+		$this->api_url  = trailingslashit($_api_url);
68 68
 		$this->api_data = $_api_data;
69
-		$this->name     = plugin_basename( $_plugin_file );
70
-		$this->slug     = basename( $_plugin_file, '.php' );
69
+		$this->name     = plugin_basename($_plugin_file);
70
+		$this->slug     = basename($_plugin_file, '.php');
71 71
 		$this->version  = $_api_data['version'];
72 72
 
73 73
 		// Set up hooks.
74 74
 		$this->init();
75
-		add_action( 'admin_init', array( $this, 'show_changelog' ) );
75
+		add_action('admin_init', array($this, 'show_changelog'));
76 76
 	}
77 77
 
78 78
 	/**
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 	 * @return void
84 84
 	 */
85 85
 	public function init() {
86
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
87
-		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
88
-		remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
89
-		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
86
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
87
+		add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
88
+		remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10);
89
+		add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
90 90
 	}
91 91
 
92 92
 	/**
@@ -103,30 +103,30 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return array|\stdClass Modified update array with custom plugin data.
105 105
 	 */
106
-	public function check_update( $_transient_data ) {
106
+	public function check_update($_transient_data) {
107 107
 
108 108
 		global $pagenow;
109 109
 
110
-		if ( ! is_object( $_transient_data ) ) {
110
+		if ( ! is_object($_transient_data)) {
111 111
 			$_transient_data = new \stdClass();
112 112
 		}
113 113
 
114
-		if ( 'plugins.php' == $pagenow && is_multisite() ) {
114
+		if ('plugins.php' == $pagenow && is_multisite()) {
115 115
 			return $_transient_data;
116 116
 		}
117 117
 
118
-		if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
118
+		if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) {
119 119
 
120
-			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
120
+			$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
121 121
 
122
-			if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
122
+			if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
123 123
 
124
-				if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
125
-					$_transient_data->response[ $this->name ] = $version_info;
124
+				if (version_compare($this->version, $version_info->new_version, '<')) {
125
+					$_transient_data->response[$this->name] = $version_info;
126 126
 				}
127 127
 
128 128
 				$_transient_data->last_checked = time();
129
-				$_transient_data->checked[ $this->name ] = $this->version;
129
+				$_transient_data->checked[$this->name] = $this->version;
130 130
 			}
131 131
 
132 132
 		}
@@ -144,81 +144,81 @@  discard block
 block discarded – undo
144 144
 	 * @param string $file
145 145
 	 * @param array  $plugin
146 146
 	 */
147
-	public function show_update_notification( $file, $plugin ) {
147
+	public function show_update_notification($file, $plugin) {
148 148
 
149
-		if ( ! current_user_can( 'update_plugins' ) ) {
149
+		if ( ! current_user_can('update_plugins')) {
150 150
 			return;
151 151
 		}
152 152
 
153
-		if ( ! is_multisite() ) {
153
+		if ( ! is_multisite()) {
154 154
 			return;
155 155
 		}
156 156
 
157
-		if ( $this->name != $file ) {
157
+		if ($this->name != $file) {
158 158
 			return;
159 159
 		}
160 160
 
161 161
 		// Remove our filter on the site transient
162
-		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
162
+		remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
163 163
 
164
-		$update_cache = get_site_transient( 'update_plugins' );
164
+		$update_cache = get_site_transient('update_plugins');
165 165
 
166
-		if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
166
+		if ( ! is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) {
167 167
 
168
-			$cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
169
-			$version_info = get_transient( $cache_key );
168
+			$cache_key    = md5('edd_plugin_'.sanitize_key($this->name).'_version_info');
169
+			$version_info = get_transient($cache_key);
170 170
 
171
-			if ( false === $version_info ) {
171
+			if (false === $version_info) {
172 172
 
173
-				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
173
+				$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
174 174
 
175
-				set_transient( $cache_key, $version_info, 3600 );
175
+				set_transient($cache_key, $version_info, 3600);
176 176
 			}
177 177
 
178
-			if ( ! is_object( $version_info ) ) {
178
+			if ( ! is_object($version_info)) {
179 179
 				return;
180 180
 			}
181 181
 
182
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
183
-				$update_cache->response[ $this->name ] = $version_info;
182
+			if (version_compare($this->version, $version_info->new_version, '<')) {
183
+				$update_cache->response[$this->name] = $version_info;
184 184
 			}
185 185
 
186 186
 			$update_cache->last_checked = time();
187
-			$update_cache->checked[ $this->name ] = $this->version;
187
+			$update_cache->checked[$this->name] = $this->version;
188 188
 
189
-			set_site_transient( 'update_plugins', $update_cache );
189
+			set_site_transient('update_plugins', $update_cache);
190 190
 
191 191
 		} else {
192 192
 
193
-			$version_info = $update_cache->response[ $this->name ];
193
+			$version_info = $update_cache->response[$this->name];
194 194
 
195 195
 		}
196 196
 
197 197
 		// Restore our filter
198
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
198
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
199 199
 
200
-		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
200
+		if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
201 201
 
202 202
 			// build a plugin list row, with update notification
203
-			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
204
-			echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
203
+			$wp_list_table = _get_list_table('WP_Plugins_List_Table');
204
+			echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">';
205 205
 
206
-			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
206
+			$changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
207 207
 
208
-			if ( empty( $version_info->download_link ) ) {
208
+			if (empty($version_info->download_link)) {
209 209
 				printf(
210
-					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'google-calendar-events' ),
211
-					esc_html( $version_info->name ),
212
-					esc_url( $changelog_link ),
213
-					esc_html( $version_info->new_version )
210
+					__('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'google-calendar-events'),
211
+					esc_html($version_info->name),
212
+					esc_url($changelog_link),
213
+					esc_html($version_info->new_version)
214 214
 				);
215 215
 			} else {
216 216
 				printf(
217
-					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'google-calendar-events' ),
218
-					esc_html( $version_info->name ),
219
-					esc_url( $changelog_link ),
220
-					esc_html( $version_info->new_version ),
221
-					esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
217
+					__('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'google-calendar-events'),
218
+					esc_html($version_info->name),
219
+					esc_url($changelog_link),
220
+					esc_html($version_info->new_version),
221
+					esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name))
222 222
 				);
223 223
 			}
224 224
 
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @return object
240 240
 	 */
241
-	public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
241
+	public function plugins_api_filter($_data, $_action = '', $_args = null) {
242 242
 
243
-		if ( 'plugin_information' != $_action ) {
243
+		if ('plugin_information' != $_action) {
244 244
 			return $_data;
245 245
 		}
246 246
 
247
-		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
247
+		if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
248 248
 			return $_data;
249 249
 		}
250 250
 
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 			),
258 258
 		);
259 259
 
260
-		$api_response = $this->api_request( 'plugin_information', $to_send );
260
+		$api_response = $this->api_request('plugin_information', $to_send);
261 261
 
262
-		if ( false !== $api_response ) {
262
+		if (false !== $api_response) {
263 263
 			$_data = $api_response;
264 264
 		}
265 265
 
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 	 * @param  string $url
277 277
 	 * @return object|array $array
278 278
 	 */
279
-	public function http_request_args( $args, $url ) {
279
+	public function http_request_args($args, $url) {
280 280
 		// If it is an https request and we are performing a package download, disable ssl verification
281
-		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
281
+		if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
282 282
 			$args['sslverify'] = false;
283 283
 		}
284 284
 		return $args;
@@ -293,42 +293,42 @@  discard block
 block discarded – undo
293 293
 	 * @param  array  $_data   Parameters for the API action.
294 294
 	 * @return false|object
295 295
 	 */
296
-	private function api_request( $_action, $_data ) {
296
+	private function api_request($_action, $_data) {
297 297
 
298 298
 		global $wp_version;
299 299
 
300
-		$data = array_merge( $this->api_data, $_data );
300
+		$data = array_merge($this->api_data, $_data);
301 301
 
302
-		if ( $data['slug'] != $this->slug ) {
302
+		if ($data['slug'] != $this->slug) {
303 303
 			return;
304 304
 		}
305 305
 
306
-		if ( empty( $data['license'] ) ) {
306
+		if (empty($data['license'])) {
307 307
 			return;
308 308
 		}
309 309
 
310
-		if ( $this->api_url == home_url() ) {
310
+		if ($this->api_url == home_url()) {
311 311
 			return false; // Don't allow a plugin to ping itself
312 312
 		}
313 313
 
314 314
 		$api_params = array(
315 315
 			'edd_action' => 'get_version',
316 316
 			'license'    => $data['license'],
317
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
318
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
317
+			'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
318
+			'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
319 319
 			'slug'       => $data['slug'],
320 320
 			'author'     => $data['author'],
321 321
 			'url'        => home_url()
322 322
 		);
323 323
 
324
-		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
324
+		$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
325 325
 
326
-		if ( ! is_wp_error( $request ) ) {
327
-			$request = json_decode( wp_remote_retrieve_body( $request ) );
326
+		if ( ! is_wp_error($request)) {
327
+			$request = json_decode(wp_remote_retrieve_body($request));
328 328
 		}
329 329
 
330
-		if ( $request && isset( $request->sections ) ) {
331
-			$request->sections = maybe_unserialize( $request->sections );
330
+		if ($request && isset($request->sections)) {
331
+			$request->sections = maybe_unserialize($request->sections);
332 332
 		} else {
333 333
 			$request = false;
334 334
 		}
@@ -343,26 +343,26 @@  discard block
 block discarded – undo
343 343
 	 */
344 344
 	public function show_changelog() {
345 345
 
346
-		if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
346
+		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
347 347
 			return;
348 348
 		}
349 349
 
350
-		if ( empty( $_REQUEST['plugin'] ) ) {
350
+		if (empty($_REQUEST['plugin'])) {
351 351
 			return;
352 352
 		}
353 353
 
354
-		if ( empty( $_REQUEST['slug'] ) ) {
354
+		if (empty($_REQUEST['slug'])) {
355 355
 			return;
356 356
 		}
357 357
 
358
-		if ( ! current_user_can( 'update_plugins' ) ) {
359
-			wp_die( __( 'You do not have permission to install plugin updates', 'google-calendar-events' ), __( 'Error', 'google-calendar-events' ), array( 'response' => 403 ) );
358
+		if ( ! current_user_can('update_plugins')) {
359
+			wp_die(__('You do not have permission to install plugin updates', 'google-calendar-events'), __('Error', 'google-calendar-events'), array('response' => 403));
360 360
 		}
361 361
 
362
-		$response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
362
+		$response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug']));
363 363
 
364
-		if ( $response && isset( $response->sections['changelog'] ) ) {
365
-			echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
364
+		if ($response && isset($response->sections['changelog'])) {
365
+			echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>';
366 366
 		}
367 367
 
368 368
 		exit;
Please login to merge, or discard this patch.
includes/ajax.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Calendar_View;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @since 3.0.0
26 26
 	 */
27 27
 	public function __construct() {
28
-		add_action( 'init', array( $this, 'add_callbacks' ), 100 );
28
+		add_action('init', array($this, 'add_callbacks'), 100);
29 29
 	}
30 30
 
31 31
 	/**
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 
38 38
 		$calendars = simcal_get_calendar_types();
39 39
 
40
-		foreach ( $calendars as $calendar => $views ) {
40
+		foreach ($calendars as $calendar => $views) {
41 41
 
42
-			foreach ( $views as $view ) {
42
+			foreach ($views as $view) {
43 43
 
44
-				$the_view = simcal_get_calendar_view( 0, $calendar . '-' . $view );
44
+				$the_view = simcal_get_calendar_view(0, $calendar.'-'.$view);
45 45
 
46
-				if ( $the_view instanceof Calendar_View ) {
46
+				if ($the_view instanceof Calendar_View) {
47 47
 					$the_view->add_ajax_actions();
48 48
 				}
49 49
 			}
50 50
 		}
51 51
 
52
-		do_action( 'simcal_add_ajax_callbacks' );
52
+		do_action('simcal_add_ajax_callbacks');
53 53
 	}
54 54
 
55 55
 }
Please login to merge, or discard this patch.
includes/autoload.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
  * @package SimpleCalendar
6 6
  */
7 7
 
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if ( ! defined('ABSPATH')) {
9 9
 	exit;
10 10
 }
11 11
 
12
-if ( ! function_exists( 'SimpleCalendar_Autoload' ) ) {
12
+if ( ! function_exists('SimpleCalendar_Autoload')) {
13 13
 
14 14
 	/**
15 15
 	 * Plugin autoloader.
@@ -22,31 +22,31 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param $class
24 24
 	 */
25
-	function SimpleCalendar_Autoload( $class ) {
25
+	function SimpleCalendar_Autoload($class) {
26 26
 
27 27
 		// Do not load unless in plugin domain.
28 28
 		$namespace = 'SimpleCalendar';
29
-		if ( strpos( $class, $namespace ) !== 0 ) {
29
+		if (strpos($class, $namespace) !== 0) {
30 30
 			return;
31 31
 		}
32 32
 
33 33
 		// Converts Class_Name (class convention) to class-name (file convention).
34
-		$class_name = implode( '-', array_map( 'lcfirst', explode( '_', strtolower( $class ) ) ) );
34
+		$class_name = implode('-', array_map('lcfirst', explode('_', strtolower($class))));
35 35
 
36 36
 		// Remove the root namespace.
37
-		$unprefixed = substr( $class_name, strlen( $namespace ) );
37
+		$unprefixed = substr($class_name, strlen($namespace));
38 38
 
39 39
 		// Build the file path.
40
-		$file_path = str_replace( '\\', DIRECTORY_SEPARATOR, $unprefixed );
41
-		$file      = dirname( __FILE__ ) . '/' . $file_path . '.php';
40
+		$file_path = str_replace('\\', DIRECTORY_SEPARATOR, $unprefixed);
41
+		$file      = dirname(__FILE__).'/'.$file_path.'.php';
42 42
 
43
-		if ( file_exists( $file ) ) {
43
+		if (file_exists($file)) {
44 44
 			require $file;
45 45
 		}
46 46
 
47 47
 	}
48 48
 
49 49
 	// Register the autoloader.
50
-	spl_autoload_register( 'SimpleCalendar_Autoload' );
50
+	spl_autoload_register('SimpleCalendar_Autoload');
51 51
 
52 52
 }
Please login to merge, or discard this patch.
includes/calendars/views/default-calendar-grid.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -453,10 +453,12 @@
 block discarded – undo
453 453
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
454 454
 				endif;
455 455
 
456
-			else :
456
+			else {
457
+				:
457 458
 
458 459
 				// Empty cell for day with no events.
459 460
 				$list_events = '<span class="simcal-no-events"></span>';
461
+			}
460 462
 
461 463
 			endif;
462 464
 
Please login to merge, or discard this patch.
Spacing   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Events\Event;
14 14
 use SimpleCalendar\Calendars\Default_Calendar;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @param string|Calendar $calendar
57 57
 	 */
58
-	public function __construct( $calendar = '' ) {
58
+	public function __construct($calendar = '') {
59 59
 		$this->calendar = $calendar;
60 60
 	}
61 61
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return string
90 90
 	 */
91 91
 	public function get_name() {
92
-		return __( 'Grid', 'google-calendar-events' );
92
+		return __('Grid', 'google-calendar-events');
93 93
 	}
94 94
 
95 95
 	/**
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @since 3.0.0
99 99
 	 */
100 100
 	public function add_ajax_actions() {
101
-		add_action( 'wp_ajax_simcal_default_calendar_draw_grid', array( $this, 'draw_grid_ajax' ) );
102
-		add_action( 'wp_ajax_nopriv_simcal_default_calendar_draw_grid', array( $this, 'draw_grid_ajax' ) );
101
+		add_action('wp_ajax_simcal_default_calendar_draw_grid', array($this, 'draw_grid_ajax'));
102
+		add_action('wp_ajax_nopriv_simcal_default_calendar_draw_grid', array($this, 'draw_grid_ajax'));
103 103
 	}
104 104
 
105 105
 	/**
@@ -113,28 +113,28 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return array
115 115
 	 */
116
-	public function scripts( $min = '' ) {
116
+	public function scripts($min = '') {
117 117
 		return array(
118 118
 			'simcal-qtip' => array(
119
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/jquery.qtip' . $min . '.js',
120
-				'deps'      => array( 'jquery' ),
119
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/jquery.qtip'.$min.'.js',
120
+				'deps'      => array('jquery'),
121 121
 				'ver'       => '2.2.1',
122 122
 				'in_footer' => true,
123 123
 			),
124 124
 			'simcal-fullcal-moment' => array(
125
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/moment' . $min . '.js',
126
-				'deps'      => array( 'jquery' ),
125
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/moment'.$min.'.js',
126
+				'deps'      => array('jquery'),
127 127
 				'ver'       => '',
128 128
 				'in_footer' => true,
129 129
 			),
130 130
 			'simcal-moment-timezone' => array(
131
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/moment-timezone-with-data' . $min . '.js',
132
-				'deps'      => array( 'jquery' ),
131
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/moment-timezone-with-data'.$min.'.js',
132
+				'deps'      => array('jquery'),
133 133
 				'ver'       => '',
134 134
 				'in_footer' => true,
135 135
 			),
136 136
 			'simcal-default-calendar' => array(
137
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
137
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
138 138
 				'deps'      => array(
139 139
 					'jquery',
140 140
 					'simcal-qtip',
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return array
163 163
 	 */
164
-	public function styles( $min = '' ) {
164
+	public function styles($min = '') {
165 165
 		return array(
166 166
 			'simcal-qtip' => array(
167
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/vendor/jquery.qtip' . $min . '.css',
167
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/vendor/jquery.qtip'.$min.'.css',
168 168
 				'ver'   => '2.2.1',
169 169
 				'media' => 'all',
170 170
 			),
171 171
 			'simcal-default-calendar-grid' => array(
172
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-grid' . $min . '.css',
172
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-grid'.$min.'.css',
173 173
 				'deps'  => array(
174 174
 					'simcal-qtip',
175 175
 				),
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 				'media' => 'all',
178 178
 			),
179 179
 			'simcal-default-calendar-list' => array(
180
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
180
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
181 181
 				'deps'  => array(
182 182
 					'simcal-qtip',
183 183
 				),
@@ -196,22 +196,22 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$calendar = $this->calendar;
198 198
 
199
-		if ( $calendar instanceof Default_Calendar ) {
199
+		if ($calendar instanceof Default_Calendar) {
200 200
 
201 201
 			?>
202 202
 
203
-			<?php edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id ); ?>
203
+			<?php edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id); ?>
204 204
 
205 205
 			<table class="simcal-calendar-grid"
206 206
 			       data-event-bubble-trigger="<?php echo $calendar->event_bubble_trigger; ?>">
207 207
 				<thead class="simcal-calendar-head">
208 208
 					<tr>
209
-						<?php if ( ! $calendar->static ) { ?>
210
-							<th class="simcal-nav simcal-prev-wrapper" colspan="<?php echo apply_filters( 'simcal_prev_cols', '1' ); ?>">
211
-								<button class="simcal-nav-button simcal-month-nav simcal-prev" title="<?php _e( 'Previous Month', 'google-calendar-events' ); ?>"><i class="simcal-icon-left"></i></button>
209
+						<?php if ( ! $calendar->static) { ?>
210
+							<th class="simcal-nav simcal-prev-wrapper" colspan="<?php echo apply_filters('simcal_prev_cols', '1'); ?>">
211
+								<button class="simcal-nav-button simcal-month-nav simcal-prev" title="<?php _e('Previous Month', 'google-calendar-events'); ?>"><i class="simcal-icon-left"></i></button>
212 212
 							</th>
213 213
 						<?php } ?>
214
-						<th colspan="<?php echo apply_filters( 'simcal_current_cols', $calendar->static ? '7' : '5' ); ?>"
214
+						<th colspan="<?php echo apply_filters('simcal_current_cols', $calendar->static ? '7' : '5'); ?>"
215 215
 						    class="simcal-nav simcal-current"
216 216
 						    data-calendar-current="<?php echo $calendar->start; ?>">
217 217
 							<?php
@@ -220,26 +220,26 @@  discard block
 block discarded – undo
220 220
 
221 221
 							// Display month and year according to user date format preference.
222 222
 
223
-							$year_pos  = strcspn( $calendar->date_format, 'Y y' );
224
-							$month_pos = strcspn( $calendar->date_format, 'F M m n' );
223
+							$year_pos  = strcspn($calendar->date_format, 'Y y');
224
+							$month_pos = strcspn($calendar->date_format, 'F M m n');
225 225
 
226
-							$current = array( 'month' => 'F', 'year' => 'Y' );
226
+							$current = array('month' => 'F', 'year' => 'Y');
227 227
 
228
-							if ( $year_pos < $month_pos ) {
229
-								$current = array_reverse( $current );
228
+							if ($year_pos < $month_pos) {
229
+								$current = array_reverse($current);
230 230
 							}
231 231
 
232
-							foreach ( $current as $k => $v ) {
233
-								echo ' <span class="simcal-current-' . $k , '">' . date_i18n( $v, $calendar->start ) . '</span> ';
232
+							foreach ($current as $k => $v) {
233
+								echo ' <span class="simcal-current-'.$k, '">'.date_i18n($v, $calendar->start).'</span> ';
234 234
 							}
235 235
 
236 236
 							echo '</h3>';
237 237
 
238 238
 							?>
239 239
 						</th>
240
-						<?php if ( ! $calendar->static ) { ?>
241
-							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters( 'simcal_next_cols', '1' ); ?>">
242
-								<button class="simcal-nav-button simcal-month-nav simcal-next" title="<?php _e( 'Next Month', 'google-calendar-events' ); ?>"><i class="simcal-icon-right"></i></button>
240
+						<?php if ( ! $calendar->static) { ?>
241
+							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters('simcal_next_cols', '1'); ?>">
242
+								<button class="simcal-nav-button simcal-month-nav simcal-next" title="<?php _e('Next Month', 'google-calendar-events'); ?>"><i class="simcal-icon-right"></i></button>
243 243
 							</th>
244 244
 						<?php } ?>
245 245
 					</tr>
@@ -249,28 +249,28 @@  discard block
 block discarded – undo
249 249
 						// Print day names in short or long form for different viewport sizes.
250 250
 
251 251
 						$week_starts     = $calendar->week_starts;
252
-						$week_days_short = simcal_get_calendar_names_i18n( 'day', 'short' );
253
-						$week_days_full  = simcal_get_calendar_names_i18n( 'day', 'full' );
252
+						$week_days_short = simcal_get_calendar_names_i18n('day', 'short');
253
+						$week_days_full  = simcal_get_calendar_names_i18n('day', 'full');
254 254
 
255
-						for ( $i = $week_starts; $i <= 6; $i ++ ) :
255
+						for ($i = $week_starts; $i <= 6; $i++) :
256 256
 
257 257
 							?>
258 258
 							<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
259
-								data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
260
-							    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
261
-							    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
259
+								data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
260
+							    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
261
+							    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
262 262
 							<?php
263 263
 
264 264
 						endfor;
265 265
 
266
-						if ( $week_starts !== 0 ) :
267
-							for ( $i = 0; $i < $week_starts; $i ++ ) :
266
+						if ($week_starts !== 0) :
267
+							for ($i = 0; $i < $week_starts; $i++) :
268 268
 
269 269
 								?>
270 270
 								<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
271
-								    data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
272
-								    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
273
-								    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
271
+								    data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
272
+								    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
273
+								    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
274 274
 								<?php
275 275
 
276 276
 							endfor;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 					</tr>
281 281
 				</thead>
282 282
 
283
-				<?php echo $this->draw_month( date( 'n', $calendar->start ), date( 'Y', $calendar->start ) ); ?>
283
+				<?php echo $this->draw_month(date('n', $calendar->start), date('Y', $calendar->start)); ?>
284 284
 
285 285
 			</table>
286 286
 
@@ -306,85 +306,85 @@  discard block
 block discarded – undo
306 306
 	 *
307 307
 	 * @return string
308 308
 	 */
309
-	private function draw_month( $month, $year, $id = 0 ) {
309
+	private function draw_month($month, $year, $id = 0) {
310 310
 
311 311
 		$calendar = $this->calendar;
312
-		if ( empty( $calendar ) ) {
313
-			$calendar = simcal_get_calendar( intval( $id ) );
314
-			if ( ! $calendar ) {
312
+		if (empty($calendar)) {
313
+			$calendar = simcal_get_calendar(intval($id));
314
+			if ( ! $calendar) {
315 315
 				return '';
316 316
 			}
317 317
 		}
318 318
 
319 319
 		$events = $calendar->events;
320 320
 
321
-		$feed          = simcal_get_feed( $calendar );
322
-		$feed_timezone = get_post_meta( $feed->post_id, '_feed_timezone', true );
321
+		$feed          = simcal_get_feed($calendar);
322
+		$feed_timezone = get_post_meta($feed->post_id, '_feed_timezone', true);
323 323
 
324 324
 		// Variables to cycle days in current month and find today in calendar.
325 325
 		$now         = $calendar->now;
326
-		$current     = Carbon::create( $year, $month, 1, 0, 0, 0, $calendar->timezone );
326
+		$current     = Carbon::create($year, $month, 1, 0, 0, 0, $calendar->timezone);
327 327
 		$current_min = $current->getTimestamp();
328 328
 		$current_max = $current->endOfDay()->getTimestamp();
329 329
 
330 330
 		// Calendar grid variables.
331 331
 		$week_starts   = $calendar->week_starts;
332
-		$week_of_year  = $current->weekOfYear;   // Relative count of the week number of the year.
333
-		$month_starts  = $current->dayOfWeek;    // Day upon which the month starts.
334
-		$days_in_month = $current->daysInMonth;  // Number of days in the given month.
332
+		$week_of_year  = $current->weekOfYear; // Relative count of the week number of the year.
333
+		$month_starts  = $current->dayOfWeek; // Day upon which the month starts.
334
+		$days_in_month = $current->daysInMonth; // Number of days in the given month.
335 335
 
336 336
 		// Set current month events timestamp boundaries.
337 337
 		$this->start = $current_min;
338 338
 		$this->end   = $current->endOfMonth()->timestamp;
339 339
 
340 340
 		// Get daily events for this month.
341
-		if ( $events && is_array( $events ) ) {
341
+		if ($events && is_array($events)) {
342 342
 
343 343
 			// Filter events within the boundaries previously set above.
344
-			$timestamps   = array_keys( $events );
345
-			$lower_bound  = array_filter( $timestamps, array( $this, 'filter_events_before' ) );
346
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after' ) );
347
-			$filtered     = ( is_array( $events ) && is_array( $higher_bound) ) && ! empty( $events ) && ! empty( $higher_bound ) ? array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) ) : array();
344
+			$timestamps   = array_keys($events);
345
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
346
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
347
+			$filtered     = (is_array($events) && is_array($higher_bound)) && ! empty($events) && ! empty($higher_bound) ? array_intersect_key($events, array_combine($higher_bound, $higher_bound)) : array();
348 348
 
349 349
 			// Put resulting events in an associative array, with day of the month as key for easy retrieval in calendar days loop.
350 350
 			$day_events = array();
351
-			foreach ( $filtered as $timestamp => $events_in_day ) {
352
-				foreach ( $events_in_day as $event ) {
353
-					if ( $event instanceof Event ){
354
-						$day = intval( Carbon::createFromTimestamp( $timestamp, $event->timezone )->endOfDay()->day );
355
-						$day_events[ $day ][] = $event;
351
+			foreach ($filtered as $timestamp => $events_in_day) {
352
+				foreach ($events_in_day as $event) {
353
+					if ($event instanceof Event) {
354
+						$day = intval(Carbon::createFromTimestamp($timestamp, $event->timezone)->endOfDay()->day);
355
+						$day_events[$day][] = $event;
356 356
 					}
357 357
 				}
358 358
 			}
359 359
 
360
-			ksort( $day_events, SORT_NUMERIC );
360
+			ksort($day_events, SORT_NUMERIC);
361 361
 		}
362 362
 
363 363
 		ob_start();
364 364
 
365
-		echo '<tbody class="simcal-month simcal-month-' . $month . '">' . "\n";
366
-		echo "\t" . '<tr class="simcal-week simcal-week-' . $week_of_year . '">';
365
+		echo '<tbody class="simcal-month simcal-month-'.$month.'">'."\n";
366
+		echo "\t".'<tr class="simcal-week simcal-week-'.$week_of_year.'">';
367 367
 
368 368
 		$days_in_row = 0;
369 369
 		// Week may start on an arbitrary day (sun, 0 - sat, 6).
370 370
 		$week_day = $week_starts;
371 371
 
372 372
 		// This fixes a possible bug when a month starts by Sunday (0).
373
-		if ( 0 !== $week_starts ) {
373
+		if (0 !== $week_starts) {
374 374
 			$b = $month_starts === 0 ? 7 : $month_starts;
375 375
 		} else {
376 376
 			$b = $month_starts;
377 377
 		}
378 378
 
379 379
 		// Void days in first week.
380
-		for ( $a = $week_starts; $a < $b; $a++ ) :
380
+		for ($a = $week_starts; $a < $b; $a++) :
381 381
 
382
-			$last_void_day_class = ( $a === ( $b - 1 ) ) ? 'simcal-day-void-last' : '';
382
+			$last_void_day_class = ($a === ($b - 1)) ? 'simcal-day-void-last' : '';
383 383
 
384
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
384
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
385 385
 
386 386
 			// Reset day of the week count (sun, 0 - sat, 6).
387
-			if ( $week_day === 6 ) {
387
+			if ($week_day === 6) {
388 388
 				$week_day = -1;
389 389
 			}
390 390
 			$week_day++;
@@ -394,103 +394,103 @@  discard block
 block discarded – undo
394 394
 		endfor;
395 395
 
396 396
 		// Actual days of the month.
397
-		for ( $day = 1; $day <= $days_in_month; $day++ ) :
397
+		for ($day = 1; $day <= $days_in_month; $day++) :
398 398
 
399 399
 			$count = 0;
400 400
 			$calendar_classes = array();
401
-			$day_classes = 'simcal-day-' . $day . ' simcal-weekday-' . $week_day;
401
+			$day_classes = 'simcal-day-'.$day.' simcal-weekday-'.$week_day;
402 402
 
403 403
 			$border_style = $bg_color = $color = '';
404 404
 
405 405
 			// Is this the present, the past or the future, Doc?
406
-			if ( $current_min <= $now && $current_max >= $now ) {
406
+			if ($current_min <= $now && $current_max >= $now) {
407 407
 				$day_classes .= ' simcal-today simcal-present simcal-day';
408
-				$the_color = new Color( $calendar->today_color );
409
-				$bg_color = '#' . $the_color->getHex();
408
+				$the_color = new Color($calendar->today_color);
409
+				$bg_color = '#'.$the_color->getHex();
410 410
 				$color = $the_color->isDark() ? '#ffffff' : '#000000';
411
-				$border_style = ' style="border: 1px solid ' . $bg_color . ';"';
412
-			} elseif ( $current_max < $now ) {
411
+				$border_style = ' style="border: 1px solid '.$bg_color.';"';
412
+			} elseif ($current_max < $now) {
413 413
 				$day_classes .= ' simcal-past simcal-day';
414
-			} elseif ( $current_min > $now ) {
414
+			} elseif ($current_min > $now) {
415 415
 				$day_classes .= ' simcal-future simcal-day';
416 416
 			}
417 417
 
418 418
 			// Print events for the current day in loop, if found any.
419
-			if ( isset( $day_events[ $day ] ) ) :
419
+			if (isset($day_events[$day])) :
420 420
 
421 421
 				$bullet_colors = array();
422 422
 
423 423
 				$list_events = '<ul class="simcal-events">';
424 424
 
425
-				foreach ( $day_events[ $day ] as $event ) :
425
+				foreach ($day_events[$day] as $event) :
426 426
 
427 427
 					$event_classes = $event_visibility = '';
428 428
 
429
-					if ( $event instanceof Event ) :
429
+					if ($event instanceof Event) :
430 430
 
431
-						if ( $feed->type == 'grouped-calendars' ) {
432
-							date_default_timezone_set( $feed_timezone );
431
+						if ($feed->type == 'grouped-calendars') {
432
+							date_default_timezone_set($feed_timezone);
433 433
 						} else {
434
-							date_default_timezone_set( $event->timezone );
434
+							date_default_timezone_set($event->timezone);
435 435
 						}
436 436
 
437 437
 						// Store the calendar id where the event belongs (useful in grouped calendar feeds)
438
-						$calendar_class  = 'simcal-events-calendar-' . strval( $event->calendar );
439
-						$calendar_classes[] = $calendar_class ;
438
+						$calendar_class = 'simcal-events-calendar-'.strval($event->calendar);
439
+						$calendar_classes[] = $calendar_class;
440 440
 
441 441
 						$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
442 442
 						$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
443 443
 
444
-						$event_classes  .= 'simcal-event ' . $recurring . $has_location . $calendar_class . ' simcal-tooltip';
444
+						$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class.' simcal-tooltip';
445 445
 
446 446
 						// Toggle some events visibility if more than optional limit.
447
-						if ( ( $calendar->events_limit > -1 )  && ( $count >= $calendar->events_limit ) ) :
447
+						if (($calendar->events_limit > -1) && ($count >= $calendar->events_limit)) :
448 448
 							$event_classes    .= ' simcal-event-toggled';
449 449
 							$event_visibility  = ' style="display: none"';
450 450
 						endif;
451 451
 
452 452
 						// Event title in list.
453
-						$title = ! empty( $event->title ) ? trim( $event->title ) : __( 'Event', 'google-calendar-events' );
454
-						if ( $calendar->trim_titles >= 1 ) {
455
-							$title = strlen( $title ) > $calendar->trim_titles ? mb_substr( $title, 0, $calendar->trim_titles ) . '&hellip;' : $title;
453
+						$title = ! empty($event->title) ? trim($event->title) : __('Event', 'google-calendar-events');
454
+						if ($calendar->trim_titles >= 1) {
455
+							$title = strlen($title) > $calendar->trim_titles ? mb_substr($title, 0, $calendar->trim_titles).'&hellip;' : $title;
456 456
 						}
457 457
 
458 458
 						// Event color.
459 459
 						$bullet = '';
460 460
 						//$bullet_color = '#000';
461 461
 						$event_color = $event->get_color();
462
-						if ( ! empty( $event_color ) ) {
463
-							$bullet = '<span style="color: ' . $event_color . ';">&#9632;</span> ';
462
+						if ( ! empty($event_color)) {
463
+							$bullet = '<span style="color: '.$event_color.';">&#9632;</span> ';
464 464
 							$bullet_colors[] = $event_color;
465 465
 						} else {
466 466
 							$bullet_colors[] = '#000';
467 467
 						}
468 468
 
469 469
 						// Event contents.
470
-						$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . ' itemscope itemtype="http://schema.org/Event">' . "\n";
471
-						$list_events .= "\t\t" . '<span class="simcal-event-title">' . $bullet . $title . '</span>' . "\n";
472
-						$list_events .= "\t\t" . '<div class="simcal-event-details simcal-tooltip-content" style="display: none;">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
473
-						$list_events .= "\t" . '</li>' . "\n";
470
+						$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.' itemscope itemtype="http://schema.org/Event">'."\n";
471
+						$list_events .= "\t\t".'<span class="simcal-event-title">'.$bullet.$title.'</span>'."\n";
472
+						$list_events .= "\t\t".'<div class="simcal-event-details simcal-tooltip-content" style="display: none;">'.$calendar->get_event_html($event).'</div>'."\n";
473
+						$list_events .= "\t".'</li>'."\n";
474 474
 
475
-						$count ++;
475
+						$count++;
476 476
 
477 477
 					endif;
478 478
 
479 479
 				endforeach;
480 480
 
481
-				if ( ( $current_min <= $now ) && ( $current_max >= $now ) ) {
481
+				if (($current_min <= $now) && ($current_max >= $now)) {
482 482
 					$day_classes .= ' simcal-today-has-events';
483 483
 				}
484
-				$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
484
+				$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
485 485
 
486
-				if ( $calendar_classes ) {
487
-					$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
486
+				if ($calendar_classes) {
487
+					$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
488 488
 				}
489 489
 
490
-				$list_events .= '</ul>' . "\n";
490
+				$list_events .= '</ul>'."\n";
491 491
 
492 492
 				// Optional button to toggle hidden events in list.
493
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
493
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
494 494
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
495 495
 				endif;
496 496
 
@@ -502,49 +502,49 @@  discard block
 block discarded – undo
502 502
 			endif;
503 503
 
504 504
 			// The actual days with numbers and events in each row cell.
505
-			echo '<td class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
506
-
507
-			if ( $color ) {
508
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
509
-			} elseif ( $count > 0 ) {
510
-				$the_color = new Color( $calendar->days_events_color );
511
-				$color = ! $color ? ( $the_color->isDark() ? '#ffffff' : '#000000' ) : $color;
512
-				$bg_color = ! $bg_color ? '#' . $the_color->getHex() : $bg_color;
513
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
505
+			echo '<td class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
506
+
507
+			if ($color) {
508
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
509
+			} elseif ($count > 0) {
510
+				$the_color = new Color($calendar->days_events_color);
511
+				$color = ! $color ? ($the_color->isDark() ? '#ffffff' : '#000000') : $color;
512
+				$bg_color = ! $bg_color ? '#'.$the_color->getHex() : $bg_color;
513
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
514 514
 			} else {
515 515
 				$day_style = '';
516 516
 			}
517 517
 
518
-			echo "\t" . '<div' . $border_style . '>' . "\n";
519
-			echo "\t\t" . '<span class="simcal-day-label simcal-day-number"' . $day_style . '>' . $day . '</span>' . "\n";
520
-			echo "\t\t" . $list_events . "\n";
518
+			echo "\t".'<div'.$border_style.'>'."\n";
519
+			echo "\t\t".'<span class="simcal-day-label simcal-day-number"'.$day_style.'>'.$day.'</span>'."\n";
520
+			echo "\t\t".$list_events."\n";
521 521
 			echo "\t\t";
522 522
 			echo '<span class="simcal-events-dots" style="display: none;">';
523 523
 
524 524
 			// Event bullets for calendar mobile mode.
525
-			for( $i = 0; $i < $count; $i++ ) {
526
-				echo '<b style="color: ' . $bullet_colors[ $i ] . ';"> &bull; </b>';
525
+			for ($i = 0; $i < $count; $i++) {
526
+				echo '<b style="color: '.$bullet_colors[$i].';"> &bull; </b>';
527 527
 			}
528 528
 
529
-			echo '</span>' . "\n";
530
-			echo "\t" . '</div>' . "\n";
531
-			echo '</td>' . "\n";
529
+			echo '</span>'."\n";
530
+			echo "\t".'</div>'."\n";
531
+			echo '</td>'."\n";
532 532
 
533 533
 			// Reset day of the week count (sun, 0 - sat, 6).
534
-			if ( $week_day === 6 ) {
534
+			if ($week_day === 6) {
535 535
 				$week_day = - 1;
536 536
 			}
537 537
 			$week_day++;
538 538
 
539 539
 			// Reset count of days for this row (0-6).
540
-			if ( $days_in_row === 6 ) :
540
+			if ($days_in_row === 6) :
541 541
 
542 542
 				// Close the week row.
543 543
 				echo '</tr>';
544 544
 
545 545
 				// Open a new week row.
546
-				if ( $day < $days_in_month ) {
547
-					echo '<tr class="simcal-week simcal-week-' . $week_of_year++ . '">' . "\n";
546
+				if ($day < $days_in_month) {
547
+					echo '<tr class="simcal-week simcal-week-'.$week_of_year++.'">'."\n";
548 548
 				}
549 549
 
550 550
 				$days_in_row = -1;
@@ -553,27 +553,27 @@  discard block
 block discarded – undo
553 553
 
554 554
 			$days_in_row++;
555 555
 
556
-			$current_min = Carbon::createFromTimestamp( $current_min, $calendar->timezone )->addDay()->getTimestamp();
557
-			$current_max = Carbon::createFromTimestamp( $current_max, $calendar->timezone )->addDay()->getTimestamp();
556
+			$current_min = Carbon::createFromTimestamp($current_min, $calendar->timezone)->addDay()->getTimestamp();
557
+			$current_max = Carbon::createFromTimestamp($current_max, $calendar->timezone)->addDay()->getTimestamp();
558 558
 
559 559
 		endfor;
560 560
 
561 561
 		// Void days at the end of the month.
562
-		$remainder_days = ( 6 - $days_in_row );
562
+		$remainder_days = (6 - $days_in_row);
563 563
 
564
-		for ( $i = 0; $i <= $remainder_days; $i ++ ) {
564
+		for ($i = 0; $i <= $remainder_days; $i++) {
565 565
 
566
-			$last_void_day_class = ( $i == $remainder_days ) ? 'simcal-day-void-last' : '';
566
+			$last_void_day_class = ($i == $remainder_days) ? 'simcal-day-void-last' : '';
567 567
 
568
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
568
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
569 569
 
570 570
 			$week_day++;
571 571
 		}
572 572
 
573
-		echo "\t" . '</tr>' . "\n";
574
-		echo '</tbody>' . "\n";
573
+		echo "\t".'</tr>'."\n";
574
+		echo '</tbody>'."\n";
575 575
 
576
-		date_default_timezone_set( $calendar->site_timezone );
576
+		date_default_timezone_set($calendar->site_timezone);
577 577
 
578 578
 		return ob_get_clean();
579 579
 	}
@@ -585,17 +585,17 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	public function draw_grid_ajax() {
587 587
 
588
-		if ( isset( $_POST['month'] ) && isset( $_POST['year'] ) && isset( $_POST['id'] ) ) {
588
+		if (isset($_POST['month']) && isset($_POST['year']) && isset($_POST['id'])) {
589 589
 
590
-			$month = absint( $_POST['month'] );
591
-			$year  = absint( $_POST['year'] );
592
-			$id    = absint( $_POST['id'] );
590
+			$month = absint($_POST['month']);
591
+			$year  = absint($_POST['year']);
592
+			$id    = absint($_POST['id']);
593 593
 
594
-			wp_send_json_success( $this->draw_month( $month, $year, $id ) );
594
+			wp_send_json_success($this->draw_month($month, $year, $id));
595 595
 
596 596
 		} else {
597 597
 
598
-			wp_send_json_error( 'Missing arguments in default calendar grid ajax request.' );
598
+			wp_send_json_error('Missing arguments in default calendar grid ajax request.');
599 599
 
600 600
 		}
601 601
 
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 	 *
612 612
 	 * @return bool
613 613
 	 */
614
-	private function filter_events_before( $event ) {
615
-		return intval( $event ) >= intval( $this->start );
614
+	private function filter_events_before($event) {
615
+		return intval($event) >= intval($this->start);
616 616
 	}
617 617
 
618 618
 	/**
@@ -625,8 +625,8 @@  discard block
 block discarded – undo
625 625
 	 *
626 626
 	 * @return bool
627 627
 	 */
628
-	private function filter_events_after( $event ) {
629
-		return intval( $event ) < intval( $this->end );
628
+	private function filter_events_after($event) {
629
+		return intval($event) < intval($this->end);
630 630
 	}
631 631
 
632 632
 }
Please login to merge, or discard this patch.
includes/calendars/views/default-calendar-list.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -576,9 +576,11 @@
 block discarded – undo
576 576
 
577 577
 			endforeach;
578 578
 
579
-		else :
579
+		else {
580
+			:
580 581
 
581 582
 			echo "\t" . '<p>';
583
+		}
582 584
 
583 585
 			$message = get_post_meta( $calendar->id, '_no_events_message', true );
584 586
 
Please login to merge, or discard this patch.
Spacing   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Calendars\Default_Calendar;
14 14
 use SimpleCalendar\Events\Event;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @param string|Calendar $calendar
77 77
 	 */
78
-	public function __construct( $calendar = '' ) {
78
+	public function __construct($calendar = '') {
79 79
 		$this->calendar = $calendar;
80 80
 	}
81 81
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return string
110 110
 	 */
111 111
 	public function get_name() {
112
-		return __( 'List', 'google-calendar-events' );
112
+		return __('List', 'google-calendar-events');
113 113
 	}
114 114
 
115 115
 	/**
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * @since 3.0.0
119 119
 	 */
120 120
 	public function add_ajax_actions() {
121
-		add_action( 'wp_ajax_simcal_default_calendar_draw_list', array( $this, 'draw_list_ajax' ) );
122
-		add_action( 'wp_ajax_nopriv_simcal_default_calendar_draw_list', array( $this, 'draw_list_ajax' ) );
121
+		add_action('wp_ajax_simcal_default_calendar_draw_list', array($this, 'draw_list_ajax'));
122
+		add_action('wp_ajax_nopriv_simcal_default_calendar_draw_list', array($this, 'draw_list_ajax'));
123 123
 	}
124 124
 
125 125
 	/**
@@ -133,16 +133,16 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return array
135 135
 	 */
136
-	public function scripts( $min = '' ) {
136
+	public function scripts($min = '') {
137 137
 		return array(
138 138
 			'simcal-qtip' => array(
139
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/qtip' . $min . '.js',
140
-				'deps'      => array( 'jquery' ),
139
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/qtip'.$min.'.js',
140
+				'deps'      => array('jquery'),
141 141
 				'ver'       => '2.2.1',
142 142
 				'in_footer' => true,
143 143
 			),
144 144
 			'simcal-default-calendar' => array(
145
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
145
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
146 146
 				'deps'      => array(
147 147
 					'jquery',
148 148
 					'simcal-qtip',
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return array
169 169
 	 */
170
-	public function styles( $min = '' ) {
170
+	public function styles($min = '') {
171 171
 		return array(
172 172
 			'simcal-default-calendar-list' => array(
173
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
173
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
174 174
 				'ver'   => SIMPLE_CALENDAR_VERSION,
175 175
 				'media' => 'all',
176 176
 			),
@@ -186,49 +186,49 @@  discard block
 block discarded – undo
186 186
 
187 187
 		$calendar = $this->calendar;
188 188
 
189
-		if ( $calendar instanceof Default_Calendar ) {
189
+		if ($calendar instanceof Default_Calendar) {
190 190
 
191 191
 			$disabled = $calendar->static === true ? ' disabled="disabled"' : '';
192 192
 
193 193
 
194
-			$hide_header = get_post_meta( $this->calendar->id, '_default_calendar_list_header', true ) == 'yes' ? true : false;
195
-			$static_calendar = get_post_meta( $this->calendar->id, '_calendar_is_static', true ) == 'yes' ? true : false;
194
+			$hide_header = get_post_meta($this->calendar->id, '_default_calendar_list_header', true) == 'yes' ? true : false;
195
+			$static_calendar = get_post_meta($this->calendar->id, '_calendar_is_static', true) == 'yes' ? true : false;
196 196
 
197 197
 			$header_class = '';
198 198
 			$compact_list_class = $calendar->compact_list ? 'simcal-calendar-list-compact' : '';
199 199
 
200
-			edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id );
200
+			edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id);
201 201
 
202
-			echo '<div class="simcal-calendar-list ' . $compact_list_class . '">';
202
+			echo '<div class="simcal-calendar-list '.$compact_list_class.'">';
203 203
 
204
-			if ( ! $hide_header && ! $static_calendar ) {
205
-				echo '<nav class="simcal-calendar-head">' . "\n";
204
+			if ( ! $hide_header && ! $static_calendar) {
205
+				echo '<nav class="simcal-calendar-head">'."\n";
206 206
 
207
-				echo "\t" . '<div class="simcal-nav">' . "\n";
208
-				echo "\t\t" . '<button class="simcal-nav-button simcal-prev" title="' . __('Previous', 'google-calendar-events') . '"' . $disabled . '>' . "\n";
209
-				echo "\t\t\t" . '<i class="simcal-icon-left"></i>' . "\n";
210
-				echo "\t\t" . '</button>' . "\n";
211
-				echo "\t" . '</div>' . "\n";
207
+				echo "\t".'<div class="simcal-nav">'."\n";
208
+				echo "\t\t".'<button class="simcal-nav-button simcal-prev" title="'.__('Previous', 'google-calendar-events').'"'.$disabled.'>'."\n";
209
+				echo "\t\t\t".'<i class="simcal-icon-left"></i>'."\n";
210
+				echo "\t\t".'</button>'."\n";
211
+				echo "\t".'</div>'."\n";
212 212
 
213
-				if ( $hide_header ) {
213
+				if ($hide_header) {
214 214
 					$header_class = 'simcal-hide-header';
215 215
 				}
216 216
 
217 217
 
218
-				echo "\t" . '<div class="simcal-nav simcal-current ' . $header_class . '" data-calendar-current="' . $calendar->start . '">' . "\n";
219
-				echo "\t\t" . '<h3 class="simcal-current-label"> </h3>' . "\n";
220
-				echo "\t" . '</div>' . "\n";
218
+				echo "\t".'<div class="simcal-nav simcal-current '.$header_class.'" data-calendar-current="'.$calendar->start.'">'."\n";
219
+				echo "\t\t".'<h3 class="simcal-current-label"> </h3>'."\n";
220
+				echo "\t".'</div>'."\n";
221 221
 
222
-				echo "\t" . '<div class="simcal-nav">';
223
-				echo "\t\t" . '<button class="simcal-nav-button simcal-next" title="' . __('Next', 'google-calendar-events') . '"' . $disabled . '>';
224
-				echo "\t\t\t" . '<i class="simcal-icon-right"></i>' . "\n";
225
-				echo "\t\t" . '</button>' . "\n";
226
-				echo "\t" . '</div>' . "\n";
222
+				echo "\t".'<div class="simcal-nav">';
223
+				echo "\t\t".'<button class="simcal-nav-button simcal-next" title="'.__('Next', 'google-calendar-events').'"'.$disabled.'>';
224
+				echo "\t\t\t".'<i class="simcal-icon-right"></i>'."\n";
225
+				echo "\t\t".'</button>'."\n";
226
+				echo "\t".'</div>'."\n";
227 227
 
228
-				echo '</nav>' . "\n";
228
+				echo '</nav>'."\n";
229 229
 			}
230 230
 
231
-			echo $this->draw_list( $calendar->start );
231
+			echo $this->draw_list($calendar->start);
232 232
 
233 233
 			echo '<div class="simcal-ajax-loader simcal-spinner-top" style="display: none;"><i class="simcal-icon-spinner simcal-icon-spin"></i></div>';
234 234
 
@@ -248,98 +248,98 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @return array
250 250
 	 */
251
-	private function get_events( $timestamp ) {
251
+	private function get_events($timestamp) {
252 252
 
253 253
 		$calendar = $this->calendar;
254 254
 		$timezone = $calendar->timezone;
255 255
 
256
-		if ( ! $calendar->group_type || ! $calendar->group_span ) {
256
+		if ( ! $calendar->group_type || ! $calendar->group_span) {
257 257
 			return array();
258 258
 		}
259 259
 
260
-		$current = Carbon::createFromTimestamp( $timestamp, $timezone );
260
+		$current = Carbon::createFromTimestamp($timestamp, $timezone);
261 261
 		$prev = clone $current;
262 262
 		$next = clone $current;
263 263
 
264 264
 		$this->start = $current->getTimestamp();
265 265
 
266
-		$interval = $span = max( absint( $calendar->group_span ), 1 );
267
-
268
-		if ( 'monthly' == $calendar->group_type ) {
269
-			$this->prev = $prev->subMonths( $span )->getTimestamp();
270
-			$this->next = $next->addMonths( $span )->getTimestamp();
271
-		} elseif ( 'weekly' == $calendar->group_type ) {
272
-			$week = new Carbon( $calendar->timezone );
273
-			$week->setTimestamp( $timestamp );
274
-			$week->setWeekStartsAt( $calendar->week_starts );
275
-			$this->prev = $prev->subWeeks( $span )->getTimestamp();
276
-			$this->next = $next->addWeeks( $span )->getTimestamp();
277
-		} elseif ( 'daily' == $calendar->group_type ) {
278
-			$this->prev = $prev->subDays( $span )->getTimestamp();
279
-			$this->next = $next->addDays( $span )->getTimestamp();
266
+		$interval = $span = max(absint($calendar->group_span), 1);
267
+
268
+		if ('monthly' == $calendar->group_type) {
269
+			$this->prev = $prev->subMonths($span)->getTimestamp();
270
+			$this->next = $next->addMonths($span)->getTimestamp();
271
+		} elseif ('weekly' == $calendar->group_type) {
272
+			$week = new Carbon($calendar->timezone);
273
+			$week->setTimestamp($timestamp);
274
+			$week->setWeekStartsAt($calendar->week_starts);
275
+			$this->prev = $prev->subWeeks($span)->getTimestamp();
276
+			$this->next = $next->addWeeks($span)->getTimestamp();
277
+		} elseif ('daily' == $calendar->group_type) {
278
+			$this->prev = $prev->subDays($span)->getTimestamp();
279
+			$this->next = $next->addDays($span)->getTimestamp();
280 280
 		}
281 281
 
282 282
 		$events = $calendar->events;
283 283
 		$daily_events = $paged_events = $flattened_events = array();
284 284
 
285
-		if ( 'events' != $calendar->group_type ) {
285
+		if ('events' != $calendar->group_type) {
286 286
 
287
-			$this->end   = $this->next - 1;
287
+			$this->end = $this->next - 1;
288 288
 
289
-			$timestamps   = array_keys( $events );
290
-			$lower_bound  = array_filter( $timestamps,  array( $this, 'filter_events_before' ) );
291
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after'  ) );
289
+			$timestamps   = array_keys($events);
290
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
291
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
292 292
 
293
-			if ( is_array( $higher_bound ) && !empty( $higher_bound ) ) {
294
-				$filtered = array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) );
295
-				foreach ( $filtered as $timestamp => $events ) {
296
-					$paged_events[ intval( $timestamp ) ] = $events;
293
+			if (is_array($higher_bound) && ! empty($higher_bound)) {
294
+				$filtered = array_intersect_key($events, array_combine($higher_bound, $higher_bound));
295
+				foreach ($filtered as $timestamp => $events) {
296
+					$paged_events[intval($timestamp)] = $events;
297 297
 				}
298 298
 			}
299 299
 
300 300
 		} else {
301 301
 
302
-			foreach ( $events as $timestamp => $e ) {
302
+			foreach ($events as $timestamp => $e) {
303 303
 				$second = 0;
304
-				foreach ( $e as $event ) {
305
-					$flattened_events[ intval( $timestamp + $second ) ][] = $event;
304
+				foreach ($e as $event) {
305
+					$flattened_events[intval($timestamp + $second)][] = $event;
306 306
 					$second++;
307 307
 				}
308 308
 			}
309
-			ksort( $flattened_events, SORT_NUMERIC );
309
+			ksort($flattened_events, SORT_NUMERIC);
310 310
 
311
-			$keys  = array_keys( $flattened_events );
311
+			$keys = array_keys($flattened_events);
312 312
 			$current = 0;
313
-			foreach ( $keys as $timestamp ) {
314
-				if ( $timestamp < $this->start ) {
313
+			foreach ($keys as $timestamp) {
314
+				if ($timestamp < $this->start) {
315 315
 					$current++;
316 316
 				}
317 317
 			}
318 318
 
319
-			$paged_events = array_slice( $flattened_events, $current, $interval, true );
319
+			$paged_events = array_slice($flattened_events, $current, $interval, true);
320 320
 
321
-			$events_end = isset( $keys[ $current + $interval ] ) ? $keys[ $current + $interval ] : $calendar->end;
321
+			$events_end = isset($keys[$current + $interval]) ? $keys[$current + $interval] : $calendar->end;
322 322
 			$this->end  = $events_end > $calendar->end ? $calendar->end : $events_end;
323 323
 
324
-			$this->prev = isset( $keys[ $current - $interval ] ) ? $keys[ $current - $interval ] : $calendar->earliest_event;
325
-			$this->next = isset( $keys[ $current + $interval ] ) ? $keys[ $current + $interval ] : $this->end;
324
+			$this->prev = isset($keys[$current - $interval]) ? $keys[$current - $interval] : $calendar->earliest_event;
325
+			$this->next = isset($keys[$current + $interval]) ? $keys[$current + $interval] : $this->end;
326 326
 
327 327
 		}
328 328
 
329 329
 		// Put resulting events in an associative array, with Ymd date as key for easy retrieval in calendar days loop.
330
-		foreach ( $paged_events as $timestamp => $events ) {
331
-			if ( $timestamp <= $this->end ) {
332
-				$date = Carbon::createFromTimestamp( $timestamp, $calendar->timezone )->endOfDay()->format( 'Ymd' );
333
-				$daily_events[ intval( $date ) ][] = $events;
330
+		foreach ($paged_events as $timestamp => $events) {
331
+			if ($timestamp <= $this->end) {
332
+				$date = Carbon::createFromTimestamp($timestamp, $calendar->timezone)->endOfDay()->format('Ymd');
333
+				$daily_events[intval($date)][] = $events;
334 334
 			}
335 335
 		}
336
-		ksort( $daily_events, SORT_NUMERIC );
336
+		ksort($daily_events, SORT_NUMERIC);
337 337
 
338
-		$first_event = array_slice( $paged_events, 0, 1, true );
339
-		$first_event = array_pop( $first_event );
338
+		$first_event = array_slice($paged_events, 0, 1, true);
339
+		$first_event = array_pop($first_event);
340 340
 		$this->first_event = $first_event[0]->start;
341 341
 
342
-		$last_event = array_pop( $paged_events );
342
+		$last_event = array_pop($paged_events);
343 343
 		$this->last_event = $last_event[0]->start;
344 344
 
345 345
 		return $daily_events;
@@ -358,84 +358,84 @@  discard block
 block discarded – undo
358 358
 	private function get_heading() {
359 359
 
360 360
 		$calendar = $this->calendar;
361
-		$start = Carbon::createFromTimestamp( $calendar->start, $calendar->timezone );
362
-		$end = Carbon::createFromTimestamp( $this->end, $calendar->timezone );
361
+		$start = Carbon::createFromTimestamp($calendar->start, $calendar->timezone);
362
+		$end = Carbon::createFromTimestamp($this->end, $calendar->timezone);
363 363
 		$date_format = $this->calendar->date_format;
364
-		$date_order  = simcal_get_date_format_order( $date_format );
364
+		$date_order  = simcal_get_date_format_order($date_format);
365 365
 
366 366
 		$st = $this->start;
367 367
 		$et = $this->end;
368 368
 
369
-		if ( $this->first_event !== 0 ) {
370
-			$start = Carbon::createFromTimestamp( $this->first_event, $calendar->timezone );
369
+		if ($this->first_event !== 0) {
370
+			$start = Carbon::createFromTimestamp($this->first_event, $calendar->timezone);
371 371
 			$st = $this->first_event;
372 372
 		}
373 373
 
374
-		if ( $this->last_event !== 0 ) {
375
-			$end = Carbon::createFromTimestamp( $this->last_event, $calendar->timezone );
374
+		if ($this->last_event !== 0) {
375
+			$end = Carbon::createFromTimestamp($this->last_event, $calendar->timezone);
376 376
 			$et = $this->last_event;
377 377
 		}
378 378
 
379
-		if ( ( $start->day == $end->day ) && ( $start->month == $end->month ) && ( $start->year == $end->year ) ) {
379
+		if (($start->day == $end->day) && ($start->month == $end->month) && ($start->year == $end->year)) {
380 380
 			// Start and end on the same day.
381 381
 			// e.g. 1 February 2020
382
-			$large = $small = date_i18n( $calendar->date_format , $st );
383
-			if ( ( $date_order['d'] !== false ) && ( $date_order['m'] !== false ) ) {
384
-				if ( $date_order['m'] > $date_order['d'] ) {
385
-					if ( $date_order['y'] !== false && $date_order['y'] > $date_order['m'] ) {
386
-						$small = date_i18n( 'Y, d M', $st );
382
+			$large = $small = date_i18n($calendar->date_format, $st);
383
+			if (($date_order['d'] !== false) && ($date_order['m'] !== false)) {
384
+				if ($date_order['m'] > $date_order['d']) {
385
+					if ($date_order['y'] !== false && $date_order['y'] > $date_order['m']) {
386
+						$small = date_i18n('Y, d M', $st);
387 387
 					} else {
388
-						$small = date_i18n( 'd M Y', $st );
388
+						$small = date_i18n('d M Y', $st);
389 389
 					}
390 390
 				} else {
391
-					if ( $date_order['y'] !== false && $date_order['y'] > $date_order['m'] ) {
392
-						$small = date_i18n( 'Y, M d', $st );
391
+					if ($date_order['y'] !== false && $date_order['y'] > $date_order['m']) {
392
+						$small = date_i18n('Y, M d', $st);
393 393
 					} else {
394
-						$small = date_i18n( 'M d Y', $st );
394
+						$small = date_i18n('M d Y', $st);
395 395
 					}
396 396
 				}
397 397
 			}
398
-		} elseif ( ( $start->month == $end->month ) && ( $start->year == $end->year ) ) {
398
+		} elseif (($start->month == $end->month) && ($start->year == $end->year)) {
399 399
 			// Start and end days on the same month.
400 400
 			// e.g. August 2020
401
-			if ( $date_order['y'] === false ) {
401
+			if ($date_order['y'] === false) {
402 402
 				// August.
403
-				$large = $small = date_i18n( 'F', $st );
403
+				$large = $small = date_i18n('F', $st);
404 404
 			} else {
405
-				if ( $date_order['y'] < $date_order['m'] ) {
405
+				if ($date_order['y'] < $date_order['m']) {
406 406
 					// 2020 August.
407
-					$large = date_i18n( 'Y F', $st );
408
-					$small = date_i18n( 'Y M', $st );
407
+					$large = date_i18n('Y F', $st);
408
+					$small = date_i18n('Y M', $st);
409 409
 				} else {
410 410
 					// August 2020.
411
-					$large = date_i18n( 'F Y', $st );
412
-					$small = date_i18n( 'M Y', $st );
411
+					$large = date_i18n('F Y', $st);
412
+					$small = date_i18n('M Y', $st);
413 413
 				}
414 414
 			}
415
-		} elseif ( $start->year == $end->year ) {
415
+		} elseif ($start->year == $end->year) {
416 416
 			// Start and end days on months of the same year.
417 417
 			// e.g. August - September 2020
418
-			if ( $date_order['y'] === false ) {
418
+			if ($date_order['y'] === false) {
419 419
 				// August - September.
420
-				$large = date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et );
421
-				$small = date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et );
420
+				$large = date_i18n('F', $st).' - '.date_i18n('F', $et);
421
+				$small = date_i18n('M', $st).' - '.date_i18n('M', $et);
422 422
 			} else {
423
-				if ( $date_order['y'] < $date_order['m'] ) {
423
+				if ($date_order['y'] < $date_order['m']) {
424 424
 					// 2020, August - September.
425
-					$large  = $small = date( 'Y', $st ) . ', ';
426
-					$large .= date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et );
427
-					$small .= date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et );
425
+					$large  = $small = date('Y', $st).', ';
426
+					$large .= date_i18n('F', $st).' - '.date_i18n('F', $et);
427
+					$small .= date_i18n('M', $st).' - '.date_i18n('M', $et);
428 428
 				} else {
429 429
 					// August - September, 2020.
430
-					$large  = date_i18n( 'F', $st ) . ' - ' . date_i18n( 'F', $et ) . ', ';
431
-					$small  = date_i18n( 'M', $st ) . ' - ' . date_i18n( 'M', $et ) . ' ';
432
-					$year   = date( 'Y', $st );
430
+					$large  = date_i18n('F', $st).' - '.date_i18n('F', $et).', ';
431
+					$small  = date_i18n('M', $st).' - '.date_i18n('M', $et).' ';
432
+					$year   = date('Y', $st);
433 433
 					$large .= $year;
434 434
 					$small .= $year;
435 435
 				}
436 436
 			}
437 437
 		} else {
438
-			$large = $small = date( 'Y', $st ) . ' - ' . date( 'Y', $et );
438
+			$large = $small = date('Y', $st).' - '.date('Y', $et);
439 439
 		}
440 440
 
441 441
 		return array(
@@ -457,133 +457,133 @@  discard block
 block discarded – undo
457 457
 	 *
458 458
 	 * @return string
459 459
 	 */
460
-	private function draw_list( $timestamp, $id = 0 ) {
460
+	private function draw_list($timestamp, $id = 0) {
461 461
 
462 462
 		$calendar = $this->calendar;
463 463
 
464
-		if ( empty( $calendar ) ) {
465
-			$calendar = $this->calendar = simcal_get_calendar( intval( $id ) );
466
-			if ( ! $calendar instanceof Default_Calendar ) {
464
+		if (empty($calendar)) {
465
+			$calendar = $this->calendar = simcal_get_calendar(intval($id));
466
+			if ( ! $calendar instanceof Default_Calendar) {
467 467
 				return '';
468 468
 			}
469 469
 		}
470 470
 
471
-		$feed          = simcal_get_feed( $calendar );
472
-		$feed_timezone = get_post_meta( $feed->post_id, '_feed_timezone', true );
471
+		$feed          = simcal_get_feed($calendar);
472
+		$feed_timezone = get_post_meta($feed->post_id, '_feed_timezone', true);
473 473
 
474 474
 		$now = $calendar->now;
475
-		$current_events = $this->get_events( $timestamp );
476
-		$day_format = explode( ' ', $calendar->date_format );
475
+		$current_events = $this->get_events($timestamp);
476
+		$day_format = explode(' ', $calendar->date_format);
477 477
 
478 478
 		ob_start();
479 479
 
480 480
 		// Draw the events.
481 481
 
482
-		$block_tag = $calendar->compact_list && ! empty( $current_events ) ? 'div' : 'dl';
482
+		$block_tag = $calendar->compact_list && ! empty($current_events) ? 'div' : 'dl';
483 483
 
484 484
 		$data_heading = '';
485 485
 		$heading = $this->get_heading();
486
-		foreach ( $heading as $k => $v ) {
487
-			$data_heading .= ' data-heading-' . $k . '="' . $v . '"';
486
+		foreach ($heading as $k => $v) {
487
+			$data_heading .= ' data-heading-'.$k.'="'.$v.'"';
488 488
 		}
489 489
 
490
-		echo '<' . $block_tag . ' class="simcal-events-list-container"' .
491
-			' data-prev="' . $this->prev . '"' .
492
-			' data-next="' . $this->next . '"' .
493
-			$data_heading . '>';
490
+		echo '<'.$block_tag.' class="simcal-events-list-container"'.
491
+			' data-prev="'.$this->prev.'"'.
492
+			' data-next="'.$this->next.'"'.
493
+			$data_heading.'>';
494 494
 
495
-		if ( ! empty( $current_events ) && is_array( $current_events ) ) :
495
+		if ( ! empty($current_events) && is_array($current_events)) :
496 496
 
497
-			foreach ( $current_events as $ymd => $events ) :
497
+			foreach ($current_events as $ymd => $events) :
498 498
 
499 499
 
500 500
 
501 501
 				// This is where we can find out if an event is a multi-day event and if it needs to be shown.
502 502
 				// Since this is for list view we are showing the event on the day viewed if it is part of that day even when
503 503
 				// expand multi-day events are turned off.
504
-				if ( isset( $events[0][0]->multiple_days ) && $events[0][0]->multiple_days > 0 ) {
505
-					if ( 'current_day_only' == get_post_meta($calendar->id, '_default_calendar_expand_multi_day_events', true ) ) {
504
+				if (isset($events[0][0]->multiple_days) && $events[0][0]->multiple_days > 0) {
505
+					if ('current_day_only' == get_post_meta($calendar->id, '_default_calendar_expand_multi_day_events', true)) {
506 506
 
507
-						$year  = substr( $ymd, 0, 4 );
508
-						$month = substr( $ymd, 4, 2 );
509
-						$day   = substr( $ymd, 6, 2 );
507
+						$year  = substr($ymd, 0, 4);
508
+						$month = substr($ymd, 4, 2);
509
+						$day   = substr($ymd, 6, 2);
510 510
 
511
-						$temp_date = Carbon::createFromDate( $year, $month, $day );
511
+						$temp_date = Carbon::createFromDate($year, $month, $day);
512 512
 
513
-						if( ! ( $temp_date < Carbon::now()->endOfDay() ) ) {
513
+						if ( ! ($temp_date < Carbon::now()->endOfDay())) {
514 514
 							continue;
515 515
 						}
516 516
 					}
517 517
 				}
518 518
 
519
-				$day_ts = Carbon::createFromFormat( 'Ymd', $ymd, $calendar->timezone )->startOfDay()->getTimestamp();
519
+				$day_ts = Carbon::createFromFormat('Ymd', $ymd, $calendar->timezone)->startOfDay()->getTimestamp();
520 520
 
521
-				if ( ! $calendar->compact_list ) :
521
+				if ( ! $calendar->compact_list) :
522 522
 
523
-					$date = new Carbon( 'now', $calendar->timezone );
524
-					$date->setLocale( substr( get_locale(), 0, 2 ) );
525
-					$date->setTimestamp( $day_ts );
523
+					$date = new Carbon('now', $calendar->timezone);
524
+					$date->setLocale(substr(get_locale(), 0, 2));
525
+					$date->setTimestamp($day_ts);
526 526
 
527
-					if ( $date->isToday() ) {
528
-						$the_color = new Color( $calendar->today_color );
527
+					if ($date->isToday()) {
528
+						$the_color = new Color($calendar->today_color);
529 529
 					} else {
530
-						$the_color = new Color( $calendar->days_events_color );
530
+						$the_color = new Color($calendar->days_events_color);
531 531
 					}
532 532
 
533
-					$bg_color = '#' . $the_color->getHex();
533
+					$bg_color = '#'.$the_color->getHex();
534 534
 					$color = $the_color->isDark() ? '#ffffff' : '#000000';
535
-					$border_style = ' style="border-bottom: 1px solid ' . $bg_color . ';" ';
536
-					$bg_style = ' style="background-color: ' . $bg_color . '; color: ' . $color . ';"';
535
+					$border_style = ' style="border-bottom: 1px solid '.$bg_color.';" ';
536
+					$bg_style = ' style="background-color: '.$bg_color.'; color: '.$color.';"';
537 537
 
538
-					echo "\t" . '<dt class="simcal-day-label"' . $border_style . '>';
539
-					echo '<span' . $bg_style .'>';
540
-					foreach ( $day_format as $format ) {
541
-						echo $format ? '<span class="simcal-date-format" data-date-format="' . $format . '">' . date_i18n( $format, $day_ts ) . '</span> ' : ' ';
538
+					echo "\t".'<dt class="simcal-day-label"'.$border_style.'>';
539
+					echo '<span'.$bg_style.'>';
540
+					foreach ($day_format as $format) {
541
+						echo $format ? '<span class="simcal-date-format" data-date-format="'.$format.'">'.date_i18n($format, $day_ts).'</span> ' : ' ';
542 542
 					}
543 543
 					echo '</span>';
544
-					echo '</dt>' . "\n";
544
+					echo '</dt>'."\n";
545 545
 
546 546
 				endif;
547 547
 
548
-				$list_events = '<ul class="simcal-events">' . "\n";
548
+				$list_events = '<ul class="simcal-events">'."\n";
549 549
 
550 550
 				$calendar_classes = array();
551
-				$day_classes = 'simcal-weekday-' . date( 'w', $day_ts );
551
+				$day_classes = 'simcal-weekday-'.date('w', $day_ts);
552 552
 
553 553
 				// Is this the present, the past or the future, Doc?
554
-				if ( $timestamp <= $now && $timestamp >= $now ) {
554
+				if ($timestamp <= $now && $timestamp >= $now) {
555 555
 					$day_classes .= ' simcal-today simcal-present simcal-day';
556
-				} elseif ( $timestamp < $now ) {
556
+				} elseif ($timestamp < $now) {
557 557
 					$day_classes .= ' simcal-past simcal-day';
558
-				} elseif ( $this->end > $now ) {
558
+				} elseif ($this->end > $now) {
559 559
 					$day_classes .= ' simcal-future simcal-day';
560 560
 				}
561 561
 
562 562
 				$count = 0;
563 563
 
564
-				foreach ( $events as $day_events ) :
565
-					foreach ( $day_events as $event ) :
564
+				foreach ($events as $day_events) :
565
+					foreach ($day_events as $event) :
566 566
 
567
-						if ( $event instanceof Event ) :
567
+						if ($event instanceof Event) :
568 568
 
569
-							if ( $feed->type == 'grouped-calendars' ) {
570
-								date_default_timezone_set( $feed_timezone );
569
+							if ($feed->type == 'grouped-calendars') {
570
+								date_default_timezone_set($feed_timezone);
571 571
 							} else {
572
-								date_default_timezone_set( $event->timezone );
572
+								date_default_timezone_set($event->timezone);
573 573
 							}
574 574
 
575 575
 							$event_classes = $event_visibility = '';
576 576
 
577
-							$calendar_class     = 'simcal-events-calendar-' . strval( $event->calendar );
577
+							$calendar_class     = 'simcal-events-calendar-'.strval($event->calendar);
578 578
 							$calendar_classes[] = $calendar_class;
579 579
 
580 580
 							$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
581 581
 							$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
582 582
 
583
-							$event_classes .= 'simcal-event ' . $recurring . $has_location . $calendar_class;
583
+							$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class;
584 584
 
585 585
 							// Toggle some events visibility if more than optional limit.
586
-							if ( ( $calendar->events_limit > - 1 ) && ( $count >= $calendar->events_limit ) ) :
586
+							if (($calendar->events_limit > - 1) && ($count >= $calendar->events_limit)) :
587 587
 								$event_classes .= ' simcal-event-toggled';
588 588
 								$event_visibility = ' style="display: none"';
589 589
 							endif;
@@ -591,75 +591,75 @@  discard block
 block discarded – undo
591 591
 							$event_color = '';
592 592
 							$bullet = '';
593 593
 							$event_color = $event->get_color();
594
-							if ( ! empty( $event_color ) ) {
594
+							if ( ! empty($event_color)) {
595 595
 								$side = is_rtl() ? 'right' : 'left';
596
-								$event_color = ' style="border-' . $side . ': 4px solid ' . $event_color . '; padding-' . $side . ': 8px;"';
596
+								$event_color = ' style="border-'.$side.': 4px solid '.$event_color.'; padding-'.$side.': 8px;"';
597 597
 							}
598 598
 
599
-							$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . $event_color . ' itemscope itemtype="http://schema.org/Event" data-start="' . esc_attr( $event->start ) . '">' . "\n";
600
-							$list_events .= "\t\t" . '<div class="simcal-event-details">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
601
-							$list_events .= "\t" . '</li>' . "\n";
599
+							$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.$event_color.' itemscope itemtype="http://schema.org/Event" data-start="'.esc_attr($event->start).'">'."\n";
600
+							$list_events .= "\t\t".'<div class="simcal-event-details">'.$calendar->get_event_html($event).'</div>'."\n";
601
+							$list_events .= "\t".'</li>'."\n";
602 602
 
603
-							$count ++;
603
+							$count++;
604 604
 
605 605
 							// Event falls within today.
606
-							if ( ( $this->end <= $now ) && ( $this->start >= $now ) ) :
606
+							if (($this->end <= $now) && ($this->start >= $now)) :
607 607
 								$day_classes .= ' simcal-today-has-events';
608 608
 							endif;
609
-							$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
609
+							$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
610 610
 
611
-							if ( $calendar_classes ) :
612
-								$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
611
+							if ($calendar_classes) :
612
+								$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
613 613
 							endif;
614 614
 
615 615
 						endif;
616 616
 					endforeach;
617 617
 				endforeach;
618 618
 
619
-				$list_events .= '</ul>' . "\n";
619
+				$list_events .= '</ul>'."\n";
620 620
 
621 621
 				// If events visibility is limited, print the button toggle.
622
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
622
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
623 623
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
624 624
 				endif;
625 625
 
626 626
 				// Print final list of events for the current day.
627 627
 				$tag = $calendar->compact_list ? 'div' : 'dd';
628
-				echo '<'  . $tag . ' class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
629
-				echo "\t" . $list_events . "\n";
630
-				echo '</' . $tag . '>' . "\n";
628
+				echo '<'.$tag.' class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
629
+				echo "\t".$list_events."\n";
630
+				echo '</'.$tag.'>'."\n";
631 631
 
632 632
 			endforeach;
633 633
 
634 634
 		else :
635 635
 
636
-			echo "\t" . '<p>';
636
+			echo "\t".'<p>';
637 637
 
638
-			$message = get_post_meta( $calendar->id, '_no_events_message', true );
638
+			$message = get_post_meta($calendar->id, '_no_events_message', true);
639 639
 
640
-			if ( 'events' == $calendar->group_type ) {
641
-				echo ! empty( $message ) ? $message : __( 'Nothing to show.', 'google-calendar-events' );
640
+			if ('events' == $calendar->group_type) {
641
+				echo ! empty($message) ? $message : __('Nothing to show.', 'google-calendar-events');
642 642
 			} else {
643
-				if ( ! empty( $message ) ) {
643
+				if ( ! empty($message)) {
644 644
 					echo $message;
645 645
 				} else {
646
-					$from = Carbon::createFromTimestamp( $this->start, $calendar->timezone )->getTimestamp();
647
-					$to = Carbon::createFromTimestamp( $this->end, $calendar->timezone )->getTimestamp();
648
-					echo apply_filters( 'simcal_no_events_message', sprintf(
649
-						__( 'Nothing from %1$s to %2$s.', 'google-calendar-events' ),
650
-						date_i18n( $calendar->date_format, $from ),
651
-						date_i18n( $calendar->date_format, $to )
652
-					), $calendar->id, $from, $to );
646
+					$from = Carbon::createFromTimestamp($this->start, $calendar->timezone)->getTimestamp();
647
+					$to = Carbon::createFromTimestamp($this->end, $calendar->timezone)->getTimestamp();
648
+					echo apply_filters('simcal_no_events_message', sprintf(
649
+						__('Nothing from %1$s to %2$s.', 'google-calendar-events'),
650
+						date_i18n($calendar->date_format, $from),
651
+						date_i18n($calendar->date_format, $to)
652
+					), $calendar->id, $from, $to);
653 653
 				}
654 654
 			}
655 655
 
656
-			echo "\t" . '</p>' . "\n";
656
+			echo "\t".'</p>'."\n";
657 657
 
658 658
 		endif;
659 659
 
660
-		echo '</' . $block_tag . '>';
660
+		echo '</'.$block_tag.'>';
661 661
 
662
-		date_default_timezone_set( $calendar->site_timezone );
662
+		date_default_timezone_set($calendar->site_timezone);
663 663
 
664 664
 		return ob_get_clean();
665 665
 	}
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
 	 */
672 672
 	public function draw_list_ajax() {
673 673
 
674
-		if ( isset( $_POST['ts'] ) && isset( $_POST['id'] ) ) {
674
+		if (isset($_POST['ts']) && isset($_POST['id'])) {
675 675
 
676
-			$ts = absint( $_POST['ts'] );
677
-			$id = absint( $_POST['id'] );
676
+			$ts = absint($_POST['ts']);
677
+			$id = absint($_POST['id']);
678 678
 
679
-			wp_send_json_success( $this->draw_list( $ts, $id ) );
679
+			wp_send_json_success($this->draw_list($ts, $id));
680 680
 
681 681
 		} else {
682 682
 
683
-			wp_send_json_error( 'Missing arguments in default calendar list ajax request.' );
683
+			wp_send_json_error('Missing arguments in default calendar list ajax request.');
684 684
 
685 685
 		}
686 686
 	}
@@ -695,8 +695,8 @@  discard block
 block discarded – undo
695 695
 	 *
696 696
 	 * @return bool
697 697
 	 */
698
-	private function filter_events_before( $event ) {
699
-		return intval( $event ) >= intval( $this->start );
698
+	private function filter_events_before($event) {
699
+		return intval($event) >= intval($this->start);
700 700
 	}
701 701
 
702 702
 	/**
@@ -709,8 +709,8 @@  discard block
 block discarded – undo
709 709
 	 *
710 710
 	 * @return bool
711 711
 	 */
712
-	private function filter_events_after( $event ) {
713
-		return intval( $event ) < intval( $this->end );
712
+	private function filter_events_after($event) {
713
+		return intval($event) < intval($this->end);
714 714
 	}
715 715
 
716 716
 }
Please login to merge, or discard this patch.
includes/events/events.php 1 patch
Spacing   +123 added lines, -123 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
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 * @param array $e Events.
46 46
 	 * @param string|\DateTimeZone $tz Timezone.
47 47
 	 */
48
-	public function __construct( $e = array(), $tz = 'UTC' ) {
49
-		$this->set_events( $e );
50
-		$this->set_timezone( $tz );
48
+	public function __construct($e = array(), $tz = 'UTC') {
49
+		$this->set_events($e);
50
+		$this->set_timezone($tz);
51 51
 	}
52 52
 
53 53
 	/**
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @return array
61 61
 	 */
62
-	public function get_events( $n = '' ) {
63
-		if ( ! empty( $n ) && ! empty( $this->events ) ) {
64
-			$length = absint( $n );
65
-			return array_slice( $this->events, 0, $length, true );
62
+	public function get_events($n = '') {
63
+		if ( ! empty($n) && ! empty($this->events)) {
64
+			$length = absint($n);
65
+			return array_slice($this->events, 0, $length, true);
66 66
 		}
67 67
 		return $this->events;
68 68
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @param array $ev Events.
76 76
 	 */
77
-	public function set_events( array $ev ) {
77
+	public function set_events(array $ev) {
78 78
 		$this->events = $ev;
79 79
 	}
80 80
 
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return Events
89 89
 	 */
90
-	public function set_timezone( $tz ) {
91
-		if ( $tz instanceof \DateTimeZone ) {
90
+	public function set_timezone($tz) {
91
+		if ($tz instanceof \DateTimeZone) {
92 92
 			$tz = $tz->getName();
93 93
 		}
94
-		$this->timezone = simcal_esc_timezone( $tz, $this->timezone );
94
+		$this->timezone = simcal_esc_timezone($tz, $this->timezone);
95 95
 		return $this;
96 96
 	}
97 97
 
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return Events
106 106
 	 */
107
-	public function shift( $n ) {
108
-		if ( ! empty( $this->events ) ) {
109
-			$offset = intval( $n );
110
-			$length = count( $this->events );
111
-			$this->set_events( array_slice( $this->events, $offset, $length, true ) );
107
+	public function shift($n) {
108
+		if ( ! empty($this->events)) {
109
+			$offset = intval($n);
110
+			$length = count($this->events);
111
+			$this->set_events(array_slice($this->events, $offset, $length, true));
112 112
 		}
113 113
 		return $this;
114 114
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @return Events
122 122
 	 */
123 123
 	public function private_only() {
124
-		$this->set_events( $this->filter_property( 'public', 'hide' ) );
124
+		$this->set_events($this->filter_property('public', 'hide'));
125 125
 		return $this;
126 126
 	}
127 127
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return Events
134 134
 	 */
135 135
 	public function public_only() {
136
-		$this->set_events( $this->filter_property( 'public', 'show' ) );
136
+		$this->set_events($this->filter_property('public', 'show'));
137 137
 		return $this;
138 138
 	}
139 139
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return Events
146 146
 	 */
147 147
 	public function recurring() {
148
-		$this->set_events( $this->filter_property( 'recurrence', 'show' ) );
148
+		$this->set_events($this->filter_property('recurrence', 'show'));
149 149
 		return $this;
150 150
 	}
151 151
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return Events
158 158
 	 */
159 159
 	public function not_recurring() {
160
-		$this->set_events( $this->filter_property( 'recurrence', 'hide' ) );
160
+		$this->set_events($this->filter_property('recurrence', 'hide'));
161 161
 		return $this;
162 162
 	}
163 163
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @return Events
170 170
 	 */
171 171
 	public function whole_day() {
172
-		$this->set_events( $this->filter_property( 'whole_day', 'show' ) );
172
+		$this->set_events($this->filter_property('whole_day', 'show'));
173 173
 		return $this;
174 174
 	}
175 175
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @return Events
182 182
 	 */
183 183
 	public function not_whole_day() {
184
-		$this->set_events( $this->filter_property( 'whole_day', 'hide' ) );
184
+		$this->set_events($this->filter_property('whole_day', 'hide'));
185 185
 		return $this;
186 186
 	}
187 187
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @return Events
194 194
 	 */
195 195
 	public function multi_day() {
196
-		$this->set_events( $this->filter_property( 'multiple_days', 'show' ) );
196
+		$this->set_events($this->filter_property('multiple_days', 'show'));
197 197
 		return $this;
198 198
 	}
199 199
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 * @return Events
206 206
 	 */
207 207
 	public function single_day() {
208
-		$this->set_events( $this->filter_property( 'multiple_days', 'hide' ) );
208
+		$this->set_events($this->filter_property('multiple_days', 'hide'));
209 209
 		return $this;
210 210
 	}
211 211
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @return Events
218 218
 	 */
219 219
 	public function with_location() {
220
-		$this->set_events( $this->filter_property( 'venue', 'show' ) );
220
+		$this->set_events($this->filter_property('venue', 'show'));
221 221
 		return $this;
222 222
 	}
223 223
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @return Events
230 230
 	 */
231 231
 	public function without_location() {
232
-		$this->set_events( $this->filter_property( 'venue', 'hide' ) );
232
+		$this->set_events($this->filter_property('venue', 'hide'));
233 233
 		return $this;
234 234
 	}
235 235
 
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @return array
246 246
 	 */
247
-	private function filter_property( $property, $toggle ) {
247
+	private function filter_property($property, $toggle) {
248 248
 		$filtered = array();
249
-		if ( ! empty( $this->events ) ) {
250
-			foreach ( $this->events as $ts => $events ) {
251
-				foreach ( $events as $event ) {
252
-					if ( 'hide' == $toggle ) {
253
-						if ( ! $event->$property ) {
254
-							$filtered[ $ts ][] = $event;
249
+		if ( ! empty($this->events)) {
250
+			foreach ($this->events as $ts => $events) {
251
+				foreach ($events as $event) {
252
+					if ('hide' == $toggle) {
253
+						if ( ! $event->$property) {
254
+							$filtered[$ts][] = $event;
255 255
 						}
256
-					} elseif ( 'show' == $toggle ) {
257
-						if ( $event->$property ) {
258
-							$filtered[ $ts ][] = $event;
256
+					} elseif ('show' == $toggle) {
257
+						if ($event->$property) {
258
+							$filtered[$ts][] = $event;
259 259
 						}
260 260
 					}
261 261
 				}
@@ -273,14 +273,14 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return Events
275 275
 	 */
276
-	public function future( $present = '' ) {
276
+	public function future($present = '') {
277 277
 		$last = $this->get_last();
278 278
 		$to = $last instanceof Event ? $last->start_utc : false;
279
-		if ( $to ) {
280
-			if ( empty( $present ) ) {
281
-				$present = Carbon::now( $this->timezone )->getTimestamp();
279
+		if ($to) {
280
+			if (empty($present)) {
281
+				$present = Carbon::now($this->timezone)->getTimestamp();
282 282
 			}
283
-			$this->set_events( $this->filter_events( intval( $present ), $to ) );
283
+			$this->set_events($this->filter_events(intval($present), $to));
284 284
 		}
285 285
 		return $this;
286 286
 	}
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @return Events
296 296
 	 */
297
-	public function past( $present = '' ) {
297
+	public function past($present = '') {
298 298
 		$first = $this->get_last();
299 299
 		$from  = $first instanceof Event ? $first->start_utc : false;
300
-		if ( $from ) {
301
-			if ( empty( $present ) ) {
302
-				$present = Carbon::now( $this->timezone )->getTimestamp();
300
+		if ($from) {
301
+			if (empty($present)) {
302
+				$present = Carbon::now($this->timezone)->getTimestamp();
303 303
 			}
304
-			$this->set_events( $this->filter_events( $from, intval( $present ) ) );
304
+			$this->set_events($this->filter_events($from, intval($present)));
305 305
 		}
306 306
 		return $this;
307 307
 	}
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @return Events
317 317
 	 */
318
-	public function after( $time ) {
319
-		$dt = $this->parse( $time );
320
-		return ! is_null( $dt ) ? $this->future( $dt->getTimestamp() ) : $this;
318
+	public function after($time) {
319
+		$dt = $this->parse($time);
320
+		return ! is_null($dt) ? $this->future($dt->getTimestamp()) : $this;
321 321
 	}
322 322
 
323 323
 	/**
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 	 *
330 330
 	 * @return Events
331 331
 	 */
332
-	public function before( $time ) {
333
-		$dt = $this->parse( $time );
334
-		return ! is_null( $dt ) ? $this->past( $dt->getTimestamp() ) : $this;
332
+	public function before($time) {
333
+		$dt = $this->parse($time);
334
+		return ! is_null($dt) ? $this->past($dt->getTimestamp()) : $this;
335 335
 	}
336 336
 
337 337
 	/**
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
 	 *
344 344
 	 * @return Events
345 345
 	 */
346
-	public function from( $time ) {
347
-		$last = $this->parse( $time );
348
-		if ( ! is_null( $last ) ) {
349
-			$this->set_events( $this->filter_events( $time, $last->getTimestamp() ) );
346
+	public function from($time) {
347
+		$last = $this->parse($time);
348
+		if ( ! is_null($last)) {
349
+			$this->set_events($this->filter_events($time, $last->getTimestamp()));
350 350
 		}
351 351
 		return $this;
352 352
 	}
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 	 *
361 361
 	 * @return Events
362 362
 	 */
363
-	public function to( $time ) {
364
-		$first = $this->parse( $time );
365
-		if ( ! is_null( $first ) ) {
366
-			$this->set_events( $this->filter_events( $first->getTimestamp(), $time ) );
363
+	public function to($time) {
364
+		$first = $this->parse($time);
365
+		if ( ! is_null($first)) {
366
+			$this->set_events($this->filter_events($first->getTimestamp(), $time));
367 367
 		}
368 368
 		return $this;
369 369
 	}
@@ -377,15 +377,15 @@  discard block
 block discarded – undo
377 377
 	 *
378 378
 	 * @return null|Carbon
379 379
 	 */
380
-	private function parse( $time ) {
381
-		if ( is_int( $time ) ) {
382
-			return Carbon::createFromTimestamp( $time, $this->timezone );
383
-		} elseif ( is_string( $time ) && ! empty( $time ) ) {
384
-			return Carbon::parse( $time, $this->timezone );
385
-		} elseif ( $time instanceof Carbon ) {
386
-			return $time->setTimezone( $this->timezone );
387
-		} elseif ( $time instanceof \DateTime ) {
388
-			return Carbon::instance( $time )->setTimezone( $this->timezone );
380
+	private function parse($time) {
381
+		if (is_int($time)) {
382
+			return Carbon::createFromTimestamp($time, $this->timezone);
383
+		} elseif (is_string($time) && ! empty($time)) {
384
+			return Carbon::parse($time, $this->timezone);
385
+		} elseif ($time instanceof Carbon) {
386
+			return $time->setTimezone($this->timezone);
387
+		} elseif ($time instanceof \DateTime) {
388
+			return Carbon::instance($time)->setTimezone($this->timezone);
389 389
 		}
390 390
 		return null;
391 391
 	}
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 * @return null|Event
399 399
 	 */
400 400
 	public function get_first() {
401
-		return array_shift( $this->events );
401
+		return array_shift($this->events);
402 402
 	}
403 403
 
404 404
 	/**
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 * @return null|Event
410 410
 	 */
411 411
 	public function get_last() {
412
-		return array_pop( $this->events );
412
+		return array_pop($this->events);
413 413
 	}
414 414
 
415 415
 	/**
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	 * @return null|Event
421 421
 	 */
422 422
 	public function get_upcoming() {
423
-		return $this->get_closest( 'future' );
423
+		return $this->get_closest('future');
424 424
 	}
425 425
 
426 426
 	/**
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * @return null|Event
432 432
 	 */
433 433
 	public function get_latest() {
434
-		return $this->get_closest( 'past' );
434
+		return $this->get_closest('past');
435 435
 	}
436 436
 
437 437
 	/**
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
 	 *
445 445
 	 * @return null|Event
446 446
 	 */
447
-	private function get_closest( $dir ) {
448
-		if ( 'future' == $dir ) {
449
-			return array_shift( $this->future()->get_events() );
450
-		} elseif ( 'past' == $dir ) {
451
-			return array_shift( $this->past()->get_events() );
447
+	private function get_closest($dir) {
448
+		if ('future' == $dir) {
449
+			return array_shift($this->future()->get_events());
450
+		} elseif ('past' == $dir) {
451
+			return array_shift($this->past()->get_events());
452 452
 		}
453 453
 		return null;
454 454
 	}
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
 	 *
463 463
 	 * @return array Multidimensional array with month number, week number and Event objects for each weekday.
464 464
 	 */
465
-	public function get_year( $year ) {
466
-		$y = intval( $year );
465
+	public function get_year($year) {
466
+		$y = intval($year);
467 467
 		$months = array();
468
-		for ( $m = 1; $m <= 12; $m++ ) {
469
-			$months[ strval( $m ) ] = $this->get_month( $y, $m );
468
+		for ($m = 1; $m <= 12; $m++) {
469
+			$months[strval($m)] = $this->get_month($y, $m);
470 470
 		}
471 471
 		return $months;
472 472
 	}
@@ -481,16 +481,16 @@  discard block
 block discarded – undo
481 481
 	 *
482 482
 	 * @return array Multidimensional array with week number, day of the week and array of Event objects for each week day.
483 483
 	 */
484
-	public function get_month( $year, $month ) {
485
-		$y = intval( $year );
486
-		$m = min( max( 1, absint( $month ) ), 12 );
487
-		$days  = Carbon::createFromDate( $y, $m, 2, $this->timezone )->startOfMonth()->daysInMonth;
484
+	public function get_month($year, $month) {
485
+		$y = intval($year);
486
+		$m = min(max(1, absint($month)), 12);
487
+		$days  = Carbon::createFromDate($y, $m, 2, $this->timezone)->startOfMonth()->daysInMonth;
488 488
 		$weeks = array();
489
-		for ( $d = 1; $d < $days; $d++ ) {
490
-			$current = Carbon::createFromDate( $y, $m, $d );
489
+		for ($d = 1; $d < $days; $d++) {
490
+			$current = Carbon::createFromDate($y, $m, $d);
491 491
 			$week = $current->weekOfYear;
492 492
 			$day  = $current->dayOfWeek;
493
-			$weeks[ strval( $week ) ][ strval( $day ) ] = $this->get_day( $y, $m, $d );
493
+			$weeks[strval($week)][strval($day)] = $this->get_day($y, $m, $d);
494 494
 		}
495 495
 		return $weeks;
496 496
 	}
@@ -505,16 +505,16 @@  discard block
 block discarded – undo
505 505
 	 *
506 506
 	 * @return array Associative array with day of the week for key and array of Event objects for value.
507 507
 	 */
508
-	public function get_week( $year, $week ) {
509
-		$y = intval( $year );
510
-		$w = absint( $week );
511
-		$m = date( 'n', strtotime( strval( $y ) . '-W' . strval( $w ) ) );
512
-		$month_dt = Carbon::createFromDate( $y, $m, 2, $this->timezone );
508
+	public function get_week($year, $week) {
509
+		$y = intval($year);
510
+		$w = absint($week);
511
+		$m = date('n', strtotime(strval($y).'-W'.strval($w)));
512
+		$month_dt = Carbon::createFromDate($y, $m, 2, $this->timezone);
513 513
 		$days = array();
514
-		for ( $d = 1; $d < $month_dt->daysInMonth; $d++ ) {
515
-			$current = Carbon::createFromDate( $y, $m, $d );
516
-			if ( $w == $current->weekOfYear ) {
517
-				$days[ strval( $current->dayOfWeek ) ] = $this->get_day( $y, $m, $d );
514
+		for ($d = 1; $d < $month_dt->daysInMonth; $d++) {
515
+			$current = Carbon::createFromDate($y, $m, $d);
516
+			if ($w == $current->weekOfYear) {
517
+				$days[strval($current->dayOfWeek)] = $this->get_day($y, $m, $d);
518 518
 			}
519 519
 		}
520 520
 		return $days;
@@ -531,13 +531,13 @@  discard block
 block discarded – undo
531 531
 	 *
532 532
 	 * @return array Event objects for the day.
533 533
 	 */
534
-	public function get_day( $year, $month, $day ) {
535
-		$y = intval( $year );
536
-		$m = min( max( 1, absint( $month ) ), 12 );
537
-		$d = min( absint( $day ), 31 );
538
-		$from = Carbon::createFromDate( $y, $m, $d, $this->timezone )->startOfDay()->getTimestamp();
539
-		$to   = Carbon::createFromDate( $y, $m, $d, $this->timezone )->endOfDay()->getTimestamp();
540
-		return $this->filter_events( $from, $to );
534
+	public function get_day($year, $month, $day) {
535
+		$y = intval($year);
536
+		$m = min(max(1, absint($month)), 12);
537
+		$d = min(absint($day), 31);
538
+		$from = Carbon::createFromDate($y, $m, $d, $this->timezone)->startOfDay()->getTimestamp();
539
+		$to   = Carbon::createFromDate($y, $m, $d, $this->timezone)->endOfDay()->getTimestamp();
540
+		return $this->filter_events($from, $to);
541 541
 	}
542 542
 
543 543
 	/**
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
 	 * @return array Event objects for today.
549 549
 	 */
550 550
 	public function get_today() {
551
-		$start = Carbon::today( $this->timezone )->startOfDay()->getTimestamp();
552
-		$end   = Carbon::today( $this->timezone )->endOfDay()->getTimestamp();
553
-		return $this->filter_events( $start, $end );
551
+		$start = Carbon::today($this->timezone)->startOfDay()->getTimestamp();
552
+		$end   = Carbon::today($this->timezone)->endOfDay()->getTimestamp();
553
+		return $this->filter_events($start, $end);
554 554
 	}
555 555
 
556 556
 	/**
@@ -561,9 +561,9 @@  discard block
 block discarded – undo
561 561
 	 * @return array Event objects for tomorrow.
562 562
 	 */
563 563
 	public function get_tomorrow() {
564
-		$start = Carbon::tomorrow( $this->timezone )->startOfDay()->getTimestamp();
565
-		$end   = Carbon::tomorrow( $this->timezone )->endOfDay()->getTimestamp();
566
-		return $this->filter_events( $start, $end );
564
+		$start = Carbon::tomorrow($this->timezone)->startOfDay()->getTimestamp();
565
+		$end   = Carbon::tomorrow($this->timezone)->endOfDay()->getTimestamp();
566
+		return $this->filter_events($start, $end);
567 567
 	}
568 568
 
569 569
 	/**
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
 	 * @return array Event objects for yesterday.
575 575
 	 */
576 576
 	public function get_yesterday() {
577
-		$start = Carbon::yesterday( $this->timezone )->startOfDay()->getTimestamp();
578
-		$end   = Carbon::yesterday( $this->timezone )->endOfDay()->getTimestamp();
579
-		return $this->filter_events( $start, $end );
577
+		$start = Carbon::yesterday($this->timezone)->startOfDay()->getTimestamp();
578
+		$end   = Carbon::yesterday($this->timezone)->endOfDay()->getTimestamp();
579
+		return $this->filter_events($start, $end);
580 580
 	}
581 581
 
582 582
 	/**
@@ -590,16 +590,16 @@  discard block
 block discarded – undo
590 590
 	 *
591 591
 	 * @return array Filtered array of Event objects.
592 592
 	 */
593
-	private function filter_events( $from, $to ) {
594
-		$timestamps   = array_keys( $this->events );
595
-		$lower_bound  = array_filter( $timestamps,  function( $ts ) use( $from ) {
596
-			return intval( $ts ) > intval( $from );
593
+	private function filter_events($from, $to) {
594
+		$timestamps   = array_keys($this->events);
595
+		$lower_bound  = array_filter($timestamps, function($ts) use($from) {
596
+			return intval($ts) > intval($from);
597 597
 		} );
598
-		$higher_bound = array_filter( $lower_bound, function( $ts ) use( $to ) {
599
-			return intval( $ts ) > intval( $to );
598
+		$higher_bound = array_filter($lower_bound, function($ts) use($to) {
599
+			return intval($ts) > intval($to);
600 600
 		} );
601
-		$filtered = array_combine( $higher_bound, $higher_bound );
602
-		return array_intersect_key( $this->events, $filtered );
601
+		$filtered = array_combine($higher_bound, $higher_bound);
602
+		return array_intersect_key($this->events, $filtered);
603 603
 	}
604 604
 
605 605
 }
Please login to merge, or discard this patch.