Completed
Push — master ( 71159f...86ffa1 )
by
unknown
06:54
created
includes/update.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @param string $version (optional) Current plugin version, defaults to value in plugin constant.
65 65
 	 */
66
-	public function __construct( $version = SIMPLE_CALENDAR_VERSION ) {
66
+	public function __construct($version = SIMPLE_CALENDAR_VERSION) {
67 67
 		// Look for previous version in current or legacy option, null for fresh install.
68
-		$installed = get_option( 'simple-calendar_version', null );
69
-		$this->installed_ver = is_null( $installed ) ? get_option( 'gce_version', null ) : $installed;
68
+		$installed = get_option('simple-calendar_version', null);
69
+		$this->installed_ver = is_null($installed) ? get_option('gce_version', null) : $installed;
70 70
 		$this->new_ver = $version;
71 71
 
72
-		if ( version_compare( $this->installed_ver, $this->new_ver, '<' ) ) {
72
+		if (version_compare($this->installed_ver, $this->new_ver, '<')) {
73 73
 			$this->run_updates();
74 74
 		}
75 75
 	}
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function run_updates() {
85 85
 
86
-		do_action( 'simcal_before_update', $this->installed_ver );
86
+		do_action('simcal_before_update', $this->installed_ver);
87 87
 
88
-		if ( ! is_null( $this->installed_ver ) ) {
88
+		if ( ! is_null($this->installed_ver)) {
89 89
 
90
-			if ( version_compare( $this->installed_ver, $this->new_ver ) === -1 ) {
90
+			if (version_compare($this->installed_ver, $this->new_ver) === -1) {
91 91
 
92
-				$post_type = version_compare( $this->installed_ver, '3.0.0' ) === -1 ? 'gce_feed' : 'calendar';
93
-				$this->posts = $this->get_posts( $post_type );
92
+				$post_type = version_compare($this->installed_ver, '3.0.0') === -1 ? 'gce_feed' : 'calendar';
93
+				$this->posts = $this->get_posts($post_type);
94 94
 
95
-				foreach ( $this->update_path as $update_to ) {
96
-					if ( version_compare( $this->installed_ver, $update_to, '<' ) ) {
97
-						$this->update( $update_to );
95
+				foreach ($this->update_path as $update_to) {
96
+					if (version_compare($this->installed_ver, $update_to, '<')) {
97
+						$this->update($update_to);
98 98
 					}
99 99
 				}
100 100
 
@@ -109,28 +109,28 @@  discard block
 block discarded – undo
109 109
 
110 110
 		}
111 111
 
112
-		do_action( 'simcal_updated', $this->new_ver );
112
+		do_action('simcal_updated', $this->new_ver);
113 113
 
114 114
 		// Redirect to a welcome page if new install or major update.
115
-		if ( is_null( $this->installed_ver ) ) {
116
-			set_transient( '_simple-calendar_activation_redirect', 'fresh', 60 );
115
+		if (is_null($this->installed_ver)) {
116
+			set_transient('_simple-calendar_activation_redirect', 'fresh', 60);
117 117
 		} else {
118
-			$major_new = substr( $this->new_ver, 0, strrpos( $this->new_ver, '.' ) );
119
-			$major_old = substr( $this->installed_ver, 0, strrpos( $this->installed_ver, '.' ) );
120
-			if ( version_compare( $major_new, $major_old, '>' ) ) {
121
-				set_transient( '_simple-calendar_activation_redirect', 'update', 60 );
122
-			} elseif ( $major_old == $major_new ) {
123
-				$version = explode( '.', $this->new_ver );
124
-				end( $version );
125
-				if ( 0 === intval( current( $version ) ) ) {
126
-					set_transient( '_simple-calendar_activation_redirect', 'update', 60 );
118
+			$major_new = substr($this->new_ver, 0, strrpos($this->new_ver, '.'));
119
+			$major_old = substr($this->installed_ver, 0, strrpos($this->installed_ver, '.'));
120
+			if (version_compare($major_new, $major_old, '>')) {
121
+				set_transient('_simple-calendar_activation_redirect', 'update', 60);
122
+			} elseif ($major_old == $major_new) {
123
+				$version = explode('.', $this->new_ver);
124
+				end($version);
125
+				if (0 === intval(current($version))) {
126
+					set_transient('_simple-calendar_activation_redirect', 'update', 60);
127 127
 				}
128 128
 			}
129 129
 		}
130 130
 
131 131
 		$this->admin_redirects();
132 132
 
133
-		update_option( 'simple-calendar_version', $this->new_ver );
133
+		update_option('simple-calendar_version', $this->new_ver);
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,25 +142,25 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public function admin_redirects() {
144 144
 
145
-		$transient = get_transient( '_simple-calendar_activation_redirect' );
145
+		$transient = get_transient('_simple-calendar_activation_redirect');
146 146
 
147
-		if ( ! $transient || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) {
147
+		if ( ! $transient || is_network_admin() || isset($_GET['activate-multi']) || ! current_user_can('manage_options')) {
148 148
 			return;
149 149
 		}
150 150
 
151
-		delete_transient( '_simple-calendar_activation_redirect' );
151
+		delete_transient('_simple-calendar_activation_redirect');
152 152
 
153 153
 		// Do not redirect if already on welcome page screen.
154
-		if ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'simple-calendar_about' ) ) ) {
154
+		if ( ! empty($_GET['page']) && in_array($_GET['page'], array('simple-calendar_about'))) {
155 155
 			return;
156 156
 		}
157 157
 
158 158
 		$url = add_query_arg(
159 159
 				'simcal_install',
160
-				esc_attr( $transient ),
161
-				admin_url( 'index.php?page=simple-calendar_about' )
160
+				esc_attr($transient),
161
+				admin_url('index.php?page=simple-calendar_about')
162 162
 		);
163
-		wp_safe_redirect( $url );
163
+		wp_safe_redirect($url);
164 164
 		exit;
165 165
 	}
166 166
 
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @return array
175 175
 	 */
176
-	private function get_posts( $post_type ) {
176
+	private function get_posts($post_type) {
177 177
 
178 178
 		$posts = array();
179 179
 
180
-		if ( ! empty( $post_type ) ) {
180
+		if ( ! empty($post_type)) {
181 181
 
182 182
 			// https://core.trac.wordpress.org/ticket/18408
183
-			$posts = get_posts( array(
183
+			$posts = get_posts(array(
184 184
 				'post_type'   => $post_type,
185 185
 				'post_status' => array(
186 186
 					'draft',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 					'trash',
192 192
 				),
193 193
 				'nopaging'    => true,
194
-			) );
194
+			));
195 195
 
196 196
 			wp_reset_postdata();
197 197
 		}
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @param string $version
210 210
 	 */
211
-	private function update( $version ) {
211
+	private function update($version) {
212 212
 
213
-		$update_v = '\\' . __NAMESPACE__ . '\Updates\\Update_V' . str_replace( '.', '', $version );
213
+		$update_v = '\\'.__NAMESPACE__.'\Updates\\Update_V'.str_replace('.', '', $version);
214 214
 
215
-		if ( class_exists( $update_v ) ) {
216
-			new $update_v( $this->posts );
215
+		if (class_exists($update_v)) {
216
+			new $update_v($this->posts);
217 217
 		}
218 218
 	}
219 219
 
Please login to merge, or discard this patch.
google-calendar-events.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@  discard block
 block discarded – undo
14 14
  */
15 15
 
16 16
 // Exit if accessed directly.
17
-if ( ! defined( 'ABSPATH' ) ) {
17
+if ( ! defined('ABSPATH')) {
18 18
 	exit;
19 19
 }
20 20
 
21 21
 // Composer fallback for PHP < 5.3.0.
22
-if ( version_compare( PHP_VERSION, '5.3.0' ) === -1 ) {
22
+if (version_compare(PHP_VERSION, '5.3.0') === -1) {
23 23
 	include_once 'vendor/autoload_52.php';
24 24
 } else {
25 25
 	include_once 'vendor/autoload.php';
26 26
 }
27 27
 
28 28
 // Plugin constants.
29
-$this_plugin_path      = trailingslashit( dirname( __FILE__ ) );
30
-$this_plugin_dir       = plugin_dir_url( __FILE__ );
29
+$this_plugin_path      = trailingslashit(dirname(__FILE__));
30
+$this_plugin_dir       = plugin_dir_url(__FILE__);
31 31
 $this_plugin_constants = array(
32 32
 	'SIMPLE_CALENDAR_VERSION'   => '3.0.13',
33 33
 	'SIMPLE_CALENDAR_MAIN_FILE' => __FILE__,
34 34
 	'SIMPLE_CALENDAR_URL'       => $this_plugin_dir,
35
-	'SIMPLE_CALENDAR_ASSETS'    => $this_plugin_dir . 'assets/',
35
+	'SIMPLE_CALENDAR_ASSETS'    => $this_plugin_dir.'assets/',
36 36
 	'SIMPLE_CALENDAR_PATH'      => $this_plugin_path,
37
-	'SIMPLE_CALENDAR_INC'       => $this_plugin_path . 'includes/',
37
+	'SIMPLE_CALENDAR_INC'       => $this_plugin_path.'includes/',
38 38
 );
39
-foreach ( $this_plugin_constants as $constant => $value ) {
40
-	if ( ! defined( $constant ) ) {
41
-		define( $constant, $value );
39
+foreach ($this_plugin_constants as $constant => $value) {
40
+	if ( ! defined($constant)) {
41
+		define($constant, $value);
42 42
 	}
43 43
 }
44 44
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 include_once 'includes/wp-requirements.php';
48 48
 
49 49
 // Check plugin requirements before loading plugin.
50
-$this_plugin_checks = new SimCal_WP_Requirements( 'Simple Calendar', plugin_basename( __FILE__ ), array(
50
+$this_plugin_checks = new SimCal_WP_Requirements('Simple Calendar', plugin_basename(__FILE__), array(
51 51
 		'PHP'        => '5.3.3',
52 52
 		'WordPress'  => '4.0.0',
53 53
 		'Extensions' => array(
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 			'json',
57 57
 			'mbstring',
58 58
 		),
59
-	) );
60
-if ( $this_plugin_checks->pass() === false ) {
59
+	));
60
+if ($this_plugin_checks->pass() === false) {
61 61
 	$this_plugin_checks->halt();
62 62
 
63 63
 	return;
Please login to merge, or discard this patch.
includes/calendars/admin/default-calendar-admin.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Calendars\Admin;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		if ( simcal_is_admin_screen() !== false ) {
28
-			add_action( 'simcal_settings_meta_calendar_panel', array( $this, 'add_settings_meta_calendar_panel' ), 10, 1 );
27
+		if (simcal_is_admin_screen() !== false) {
28
+			add_action('simcal_settings_meta_calendar_panel', array($this, 'add_settings_meta_calendar_panel'), 10, 1);
29 29
 		}
30
-		add_action( 'simcal_process_settings_meta', array( $this, 'process_meta' ), 10, 1 );
30
+		add_action('simcal_process_settings_meta', array($this, 'process_meta'), 10, 1);
31 31
 	}
32 32
 
33 33
 	/**
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param int $post_id
78 78
 	 */
79
-	public function add_settings_meta_calendar_panel( $post_id ) {
79
+	public function add_settings_meta_calendar_panel($post_id) {
80 80
 
81 81
 		?>
82 82
 		<table id="default-calendar-settings">
83 83
 			<thead>
84
-			<tr><th colspan="2"><?php _e( 'Default calendar', 'google-calendar-events' ); ?></th></tr>
84
+			<tr><th colspan="2"><?php _e('Default calendar', 'google-calendar-events'); ?></th></tr>
85 85
 			</thead>
86 86
 			<tbody class="simcal-panel-section">
87 87
 
@@ -89,46 +89,46 @@  discard block
 block discarded – undo
89 89
 				<th></th>
90 90
 				<td>
91 91
 					<p class="description">
92
-						<?php _e( "Tip: If calendar styles appear to be missing and/or navigation isn't working, try going to", 'google-calendar-events' ); ?>
93
-						<a href="<?php echo esc_url( add_query_arg( array ( 'page' => 'simple-calendar_settings', 'tab' => 'advanced' ), admin_url( 'admin.php' ) ) ); ?>">
94
-							<?php _e( 'Calendars &rarr; Settings &rarr; Advanced', 'google-calendar-events' ); ?></a>
95
-						<?php _e( 'and enable', 'google-calendar-events' ); ?> <strong><?php _e( 'Always Enqueue', 'google-calendar-events' ); ?></strong>.
92
+						<?php _e("Tip: If calendar styles appear to be missing and/or navigation isn't working, try going to", 'google-calendar-events'); ?>
93
+						<a href="<?php echo esc_url(add_query_arg(array('page' => 'simple-calendar_settings', 'tab' => 'advanced'), admin_url('admin.php'))); ?>">
94
+							<?php _e('Calendars &rarr; Settings &rarr; Advanced', 'google-calendar-events'); ?></a>
95
+						<?php _e('and enable', 'google-calendar-events'); ?> <strong><?php _e('Always Enqueue', 'google-calendar-events'); ?></strong>.
96 96
 					</p>
97 97
 				</td>
98 98
 			</tr>
99 99
 			
100 100
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
101
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Event bubbles', 'google-calendar-events' ); ?></label></th>
101
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Event bubbles', 'google-calendar-events'); ?></label></th>
102 102
 				<td>
103 103
 					<?php
104 104
 
105
-					$bubbles = get_post_meta( $post_id, '_default_calendar_event_bubble_trigger', true );
105
+					$bubbles = get_post_meta($post_id, '_default_calendar_event_bubble_trigger', true);
106 106
 
107
-					simcal_print_field( array(
107
+					simcal_print_field(array(
108 108
 						'type'    => 'radio',
109 109
 						'inline'  => 'inline',
110 110
 						'name'    => '_default_calendar_event_bubble_trigger',
111 111
 						'id'      => '_default_calendar_event_bubble_trigger',
112
-						'tooltip' => __( 'Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events' ),
112
+						'tooltip' => __('Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events'),
113 113
 						'value'   => $bubbles ? $bubbles : 'hover',
114 114
 						'default' => 'hover',
115 115
 						'options' => array(
116
-							'click' => __( 'Click', 'google-calendar-events' ),
117
-							'hover' => __( 'Hover', 'google-calendar-events' ),
116
+							'click' => __('Click', 'google-calendar-events'),
117
+							'hover' => __('Hover', 'google-calendar-events'),
118 118
 						),
119
-					) );
119
+					));
120 120
 
121 121
 					?>
122 122
 				</td>
123 123
 			</tr>
124 124
 			<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;">
125
-				<th><label for="_default_calendar_trim_titles"><?php _e( 'Trim event titles', 'google-calendar-events' ); ?></label></th>
125
+				<th><label for="_default_calendar_trim_titles"><?php _e('Trim event titles', 'google-calendar-events'); ?></label></th>
126 126
 				<td>
127 127
 					<?php
128 128
 
129
-					$trim = get_post_meta( $post_id, '_default_calendar_trim_titles', true );
129
+					$trim = get_post_meta($post_id, '_default_calendar_trim_titles', true);
130 130
 
131
-					simcal_print_field( array(
131
+					simcal_print_field(array(
132 132
 						'type'        => 'checkbox',
133 133
 						'name'        => '_default_calendar_trim_titles',
134 134
 						'id'          => '_default_calendar_trim_titles',
@@ -139,34 +139,34 @@  discard block
 block discarded – undo
139 139
 						'attributes'  => array(
140 140
 							'data-show-next-if-value' => 'yes',
141 141
 						),
142
-					) );
142
+					));
143 143
 
144
-					simcal_print_field( array(
144
+					simcal_print_field(array(
145 145
 						'type'       => 'standard',
146 146
 						'subtype'    => 'number',
147 147
 						'name'       => '_default_calendar_trim_titles_chars',
148 148
 						'id'         => '_default_calendar_trim_titles_chars',
149
-						'tooltip'    => __( 'Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events' ),
149
+						'tooltip'    => __('Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events'),
150 150
 						'class'      => array(
151 151
 							'simcal-field-tiny',
152 152
 						),
153
-						'value'      => 'yes' == $trim ? strval( max( absint( get_post_meta( $post_id, '_default_calendar_trim_titles_chars', true ) ), 1 ) ) : '20',
153
+						'value'      => 'yes' == $trim ? strval(max(absint(get_post_meta($post_id, '_default_calendar_trim_titles_chars', true)), 1)) : '20',
154 154
 						'attributes' => array(
155 155
 							'min'     => '1',
156 156
 						),
157
-					) );
157
+					));
158 158
 
159 159
 					?>
160 160
 				</td>
161 161
 			</tr>
162 162
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
163
-				<th><label for="_default_calendar_list_grouped_span"><?php _e( 'Span', 'google-calendar-events' ); ?></label></th>
163
+				<th><label for="_default_calendar_list_grouped_span"><?php _e('Span', 'google-calendar-events'); ?></label></th>
164 164
 				<td>
165 165
 					<?php
166 166
 
167
-					$list_span = max( absint( get_post_meta( $post_id, '_default_calendar_list_range_span', true ) ), 1 );
167
+					$list_span = max(absint(get_post_meta($post_id, '_default_calendar_list_range_span', true)), 1);
168 168
 
169
-					simcal_print_field( array(
169
+					simcal_print_field(array(
170 170
 						'type'    => 'standard',
171 171
 						'subtype' => 'number',
172 172
 						'name'    => '_default_calendar_list_range_span',
@@ -175,78 +175,78 @@  discard block
 block discarded – undo
175 175
 							'simcal-field-tiny',
176 176
 							'simcal-field-inline',
177 177
 						),
178
-						'value'   => strval( $list_span ),
178
+						'value'   => strval($list_span),
179 179
 						'attributes'  => array(
180 180
 							'min' => '1',
181 181
 						),
182
-					) );
182
+					));
183 183
 
184
-					$list_type = get_post_meta( $post_id, '_default_calendar_list_range_type', true );
184
+					$list_type = get_post_meta($post_id, '_default_calendar_list_range_type', true);
185 185
 
186
-					simcal_print_field( array(
186
+					simcal_print_field(array(
187 187
 						'type'    => 'select',
188 188
 						'name'    => '_default_calendar_list_range_type',
189 189
 						'id'      => '_default_calendar_list_range_type',
190
-						'tooltip' => __( 'Range of events to show on each calendar page.', 'google-calendar-events' ),
190
+						'tooltip' => __('Range of events to show on each calendar page.', 'google-calendar-events'),
191 191
 						'class'   => array(
192 192
 							'simcal-field-inline',
193 193
 						),
194 194
 						'value'   => $list_type,
195 195
 						'options' => array(
196
-							'monthly' => __( 'Month(s)', 'google-calendar-events' ),
197
-							'weekly'  => __( 'Week(s)', 'google-calendar-events' ),
198
-							'daily'   => __( 'Day(s)', 'google-calendar-events' ),
199
-							'events'  => __( 'Event(s)', 'google-calendar-events' ),
196
+							'monthly' => __('Month(s)', 'google-calendar-events'),
197
+							'weekly'  => __('Week(s)', 'google-calendar-events'),
198
+							'daily'   => __('Day(s)', 'google-calendar-events'),
199
+							'events'  => __('Event(s)', 'google-calendar-events'),
200 200
 						),
201
-					) );
201
+					));
202 202
 
203 203
 					?>
204 204
 				</td>
205 205
 			</tr>
206 206
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
207
-				<th><label for="_default_calendar_list_header"><?php _e( 'Hide header', 'google-calendar-events' ); ?></label></th>
207
+				<th><label for="_default_calendar_list_header"><?php _e('Hide header', 'google-calendar-events'); ?></label></th>
208 208
 				<td>
209 209
 					<?php
210 210
 
211
-					$header = get_post_meta( $post_id, '_default_calendar_list_header', true );
211
+					$header = get_post_meta($post_id, '_default_calendar_list_header', true);
212 212
 
213
-					simcal_print_field( array(
213
+					simcal_print_field(array(
214 214
 						'type'    => 'checkbox',
215 215
 						'name'    => '_default_calendar_list_header',
216 216
 						'id'      => '_default_calendar_list_header',
217
-						'tooltip' => __( 'You can use this to hide the month header for this calendar.', 'google-calendar-events' ),
217
+						'tooltip' => __('You can use this to hide the month header for this calendar.', 'google-calendar-events'),
218 218
 						'value'   => 'yes' == $header ? 'yes' : 'no',
219
-					) );
219
+					));
220 220
 
221 221
 					?>
222 222
 				</td>
223 223
 			</tr>
224 224
 			<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;">
225
-				<th><label for="_default_calendar_compact_list"><?php _e( 'Compact list', 'google-calendar-events' ); ?></label></th>
225
+				<th><label for="_default_calendar_compact_list"><?php _e('Compact list', 'google-calendar-events'); ?></label></th>
226 226
 				<td>
227 227
 					<?php
228 228
 
229
-					$compact = get_post_meta( $post_id, '_default_calendar_compact_list', true );
229
+					$compact = get_post_meta($post_id, '_default_calendar_compact_list', true);
230 230
 
231
-					simcal_print_field( array(
231
+					simcal_print_field(array(
232 232
 						'type'    => 'checkbox',
233 233
 						'name'    => '_default_calendar_compact_list',
234 234
 						'id'      => '_default_calendar_compact_list',
235
-						'tooltip' => __( 'Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events' ),
235
+						'tooltip' => __('Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events'),
236 236
 						'value'   => 'yes' == $compact ? 'yes' : 'no',
237
-					) );
237
+					));
238 238
 
239 239
 					?>
240 240
 				</td>
241 241
 			</tr>
242 242
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list"  style="display: none;">
243
-				<th><label for="_default_calendar_limit_visible_events"><?php _e( 'Limit visible events', 'google-calendar-events' ); ?></label></th>
243
+				<th><label for="_default_calendar_limit_visible_events"><?php _e('Limit visible events', 'google-calendar-events'); ?></label></th>
244 244
 				<td>
245 245
 					<?php
246 246
 
247
-					$limit = get_post_meta( $post_id, '_default_calendar_limit_visible_events', true );
247
+					$limit = get_post_meta($post_id, '_default_calendar_limit_visible_events', true);
248 248
 
249
-					simcal_print_field( array(
249
+					simcal_print_field(array(
250 250
 						'type'        => 'checkbox',
251 251
 						'name'        => '_default_calendar_limit_visible_events',
252 252
 						'id'          => '_default_calendar_limit_visible_events',
@@ -257,17 +257,17 @@  discard block
 block discarded – undo
257 257
 						'attributes'  => array(
258 258
 							'data-show-next-if-value' => 'yes',
259 259
 						)
260
-					) );
260
+					));
261 261
 
262
-					$visible_events = absint( get_post_meta( $post_id, '_default_calendar_visible_events', true ) );
262
+					$visible_events = absint(get_post_meta($post_id, '_default_calendar_visible_events', true));
263 263
 					$visible_events = $visible_events > 0 ? $visible_events : 3;
264 264
 
265
-					simcal_print_field( array(
265
+					simcal_print_field(array(
266 266
 						'type'       => 'standard',
267 267
 						'subtype'    => 'number',
268 268
 						'name'       => '_default_calendar_visible_events',
269 269
 						'id'         => '_default_calendar_visible_events',
270
-						'tooltip'    => __( 'Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events' ),
270
+						'tooltip'    => __('Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events'),
271 271
 						'class'      => array(
272 272
 							'simcal-field-tiny',
273 273
 						),
@@ -275,39 +275,39 @@  discard block
 block discarded – undo
275 275
 						'attributes' => array(
276 276
 							'min'     => '1',
277 277
 						)
278
-					) );
278
+					));
279 279
 
280 280
 					?>
281 281
 				</td>
282 282
 			</tr>
283 283
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
284
-				<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Expand multi-day events', 'google-calendar-events' ); ?></label></th>
284
+				<th><label for="_default_calendar_event_bubbles_action"><?php _e('Expand multi-day events', 'google-calendar-events'); ?></label></th>
285 285
 				<td>
286 286
 					<?php
287 287
 
288
-					$post_meta = get_post_meta( $post_id );
288
+					$post_meta = get_post_meta($post_id);
289 289
 
290
-					if ( ! is_array( $post_meta ) && ! empty( $post_meta ) ) {
290
+					if ( ! is_array($post_meta) && ! empty($post_meta)) {
291 291
 						$multi_day_value = 'current_day_only';
292 292
 					} else {
293
-						$multi_day_value = get_post_meta( $post_id, '_default_calendar_expand_multi_day_events', true );
293
+						$multi_day_value = get_post_meta($post_id, '_default_calendar_expand_multi_day_events', true);
294 294
 					}
295 295
 
296
-					simcal_print_field( array(
296
+					simcal_print_field(array(
297 297
 						'type'    => 'select',
298 298
 						'name'    => '_default_calendar_expand_multi_day_events',
299 299
 						'id'      => '_default_calendar_expand_multi_day_events',
300
-						'tooltip' => __( 'For events spanning multiple days, you can display them on each day of the event, ' .
301
-						                 'only on the first day of the event, or on all days of the event, but only up to the current day. ' .
302
-						                 'Third option applies to list views only.', 'google-calendar-events' ),
300
+						'tooltip' => __('For events spanning multiple days, you can display them on each day of the event, '.
301
+						                 'only on the first day of the event, or on all days of the event, but only up to the current day. '.
302
+						                 'Third option applies to list views only.', 'google-calendar-events'),
303 303
 						'value'   => $multi_day_value,
304 304
 						'options' => array(
305
-							'yes'              => __( 'Yes, display on all days of event', 'google-calendar-events' ),
306
-							'no'               => __( 'No, display only on first day of event', 'google-calendar-events' ),
307
-							'current_day_only' => __( 'No, display on all days of event up to current day (list view only)', 'google-calendar-events' ),
305
+							'yes'              => __('Yes, display on all days of event', 'google-calendar-events'),
306
+							'no'               => __('No, display only on first day of event', 'google-calendar-events'),
307
+							'current_day_only' => __('No, display on all days of event up to current day (list view only)', 'google-calendar-events'),
308 308
 						),
309 309
 						'default' => 'current_day_only',
310
-					) );
310
+					));
311 311
 
312 312
 					?>
313 313
 				</td>
@@ -315,70 +315,70 @@  discard block
 block discarded – undo
315 315
 			</tbody>
316 316
 			<?php
317 317
 
318
-			$settings                   = get_option( 'simple-calendar_settings_calendars' );
319
-			$default_theme              = isset( $settings['default-calendar']['theme'] ) ? $settings['default-calendar']['theme'] : 'light';
318
+			$settings                   = get_option('simple-calendar_settings_calendars');
319
+			$default_theme              = isset($settings['default-calendar']['theme']) ? $settings['default-calendar']['theme'] : 'light';
320 320
 			$default_today_color        = /*isset( $settings['default-calendar']['today_color'] ) ? $settings['default-calendar']['today_color'] :*/ '#1e73be';
321 321
 			$default_days_events_color  = /*isset( $settings['default-calendar']['days_events_color'] ) ? $settings['default-calendar']['days_events_color'] :*/ '#000000';
322 322
 
323 323
 			?>
324 324
 			<tbody class="simcal-panel-section">
325 325
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
326
-				<th><label for="_default_calendar_style_theme"><?php _e( 'Theme', 'google-calendar-events' ); ?></label></th>
326
+				<th><label for="_default_calendar_style_theme"><?php _e('Theme', 'google-calendar-events'); ?></label></th>
327 327
 				<td>
328 328
 					<?php
329 329
 
330
-					$saved = get_post_meta( $post_id, '_default_calendar_style_theme', true );
330
+					$saved = get_post_meta($post_id, '_default_calendar_style_theme', true);
331 331
 					$value = ! $saved ? $default_theme : $saved;
332 332
 
333
-					simcal_print_field( array(
333
+					simcal_print_field(array(
334 334
 						'type'    => 'select',
335 335
 						'name'    => '_default_calendar_style_theme',
336 336
 						'id'      => '_default_calendar_style_theme',
337 337
 						'value'   => $value,
338
-						'tooltip' => __( 'Choose a calendar theme to match your site theme.', 'google-calendar-events' ),
338
+						'tooltip' => __('Choose a calendar theme to match your site theme.', 'google-calendar-events'),
339 339
 						'options' => array(
340
-							'light' => __( 'Light', 'google-calendar-events' ),
341
-							'dark' => __( 'Dark', 'google-calendar-events' ),
340
+							'light' => __('Light', 'google-calendar-events'),
341
+							'dark' => __('Dark', 'google-calendar-events'),
342 342
 						),
343
-					) );
343
+					));
344 344
 
345 345
 					?>
346 346
 				</td>
347 347
 			</tr>
348 348
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
349
-				<th><label for="_default_calendar_style_today"><?php _e( 'Today', 'google-calendar-events' ); ?></label></th>
349
+				<th><label for="_default_calendar_style_today"><?php _e('Today', 'google-calendar-events'); ?></label></th>
350 350
 				<td>
351 351
 					<?php
352 352
 
353
-					$saved = get_post_meta( $post_id, '_default_calendar_style_today', true );
353
+					$saved = get_post_meta($post_id, '_default_calendar_style_today', true);
354 354
 					$value = ! $saved ? $default_today_color : $saved;
355 355
 
356
-					simcal_print_field( array(
356
+					simcal_print_field(array(
357 357
 						'type'    => 'standard',
358 358
 						'subtype' => 'color-picker',
359 359
 						'name'    => '_default_calendar_style_today',
360 360
 						'id'      => '_default_calendar_style_today',
361 361
 						'value'   => $value,
362
-					) );
362
+					));
363 363
 
364 364
 					?>
365 365
 				</td>
366 366
 			</tr>
367 367
 			<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;">
368
-				<th><label for="_default_calendar_style_days_events"><?php _e( 'Days with events', 'google-calendar-events' ); ?></label></th>
368
+				<th><label for="_default_calendar_style_days_events"><?php _e('Days with events', 'google-calendar-events'); ?></label></th>
369 369
 				<td>
370 370
 					<?php
371 371
 
372
-					$saved = get_post_meta( $post_id, '_default_calendar_style_days_events', true );
372
+					$saved = get_post_meta($post_id, '_default_calendar_style_days_events', true);
373 373
 					$value = ! $saved ? $default_days_events_color : $saved;
374 374
 
375
-					simcal_print_field( array(
375
+					simcal_print_field(array(
376 376
 						'type'    => 'standard',
377 377
 						'subtype' => 'color-picker',
378 378
 						'name'    => '_default_calendar_style_days_events',
379 379
 						'id'      => '_default_calendar_style_days_events',
380 380
 						'value'   => $value,
381
-					) );
381
+					));
382 382
 
383 383
 					?>
384 384
 				</td>
@@ -400,55 +400,55 @@  discard block
 block discarded – undo
400 400
 	 *
401 401
 	 * @param int $post_id
402 402
 	 */
403
-	public function process_meta( $post_id ) {
403
+	public function process_meta($post_id) {
404 404
 
405 405
 		// Theme.
406
-		$theme = isset( $_POST['_default_calendar_style_theme'] ) ? sanitize_key( $_POST['_default_calendar_style_theme'] ) : 'light';
407
-		update_post_meta( $post_id, '_default_calendar_style_theme', $theme );
406
+		$theme = isset($_POST['_default_calendar_style_theme']) ? sanitize_key($_POST['_default_calendar_style_theme']) : 'light';
407
+		update_post_meta($post_id, '_default_calendar_style_theme', $theme);
408 408
 
409 409
 		// Today color.
410
-		$today_color = isset( $_POST['_default_calendar_style_today'] ) ? sanitize_text_field( $_POST['_default_calendar_style_today'] ) : '#FF000';
411
-		update_post_meta( $post_id, '_default_calendar_style_today', $today_color );
410
+		$today_color = isset($_POST['_default_calendar_style_today']) ? sanitize_text_field($_POST['_default_calendar_style_today']) : '#FF000';
411
+		update_post_meta($post_id, '_default_calendar_style_today', $today_color);
412 412
 
413 413
 		// Days with events color.
414
-		$days_events_color = isset( $_POST['_default_calendar_style_days_events'] ) ? sanitize_text_field( $_POST['_default_calendar_style_days_events'] ) : '#000000';
415
-		update_post_meta( $post_id, '_default_calendar_style_days_events', $days_events_color );
414
+		$days_events_color = isset($_POST['_default_calendar_style_days_events']) ? sanitize_text_field($_POST['_default_calendar_style_days_events']) : '#000000';
415
+		update_post_meta($post_id, '_default_calendar_style_days_events', $days_events_color);
416 416
 
417 417
 		// List range span.
418
-		$span = isset( $_POST['_default_calendar_list_range_span'] ) ? max( absint( $_POST['_default_calendar_list_range_span'] ), 1 ) : 1;
419
-		update_post_meta( $post_id, '_default_calendar_list_range_span', $span );
418
+		$span = isset($_POST['_default_calendar_list_range_span']) ? max(absint($_POST['_default_calendar_list_range_span']), 1) : 1;
419
+		update_post_meta($post_id, '_default_calendar_list_range_span', $span);
420 420
 
421 421
 		// List range type.
422
-		$group = isset( $_POST['_default_calendar_list_range_type'] ) ? sanitize_key( $_POST['_default_calendar_list_range_type'] ) : 'monthly';
423
-		update_post_meta( $post_id, '_default_calendar_list_range_type', $group );
422
+		$group = isset($_POST['_default_calendar_list_range_type']) ? sanitize_key($_POST['_default_calendar_list_range_type']) : 'monthly';
423
+		update_post_meta($post_id, '_default_calendar_list_range_type', $group);
424 424
 
425 425
 		// Hide header.
426
-		$header = isset( $_POST['_default_calendar_list_header'] ) ? 'yes' : 'no';
427
-		update_post_meta( $post_id, '_default_calendar_list_header', $header );
426
+		$header = isset($_POST['_default_calendar_list_header']) ? 'yes' : 'no';
427
+		update_post_meta($post_id, '_default_calendar_list_header', $header);
428 428
 
429 429
 		// Compact list.
430
-		$compact = isset( $_POST['_default_calendar_compact_list'] ) ? 'yes' : 'no';
431
-		update_post_meta( $post_id, '_default_calendar_compact_list', $compact );
430
+		$compact = isset($_POST['_default_calendar_compact_list']) ? 'yes' : 'no';
431
+		update_post_meta($post_id, '_default_calendar_compact_list', $compact);
432 432
 
433 433
 		// Limit number of initially visible daily events.
434
-		$limit = isset( $_POST['_default_calendar_limit_visible_events'] ) ? 'yes' : 'no';
435
-		update_post_meta( $post_id, '_default_calendar_limit_visible_events', $limit );
436
-		$number = isset( $_POST['_default_calendar_visible_events'] ) ? absint( $_POST['_default_calendar_visible_events'] ) : 3;
437
-		update_post_meta( $post_id, '_default_calendar_visible_events', $number );
434
+		$limit = isset($_POST['_default_calendar_limit_visible_events']) ? 'yes' : 'no';
435
+		update_post_meta($post_id, '_default_calendar_limit_visible_events', $limit);
436
+		$number = isset($_POST['_default_calendar_visible_events']) ? absint($_POST['_default_calendar_visible_events']) : 3;
437
+		update_post_meta($post_id, '_default_calendar_visible_events', $number);
438 438
 
439 439
 		// Grid event bubbles action.
440
-		$bubbles = isset( $_POST['_default_calendar_event_bubble_trigger'] ) ? esc_attr( $_POST['_default_calendar_event_bubble_trigger'] ) : 'hover';
441
-		update_post_meta( $post_id, '_default_calendar_event_bubble_trigger', $bubbles );
440
+		$bubbles = isset($_POST['_default_calendar_event_bubble_trigger']) ? esc_attr($_POST['_default_calendar_event_bubble_trigger']) : 'hover';
441
+		update_post_meta($post_id, '_default_calendar_event_bubble_trigger', $bubbles);
442 442
 
443 443
 		// Trim event titles characters length.
444
-		$trim = isset( $_POST['_default_calendar_trim_titles'] ) ? 'yes' : 'no';
445
-		update_post_meta( $post_id, '_default_calendar_trim_titles', $trim );
446
-		$chars = isset( $_POST['_default_calendar_trim_titles_chars'] ) ? max( absint( $_POST['_default_calendar_trim_titles_chars'] ), 1 ) : 20;
447
-		update_post_meta( $post_id, '_default_calendar_trim_titles_chars', $chars );
444
+		$trim = isset($_POST['_default_calendar_trim_titles']) ? 'yes' : 'no';
445
+		update_post_meta($post_id, '_default_calendar_trim_titles', $trim);
446
+		$chars = isset($_POST['_default_calendar_trim_titles_chars']) ? max(absint($_POST['_default_calendar_trim_titles_chars']), 1) : 20;
447
+		update_post_meta($post_id, '_default_calendar_trim_titles_chars', $chars);
448 448
 
449 449
 		// Expand multiple day events on each day.
450
-		$multi_day = isset( $_POST['_default_calendar_expand_multi_day_events'] ) && ! empty( $_POST['_default_calendar_expand_multi_day_events'] ) ? sanitize_key( $_POST['_default_calendar_expand_multi_day_events'] ) : 'current_day_only';
451
-		update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', $multi_day );
450
+		$multi_day = isset($_POST['_default_calendar_expand_multi_day_events']) && ! empty($_POST['_default_calendar_expand_multi_day_events']) ? sanitize_key($_POST['_default_calendar_expand_multi_day_events']) : 'current_day_only';
451
+		update_post_meta($post_id, '_default_calendar_expand_multi_day_events', $multi_day);
452 452
 
453 453
 	}
454 454
 
Please login to merge, or discard this patch.
includes/calendars/default-calendar.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use SimpleCalendar\Calendars\Views;
14 14
 use SimpleCalendar\Events\Event;
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -105,35 +105,35 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @param int|object|\WP_Post|Calendar $calendar
107 107
 	 */
108
-	public function __construct( $calendar ) {
108
+	public function __construct($calendar) {
109 109
 
110 110
 		$this->type = 'default-calendar';
111
-		$this->name = __( 'Default', 'google-calendar-events' );
112
-		$this->views = apply_filters( 'simcal_default_calendar_views', array(
113
-			'grid' => __( 'Grid', 'google-calendar-events' ),
114
-			'list' => __( 'List', 'google-calendar-events' ),
115
-		) );
111
+		$this->name = __('Default', 'google-calendar-events');
112
+		$this->views = apply_filters('simcal_default_calendar_views', array(
113
+			'grid' => __('Grid', 'google-calendar-events'),
114
+			'list' => __('List', 'google-calendar-events'),
115
+		));
116 116
 
117
-		parent::__construct( $calendar );
117
+		parent::__construct($calendar);
118 118
 
119
-		if ( ! is_null( $this->post ) ) {
119
+		if ( ! is_null($this->post)) {
120 120
 
121
-			$this->set_properties( $this->view->get_type() );
121
+			$this->set_properties($this->view->get_type());
122 122
 
123 123
 			$id = $this->id;
124 124
 			$theme = $this->theme;
125 125
 
126
-			add_filter( 'simcal_calendar_class', function( $class, $post_id ) use ( $theme, $id ) {
127
-				if ( in_array( 'default-calendar', $class ) && $post_id === $id ) {
128
-					array_push( $class, 'default-calendar-' . $theme );
126
+			add_filter('simcal_calendar_class', function($class, $post_id) use ($theme, $id) {
127
+				if (in_array('default-calendar', $class) && $post_id === $id) {
128
+					array_push($class, 'default-calendar-'.$theme);
129 129
 				}
130 130
 				return $class;
131
-			}, 10, 2 );
131
+			}, 10, 2);
132 132
 
133 133
 		}
134 134
 
135 135
 		// Calendar settings handling.
136
-		if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
136
+		if (is_admin() && ! defined('DOING_AJAX')) {
137 137
 			$admin = new Default_Calendar_Admin();
138 138
 			$this->settings = $admin->settings_fields();
139 139
 		}
@@ -147,49 +147,49 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @param  $view
149 149
 	 */
150
-	private function set_properties( $view ) {
150
+	private function set_properties($view) {
151 151
 
152 152
 		// Set styles.
153
-		if ( 'dark' == get_post_meta( $this->id, '_default_calendar_style_theme', true ) ) {
153
+		if ('dark' == get_post_meta($this->id, '_default_calendar_style_theme', true)) {
154 154
 			$this->theme = 'dark';
155 155
 		}
156
-		if ( $today_color = get_post_meta( $this->id, '_default_calendar_style_today', true ) ) {
157
-			$this->today_color = esc_attr( $today_color );
156
+		if ($today_color = get_post_meta($this->id, '_default_calendar_style_today', true)) {
157
+			$this->today_color = esc_attr($today_color);
158 158
 		}
159
-		if ( $day_events_color = get_post_meta( $this->id, '_default_calendar_style_days_events', true ) ) {
160
-			$this->days_events_color = esc_attr( $day_events_color );
159
+		if ($day_events_color = get_post_meta($this->id, '_default_calendar_style_days_events', true)) {
160
+			$this->days_events_color = esc_attr($day_events_color);
161 161
 		}
162 162
 
163 163
 		// Hide too many events.
164
-		if ( 'yes' == get_post_meta( $this->id, '_default_calendar_limit_visible_events', true ) ) {
165
-			$this->events_limit = absint( get_post_meta( $this->id, '_default_calendar_visible_events', true ) );
164
+		if ('yes' == get_post_meta($this->id, '_default_calendar_limit_visible_events', true)) {
165
+			$this->events_limit = absint(get_post_meta($this->id, '_default_calendar_visible_events', true));
166 166
 		}
167 167
 
168 168
 		// Expand multiple day events.
169
-		if ( 'yes' == get_post_meta( $this->id, '_default_calendar_expand_multi_day_events', true ) || ( 'list' == $view && 'current_day_only' == get_post_meta( $this->id, '_default_calendar_expand_multi_day_events', true ) ) ) {
169
+		if ('yes' == get_post_meta($this->id, '_default_calendar_expand_multi_day_events', true) || ('list' == $view && 'current_day_only' == get_post_meta($this->id, '_default_calendar_expand_multi_day_events', true))) {
170 170
 			$this->events = $this->expand_multiple_days_events();
171 171
 		}
172 172
 
173
-		if ( 'grid' == $view ) {
173
+		if ('grid' == $view) {
174 174
 
175 175
 			// Use hover to open event bubbles.
176
-			if ( 'hover' == get_post_meta( $this->id, '_default_calendar_event_bubble_trigger', true ) ) {
176
+			if ('hover' == get_post_meta($this->id, '_default_calendar_event_bubble_trigger', true)) {
177 177
 				$this->event_bubble_trigger = 'hover';
178 178
 			}
179 179
 
180 180
 			// Trim long event titles.
181
-			if ( 'yes' == get_post_meta( $this->id, '_default_calendar_trim_titles', true ) ) {
182
-				$this->trim_titles = max( absint( get_post_meta( $this->id, '_default_calendar_trim_titles_chars', true ) ), 1 );
181
+			if ('yes' == get_post_meta($this->id, '_default_calendar_trim_titles', true)) {
182
+				$this->trim_titles = max(absint(get_post_meta($this->id, '_default_calendar_trim_titles_chars', true)), 1);
183 183
 			}
184 184
 
185 185
 		} else {
186 186
 
187 187
 			// List range.
188
-			$this->group_type = esc_attr( get_post_meta( $this->id, '_default_calendar_list_range_type', true ) );
189
-			$this->group_span = max( absint( get_post_meta( $this->id, '_default_calendar_list_range_span', true ) ), 1 );
188
+			$this->group_type = esc_attr(get_post_meta($this->id, '_default_calendar_list_range_type', true));
189
+			$this->group_span = max(absint(get_post_meta($this->id, '_default_calendar_list_range_span', true)), 1);
190 190
 
191 191
 			// Make the list look more compact.
192
-			if ( 'yes' == get_post_meta( $this->id, '_default_calendar_compact_list', true ) ) {
192
+			if ('yes' == get_post_meta($this->id, '_default_calendar_compact_list', true)) {
193 193
 				$this->compact_list = true;
194 194
 			}
195 195
 
@@ -210,24 +210,24 @@  discard block
 block discarded – undo
210 210
 		$old_events = $this->events;
211 211
 		$new_events = array();
212 212
 
213
-		if ( ! empty( $old_events ) ) {
213
+		if ( ! empty($old_events)) {
214 214
 
215
-			foreach ( $old_events as $events ) {
216
-				foreach ( $events as $event ) {
217
-					if ( $event instanceof Event ) {
218
-						if ( false !== $event->multiple_days ) {
215
+			foreach ($old_events as $events) {
216
+				foreach ($events as $event) {
217
+					if ($event instanceof Event) {
218
+						if (false !== $event->multiple_days) {
219 219
 							$days = $event->multiple_days;
220 220
 
221
-							if ( $days == 1 ) {
222
-								$new_events[ intval( $event->start + ( DAY_IN_SECONDS ) - 1 ) ][] = $event;
221
+							if ($days == 1) {
222
+								$new_events[intval($event->start + (DAY_IN_SECONDS) - 1)][] = $event;
223 223
 							} else {
224 224
 
225 225
 								/*if ( ! empty( $event->whole_day ) ) {
226 226
 									$days--;
227 227
 								}*/
228 228
 
229
-								for ( $d = 1; $d <= $days; $d++ ) {
230
-									$new_events[ intval( $event->start + ( $d * DAY_IN_SECONDS ) - 1 ) ][] = $event;
229
+								for ($d = 1; $d <= $days; $d++) {
230
+									$new_events[intval($event->start + ($d * DAY_IN_SECONDS) - 1)][] = $event;
231 231
 								}
232 232
 							}
233 233
 						}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		}
240 240
 
241 241
 		$events = $old_events + $new_events;
242
-		ksort( $events, SORT_NUMERIC );
242
+		ksort($events, SORT_NUMERIC);
243 243
 		return $events;
244 244
 	}
245 245
 
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
 	 *
255 255
 	 * @return null|Calendar_View
256 256
 	 */
257
-	public function get_view( $view = '' ) {
257
+	public function get_view($view = '') {
258 258
 
259
-		$view = ! empty( $view ) ? $view : 'grid';
259
+		$view = ! empty($view) ? $view : 'grid';
260 260
 
261
-		do_action( 'simcal_calendar_get_view', $this->type, $view );
261
+		do_action('simcal_calendar_get_view', $this->type, $view);
262 262
 
263
-		if ( 'grid' == $view ) {
264
-			return new Views\Default_Calendar_Grid( $this );
265
-		} elseif ( 'list' == $view ) {
266
-			return new Views\Default_Calendar_List( $this );
263
+		if ('grid' == $view) {
264
+			return new Views\Default_Calendar_Grid($this);
265
+		} elseif ('list' == $view) {
266
+			return new Views\Default_Calendar_List($this);
267 267
 		}
268 268
 
269 269
 		return null;
Please login to merge, or discard this patch.
includes/wp-requirements.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @license GPL2+
12 12
  */
13 13
 
14
-if ( ! class_exists( 'SimCal_WP_Requirements' ) ) {
14
+if ( ! class_exists('SimCal_WP_Requirements')) {
15 15
 
16 16
 	class SimCal_WP_Requirements {
17 17
 
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 		 * @param string $plugin       Output of `plugin_basename( __FILE__ )`.
91 91
 		 * @param array  $requirements Associative array with requirements.
92 92
 		 */
93
-		public function __construct( $name, $plugin, $requirements ) {
93
+		public function __construct($name, $plugin, $requirements) {
94 94
 
95
-			$this->name = htmlspecialchars( strip_tags( $name ) );
95
+			$this->name = htmlspecialchars(strip_tags($name));
96 96
 			$this->plugin = $plugin;
97 97
 			$this->requirements = $requirements;
98 98
 
99
-			if ( ! empty( $requirements ) && is_array( $requirements ) ) {
99
+			if ( ! empty($requirements) && is_array($requirements)) {
100 100
 
101 101
 				$failures = $extensions = array();
102 102
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 				);
110 110
 
111 111
 				// Check for WordPress version.
112
-				if ( $requirements['WordPress'] && is_string( $requirements['WordPress'] ) ) {
113
-					if ( function_exists( 'get_bloginfo' ) ) {
114
-						$wp_version = get_bloginfo( 'version' );
115
-						if ( version_compare( $wp_version, $requirements['WordPress'] ) === - 1 ) {
112
+				if ($requirements['WordPress'] && is_string($requirements['WordPress'])) {
113
+					if (function_exists('get_bloginfo')) {
114
+						$wp_version = get_bloginfo('version');
115
+						if (version_compare($wp_version, $requirements['WordPress']) === - 1) {
116 116
 							$failures['WordPress'] = $wp_version;
117 117
 							$this->wp = false;
118 118
 						}
@@ -120,24 +120,24 @@  discard block
 block discarded – undo
120 120
 				}
121 121
 
122 122
 				// Check fo PHP version.
123
-				if ( $requirements['PHP'] && is_string( $requirements['PHP'] ) ) {
124
-					if ( version_compare( PHP_VERSION, $requirements['PHP'] ) === -1 ) {
123
+				if ($requirements['PHP'] && is_string($requirements['PHP'])) {
124
+					if (version_compare(PHP_VERSION, $requirements['PHP']) === -1) {
125 125
 						$failures['PHP'] = PHP_VERSION;
126 126
 						$this->php = false;
127 127
 					}
128 128
 				}
129 129
 
130 130
 				// Check fo PHP Extensions.
131
-				if ( $requirements['Extensions'] && is_array( $requirements['Extensions'] ) ) {
132
-					foreach ( $requirements['Extensions'] as $extension ) {
133
-						if ( $extension && is_string( $extension ) ) {
134
-							$extensions[ $extension ] = extension_loaded( $extension );
131
+				if ($requirements['Extensions'] && is_array($requirements['Extensions'])) {
132
+					foreach ($requirements['Extensions'] as $extension) {
133
+						if ($extension && is_string($extension)) {
134
+							$extensions[$extension] = extension_loaded($extension);
135 135
 						}
136 136
 					}
137
-					if ( in_array( false, $extensions ) ) {
138
-						foreach ( $extensions as $extension_name => $found  ) {
139
-							if ( $found === false ) {
140
-								$failures['Extensions'][ $extension_name ] = $extension_name;
137
+					if (in_array(false, $extensions)) {
138
+						foreach ($extensions as $extension_name => $found) {
139
+							if ($found === false) {
140
+								$failures['Extensions'][$extension_name] = $extension_name;
141 141
 							}
142 142
 						}
143 143
 						$this->extensions = false;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
 			} else {
150 150
 
151
-				trigger_error( 'WP Requirements: the requirements are invalid.', E_USER_ERROR );
151
+				trigger_error('WP Requirements: the requirements are invalid.', E_USER_ERROR);
152 152
 
153 153
 			}
154 154
 		}
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 		 * @return bool
169 169
 		 */
170 170
 		public function pass() {
171
-			if ( in_array( false, array(
171
+			if (in_array(false, array(
172 172
 				$this->wp,
173 173
 				$this->php,
174 174
 				$this->extensions,
175
-			) ) ) {
175
+			))) {
176 176
 				return false;
177 177
 			}
178 178
 			return true;
@@ -185,28 +185,28 @@  discard block
 block discarded – undo
185 185
 		 *
186 186
 		 * @return string
187 187
 		 */
188
-		public function get_notice( $message = '' ) {
188
+		public function get_notice($message = '') {
189 189
 
190 190
 			$notice   = '';
191 191
 			$name     = $this->name;
192 192
 			$failures = $this->failures;
193 193
 
194
-			if ( ! empty( $failures ) && is_array( $failures ) ) {
194
+			if ( ! empty($failures) && is_array($failures)) {
195 195
 
196
-				$notice  = '<div class="error">' . "\n";
197
-				$notice .= "\t" . '<p>' . "\n";
198
-				$notice .= '<strong>' . sprintf( '%s could not be activated.', $name ) . '</strong><br>';
196
+				$notice  = '<div class="error">'."\n";
197
+				$notice .= "\t".'<p>'."\n";
198
+				$notice .= '<strong>'.sprintf('%s could not be activated.', $name).'</strong><br>';
199 199
 
200
-				foreach ( $failures as $requirement => $found ) {
200
+				foreach ($failures as $requirement => $found) {
201 201
 
202
-					$required = $this->requirements[ $requirement ];
202
+					$required = $this->requirements[$requirement];
203 203
 
204
-					if ( 'Extensions' == $requirement ) {
205
-						if ( is_array( $found ) ) {
204
+					if ('Extensions' == $requirement) {
205
+						if (is_array($found)) {
206 206
 							$notice .= sprintf( 
207 207
 									'Required PHP Extension(s) not found: %s.', 
208
-									join( ', ', $found ) 
209
-								) . '<br>';
208
+									join(', ', $found) 
209
+								).'<br>';
210 210
 						}
211 211
 					} else {
212 212
 						$notice .= sprintf( 
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 								$requirement, 
215 215
 								$required, 
216 216
 								$found 
217
-							) . '<br>';
217
+							).'<br>';
218 218
 					}
219 219
 
220 220
 				}
221 221
 
222
-				$notice .= '<em>' . sprintf( 'Please update to meet %s requirements.', $name ) . '</em>' . "\n";
223
-				$notice .= "\t" . '</p>' . "\n";
224
-				if ( $message ) {
222
+				$notice .= '<em>'.sprintf('Please update to meet %s requirements.', $name).'</em>'."\n";
223
+				$notice .= "\t".'</p>'."\n";
224
+				if ($message) {
225 225
 					$notice .= $message;
226 226
 				}
227 227
 				$notice .= '</div>';
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 		 * Deactivate plugin.
242 242
 		 */
243 243
 		public function deactivate_plugin() {
244
-			if ( function_exists( 'deactivate_plugins' ) && function_exists( 'plugin_basename' ) ) {
245
-				deactivate_plugins( $this->plugin );
244
+			if (function_exists('deactivate_plugins') && function_exists('plugin_basename')) {
245
+				deactivate_plugins($this->plugin);
246 246
 			}
247 247
 		}
248 248
 
@@ -251,17 +251,17 @@  discard block
 block discarded – undo
251 251
 		 *
252 252
 		 * @param string $message An additional message in notice.
253 253
 		 */
254
-		public function halt( $message = '' ) {
254
+		public function halt($message = '') {
255 255
 
256
-			$this->notice = $this->get_notice( $message );
256
+			$this->notice = $this->get_notice($message);
257 257
 
258
-			if ( $this->notice && function_exists( 'add_action' ) ) {
258
+			if ($this->notice && function_exists('add_action')) {
259 259
 
260
-				add_action( 'admin_notices', array( $this, 'print_notice' ) );
261
-				add_action( 'admin_init', array( $this, 'deactivate_plugin' ) );
260
+				add_action('admin_notices', array($this, 'print_notice'));
261
+				add_action('admin_init', array($this, 'deactivate_plugin'));
262 262
 
263
-				if ( isset( $_GET['activate'] ) ) {
264
-					unset( $_GET['activate'] );
263
+				if (isset($_GET['activate'])) {
264
+					unset($_GET['activate']);
265 265
 				}
266 266
 			}
267 267
 		}
Please login to merge, or discard this patch.
includes/updates/update-v3013.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Carbon\Carbon;
10 10
 use SimpleCalendar\Post_Types;
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param array $posts
25 25
 	 */
26
-	public function __construct( $posts ) {
26
+	public function __construct($posts) {
27 27
 
28 28
 		$this->update_options();
29 29
 	}
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function update_options() {
36 36
 
37
-		$settings_advanced = get_option( 'simple-calendar_settings_advanced' );
37
+		$settings_advanced = get_option('simple-calendar_settings_advanced');
38 38
 		
39 39
 		// Remove stored always_enqueue value
40
-		if ( isset( $settings_advanced['assets']['always_enqueue'] ) ) {
41
-			unset( $settings_advanced['assets']['always_enqueue'] );
40
+		if (isset($settings_advanced['assets']['always_enqueue'])) {
41
+			unset($settings_advanced['assets']['always_enqueue']);
42 42
 		}
43 43
 
44 44
 		// Remove stored disable_js value
45
-		if ( isset( $settings_advanced['assets']['disable_js'] ) ) {
46
-			unset( $settings_advanced['assets']['disable_js'] );
45
+		if (isset($settings_advanced['assets']['disable_js'])) {
46
+			unset($settings_advanced['assets']['disable_js']);
47 47
 		}
48 48
 
49
-		update_option( 'simple-calendar_settings_advanced', $settings_advanced );
49
+		update_option('simple-calendar_settings_advanced', $settings_advanced);
50 50
 
51 51
 		// Delete legacy options.
52
-		delete_option( 'simple-calendar_defaults' );
52
+		delete_option('simple-calendar_defaults');
53 53
 	}
54 54
 
55 55
 }
Please login to merge, or discard this patch.
includes/assets.php 1 patch
Spacing   +63 added lines, -63 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
 
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function __construct() {
62 62
 
63
-		$this->min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) ? '' : '.min';
63
+		$this->min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true) ? '' : '.min';
64 64
 
65
-		$settings = get_option( 'simple-calendar_settings_advanced' );
65
+		$settings = get_option('simple-calendar_settings_advanced');
66 66
 
67
-		if ( isset( $settings['assets']['disable_css'] ) ) {
67
+		if (isset($settings['assets']['disable_css'])) {
68 68
 			$this->disable_styles = 'yes' == $settings['assets']['disable_css'] ? true : false;
69 69
 		}
70 70
 
71
-		add_action( 'init', array( $this, 'register' ), 20 );
72
-		add_action( 'init', array( $this, 'enqueue' ), 40 );
71
+		add_action('init', array($this, 'register'), 20);
72
+		add_action('init', array($this, 'enqueue'), 40);
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since 3.0.0
79 79
 	 */
80 80
 	public function register() {
81
-		do_action( 'simcal_register_assets', $this->min );
81
+		do_action('simcal_register_assets', $this->min);
82 82
 	}
83 83
 
84 84
 	/**
@@ -88,25 +88,25 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function enqueue() {
90 90
 
91
-		add_action( 'wp_enqueue_scripts', array( $this, 'load' ), 10 );
91
+		add_action('wp_enqueue_scripts', array($this, 'load'), 10);
92 92
 
93
-		do_action( 'simcal_enqueue_assets', $this->min );
93
+		do_action('simcal_enqueue_assets', $this->min);
94 94
 
95 95
 
96 96
 		$min = $this->min;
97 97
 		// Improves compatibility with themes and plugins using Isotope and Masonry.
98
-		add_action( 'wp_enqueue_scripts',
99
-			function () use ( $min ) {
100
-				if ( wp_script_is( 'simcal-qtip', 'enqueued' ) ) {
98
+		add_action('wp_enqueue_scripts',
99
+			function() use ($min) {
100
+				if (wp_script_is('simcal-qtip', 'enqueued')) {
101 101
 					wp_enqueue_script(
102 102
 						'simplecalendar-imagesloaded',
103
-						SIMPLE_CALENDAR_ASSETS . 'js/vendor/imagesloaded.pkgd' . $min . '.js',
104
-						array( 'simcal-qtip' ),
103
+						SIMPLE_CALENDAR_ASSETS.'js/vendor/imagesloaded.pkgd'.$min.'.js',
104
+						array('simcal-qtip'),
105 105
 						'3.1.8',
106 106
 						true
107 107
 					);
108 108
 				}
109
-			}, 1000 );
109
+			}, 1000);
110 110
 	}
111 111
 
112 112
 	/**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 		$scripts = $this->get_default_scripts();
120 120
 		$styles  = $this->get_default_styles();
121 121
 
122
-		$this->scripts = apply_filters( 'simcal_front_end_scripts', $scripts, $this->min );
123
-		$this->styles  = apply_filters( 'simcal_front_end_styles', $styles, $this->min );
122
+		$this->scripts = apply_filters('simcal_front_end_scripts', $scripts, $this->min);
123
+		$this->styles  = apply_filters('simcal_front_end_styles', $styles, $this->min);
124 124
 
125
-		$this->load_scripts( $this->scripts );
126
-		$this->load_styles( $this->styles );
125
+		$this->load_scripts($this->scripts);
126
+		$this->load_styles($this->styles);
127 127
 	}
128 128
 
129 129
 	/**
@@ -133,25 +133,25 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function get_widgets_assets() {
135 135
 
136
-		$widgets = get_option( 'widget_gce_widget' );
136
+		$widgets = get_option('widget_gce_widget');
137 137
 
138
-		if ( ! empty( $widgets ) && is_array( $widgets ) ) {
138
+		if ( ! empty($widgets) && is_array($widgets)) {
139 139
 
140
-			foreach ( $widgets as $settings ) {
140
+			foreach ($widgets as $settings) {
141 141
 
142
-				if ( ! empty( $settings ) && is_array( $settings ) ) {
142
+				if ( ! empty($settings) && is_array($settings)) {
143 143
 
144
-					if ( isset( $settings['calendar_id'] ) ) {
144
+					if (isset($settings['calendar_id'])) {
145 145
 
146
-						$view = simcal_get_calendar_view( absint( $settings['calendar_id'] ) );
146
+						$view = simcal_get_calendar_view(absint($settings['calendar_id']));
147 147
 
148
-						if ( $view instanceof Calendar_View ) {
149
-							add_filter( 'simcal_front_end_scripts', function ( $scripts, $min ) use ( $view ) {
150
-								return array_merge( $scripts, $view->scripts( $min ) );
151
-							}, 100, 2 );
152
-							add_filter( 'simcal_front_end_styles', function ( $styles, $min ) use ( $view ) {
153
-								return array_merge( $styles, $view->styles( $min ) );
154
-							}, 100, 2 );
148
+						if ($view instanceof Calendar_View) {
149
+							add_filter('simcal_front_end_scripts', function($scripts, $min) use ($view) {
150
+								return array_merge($scripts, $view->scripts($min));
151
+							}, 100, 2);
152
+							add_filter('simcal_front_end_styles', function($styles, $min) use ($view) {
153
+								return array_merge($styles, $view->styles($min));
154
+							}, 100, 2);
155 155
 						}
156 156
 
157 157
 					}
@@ -169,31 +169,31 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @param array $scripts
171 171
 	 */
172
-	public function load_scripts( $scripts ) {
172
+	public function load_scripts($scripts) {
173 173
 
174 174
 		// Only load if not disabled in the settings
175
-		if ( ! empty( $scripts ) && is_array( $scripts ) ) {
175
+		if ( ! empty($scripts) && is_array($scripts)) {
176 176
 
177
-			foreach ( $scripts as $script => $v ) {
177
+			foreach ($scripts as $script => $v) {
178 178
 
179
-				if ( ! empty( $v['src'] ) ) {
179
+				if ( ! empty($v['src'])) {
180 180
 
181
-					$src        = esc_url( $v['src'] );
182
-					$deps       = isset( $v['deps'] )        ? $v['deps']       : array();
183
-					$ver        = isset( $v['ver'] )         ? $v['ver']        : SIMPLE_CALENDAR_VERSION;
184
-					$in_footer  = isset( $v['in_footer'] )   ? $v['in_footer']  : false;
181
+					$src        = esc_url($v['src']);
182
+					$deps       = isset($v['deps']) ? $v['deps'] : array();
183
+					$ver        = isset($v['ver']) ? $v['ver'] : SIMPLE_CALENDAR_VERSION;
184
+					$in_footer  = isset($v['in_footer']) ? $v['in_footer'] : false;
185 185
 
186
-					wp_enqueue_script( $script, $src, $deps, $ver, $in_footer );
186
+					wp_enqueue_script($script, $src, $deps, $ver, $in_footer);
187 187
 
188
-					if ( ! empty( $v['localize'] ) && is_array( $v['localize'] ) ) {
189
-						foreach ( $v['localize'] as $object => $l10n ) {
190
-							wp_localize_script( $script, $object, $l10n );
188
+					if ( ! empty($v['localize']) && is_array($v['localize'])) {
189
+						foreach ($v['localize'] as $object => $l10n) {
190
+							wp_localize_script($script, $object, $l10n);
191 191
 						}
192 192
 					}
193 193
 
194
-				} elseif ( is_string( $v ) && ! empty( $v ) ) {
194
+				} elseif (is_string($v) && ! empty($v)) {
195 195
 
196
-					wp_enqueue_script( $v );
196
+					wp_enqueue_script($v);
197 197
 				}
198 198
 			}
199 199
 
@@ -207,25 +207,25 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param array $styles
209 209
 	 */
210
-	public function load_styles( $styles ) {
210
+	public function load_styles($styles) {
211 211
 
212 212
 		// Only load if not disabled in the settings
213
-		if ( ! empty( $styles ) && is_array( $styles ) && false === $this->disable_styles ) {
213
+		if ( ! empty($styles) && is_array($styles) && false === $this->disable_styles) {
214 214
 
215
-			foreach ( $styles as $style => $v ) {
215
+			foreach ($styles as $style => $v) {
216 216
 
217
-				if ( ! empty( $v['src'] ) ) {
217
+				if ( ! empty($v['src'])) {
218 218
 
219
-					$src    = esc_url( $v['src'] );
220
-					$deps   = isset( $v['deps'] )   ? $v['deps']    : array();
221
-					$ver    = isset( $v['ver'] )    ? $v['ver']     : SIMPLE_CALENDAR_VERSION;
222
-					$media  = isset( $v['media'] )  ? $v['media']   : 'all';
219
+					$src    = esc_url($v['src']);
220
+					$deps   = isset($v['deps']) ? $v['deps'] : array();
221
+					$ver    = isset($v['ver']) ? $v['ver'] : SIMPLE_CALENDAR_VERSION;
222
+					$media  = isset($v['media']) ? $v['media'] : 'all';
223 223
 
224
-					wp_enqueue_style( $style, $src, $deps, $ver, $media );
224
+					wp_enqueue_style($style, $src, $deps, $ver, $media);
225 225
 
226
-				} elseif ( is_string( $v ) && ! empty( $v ) ) {
226
+				} elseif (is_string($v) && ! empty($v)) {
227 227
 
228
-					wp_enqueue_style( $v );
228
+					wp_enqueue_style($v);
229 229
 				}
230 230
 
231 231
 			}
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 	public function get_default_scripts() {
242 242
 		return array(
243 243
 			'simcal-qtip' => array(
244
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/jquery.qtip' . $this->min . '.js',
245
-				'deps'      => array( 'jquery' ),
244
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/jquery.qtip'.$this->min.'.js',
245
+				'deps'      => array('jquery'),
246 246
 				'ver'       => '2.2.1',
247 247
 				'in_footer' => true,
248 248
 			),
249 249
 			'simcal-default-calendar' => array(
250
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $this->min . '.js',
250
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$this->min.'.js',
251 251
 				'deps'      => array(
252 252
 					'jquery',
253 253
 					'simcal-qtip',
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
 	public function get_default_styles() {
270 270
 		return array(
271 271
 			'simcal-qtip' => array(
272
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/vendor/jquery.qtip' . $this->min . '.css',
272
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/vendor/jquery.qtip'.$this->min.'.css',
273 273
 				'ver'   => '2.2.1',
274 274
 				'media' => 'all',
275 275
 			),
276 276
 			'simcal-default-calendar-grid' => array(
277
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-grid' . $this->min . '.css',
277
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-grid'.$this->min.'.css',
278 278
 				'deps'  => array(
279 279
 					'simcal-qtip',
280 280
 				),
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 				'media' => 'all',
283 283
 			),
284 284
 			'simcal-default-calendar-list' => array(
285
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $this->min . '.css',
285
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$this->min.'.css',
286 286
 				'deps'  => array(
287 287
 					'simcal-qtip',
288 288
 				),
Please login to merge, or discard this patch.
includes/admin/pages/advanced.php 1 patch
Spacing   +30 added lines, -30 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
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function __construct() {
30 30
 		$this->id           = 'advanced';
31 31
 		$this->option_group = 'settings';
32
-		$this->label        = __( 'Advanced', 'google-calendar-events' );
32
+		$this->label        = __('Advanced', 'google-calendar-events');
33 33
 		//$this->description  = __( 'Advanced settings.', 'google-calendar-events' );
34 34
 		$this->sections     = $this->add_sections();
35 35
 		$this->fields       = $this->add_fields();
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 	 * @return array
44 44
 	 */
45 45
 	public function add_sections() {
46
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', array(
46
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', array(
47 47
 			'assets' => array(
48
-				'title'       => __( 'Styles', 'google-calendar-events' ),
49
-				'description' => __( 'Manage front end assets that handle the calendars appearance.', 'google-calendar-events' )
48
+				'title'       => __('Styles', 'google-calendar-events'),
49
+				'description' => __('Manage front end assets that handle the calendars appearance.', 'google-calendar-events')
50 50
 			),
51 51
 			'installation' => array(
52
-				'title'       => __( 'Installation', 'google-calendar-events' ),
53
-				'description' => __( 'Manage your data (plugin settings and saved calendars).', 'google-calendar-events' )
52
+				'title'       => __('Installation', 'google-calendar-events'),
53
+				'description' => __('Manage your data (plugin settings and saved calendars).', 'google-calendar-events')
54 54
 			)
55
-		) );
55
+		));
56 56
 	}
57 57
 
58 58
 	/**
@@ -65,41 +65,41 @@  discard block
 block discarded – undo
65 65
 	public function add_fields() {
66 66
 
67 67
 		$fields       = array();
68
-		$this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id );
68
+		$this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id);
69 69
 
70
-		foreach ( $this->sections  as $section => $a ) :
70
+		foreach ($this->sections  as $section => $a) :
71 71
 
72
-			if ( 'assets' == $section ) {
72
+			if ('assets' == $section) {
73 73
 
74
-				$fields[ $section ] = array(
74
+				$fields[$section] = array(
75 75
 					'disable_css' => array(
76
-						'title'   => __( 'Disable CSS', 'google-calendar-events' ),
77
-						'tooltip' => __( 'If ticked, this option will prevent front end stylesheet to load.', 'google-calendar-events' ),
76
+						'title'   => __('Disable CSS', 'google-calendar-events'),
77
+						'tooltip' => __('If ticked, this option will prevent front end stylesheet to load.', 'google-calendar-events'),
78 78
 						'type'    => 'checkbox',
79
-						'name'    => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][disable_css]',
80
-						'id'      => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-disable-css',
81
-						'value'   => $this->get_option_value( $section, 'disable_css' )
79
+						'name'    => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][disable_css]',
80
+						'id'      => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-disable-css',
81
+						'value'   => $this->get_option_value($section, 'disable_css')
82 82
 					),
83 83
 				);
84 84
 
85
-			} elseif ( 'installation' == $section ) {
85
+			} elseif ('installation' == $section) {
86 86
 
87
-				$fields[ $section ] = array(
87
+				$fields[$section] = array(
88 88
 					'delete_settings' => array(
89
-						'title'   => __( 'Delete settings', 'google-calendar-events' ),
90
-						'tooltip' => __( 'Tick this option if you want to wipe this plugin settings from database when uninstalling.', 'google-calendar-events' ),
89
+						'title'   => __('Delete settings', 'google-calendar-events'),
90
+						'tooltip' => __('Tick this option if you want to wipe this plugin settings from database when uninstalling.', 'google-calendar-events'),
91 91
 						'type'    => 'checkbox',
92
-						'name'    => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][delete_settings]',
93
-						'id'      => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-delete-settings',
94
-						'value'   => $this->get_option_value( $section, 'delete_settings' ),
92
+						'name'    => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][delete_settings]',
93
+						'id'      => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-delete-settings',
94
+						'value'   => $this->get_option_value($section, 'delete_settings'),
95 95
 					),
96 96
 					'erase_data' => array(
97
-						'title'   => __( 'Erase calendar data', 'google-calendar-events' ),
98
-						'tooltip' => __( 'By default your data will be retained in database even after uninstall. Tick this option if you want to delete all your calendar data when uninstalling.', 'google-calendar-events' ),
97
+						'title'   => __('Erase calendar data', 'google-calendar-events'),
98
+						'tooltip' => __('By default your data will be retained in database even after uninstall. Tick this option if you want to delete all your calendar data when uninstalling.', 'google-calendar-events'),
99 99
 						'type'    => 'checkbox',
100
-						'name'    => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][erase_data]',
101
-						'id'      => 'simple-calendar_' . $this->option_group . '_' . $this->id . '-delete-data',
102
-						'value'   => $this->get_option_value( $section, 'erase_data' ),
100
+						'name'    => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][erase_data]',
101
+						'id'      => 'simple-calendar_'.$this->option_group.'_'.$this->id.'-delete-data',
102
+						'value'   => $this->get_option_value($section, 'erase_data'),
103 103
 					)
104 104
 				);
105 105
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 		endforeach;
109 109
 
110
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields );
110
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields);
111 111
 	}
112 112
 
113 113
 }
Please login to merge, or discard this patch.
includes/admin/assets.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Admin;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function __construct() {
36 36
 
37
-		$this->min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) ? '' : '.min';
37
+		$this->min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true) ? '' : '.min';
38 38
 
39
-		add_action( 'admin_enqueue_scripts', array( $this, 'load' ) );
39
+		add_action('admin_enqueue_scripts', array($this, 'load'));
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function load() {
48 48
 
49
-		$css_path        = SIMPLE_CALENDAR_ASSETS . 'css/';
50
-		$css_path_vendor = $css_path . 'vendor/';
51
-		$js_path         = SIMPLE_CALENDAR_ASSETS . 'js/';
52
-		$js_path_vendor  = $js_path . 'vendor/';
49
+		$css_path        = SIMPLE_CALENDAR_ASSETS.'css/';
50
+		$css_path_vendor = $css_path.'vendor/';
51
+		$js_path         = SIMPLE_CALENDAR_ASSETS.'js/';
52
+		$js_path_vendor  = $js_path.'vendor/';
53 53
 
54 54
 		/* ====================== *
55 55
 		 * Register Admin Scripts *
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
 		// TipTip uses ".minified.js" filename ending.
59 59
 		wp_register_script(
60 60
 			'simcal-tiptip',
61
-			$js_path_vendor . 'jquery.tipTip' . ( ( $this->min !== '' ) ? '.minified' : '' ) . '.js',
62
-			array( 'jquery' ),
61
+			$js_path_vendor.'jquery.tipTip'.(($this->min !== '') ? '.minified' : '').'.js',
62
+			array('jquery'),
63 63
 			'1.3',
64 64
 			true
65 65
 		);
66 66
 		wp_register_script(
67 67
 			'simcal-select2',
68
-			$js_path_vendor . 'select2' . $this->min . '.js',
68
+			$js_path_vendor.'select2'.$this->min.'.js',
69 69
 			array(),
70 70
 			'4.0',
71 71
 			true
72 72
 		);
73 73
 		wp_register_script(
74 74
 			'simcal-admin',
75
-			$js_path . 'admin' . $this->min . '.js',
75
+			$js_path.'admin'.$this->min.'.js',
76 76
 			array(
77 77
 				'jquery',
78 78
 				'jquery-ui-sortable',
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		);
87 87
 		wp_register_script(
88 88
 			'simcal-admin-add-calendar',
89
-			$js_path . 'admin-add-calendar' . $this->min . '.js',
90
-			array( 'simcal-select2' ),
89
+			$js_path.'admin-add-calendar'.$this->min.'.js',
90
+			array('simcal-select2'),
91 91
 			SIMPLE_CALENDAR_VERSION,
92 92
 			true
93 93
 		);
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 
99 99
 		wp_register_style(
100 100
 			'simcal-select2',
101
-			$css_path_vendor . 'select2' . $this->min . '.css',
101
+			$css_path_vendor.'select2'.$this->min.'.css',
102 102
 			array(),
103 103
 			'4.0.0'
104 104
 		);
105 105
 		wp_register_style(
106 106
 			'simcal-admin',
107
-			$css_path . 'admin' . $this->min . '.css',
107
+			$css_path.'admin'.$this->min.'.css',
108 108
 			array(
109 109
 				'wp-color-picker',
110 110
 				'simcal-select2',
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
 		);
114 114
 		wp_register_style(
115 115
 			'simcal-admin-add-calendar',
116
-			$css_path . 'admin-add-calendar' . $this->min . '.css',
117
-			array( 'simcal-select2' ),
116
+			$css_path.'admin-add-calendar'.$this->min.'.css',
117
+			array('simcal-select2'),
118 118
 			SIMPLE_CALENDAR_VERSION
119 119
 		);
120 120
 
121
-		if ( simcal_is_admin_screen() !== false ) {
121
+		if (simcal_is_admin_screen() !== false) {
122 122
 
123
-			wp_enqueue_script( 'simcal-admin' );
123
+			wp_enqueue_script('simcal-admin');
124 124
 			wp_localize_script(
125 125
 				'simcal-admin',
126 126
 				'simcal_admin',
127 127
 				simcal_common_scripts_variables()
128 128
 			);
129 129
 
130
-			wp_enqueue_style( 'simcal-admin' );
130
+			wp_enqueue_style('simcal-admin');
131 131
 
132 132
 		} else {
133 133
 
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 			$screen = get_current_screen();
136 136
 
137 137
 			$post_types = array();
138
-			$settings = get_option( 'simple-calendar_settings_calendars' );
139
-			if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
138
+			$settings = get_option('simple-calendar_settings_calendars');
139
+			if (isset($settings['general']['attach_calendars_posts'])) {
140 140
 				$post_types = $settings['general']['attach_calendars_posts'];
141 141
 			}
142 142
 
143 143
 			$conditions = array(
144
-				in_array( $post_type, (array) $post_types ),
144
+				in_array($post_type, (array) $post_types),
145 145
 				$screen->id == 'widgets',
146 146
 			);
147 147
 
148
-			if ( in_array( true, $conditions ) ) {
148
+			if (in_array(true, $conditions)) {
149 149
 
150
-				wp_enqueue_script( 'simcal-admin-add-calendar' );
151
-				wp_localize_script( 'simcal-admin-add-calendar', 'simcal_admin', array(
150
+				wp_enqueue_script('simcal-admin-add-calendar');
151
+				wp_localize_script('simcal-admin-add-calendar', 'simcal_admin', array(
152 152
 					'locale'   => get_locale(),
153 153
 					'text_dir' => is_rtl() ? 'rtl' : 'ltr',
154
-				) );
154
+				));
155 155
 
156
-				wp_enqueue_style( 'simcal-admin-add-calendar' );
156
+				wp_enqueue_style('simcal-admin-add-calendar');
157 157
 			}
158 158
 
159 159
 		}
Please login to merge, or discard this patch.