Completed
Push — master ( e47c17...035b95 )
by
unknown
04:49
created
includes/admin/pages/feeds.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use SimpleCalendar\Abstracts\Feed;
10 10
 use SimpleCalendar\Abstracts\Admin_Page;
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -39,20 +39,20 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$this->id           = 'feeds';
41 41
 		$this->option_group = 'settings';
42
-		$this->label        = __( 'Event Sources', 'google-calendar-events' );
42
+		$this->label        = __('Event Sources', 'google-calendar-events');
43 43
 		//$this->description  = __( 'Manage calendar event sources settings.', 'google-calendar-events' );
44 44
 
45 45
 		$feeds_settings = array();
46 46
 		$feeds = simcal_get_feed_types();
47
-		if ( ! empty( $feeds ) && is_array( $feeds ) ) {
48
-			foreach ( $feeds as $feed ) {
47
+		if ( ! empty($feeds) && is_array($feeds)) {
48
+			foreach ($feeds as $feed) {
49 49
 
50
-				$feed_type = simcal_get_feed( $feed );
50
+				$feed_type = simcal_get_feed($feed);
51 51
 
52
-				if ( $feed_type instanceof Feed ) {
52
+				if ($feed_type instanceof Feed) {
53 53
 					$settings = $feed_type->settings_fields();
54
-					if ( ! empty( $settings ) ) {
55
-						$feeds_settings[ $feed ] = $settings;
54
+					if ( ! empty($settings)) {
55
+						$feeds_settings[$feed] = $settings;
56 56
 					}
57 57
 				}
58 58
 			}
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
 
75 75
 		$sections = array();
76 76
 
77
-		foreach ( $this->feed_types as $feed_type => $type ) {
77
+		foreach ($this->feed_types as $feed_type => $type) {
78 78
 
79
-			$sections[ $feed_type ] = array(
79
+			$sections[$feed_type] = array(
80 80
 				'title'       => $type['name'],
81 81
 				'description' => $type['description'],
82 82
 			);
83 83
 
84 84
 		}
85 85
 
86
-		arsort( $sections );
86
+		arsort($sections);
87 87
 
88
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', $sections );
88
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', $sections);
89 89
 	}
90 90
 
91 91
 	/**
@@ -99,25 +99,25 @@  discard block
 block discarded – undo
99 99
 
100 100
 		$fields       = array();
101 101
 		$feed_types   = $this->feed_types;
102
-		$this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id );
102
+		$this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id);
103 103
 
104
-		foreach ( $this->sections as $type => $contents ) :
104
+		foreach ($this->sections as $type => $contents) :
105 105
 
106
-			if ( isset( $feed_types[ $type ]['fields'] ) ) {
107
-				foreach ( $feed_types[ $type ]['fields'] as $key => $args ) {
106
+			if (isset($feed_types[$type]['fields'])) {
107
+				foreach ($feed_types[$type]['fields'] as $key => $args) {
108 108
 
109
-					$fields[ $type ][] = array_merge( $args, array(
110
-						'name'  => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $type . '][' . $key . ']',
111
-						'id'    => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $type . '-' . $key,
112
-						'value' => $this->get_option_value( $type, $key )
113
-					) );
109
+					$fields[$type][] = array_merge($args, array(
110
+						'name'  => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$type.']['.$key.']',
111
+						'id'    => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$type.'-'.$key,
112
+						'value' => $this->get_option_value($type, $key)
113
+					));
114 114
 
115 115
 				}
116 116
 			}
117 117
 
118 118
 		endforeach;
119 119
 
120
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields );
120
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields);
121 121
 	}
122 122
 
123 123
 }
Please login to merge, or discard this patch.
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   +143 added lines, -143 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,16 +113,16 @@  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-default-calendar' => array(
125
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
125
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
126 126
 				'deps'      => array(
127 127
 					'jquery',
128 128
 					'simcal-qtip',
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @return array
149 149
 	 */
150
-	public function styles( $min = '' ) {
150
+	public function styles($min = '') {
151 151
 		return array(
152 152
 			'simcal-qtip' => array(
153
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/vendor/jquery.qtip' . $min . '.css',
153
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/vendor/jquery.qtip'.$min.'.css',
154 154
 				'ver'   => '2.2.1',
155 155
 				'media' => 'all',
156 156
 			),
157 157
 			'simcal-default-calendar-grid' => array(
158
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-grid' . $min . '.css',
158
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-grid'.$min.'.css',
159 159
 				'deps'  => array(
160 160
 					'simcal-qtip',
161 161
 				),
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 				'media' => 'all',
164 164
 			),
165 165
 			'simcal-default-calendar-list' => array(
166
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
166
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
167 167
 				'deps'  => array(
168 168
 					'simcal-qtip',
169 169
 				),
@@ -182,22 +182,22 @@  discard block
 block discarded – undo
182 182
 
183 183
 		$calendar = $this->calendar;
184 184
 
185
-		if ( $calendar instanceof Default_Calendar ) {
185
+		if ($calendar instanceof Default_Calendar) {
186 186
 
187 187
 			?>
188 188
 
189
-			<?php edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id ); ?>
189
+			<?php edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id); ?>
190 190
 
191 191
 			<table class="simcal-calendar-grid"
192 192
 			       data-event-bubble-trigger="<?php echo $calendar->event_bubble_trigger; ?>">
193 193
 				<thead class="simcal-calendar-head">
194 194
 					<tr>
195
-						<?php if ( ! $calendar->static ) { ?>
196
-							<th class="simcal-nav simcal-prev-wrapper" colspan=colspan="<?php echo apply_filters( 'simcal_prev_cols', '1' ); ?>">
197
-								<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>
195
+						<?php if ( ! $calendar->static) { ?>
196
+							<th class="simcal-nav simcal-prev-wrapper" colspan=colspan="<?php echo apply_filters('simcal_prev_cols', '1'); ?>">
197
+								<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>
198 198
 							</th>
199 199
 						<?php } ?>
200
-						<th colspan="<?php echo apply_filters( 'simcal_current_cols', $calendar->static ? '7' : '5' ); ?>"
200
+						<th colspan="<?php echo apply_filters('simcal_current_cols', $calendar->static ? '7' : '5'); ?>"
201 201
 						    class="simcal-nav simcal-current"
202 202
 						    data-calendar-current="<?php echo $calendar->start; ?>">
203 203
 							<?php
@@ -206,26 +206,26 @@  discard block
 block discarded – undo
206 206
 
207 207
 							// Display month and year according to user date format preference.
208 208
 
209
-							$year_pos  = strcspn( $calendar->date_format, 'Y y' );
210
-							$month_pos = strcspn( $calendar->date_format, 'F M m n' );
209
+							$year_pos  = strcspn($calendar->date_format, 'Y y');
210
+							$month_pos = strcspn($calendar->date_format, 'F M m n');
211 211
 
212
-							$current = array( 'month' => 'F', 'year' => 'Y' );
212
+							$current = array('month' => 'F', 'year' => 'Y');
213 213
 
214
-							if ( $year_pos < $month_pos ) {
215
-								$current = array_reverse( $current );
214
+							if ($year_pos < $month_pos) {
215
+								$current = array_reverse($current);
216 216
 							}
217 217
 
218
-							foreach ( $current as $k => $v ) {
219
-								echo ' <span class="simcal-current-' . $k , '">' . date_i18n( $v, $calendar->start ) . '</span> ';
218
+							foreach ($current as $k => $v) {
219
+								echo ' <span class="simcal-current-'.$k, '">'.date_i18n($v, $calendar->start).'</span> ';
220 220
 							}
221 221
 
222 222
 							echo '</h3>';
223 223
 
224 224
 							?>
225 225
 						</th>
226
-						<?php if ( ! $calendar->static ) { ?>
227
-							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters( 'simcal_next_cols', '1' ); ?>">
228
-								<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>
226
+						<?php if ( ! $calendar->static) { ?>
227
+							<th class="simcal-nav simcal-next-wrapper" colspan="<?php echo apply_filters('simcal_next_cols', '1'); ?>">
228
+								<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>
229 229
 							</th>
230 230
 						<?php } ?>
231 231
 					</tr>
@@ -235,28 +235,28 @@  discard block
 block discarded – undo
235 235
 						// Print day names in short or long form for different viewport sizes.
236 236
 
237 237
 						$week_starts     = $calendar->week_starts;
238
-						$week_days_short = simcal_get_calendar_names_i18n( 'day', 'short' );
239
-						$week_days_full  = simcal_get_calendar_names_i18n( 'day', 'full' );
238
+						$week_days_short = simcal_get_calendar_names_i18n('day', 'short');
239
+						$week_days_full  = simcal_get_calendar_names_i18n('day', 'full');
240 240
 
241
-						for ( $i = $week_starts; $i <= 6; $i ++ ) :
241
+						for ($i = $week_starts; $i <= 6; $i++) :
242 242
 
243 243
 							?>
244 244
 							<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
245
-								data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
246
-							    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
247
-							    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
245
+								data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
246
+							    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
247
+							    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
248 248
 							<?php
249 249
 
250 250
 						endfor;
251 251
 
252
-						if ( $week_starts !== 0 ) :
253
-							for ( $i = 0; $i < $week_starts; $i ++ ) :
252
+						if ($week_starts !== 0) :
253
+							for ($i = 0; $i < $week_starts; $i++) :
254 254
 
255 255
 								?>
256 256
 								<th class="simcal-week-day simcal-week-day-<?php echo $i ?>"
257
-								    data-screen-small="<?php echo mb_substr( $week_days_short[ $i ], 0, 1, 'UTF-8' ); ?>"
258
-								    data-screen-medium="<?php echo $week_days_short[ $i ]; ?>"
259
-								    data-screen-large="<?php echo $week_days_full[ $i ]; ?>"><?php echo $week_days_short[ $i ]; ?></th>
257
+								    data-screen-small="<?php echo mb_substr($week_days_short[$i], 0, 1, 'UTF-8'); ?>"
258
+								    data-screen-medium="<?php echo $week_days_short[$i]; ?>"
259
+								    data-screen-large="<?php echo $week_days_full[$i]; ?>"><?php echo $week_days_short[$i]; ?></th>
260 260
 								<?php
261 261
 
262 262
 							endfor;
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 					</tr>
267 267
 				</thead>
268 268
 
269
-				<?php echo $this->draw_month( date( 'n', $calendar->start ), date( 'Y', $calendar->start ) ); ?>
269
+				<?php echo $this->draw_month(date('n', $calendar->start), date('Y', $calendar->start)); ?>
270 270
 
271 271
 			</table>
272 272
 
@@ -292,85 +292,85 @@  discard block
 block discarded – undo
292 292
 	 *
293 293
 	 * @return string
294 294
 	 */
295
-	private function draw_month( $month, $year, $id = 0 ) {
295
+	private function draw_month($month, $year, $id = 0) {
296 296
 
297 297
 		$calendar = $this->calendar;
298
-		if ( empty( $calendar ) ) {
299
-			$calendar = simcal_get_calendar( intval( $id ) );
300
-			if ( ! $calendar ) {
298
+		if (empty($calendar)) {
299
+			$calendar = simcal_get_calendar(intval($id));
300
+			if ( ! $calendar) {
301 301
 				return '';
302 302
 			}
303 303
 		}
304 304
 
305 305
 		$events = $calendar->events;
306 306
 
307
-		$feed          = simcal_get_feed( $calendar );
308
-		$feed_timezone = get_post_meta( $feed->post_id, '_feed_timezone', true );
307
+		$feed          = simcal_get_feed($calendar);
308
+		$feed_timezone = get_post_meta($feed->post_id, '_feed_timezone', true);
309 309
 
310 310
 		// Variables to cycle days in current month and find today in calendar.
311 311
 		$now         = $calendar->now;
312
-		$current     = Carbon::create( $year, $month, 1, 0, 0, 0, $calendar->timezone );
312
+		$current     = Carbon::create($year, $month, 1, 0, 0, 0, $calendar->timezone);
313 313
 		$current_min = $current->getTimestamp();
314 314
 		$current_max = $current->endOfDay()->getTimestamp();
315 315
 
316 316
 		// Calendar grid variables.
317 317
 		$week_starts   = $calendar->week_starts;
318
-		$week_of_year  = $current->weekOfYear;   // Relative count of the week number of the year.
319
-		$month_starts  = $current->dayOfWeek;    // Day upon which the month starts.
320
-		$days_in_month = $current->daysInMonth;  // Number of days in the given month.
318
+		$week_of_year  = $current->weekOfYear; // Relative count of the week number of the year.
319
+		$month_starts  = $current->dayOfWeek; // Day upon which the month starts.
320
+		$days_in_month = $current->daysInMonth; // Number of days in the given month.
321 321
 
322 322
 		// Set current month events timestamp boundaries.
323 323
 		$this->start = $current_min;
324 324
 		$this->end   = $current->endOfMonth()->timestamp;
325 325
 
326 326
 		// Get daily events for this month.
327
-		if ( $events && is_array( $events ) ) {
327
+		if ($events && is_array($events)) {
328 328
 
329 329
 			// Filter events within the boundaries previously set above.
330
-			$timestamps   = array_keys( $events );
331
-			$lower_bound  = array_filter( $timestamps, array( $this, 'filter_events_before' ) );
332
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after' ) );
333
-			$filtered     = ( is_array( $events ) && is_array( $higher_bound) ) && ! empty( $events ) && ! empty( $higher_bound ) ? array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) ) : array();
330
+			$timestamps   = array_keys($events);
331
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
332
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
333
+			$filtered     = (is_array($events) && is_array($higher_bound)) && ! empty($events) && ! empty($higher_bound) ? array_intersect_key($events, array_combine($higher_bound, $higher_bound)) : array();
334 334
 
335 335
 			// Put resulting events in an associative array, with day of the month as key for easy retrieval in calendar days loop.
336 336
 			$day_events = array();
337
-			foreach ( $filtered as $timestamp => $events_in_day ) {
338
-				foreach ( $events_in_day as $event ) {
339
-					if ( $event instanceof Event ){
340
-						$day = intval( Carbon::createFromTimestamp( $timestamp, $event->timezone )->endOfDay()->day );
341
-						$day_events[ $day ][] = $event;
337
+			foreach ($filtered as $timestamp => $events_in_day) {
338
+				foreach ($events_in_day as $event) {
339
+					if ($event instanceof Event) {
340
+						$day = intval(Carbon::createFromTimestamp($timestamp, $event->timezone)->endOfDay()->day);
341
+						$day_events[$day][] = $event;
342 342
 					}
343 343
 				}
344 344
 			}
345 345
 
346
-			ksort( $day_events, SORT_NUMERIC );
346
+			ksort($day_events, SORT_NUMERIC);
347 347
 		}
348 348
 
349 349
 		ob_start();
350 350
 
351
-		echo '<tbody class="simcal-month simcal-month-' . $month . '">' . "\n";
352
-		echo "\t" . '<tr class="simcal-week simcal-week-' . $week_of_year . '">';
351
+		echo '<tbody class="simcal-month simcal-month-'.$month.'">'."\n";
352
+		echo "\t".'<tr class="simcal-week simcal-week-'.$week_of_year.'">';
353 353
 
354 354
 		$days_in_row = 0;
355 355
 		// Week may start on an arbitrary day (sun, 0 - sat, 6).
356 356
 		$week_day = $week_starts;
357 357
 
358 358
 		// This fixes a possible bug when a month starts by Sunday (0).
359
-		if ( 0 !== $week_starts ) {
359
+		if (0 !== $week_starts) {
360 360
 			$b = $month_starts === 0 ? 7 : $month_starts;
361 361
 		} else {
362 362
 			$b = $month_starts;
363 363
 		}
364 364
 
365 365
 		// Void days in first week.
366
-		for ( $a = $week_starts; $a < $b; $a++ ) :
366
+		for ($a = $week_starts; $a < $b; $a++) :
367 367
 
368
-			$last_void_day_class = ( $a === ( $b - 1 ) ) ? 'simcal-day-void-last' : '';
368
+			$last_void_day_class = ($a === ($b - 1)) ? 'simcal-day-void-last' : '';
369 369
 
370
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
370
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
371 371
 
372 372
 			// Reset day of the week count (sun, 0 - sat, 6).
373
-			if ( $week_day === 6 ) {
373
+			if ($week_day === 6) {
374 374
 				$week_day = -1;
375 375
 			}
376 376
 			$week_day++;
@@ -380,103 +380,103 @@  discard block
 block discarded – undo
380 380
 		endfor;
381 381
 
382 382
 		// Actual days of the month.
383
-		for ( $day = 1; $day <= $days_in_month; $day++ ) :
383
+		for ($day = 1; $day <= $days_in_month; $day++) :
384 384
 
385 385
 			$count = 0;
386 386
 			$calendar_classes = array();
387
-			$day_classes = 'simcal-day-' . $day . ' simcal-weekday-' . $week_day;
387
+			$day_classes = 'simcal-day-'.$day.' simcal-weekday-'.$week_day;
388 388
 
389 389
 			$border_style = $bg_color = $color = '';
390 390
 
391 391
 			// Is this the present, the past or the future, Doc?
392
-			if ( $current_min <= $now && $current_max >= $now ) {
392
+			if ($current_min <= $now && $current_max >= $now) {
393 393
 				$day_classes .= ' simcal-today simcal-present simcal-day';
394
-				$the_color = new Color( $calendar->today_color );
395
-				$bg_color = '#' . $the_color->getHex();
394
+				$the_color = new Color($calendar->today_color);
395
+				$bg_color = '#'.$the_color->getHex();
396 396
 				$color = $the_color->isDark() ? '#ffffff' : '#000000';
397
-				$border_style = ' style="border: 1px solid ' . $bg_color . ';"';
398
-			} elseif ( $current_max < $now ) {
397
+				$border_style = ' style="border: 1px solid '.$bg_color.';"';
398
+			} elseif ($current_max < $now) {
399 399
 				$day_classes .= ' simcal-past simcal-day';
400
-			} elseif ( $current_min > $now ) {
400
+			} elseif ($current_min > $now) {
401 401
 				$day_classes .= ' simcal-future simcal-day';
402 402
 			}
403 403
 
404 404
 			// Print events for the current day in loop, if found any.
405
-			if ( isset( $day_events[ $day ] ) ) :
405
+			if (isset($day_events[$day])) :
406 406
 
407 407
 				$bullet_colors = array();
408 408
 
409 409
 				$list_events = '<ul class="simcal-events">';
410 410
 
411
-				foreach ( $day_events[ $day ] as $event ) :
411
+				foreach ($day_events[$day] as $event) :
412 412
 
413 413
 					$event_classes = $event_visibility = '';
414 414
 
415
-					if ( $event instanceof Event ) :
415
+					if ($event instanceof Event) :
416 416
 
417
-						if ( $feed->type == 'grouped-calendars' ) {
418
-							date_default_timezone_set( $feed_timezone );
417
+						if ($feed->type == 'grouped-calendars') {
418
+							date_default_timezone_set($feed_timezone);
419 419
 						} else {
420
-							date_default_timezone_set( $event->timezone );
420
+							date_default_timezone_set($event->timezone);
421 421
 						}
422 422
 
423 423
 						// Store the calendar id where the event belongs (useful in grouped calendar feeds)
424
-						$calendar_class  = 'simcal-events-calendar-' . strval( $event->calendar );
425
-						$calendar_classes[] = $calendar_class ;
424
+						$calendar_class = 'simcal-events-calendar-'.strval($event->calendar);
425
+						$calendar_classes[] = $calendar_class;
426 426
 
427 427
 						$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
428 428
 						$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
429 429
 
430
-						$event_classes  .= 'simcal-event ' . $recurring . $has_location . $calendar_class . ' simcal-tooltip';
430
+						$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class.' simcal-tooltip';
431 431
 
432 432
 						// Toggle some events visibility if more than optional limit.
433
-						if ( ( $calendar->events_limit > -1 )  && ( $count >= $calendar->events_limit ) ) :
433
+						if (($calendar->events_limit > -1) && ($count >= $calendar->events_limit)) :
434 434
 							$event_classes    .= ' simcal-event-toggled';
435 435
 							$event_visibility  = ' style="display: none"';
436 436
 						endif;
437 437
 
438 438
 						// Event title in list.
439
-						$title = ! empty( $event->title ) ? trim( $event->title ) : __( 'Event', 'google-calendar-events' );
440
-						if ( $calendar->trim_titles >= 1 ) {
441
-							$title = strlen( $title ) > $calendar->trim_titles ? mb_substr( $title, 0, $calendar->trim_titles ) . '&hellip;' : $title;
439
+						$title = ! empty($event->title) ? trim($event->title) : __('Event', 'google-calendar-events');
440
+						if ($calendar->trim_titles >= 1) {
441
+							$title = strlen($title) > $calendar->trim_titles ? mb_substr($title, 0, $calendar->trim_titles).'&hellip;' : $title;
442 442
 						}
443 443
 
444 444
 						// Event color.
445 445
 						$bullet = '';
446 446
 						//$bullet_color = '#000';
447 447
 						$event_color = $event->get_color();
448
-						if ( ! empty( $event_color ) ) {
449
-							$bullet = '<span style="color: ' . $event_color . ';">&#9632;</span> ';
448
+						if ( ! empty($event_color)) {
449
+							$bullet = '<span style="color: '.$event_color.';">&#9632;</span> ';
450 450
 							$bullet_colors[] = $event_color;
451 451
 						} else {
452 452
 							$bullet_colors[] = '#000';
453 453
 						}
454 454
 
455 455
 						// Event contents.
456
-						$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . ' itemscope itemtype="http://schema.org/Event">' . "\n";
457
-						$list_events .= "\t\t" . '<span class="simcal-event-title">' . $bullet . $title . '</span>' . "\n";
458
-						$list_events .= "\t\t" . '<div class="simcal-event-details simcal-tooltip-content" style="display: none;">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
459
-						$list_events .= "\t" . '</li>' . "\n";
456
+						$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.' itemscope itemtype="http://schema.org/Event">'."\n";
457
+						$list_events .= "\t\t".'<span class="simcal-event-title">'.$bullet.$title.'</span>'."\n";
458
+						$list_events .= "\t\t".'<div class="simcal-event-details simcal-tooltip-content" style="display: none;">'.$calendar->get_event_html($event).'</div>'."\n";
459
+						$list_events .= "\t".'</li>'."\n";
460 460
 
461
-						$count ++;
461
+						$count++;
462 462
 
463 463
 					endif;
464 464
 
465 465
 				endforeach;
466 466
 
467
-				if ( ( $current_min <= $now ) && ( $current_max >= $now ) ) {
467
+				if (($current_min <= $now) && ($current_max >= $now)) {
468 468
 					$day_classes .= ' simcal-today-has-events';
469 469
 				}
470
-				$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
470
+				$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
471 471
 
472
-				if ( $calendar_classes ) {
473
-					$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
472
+				if ($calendar_classes) {
473
+					$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
474 474
 				}
475 475
 
476
-				$list_events .= '</ul>' . "\n";
476
+				$list_events .= '</ul>'."\n";
477 477
 
478 478
 				// Optional button to toggle hidden events in list.
479
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
479
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
480 480
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
481 481
 				endif;
482 482
 
@@ -488,49 +488,49 @@  discard block
 block discarded – undo
488 488
 			endif;
489 489
 
490 490
 			// The actual days with numbers and events in each row cell.
491
-			echo '<td class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
492
-
493
-			if ( $color ) {
494
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
495
-			} elseif ( $count > 0 ) {
496
-				$the_color = new Color( $calendar->days_events_color );
497
-				$color = ! $color ? ( $the_color->isDark() ? '#ffffff' : '#000000' ) : $color;
498
-				$bg_color = ! $bg_color ? '#' . $the_color->getHex() : $bg_color;
499
-				$day_style = ' style="background-color: ' . $bg_color . '; color: ' . $color .'"';
491
+			echo '<td class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
492
+
493
+			if ($color) {
494
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
495
+			} elseif ($count > 0) {
496
+				$the_color = new Color($calendar->days_events_color);
497
+				$color = ! $color ? ($the_color->isDark() ? '#ffffff' : '#000000') : $color;
498
+				$bg_color = ! $bg_color ? '#'.$the_color->getHex() : $bg_color;
499
+				$day_style = ' style="background-color: '.$bg_color.'; color: '.$color.'"';
500 500
 			} else {
501 501
 				$day_style = '';
502 502
 			}
503 503
 
504
-			echo "\t" . '<div' . $border_style . '>' . "\n";
505
-			echo "\t\t" . '<span class="simcal-day-label simcal-day-number"' . $day_style . '>' . $day . '</span>' . "\n";
506
-			echo "\t\t" . $list_events . "\n";
504
+			echo "\t".'<div'.$border_style.'>'."\n";
505
+			echo "\t\t".'<span class="simcal-day-label simcal-day-number"'.$day_style.'>'.$day.'</span>'."\n";
506
+			echo "\t\t".$list_events."\n";
507 507
 			echo "\t\t";
508 508
 			echo '<span class="simcal-events-dots" style="display: none;">';
509 509
 
510 510
 			// Event bullets for calendar mobile mode.
511
-			for( $i = 0; $i < $count; $i++ ) {
512
-				echo '<b style="color: ' . $bullet_colors[ $i ] . ';"> &bull; </b>';
511
+			for ($i = 0; $i < $count; $i++) {
512
+				echo '<b style="color: '.$bullet_colors[$i].';"> &bull; </b>';
513 513
 			}
514 514
 
515
-			echo '</span>' . "\n";
516
-			echo "\t" . '</div>' . "\n";
517
-			echo '</td>' . "\n";
515
+			echo '</span>'."\n";
516
+			echo "\t".'</div>'."\n";
517
+			echo '</td>'."\n";
518 518
 
519 519
 			// Reset day of the week count (sun, 0 - sat, 6).
520
-			if ( $week_day === 6 ) {
520
+			if ($week_day === 6) {
521 521
 				$week_day = - 1;
522 522
 			}
523 523
 			$week_day++;
524 524
 
525 525
 			// Reset count of days for this row (0-6).
526
-			if ( $days_in_row === 6 ) :
526
+			if ($days_in_row === 6) :
527 527
 
528 528
 				// Close the week row.
529 529
 				echo '</tr>';
530 530
 
531 531
 				// Open a new week row.
532
-				if ( $day < $days_in_month ) {
533
-					echo '<tr class="simcal-week simcal-week-' . $week_of_year++ . '">' . "\n";
532
+				if ($day < $days_in_month) {
533
+					echo '<tr class="simcal-week simcal-week-'.$week_of_year++.'">'."\n";
534 534
 				}
535 535
 
536 536
 				$days_in_row = -1;
@@ -539,27 +539,27 @@  discard block
 block discarded – undo
539 539
 
540 540
 			$days_in_row++;
541 541
 
542
-			$current_min = Carbon::createFromTimestamp( $current_min, $calendar->timezone )->addDay()->getTimestamp();
543
-			$current_max = Carbon::createFromTimestamp( $current_max, $calendar->timezone )->addDay()->getTimestamp();
542
+			$current_min = Carbon::createFromTimestamp($current_min, $calendar->timezone)->addDay()->getTimestamp();
543
+			$current_max = Carbon::createFromTimestamp($current_max, $calendar->timezone)->addDay()->getTimestamp();
544 544
 
545 545
 		endfor;
546 546
 
547 547
 		// Void days at the end of the month.
548
-		$remainder_days = ( 6 - $days_in_row );
548
+		$remainder_days = (6 - $days_in_row);
549 549
 
550
-		for ( $i = 0; $i <= $remainder_days; $i ++ ) {
550
+		for ($i = 0; $i <= $remainder_days; $i++) {
551 551
 
552
-			$last_void_day_class = ( $i == $remainder_days ) ? 'simcal-day-void-last' : '';
552
+			$last_void_day_class = ($i == $remainder_days) ? 'simcal-day-void-last' : '';
553 553
 
554
-			echo '<td class="simcal-day simcal-day-void ' . $last_void_day_class . '"></td>' . "\n";
554
+			echo '<td class="simcal-day simcal-day-void '.$last_void_day_class.'"></td>'."\n";
555 555
 
556 556
 			$week_day++;
557 557
 		}
558 558
 
559
-		echo "\t" . '</tr>' . "\n";
560
-		echo '</tbody>' . "\n";
559
+		echo "\t".'</tr>'."\n";
560
+		echo '</tbody>'."\n";
561 561
 
562
-		date_default_timezone_set( $calendar->site_timezone );
562
+		date_default_timezone_set($calendar->site_timezone);
563 563
 
564 564
 		return ob_get_clean();
565 565
 	}
@@ -571,17 +571,17 @@  discard block
 block discarded – undo
571 571
 	 */
572 572
 	public function draw_grid_ajax() {
573 573
 
574
-		if ( isset( $_POST['month'] ) && isset( $_POST['year'] ) && isset( $_POST['id'] ) ) {
574
+		if (isset($_POST['month']) && isset($_POST['year']) && isset($_POST['id'])) {
575 575
 
576
-			$month = absint( $_POST['month'] );
577
-			$year  = absint( $_POST['year'] );
578
-			$id    = absint( $_POST['id'] );
576
+			$month = absint($_POST['month']);
577
+			$year  = absint($_POST['year']);
578
+			$id    = absint($_POST['id']);
579 579
 
580
-			wp_send_json_success( $this->draw_month( $month, $year, $id ) );
580
+			wp_send_json_success($this->draw_month($month, $year, $id));
581 581
 
582 582
 		} else {
583 583
 
584
-			wp_send_json_error( 'Missing arguments in default calendar grid ajax request.' );
584
+			wp_send_json_error('Missing arguments in default calendar grid ajax request.');
585 585
 
586 586
 		}
587 587
 
@@ -597,8 +597,8 @@  discard block
 block discarded – undo
597 597
 	 *
598 598
 	 * @return bool
599 599
 	 */
600
-	private function filter_events_before( $event ) {
601
-		return intval( $event ) >= intval( $this->start );
600
+	private function filter_events_before($event) {
601
+		return intval($event) >= intval($this->start);
602 602
 	}
603 603
 
604 604
 	/**
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 	 *
612 612
 	 * @return bool
613 613
 	 */
614
-	private function filter_events_after( $event ) {
615
-		return intval( $event ) < intval( $this->end );
614
+	private function filter_events_after($event) {
615
+		return intval($event) < intval($this->end);
616 616
 	}
617 617
 
618 618
 }
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   +202 added lines, -202 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
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param string|Calendar $calendar
73 73
 	 */
74
-	public function __construct( $calendar = '' ) {
74
+	public function __construct($calendar = '') {
75 75
 		$this->calendar = $calendar;
76 76
 	}
77 77
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @return string
106 106
 	 */
107 107
 	public function get_name() {
108
-		return __( 'List', 'google-calendar-events' );
108
+		return __('List', 'google-calendar-events');
109 109
 	}
110 110
 
111 111
 	/**
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 * @since 3.0.0
115 115
 	 */
116 116
 	public function add_ajax_actions() {
117
-		add_action( 'wp_ajax_simcal_default_calendar_draw_list', array( $this, 'draw_list_ajax' ) );
118
-		add_action( 'wp_ajax_nopriv_simcal_default_calendar_draw_list', array( $this, 'draw_list_ajax' ) );
117
+		add_action('wp_ajax_simcal_default_calendar_draw_list', array($this, 'draw_list_ajax'));
118
+		add_action('wp_ajax_nopriv_simcal_default_calendar_draw_list', array($this, 'draw_list_ajax'));
119 119
 	}
120 120
 
121 121
 	/**
@@ -129,16 +129,16 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return array
131 131
 	 */
132
-	public function scripts( $min = '' ) {
132
+	public function scripts($min = '') {
133 133
 		return array(
134 134
 			'simcal-qtip' => array(
135
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/qtip' . $min . '.js',
136
-				'deps'      => array( 'jquery' ),
135
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/qtip'.$min.'.js',
136
+				'deps'      => array('jquery'),
137 137
 				'ver'       => '2.2.1',
138 138
 				'in_footer' => true,
139 139
 			),
140 140
 			'simcal-default-calendar' => array(
141
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $min . '.js',
141
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$min.'.js',
142 142
 				'deps'      => array(
143 143
 					'jquery',
144 144
 					'simcal-qtip',
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return array
165 165
 	 */
166
-	public function styles( $min = '' ) {
166
+	public function styles($min = '') {
167 167
 		return array(
168 168
 			'simcal-default-calendar-list' => array(
169
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $min . '.css',
169
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$min.'.css',
170 170
 				'ver'   => SIMPLE_CALENDAR_VERSION,
171 171
 				'media' => 'all',
172 172
 			),
@@ -182,49 +182,49 @@  discard block
 block discarded – undo
182 182
 
183 183
 		$calendar = $this->calendar;
184 184
 
185
-		if ( $calendar instanceof Default_Calendar ) {
185
+		if ($calendar instanceof Default_Calendar) {
186 186
 
187 187
 			$disabled = $calendar->static === true ? ' disabled="disabled"' : '';
188 188
 
189 189
 
190
-			$hide_header = get_post_meta( $this->calendar->id, '_default_calendar_list_header', true ) == 'yes' ? true : false;
191
-			$static_calendar = get_post_meta( $this->calendar->id, '_calendar_is_static', true ) == 'yes' ? true : false;
190
+			$hide_header = get_post_meta($this->calendar->id, '_default_calendar_list_header', true) == 'yes' ? true : false;
191
+			$static_calendar = get_post_meta($this->calendar->id, '_calendar_is_static', true) == 'yes' ? true : false;
192 192
 
193 193
 			$header_class = '';
194 194
 			$compact_list_class = $calendar->compact_list ? 'simcal-calendar-list-compact' : '';
195 195
 
196
-			edit_post_link( __( 'Edit Calendar', 'google-calendar-events' ), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id );
196
+			edit_post_link(__('Edit Calendar', 'google-calendar-events'), '<p class="simcal-align-right"><small>', '</small></p>', $calendar->id);
197 197
 
198
-			echo '<div class="simcal-calendar-list ' . $compact_list_class . '">';
198
+			echo '<div class="simcal-calendar-list '.$compact_list_class.'">';
199 199
 
200
-			if ( ! $hide_header && ! $static_calendar ) {
201
-				echo '<nav class="simcal-calendar-head">' . "\n";
200
+			if ( ! $hide_header && ! $static_calendar) {
201
+				echo '<nav class="simcal-calendar-head">'."\n";
202 202
 
203
-				echo "\t" . '<div class="simcal-nav">' . "\n";
204
-				echo "\t\t" . '<button class="simcal-nav-button simcal-prev" title="' . __('Previous', 'google-calendar-events') . '"' . $disabled . '>' . "\n";
205
-				echo "\t\t\t" . '<i class="simcal-icon-left"></i>' . "\n";
206
-				echo "\t\t" . '</button>' . "\n";
207
-				echo "\t" . '</div>' . "\n";
203
+				echo "\t".'<div class="simcal-nav">'."\n";
204
+				echo "\t\t".'<button class="simcal-nav-button simcal-prev" title="'.__('Previous', 'google-calendar-events').'"'.$disabled.'>'."\n";
205
+				echo "\t\t\t".'<i class="simcal-icon-left"></i>'."\n";
206
+				echo "\t\t".'</button>'."\n";
207
+				echo "\t".'</div>'."\n";
208 208
 
209
-				if ( $hide_header ) {
209
+				if ($hide_header) {
210 210
 					$header_class = 'simcal-hide-header';
211 211
 				}
212 212
 
213 213
 
214
-				echo "\t" . '<div class="simcal-nav simcal-current ' . $header_class . '" data-calendar-current="' . $calendar->start . '">' . "\n";
215
-				echo "\t\t" . '<h3 class="simcal-current-label"> </h3>' . "\n";
216
-				echo "\t" . '</div>' . "\n";
214
+				echo "\t".'<div class="simcal-nav simcal-current '.$header_class.'" data-calendar-current="'.$calendar->start.'">'."\n";
215
+				echo "\t\t".'<h3 class="simcal-current-label"> </h3>'."\n";
216
+				echo "\t".'</div>'."\n";
217 217
 
218
-				echo "\t" . '<div class="simcal-nav">';
219
-				echo "\t\t" . '<button class="simcal-nav-button simcal-next" title="' . __('Next', 'google-calendar-events') . '"' . $disabled . '>';
220
-				echo "\t\t\t" . '<i class="simcal-icon-right"></i>' . "\n";
221
-				echo "\t\t" . '</button>' . "\n";
222
-				echo "\t" . '</div>' . "\n";
218
+				echo "\t".'<div class="simcal-nav">';
219
+				echo "\t\t".'<button class="simcal-nav-button simcal-next" title="'.__('Next', 'google-calendar-events').'"'.$disabled.'>';
220
+				echo "\t\t\t".'<i class="simcal-icon-right"></i>'."\n";
221
+				echo "\t\t".'</button>'."\n";
222
+				echo "\t".'</div>'."\n";
223 223
 
224
-				echo '</nav>' . "\n";
224
+				echo '</nav>'."\n";
225 225
 			}
226 226
 
227
-			echo $this->draw_list( $calendar->start );
227
+			echo $this->draw_list($calendar->start);
228 228
 
229 229
 			echo '<div class="simcal-ajax-loader simcal-spinner-top" style="display: none;"><i class="simcal-icon-spinner simcal-icon-spin"></i></div>';
230 230
 
@@ -244,92 +244,92 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @return array
246 246
 	 */
247
-	private function get_events( $timestamp ) {
247
+	private function get_events($timestamp) {
248 248
 
249 249
 		$calendar = $this->calendar;
250 250
 		$timezone = $calendar->timezone;
251 251
 
252
-		if ( ! $calendar->group_type || ! $calendar->group_span ) {
252
+		if ( ! $calendar->group_type || ! $calendar->group_span) {
253 253
 			return array();
254 254
 		}
255 255
 
256
-		$current = Carbon::createFromTimestamp( $timestamp, $timezone );
256
+		$current = Carbon::createFromTimestamp($timestamp, $timezone);
257 257
 		$prev = clone $current;
258 258
 		$next = clone $current;
259 259
 
260 260
 		$this->start = $current->getTimestamp();
261 261
 
262
-		$interval = $span = max( absint( $calendar->group_span ), 1 );
263
-
264
-		if ( 'monthly' == $calendar->group_type ) {
265
-			$this->prev = $prev->subMonths( $span )->getTimestamp();
266
-			$this->next = $next->addMonths( $span )->getTimestamp();
267
-		} elseif ( 'weekly' == $calendar->group_type ) {
268
-			$week = new Carbon( $calendar->timezone );
269
-			$week->setTimestamp( $timestamp );
270
-			$week->setWeekStartsAt( $calendar->week_starts );
271
-			$this->prev = $prev->subWeeks( $span )->getTimestamp();
272
-			$this->next = $next->addWeeks( $span )->getTimestamp();
273
-		} elseif ( 'daily' == $calendar->group_type ) {
274
-			$this->prev = $prev->subDays( $span )->getTimestamp();
275
-			$this->next = $next->addDays( $span )->getTimestamp();
262
+		$interval = $span = max(absint($calendar->group_span), 1);
263
+
264
+		if ('monthly' == $calendar->group_type) {
265
+			$this->prev = $prev->subMonths($span)->getTimestamp();
266
+			$this->next = $next->addMonths($span)->getTimestamp();
267
+		} elseif ('weekly' == $calendar->group_type) {
268
+			$week = new Carbon($calendar->timezone);
269
+			$week->setTimestamp($timestamp);
270
+			$week->setWeekStartsAt($calendar->week_starts);
271
+			$this->prev = $prev->subWeeks($span)->getTimestamp();
272
+			$this->next = $next->addWeeks($span)->getTimestamp();
273
+		} elseif ('daily' == $calendar->group_type) {
274
+			$this->prev = $prev->subDays($span)->getTimestamp();
275
+			$this->next = $next->addDays($span)->getTimestamp();
276 276
 		}
277 277
 
278 278
 		$events = $calendar->events;
279 279
 		$daily_events = $paged_events = $flattened_events = array();
280 280
 
281
-		if ( 'events' != $calendar->group_type ) {
281
+		if ('events' != $calendar->group_type) {
282 282
 
283
-			$this->end   = $this->next - 1;
283
+			$this->end = $this->next - 1;
284 284
 
285
-			$timestamps   = array_keys( $events );
286
-			$lower_bound  = array_filter( $timestamps,  array( $this, 'filter_events_before' ) );
287
-			$higher_bound = array_filter( $lower_bound, array( $this, 'filter_events_after'  ) );
285
+			$timestamps   = array_keys($events);
286
+			$lower_bound  = array_filter($timestamps, array($this, 'filter_events_before'));
287
+			$higher_bound = array_filter($lower_bound, array($this, 'filter_events_after'));
288 288
 
289
-			if ( is_array( $higher_bound ) && !empty( $higher_bound ) ) {
290
-				$filtered = array_intersect_key( $events, array_combine( $higher_bound, $higher_bound ) );
291
-				foreach ( $filtered as $timestamp => $events ) {
292
-					$paged_events[ intval( $timestamp ) ] = $events;
289
+			if (is_array($higher_bound) && ! empty($higher_bound)) {
290
+				$filtered = array_intersect_key($events, array_combine($higher_bound, $higher_bound));
291
+				foreach ($filtered as $timestamp => $events) {
292
+					$paged_events[intval($timestamp)] = $events;
293 293
 				}
294 294
 			}
295 295
 
296 296
 		} else {
297 297
 
298
-			foreach ( $events as $timestamp => $e ) {
298
+			foreach ($events as $timestamp => $e) {
299 299
 				$second = 0;
300
-				foreach ( $e as $event ) {
301
-					$flattened_events[ intval( $timestamp + $second ) ][] = $event;
300
+				foreach ($e as $event) {
301
+					$flattened_events[intval($timestamp + $second)][] = $event;
302 302
 					$second++;
303 303
 				}
304 304
 			}
305
-			ksort( $flattened_events, SORT_NUMERIC );
305
+			ksort($flattened_events, SORT_NUMERIC);
306 306
 
307
-			$keys  = array_keys( $flattened_events );
307
+			$keys = array_keys($flattened_events);
308 308
 			$current = 0;
309
-			foreach ( $keys as $timestamp ) {
310
-				if ( $timestamp <= $this->start ) {
309
+			foreach ($keys as $timestamp) {
310
+				if ($timestamp <= $this->start) {
311 311
 					$current++;
312 312
 				}
313 313
 			}
314 314
 
315
-			$paged_events = array_slice( $flattened_events, $current, $interval, true );
315
+			$paged_events = array_slice($flattened_events, $current, $interval, true);
316 316
 
317
-			$events_end = isset( $keys[ $current + $interval ] ) ? $keys[ $current + $interval ] : $calendar->end;
317
+			$events_end = isset($keys[$current + $interval]) ? $keys[$current + $interval] : $calendar->end;
318 318
 			$this->end  = $events_end > $calendar->end ? $calendar->end : $events_end;
319 319
 			// -1 adjusts the interval count to index count, which starts at 0.
320
-			$this->prev = isset( $keys[ $current - $interval - 1 ] ) ? $keys[ $current - $interval - 1 ] : $calendar->earliest_event;
321
-			$this->next = isset( $keys[ $current + $interval - 1 ] ) ? $keys[ $current + $interval - 1 ] : $this->end;
320
+			$this->prev = isset($keys[$current - $interval - 1]) ? $keys[$current - $interval - 1] : $calendar->earliest_event;
321
+			$this->next = isset($keys[$current + $interval - 1]) ? $keys[$current + $interval - 1] : $this->end;
322 322
 
323 323
 		}
324 324
 
325 325
 		// Put resulting events in an associative array, with Ymd date as key for easy retrieval in calendar days loop.
326
-		foreach ( $paged_events as $timestamp => $events ) {
327
-			if ( $timestamp <= $this->end ) {
328
-				$date = Carbon::createFromTimestamp( $timestamp, $calendar->timezone )->endOfDay()->format( 'Ymd' );
329
-				$daily_events[ intval( $date ) ][] = $events;
326
+		foreach ($paged_events as $timestamp => $events) {
327
+			if ($timestamp <= $this->end) {
328
+				$date = Carbon::createFromTimestamp($timestamp, $calendar->timezone)->endOfDay()->format('Ymd');
329
+				$daily_events[intval($date)][] = $events;
330 330
 			}
331 331
 		}
332
-		ksort( $daily_events, SORT_NUMERIC );
332
+		ksort($daily_events, SORT_NUMERIC);
333 333
 
334 334
 		return $daily_events;
335 335
 	}
@@ -347,71 +347,71 @@  discard block
 block discarded – undo
347 347
 	private function get_heading() {
348 348
 
349 349
 		$calendar = $this->calendar;
350
-		$start = Carbon::createFromTimestamp( $this->start, $calendar->timezone );
351
-		$end = Carbon::createFromTimestamp( $this->end, $calendar->timezone );
350
+		$start = Carbon::createFromTimestamp($this->start, $calendar->timezone);
351
+		$end = Carbon::createFromTimestamp($this->end, $calendar->timezone);
352 352
 		$date_format = $this->calendar->date_format;
353
-		$date_order  = simcal_get_date_format_order( $date_format );
353
+		$date_order  = simcal_get_date_format_order($date_format);
354 354
 
355
-		if ( ( $start->day == $end->day ) && ( $start->month == $end->month ) && ( $start->year == $end->year ) ) {
355
+		if (($start->day == $end->day) && ($start->month == $end->month) && ($start->year == $end->year)) {
356 356
 			// Start and end on the same day.
357 357
 			// e.g. 1 February 2020
358
-			$large = $small = date_i18n( $calendar->date_format , $this->start );
359
-			if ( ( $date_order['d'] !== false ) && ( $date_order['m'] !== false ) ) {
360
-				if ( $date_order['m'] > $date_order['d'] ) {
361
-					if ( $date_order['y'] !== false && $date_order['y'] > $date_order['m'] ) {
362
-						$small = date_i18n( 'Y, d M', $this->start );
358
+			$large = $small = date_i18n($calendar->date_format, $this->start);
359
+			if (($date_order['d'] !== false) && ($date_order['m'] !== false)) {
360
+				if ($date_order['m'] > $date_order['d']) {
361
+					if ($date_order['y'] !== false && $date_order['y'] > $date_order['m']) {
362
+						$small = date_i18n('Y, d M', $this->start);
363 363
 					} else {
364
-						$small = date_i18n( 'd M Y', $this->start );
364
+						$small = date_i18n('d M Y', $this->start);
365 365
 					}
366 366
 				} else {
367
-					if ( $date_order['y'] !== false && $date_order['y'] > $date_order['m'] ) {
368
-						$small = date_i18n( 'Y, M d', $this->start );
367
+					if ($date_order['y'] !== false && $date_order['y'] > $date_order['m']) {
368
+						$small = date_i18n('Y, M d', $this->start);
369 369
 					} else {
370
-						$small = date_i18n( 'M d Y', $this->start );
370
+						$small = date_i18n('M d Y', $this->start);
371 371
 					}
372 372
 				}
373 373
 			}
374
-		} elseif ( ( $start->month == $end->month ) && ( $start->year == $end->year ) ) {
374
+		} elseif (($start->month == $end->month) && ($start->year == $end->year)) {
375 375
 			// Start and end days on the same month.
376 376
 			// e.g. August 2020
377
-			if ( $date_order['y'] === false ) {
377
+			if ($date_order['y'] === false) {
378 378
 				// August.
379
-				$large = $small = date_i18n( 'F', $this->start );
379
+				$large = $small = date_i18n('F', $this->start);
380 380
 			} else {
381
-				if ( $date_order['y'] < $date_order['m'] ) {
381
+				if ($date_order['y'] < $date_order['m']) {
382 382
 					// 2020 August.
383
-					$large = date_i18n( 'Y F', $this->start );
384
-					$small = date_i18n( 'Y M', $this->start );
383
+					$large = date_i18n('Y F', $this->start);
384
+					$small = date_i18n('Y M', $this->start);
385 385
 				} else {
386 386
 					// August 2020.
387
-					$large = date_i18n( 'F Y', $this->start );
388
-					$small = date_i18n( 'M Y', $this->start );
387
+					$large = date_i18n('F Y', $this->start);
388
+					$small = date_i18n('M Y', $this->start);
389 389
 				}
390 390
 			}
391
-		} elseif ( $start->year == $end->year ) {
391
+		} elseif ($start->year == $end->year) {
392 392
 			// Start and end days on months of the same year.
393 393
 			// e.g. August - September 2020
394
-			if ( $date_order['y'] === false ) {
394
+			if ($date_order['y'] === false) {
395 395
 				// August - September.
396
-				$large = date_i18n( 'F', $this->start ) . ' - ' . date_i18n( 'F', $this->end );
397
-				$small = date_i18n( 'M', $this->start ) . ' - ' . date_i18n( 'M', $this->end );
396
+				$large = date_i18n('F', $this->start).' - '.date_i18n('F', $this->end);
397
+				$small = date_i18n('M', $this->start).' - '.date_i18n('M', $this->end);
398 398
 			} else {
399
-				if ( $date_order['y'] < $date_order['m'] ) {
399
+				if ($date_order['y'] < $date_order['m']) {
400 400
 					// 2020, August - September.
401
-					$large  = $small = date( 'Y', $this->start ) . ', ';
402
-					$large .= date_i18n( 'F', $this->start ) . ' - ' . date_i18n( 'F', $this->end );
403
-					$small .= date_i18n( 'M', $this->start ) . ' - ' . date_i18n( 'M', $this->end );
401
+					$large  = $small = date('Y', $this->start).', ';
402
+					$large .= date_i18n('F', $this->start).' - '.date_i18n('F', $this->end);
403
+					$small .= date_i18n('M', $this->start).' - '.date_i18n('M', $this->end);
404 404
 				} else {
405 405
 					// August - September, 2020.
406
-					$large  = date_i18n( 'F', $this->start ) . ' - ' . date_i18n( 'F', $this->end ) . ', ';
407
-					$small  = date_i18n( 'M', $this->start ) . ' - ' . date_i18n( 'M', $this->end ) . ' ';
408
-					$year   = date( 'Y', $this->start );
406
+					$large  = date_i18n('F', $this->start).' - '.date_i18n('F', $this->end).', ';
407
+					$small  = date_i18n('M', $this->start).' - '.date_i18n('M', $this->end).' ';
408
+					$year   = date('Y', $this->start);
409 409
 					$large .= $year;
410 410
 					$small .= $year;
411 411
 				}
412 412
 			}
413 413
 		} else {
414
-			$large = $small = date( 'Y', $this->start ) . ' - ' . date( 'Y', $this->end );
414
+			$large = $small = date('Y', $this->start).' - '.date('Y', $this->end);
415 415
 		}
416 416
 
417 417
 		return array(
@@ -433,133 +433,133 @@  discard block
 block discarded – undo
433 433
 	 *
434 434
 	 * @return string
435 435
 	 */
436
-	private function draw_list( $timestamp, $id = 0 ) {
436
+	private function draw_list($timestamp, $id = 0) {
437 437
 
438 438
 		$calendar = $this->calendar;
439 439
 
440
-		if ( empty( $calendar ) ) {
441
-			$calendar = $this->calendar = simcal_get_calendar( intval( $id ) );
442
-			if ( ! $calendar instanceof Default_Calendar ) {
440
+		if (empty($calendar)) {
441
+			$calendar = $this->calendar = simcal_get_calendar(intval($id));
442
+			if ( ! $calendar instanceof Default_Calendar) {
443 443
 				return '';
444 444
 			}
445 445
 		}
446 446
 
447
-		$feed          = simcal_get_feed( $calendar );
448
-		$feed_timezone = get_post_meta( $feed->post_id, '_feed_timezone', true );
447
+		$feed          = simcal_get_feed($calendar);
448
+		$feed_timezone = get_post_meta($feed->post_id, '_feed_timezone', true);
449 449
 
450 450
 		$now = $calendar->now;
451
-		$current_events = $this->get_events( $timestamp );
452
-		$day_format = explode( ' ', $calendar->date_format );
451
+		$current_events = $this->get_events($timestamp);
452
+		$day_format = explode(' ', $calendar->date_format);
453 453
 
454 454
 		ob_start();
455 455
 
456 456
 		// Draw the events.
457 457
 
458
-		$block_tag = $calendar->compact_list && ! empty( $current_events ) ? 'div' : 'dl';
458
+		$block_tag = $calendar->compact_list && ! empty($current_events) ? 'div' : 'dl';
459 459
 
460 460
 		$data_heading = '';
461 461
 		$heading = $this->get_heading();
462
-		foreach ( $heading as $k => $v ) {
463
-			$data_heading .= ' data-heading-' . $k . '="' . $v . '"';
462
+		foreach ($heading as $k => $v) {
463
+			$data_heading .= ' data-heading-'.$k.'="'.$v.'"';
464 464
 		}
465 465
 
466
-		echo '<' . $block_tag . ' class="simcal-events-list-container"' .
467
-			' data-prev="' . $this->prev . '"' .
468
-			' data-next="' . $this->next . '"' .
469
-			$data_heading . '>';
466
+		echo '<'.$block_tag.' class="simcal-events-list-container"'.
467
+			' data-prev="'.$this->prev.'"'.
468
+			' data-next="'.$this->next.'"'.
469
+			$data_heading.'>';
470 470
 
471
-		if ( ! empty( $current_events ) && is_array( $current_events ) ) :
471
+		if ( ! empty($current_events) && is_array($current_events)) :
472 472
 
473
-			foreach ( $current_events as $ymd => $events ) :
473
+			foreach ($current_events as $ymd => $events) :
474 474
 
475 475
 
476 476
 
477 477
 				// This is where we can find out if an event is a multi-day event and if it needs to be shown.
478 478
 				// Since this is for list view we are showing the event on the day viewed if it is part of that day even when
479 479
 				// expand multi-day events are turned off.
480
-				if ( isset( $events[0][0]->multiple_days ) && $events[0][0]->multiple_days > 0 ) {
481
-					if ( 'current_day_only' == get_post_meta($calendar->id, '_default_calendar_expand_multi_day_events', true ) ) {
480
+				if (isset($events[0][0]->multiple_days) && $events[0][0]->multiple_days > 0) {
481
+					if ('current_day_only' == get_post_meta($calendar->id, '_default_calendar_expand_multi_day_events', true)) {
482 482
 
483
-						$year  = substr( $ymd, 0, 4 );
484
-						$month = substr( $ymd, 4, 2 );
485
-						$day   = substr( $ymd, 6, 2 );
483
+						$year  = substr($ymd, 0, 4);
484
+						$month = substr($ymd, 4, 2);
485
+						$day   = substr($ymd, 6, 2);
486 486
 
487
-						$temp_date = Carbon::createFromDate( $year, $month, $day );
487
+						$temp_date = Carbon::createFromDate($year, $month, $day);
488 488
 
489
-						if( ! ( $temp_date < Carbon::now()->endOfDay() ) ) {
489
+						if ( ! ($temp_date < Carbon::now()->endOfDay())) {
490 490
 							continue;
491 491
 						}
492 492
 					}
493 493
 				}
494 494
 
495
-				$day_ts = Carbon::createFromFormat( 'Ymd', $ymd, $calendar->timezone )->getTimestamp();
495
+				$day_ts = Carbon::createFromFormat('Ymd', $ymd, $calendar->timezone)->getTimestamp();
496 496
 
497
-				if ( ! $calendar->compact_list ) :
497
+				if ( ! $calendar->compact_list) :
498 498
 
499
-					$date = new Carbon( 'now', $calendar->timezone );
500
-					$date->setLocale( substr( get_locale(), 0, 2 ) );
501
-					$date->setTimestamp( $day_ts );
499
+					$date = new Carbon('now', $calendar->timezone);
500
+					$date->setLocale(substr(get_locale(), 0, 2));
501
+					$date->setTimestamp($day_ts);
502 502
 
503
-					if ( $date->isToday() ) {
504
-						$the_color = new Color( $calendar->today_color );
503
+					if ($date->isToday()) {
504
+						$the_color = new Color($calendar->today_color);
505 505
 					} else {
506
-						$the_color = new Color( $calendar->days_events_color );
506
+						$the_color = new Color($calendar->days_events_color);
507 507
 					}
508 508
 
509
-					$bg_color = '#' . $the_color->getHex();
509
+					$bg_color = '#'.$the_color->getHex();
510 510
 					$color = $the_color->isDark() ? '#ffffff' : '#000000';
511
-					$border_style = ' style="border-bottom: 1px solid ' . $bg_color . ';" ';
512
-					$bg_style = ' style="background-color: ' . $bg_color . '; color: ' . $color . ';"';
511
+					$border_style = ' style="border-bottom: 1px solid '.$bg_color.';" ';
512
+					$bg_style = ' style="background-color: '.$bg_color.'; color: '.$color.';"';
513 513
 
514
-					echo "\t" . '<dt class="simcal-day-label"' . $border_style . '>';
515
-					echo '<span' . $bg_style .'>';
516
-					foreach ( $day_format as $format ) {
517
-						echo $format ? '<span class="simcal-date-format" data-date-format="' . $format . '">' . date_i18n( $format, $day_ts ) . '</span> ' : ' ';
514
+					echo "\t".'<dt class="simcal-day-label"'.$border_style.'>';
515
+					echo '<span'.$bg_style.'>';
516
+					foreach ($day_format as $format) {
517
+						echo $format ? '<span class="simcal-date-format" data-date-format="'.$format.'">'.date_i18n($format, $day_ts).'</span> ' : ' ';
518 518
 					}
519 519
 					echo '</span>';
520
-					echo '</dt>' . "\n";
520
+					echo '</dt>'."\n";
521 521
 
522 522
 				endif;
523 523
 
524
-				$list_events = '<ul class="simcal-events">' . "\n";
524
+				$list_events = '<ul class="simcal-events">'."\n";
525 525
 
526 526
 				$calendar_classes = array();
527
-				$day_classes = 'simcal-weekday-' . date( 'w', $day_ts );
527
+				$day_classes = 'simcal-weekday-'.date('w', $day_ts);
528 528
 
529 529
 				// Is this the present, the past or the future, Doc?
530
-				if ( $timestamp <= $now && $timestamp >= $now ) {
530
+				if ($timestamp <= $now && $timestamp >= $now) {
531 531
 					$day_classes .= ' simcal-today simcal-present simcal-day';
532
-				} elseif ( $timestamp < $now ) {
532
+				} elseif ($timestamp < $now) {
533 533
 					$day_classes .= ' simcal-past simcal-day';
534
-				} elseif ( $this->end > $now ) {
534
+				} elseif ($this->end > $now) {
535 535
 					$day_classes .= ' simcal-future simcal-day';
536 536
 				}
537 537
 
538 538
 				$count = 0;
539 539
 
540
-				foreach ( $events as $day_events ) :
541
-					foreach ( $day_events as $event ) :
540
+				foreach ($events as $day_events) :
541
+					foreach ($day_events as $event) :
542 542
 
543
-						if ( $event instanceof Event ) :
543
+						if ($event instanceof Event) :
544 544
 
545
-							if ( $feed->type == 'grouped-calendars' ) {
546
-								date_default_timezone_set( $feed_timezone );
545
+							if ($feed->type == 'grouped-calendars') {
546
+								date_default_timezone_set($feed_timezone);
547 547
 							} else {
548
-								date_default_timezone_set( $event->timezone );
548
+								date_default_timezone_set($event->timezone);
549 549
 							}
550 550
 
551 551
 							$event_classes = $event_visibility = '';
552 552
 
553
-							$calendar_class     = 'simcal-events-calendar-' . strval( $event->calendar );
553
+							$calendar_class     = 'simcal-events-calendar-'.strval($event->calendar);
554 554
 							$calendar_classes[] = $calendar_class;
555 555
 
556 556
 							$recurring     = $event->recurrence ? 'simcal-event-recurring ' : '';
557 557
 							$has_location  = $event->venue ? 'simcal-event-has-location ' : '';
558 558
 
559
-							$event_classes .= 'simcal-event ' . $recurring . $has_location . $calendar_class;
559
+							$event_classes .= 'simcal-event '.$recurring.$has_location.$calendar_class;
560 560
 
561 561
 							// Toggle some events visibility if more than optional limit.
562
-							if ( ( $calendar->events_limit > - 1 ) && ( $count >= $calendar->events_limit ) ) :
562
+							if (($calendar->events_limit > - 1) && ($count >= $calendar->events_limit)) :
563 563
 								$event_classes .= ' simcal-event-toggled';
564 564
 								$event_visibility = ' style="display: none"';
565 565
 							endif;
@@ -567,75 +567,75 @@  discard block
 block discarded – undo
567 567
 							$event_color = '';
568 568
 							$bullet = '';
569 569
 							$event_color = $event->get_color();
570
-							if ( ! empty( $event_color ) ) {
570
+							if ( ! empty($event_color)) {
571 571
 								$side = is_rtl() ? 'right' : 'left';
572
-								$event_color = ' style="border-' . $side . ': 4px solid ' . $event_color . '; padding-' . $side . ': 8px;"';
572
+								$event_color = ' style="border-'.$side.': 4px solid '.$event_color.'; padding-'.$side.': 8px;"';
573 573
 							}
574 574
 
575
-							$list_events .= "\t" . '<li class="' . $event_classes . '"' . $event_visibility . $event_color . ' itemscope itemtype="http://schema.org/Event">' . "\n";
576
-							$list_events .= "\t\t" . '<div class="simcal-event-details">' . $calendar->get_event_html( $event ) . '</div>' . "\n";
577
-							$list_events .= "\t" . '</li>' . "\n";
575
+							$list_events .= "\t".'<li class="'.$event_classes.'"'.$event_visibility.$event_color.' itemscope itemtype="http://schema.org/Event">'."\n";
576
+							$list_events .= "\t\t".'<div class="simcal-event-details">'.$calendar->get_event_html($event).'</div>'."\n";
577
+							$list_events .= "\t".'</li>'."\n";
578 578
 
579
-							$count ++;
579
+							$count++;
580 580
 
581 581
 							// Event falls within today.
582
-							if ( ( $this->end <= $now ) && ( $this->start >= $now ) ) :
582
+							if (($this->end <= $now) && ($this->start >= $now)) :
583 583
 								$day_classes .= ' simcal-today-has-events';
584 584
 							endif;
585
-							$day_classes .= ' simcal-day-has-events simcal-day-has-' . strval( $count ) . '-events';
585
+							$day_classes .= ' simcal-day-has-events simcal-day-has-'.strval($count).'-events';
586 586
 
587
-							if ( $calendar_classes ) :
588
-								$day_classes .= ' ' . trim( implode( ' ', array_unique( $calendar_classes ) ) );
587
+							if ($calendar_classes) :
588
+								$day_classes .= ' '.trim(implode(' ', array_unique($calendar_classes)));
589 589
 							endif;
590 590
 
591 591
 						endif;
592 592
 					endforeach;
593 593
 				endforeach;
594 594
 
595
-				$list_events .= '</ul>' . "\n";
595
+				$list_events .= '</ul>'."\n";
596 596
 
597 597
 				// If events visibility is limited, print the button toggle.
598
-				if ( ( $calendar->events_limit > -1 ) && ( $count > $calendar->events_limit ) ) :
598
+				if (($calendar->events_limit > -1) && ($count > $calendar->events_limit)) :
599 599
 					$list_events .= '<button class="simcal-events-toggle"><i class="simcal-icon-down simcal-icon-animate"></i></button>';
600 600
 				endif;
601 601
 
602 602
 				// Print final list of events for the current day.
603 603
 				$tag = $calendar->compact_list ? 'div' : 'dd';
604
-				echo '<'  . $tag . ' class="' . $day_classes . '" data-events-count="' . strval( $count ) . '">' . "\n";
605
-				echo "\t" . $list_events . "\n";
606
-				echo '</' . $tag . '>' . "\n";
604
+				echo '<'.$tag.' class="'.$day_classes.'" data-events-count="'.strval($count).'">'."\n";
605
+				echo "\t".$list_events."\n";
606
+				echo '</'.$tag.'>'."\n";
607 607
 
608 608
 			endforeach;
609 609
 
610 610
 		else :
611 611
 
612
-			echo "\t" . '<p>';
612
+			echo "\t".'<p>';
613 613
 
614
-			$message = get_post_meta( $calendar->id, '_no_events_message', true );
614
+			$message = get_post_meta($calendar->id, '_no_events_message', true);
615 615
 
616
-			if ( 'events' == $calendar->group_type ) {
617
-				echo ! empty( $message ) ? $message : __( 'Nothing to show.', 'google-calendar-events' );
616
+			if ('events' == $calendar->group_type) {
617
+				echo ! empty($message) ? $message : __('Nothing to show.', 'google-calendar-events');
618 618
 			} else {
619
-				if ( ! empty( $message ) ) {
619
+				if ( ! empty($message)) {
620 620
 					echo $message;
621 621
 				} else {
622
-					$from = Carbon::createFromTimestamp( $this->start, $calendar->timezone )->getTimestamp();
623
-					$to = Carbon::createFromTimestamp( $this->end, $calendar->timezone )->getTimestamp();
624
-					echo apply_filters( 'simcal_no_events_message', sprintf(
625
-						__( 'Nothing from %1$s to %2$s.', 'google-calendar-events' ),
626
-						date_i18n( $calendar->date_format, $from ),
627
-						date_i18n( $calendar->date_format, $to )
628
-					), $calendar->id, $from, $to );
622
+					$from = Carbon::createFromTimestamp($this->start, $calendar->timezone)->getTimestamp();
623
+					$to = Carbon::createFromTimestamp($this->end, $calendar->timezone)->getTimestamp();
624
+					echo apply_filters('simcal_no_events_message', sprintf(
625
+						__('Nothing from %1$s to %2$s.', 'google-calendar-events'),
626
+						date_i18n($calendar->date_format, $from),
627
+						date_i18n($calendar->date_format, $to)
628
+					), $calendar->id, $from, $to);
629 629
 				}
630 630
 			}
631 631
 
632
-			echo "\t" . '</p>' . "\n";
632
+			echo "\t".'</p>'."\n";
633 633
 
634 634
 		endif;
635 635
 
636
-		echo '</' . $block_tag . '>';
636
+		echo '</'.$block_tag.'>';
637 637
 
638
-		date_default_timezone_set( $calendar->site_timezone );
638
+		date_default_timezone_set($calendar->site_timezone);
639 639
 
640 640
 		return ob_get_clean();
641 641
 	}
@@ -647,16 +647,16 @@  discard block
 block discarded – undo
647 647
 	 */
648 648
 	public function draw_list_ajax() {
649 649
 
650
-		if ( isset( $_POST['ts'] ) && isset( $_POST['id'] ) ) {
650
+		if (isset($_POST['ts']) && isset($_POST['id'])) {
651 651
 
652
-			$ts = absint( $_POST['ts'] );
653
-			$id = absint( $_POST['id'] );
652
+			$ts = absint($_POST['ts']);
653
+			$id = absint($_POST['id']);
654 654
 
655
-			wp_send_json_success( $this->draw_list( $ts, $id ) );
655
+			wp_send_json_success($this->draw_list($ts, $id));
656 656
 
657 657
 		} else {
658 658
 
659
-			wp_send_json_error( 'Missing arguments in default calendar list ajax request.' );
659
+			wp_send_json_error('Missing arguments in default calendar list ajax request.');
660 660
 
661 661
 		}
662 662
 	}
@@ -671,8 +671,8 @@  discard block
 block discarded – undo
671 671
 	 *
672 672
 	 * @return bool
673 673
 	 */
674
-	private function filter_events_before( $event ) {
675
-		return intval( $event ) >= intval( $this->start );
674
+	private function filter_events_before($event) {
675
+		return intval($event) >= intval($this->start);
676 676
 	}
677 677
 
678 678
 	/**
@@ -685,8 +685,8 @@  discard block
 block discarded – undo
685 685
 	 *
686 686
 	 * @return bool
687 687
 	 */
688
-	private function filter_events_after( $event ) {
689
-		return intval( $event ) < intval( $this->end );
688
+	private function filter_events_after($event) {
689
+		return intval($event) < intval($this->end);
690 690
 	}
691 691
 
692 692
 }
Please login to merge, or discard this patch.