Completed
Push — master ( f805dd...62b222 )
by
unknown
03:34
created
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 all front end stylesheets to load. This also includes all add-on stylesheets.', 'google-calendar-events' ),
76
+						'title'   => __('Disable CSS', 'google-calendar-events'),
77
+						'tooltip' => __('If ticked, this option will prevent all front end stylesheets to load. This also includes all add-on stylesheets.', '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/pages/add-ons.php 1 patch
Spacing   +5 added lines, -5 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
 
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
 
29 29
 		$this->id           = $tab = 'add-ons';
30 30
 		$this->option_group = $page = 'add-ons';
31
-		$this->label        = __( 'Add-ons', 'google-calendar-events' );
31
+		$this->label        = __('Add-ons', 'google-calendar-events');
32 32
 		$this->description  = '';
33 33
 		$this->sections     = $this->add_sections();
34 34
 		$this->fields       = $this->add_fields();
35 35
 
36 36
 		// Disable the submit button for this page.
37
-		add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } );
37
+		add_filter('simcal_admin_page_'.$page.'_'.$tab.'_submit', function() { return false; } );
38 38
 
39 39
 		// Add html.
40
-		add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( $this, 'html' ) );
40
+		add_action('simcal_admin_page_'.$page.'_'.$tab.'_end', array($this, 'html'));
41 41
 
42 42
 	}
43 43
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 		// @todo pull data from simplecalendar.io to showcase add-ons
52 52
 		$js_redirect = '<script type="text/javascript">';
53
-		$js_redirect .= 'window.location = "' . simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'plugin-submenu-link', true ) . '"';
53
+		$js_redirect .= 'window.location = "'.simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'plugin-submenu-link', true).'"';
54 54
 		$js_redirect .= '</script>';
55 55
 
56 56
 		echo $js_redirect;
Please login to merge, or discard this patch.
includes/admin/metaboxes/attach-calendar.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Meta_Box;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -28,38 +28,38 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param \WP_Post $post
30 30
 	 */
31
-	public static function html( $post ) {
31
+	public static function html($post) {
32 32
 
33 33
 		// @see Meta_Boxes::save_meta_boxes()
34
-		wp_nonce_field( 'simcal_save_data', 'simcal_meta_nonce' );
34
+		wp_nonce_field('simcal_save_data', 'simcal_meta_nonce');
35 35
 
36 36
 		$calendars = simcal_get_calendars();
37 37
 
38
-		simcal_print_field( array(
38
+		simcal_print_field(array(
39 39
 			'type'       => 'select',
40 40
 			'id'         => '_simcal_attach_calendar_id',
41 41
 			'name'       => '_simcal_attach_calendar_id',
42
-			'enhanced'   => count( $calendars ) > 15 ? 'enhanced' : '',
42
+			'enhanced'   => count($calendars) > 15 ? 'enhanced' : '',
43 43
 			'allow_void' => 'allow_void',
44
-			'value'      => absint( get_post_meta( $post->ID, '_simcal_attach_calendar_id', true ) ),
44
+			'value'      => absint(get_post_meta($post->ID, '_simcal_attach_calendar_id', true)),
45 45
 			'options'    => $calendars,
46 46
 			'attributes' => array(
47 47
 				'data-allowclear' => 'true',
48 48
 			)
49
-		) );
49
+		));
50 50
 
51
-		$position = get_post_meta( $post->ID, '_simcal_attach_calendar_position', true );
51
+		$position = get_post_meta($post->ID, '_simcal_attach_calendar_position', true);
52 52
 
53
-		simcal_print_field( array(
53
+		simcal_print_field(array(
54 54
 			'type'      => 'radio',
55 55
 			'id'        => '_simcal_attach_calendar_position',
56 56
 			'name'      => '_simcal_attach_calendar_position',
57 57
 			'value'     => $position ? $position : 'after',
58 58
 			'options'   => array(
59
-				'after'  => __( 'After Content', 'google-calendar-events' ),
60
-				'before' => __( 'Before Content', 'google-calendar-events' ),
59
+				'after'  => __('After Content', 'google-calendar-events'),
60
+				'before' => __('Before Content', 'google-calendar-events'),
61 61
 			),
62
-		) );
62
+		));
63 63
 
64 64
 	}
65 65
 
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 	 * @param int      $post_id
72 72
 	 * @param \WP_Post $post
73 73
 	 */
74
-	public static function save( $post_id, $post ) {
74
+	public static function save($post_id, $post) {
75 75
 
76
-		$id = isset( $_POST['_simcal_attach_calendar_id'] ) ? absint( $_POST['_simcal_attach_calendar_id'] ) : '';
77
-		update_post_meta( $post_id, '_simcal_attach_calendar_id', $id );
76
+		$id = isset($_POST['_simcal_attach_calendar_id']) ? absint($_POST['_simcal_attach_calendar_id']) : '';
77
+		update_post_meta($post_id, '_simcal_attach_calendar_id', $id);
78 78
 
79
-		$position = isset( $_POST['_simcal_attach_calendar_position'] ) ? sanitize_title( $_POST['_simcal_attach_calendar_position'] ) : 'after';
80
-		update_post_meta( $post_id, '_simcal_attach_calendar_position', $position );
79
+		$position = isset($_POST['_simcal_attach_calendar_position']) ? sanitize_title($_POST['_simcal_attach_calendar_position']) : 'after';
80
+		update_post_meta($post_id, '_simcal_attach_calendar_position', $position);
81 81
 
82 82
 	}
83 83
 
Please login to merge, or discard this patch.
includes/events/event.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use Carbon\Carbon;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -239,35 +239,35 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @param array $event
241 241
 	 */
242
-	public function __construct( array $event ) {
242
+	public function __construct(array $event) {
243 243
 
244 244
 		/* ================= *
245 245
 		 * Event Identifiers *
246 246
 		 * ================= */
247 247
 
248 248
 		// Event unique id.
249
-		if ( ! empty( $event['uid'] ) ) {
250
-			$this->uid = esc_attr( $event['uid'] );
249
+		if ( ! empty($event['uid'])) {
250
+			$this->uid = esc_attr($event['uid']);
251 251
 		}
252 252
 
253 253
 		// iCal ID
254
-		if ( ! empty( $event['ical_id'] ) ) {
255
-			$this->ical_id = esc_attr( $event['ical_id'] );
254
+		if ( ! empty($event['ical_id'])) {
255
+			$this->ical_id = esc_attr($event['ical_id']);
256 256
 		}
257 257
 
258 258
 		// Event source.
259
-		if ( ! empty( $event['source'] ) ) {
260
-			$this->source = esc_attr( $event['source'] );
259
+		if ( ! empty($event['source'])) {
260
+			$this->source = esc_attr($event['source']);
261 261
 		}
262 262
 
263 263
 		// Event parent calendar id.
264
-		if ( ! empty( $event['calendar'] ) ) {
265
-			$this->calendar = max( intval( $event['calendar'] ), 0 );
264
+		if ( ! empty($event['calendar'])) {
265
+			$this->calendar = max(intval($event['calendar']), 0);
266 266
 		}
267 267
 
268 268
 		// Event parent calendar timezone.
269
-		if ( ! empty( $event['timezone'] ) ) {
270
-			$this->timezone = esc_attr( $event['timezone'] );
269
+		if ( ! empty($event['timezone'])) {
270
+			$this->timezone = esc_attr($event['timezone']);
271 271
 		}
272 272
 
273 273
 		/* ============= *
@@ -275,23 +275,23 @@  discard block
 block discarded – undo
275 275
 		 * ============= */
276 276
 
277 277
 		// Event title.
278
-		if ( ! empty( $event['title'] ) ) {
279
-			$this->title = esc_html( $event['title'] );
278
+		if ( ! empty($event['title'])) {
279
+			$this->title = esc_html($event['title']);
280 280
 		}
281 281
 
282 282
 		// Event description.
283
-		if ( ! empty( $event['description'] ) ) {
284
-			$this->description = wp_kses_post( $event['description'] );
283
+		if ( ! empty($event['description'])) {
284
+			$this->description = wp_kses_post($event['description']);
285 285
 		}
286 286
 
287 287
 		// Event link URL.
288
-		if ( ! empty( $event['link'] ) ) {
289
-			$this->link = esc_url_raw( $event['link'] );
288
+		if ( ! empty($event['link'])) {
289
+			$this->link = esc_url_raw($event['link']);
290 290
 		}
291 291
 
292 292
 		// Event visibility.
293
-		if ( ! empty( $event['visibility'] ) ) {
294
-			$this->visibility = esc_attr( $event['visibility'] );
293
+		if ( ! empty($event['visibility'])) {
294
+			$this->visibility = esc_attr($event['visibility']);
295 295
 			$this->public = $this->visibility == 'public' ? true : false;
296 296
 		}
297 297
 
@@ -299,34 +299,34 @@  discard block
 block discarded – undo
299 299
 		 * Event Start *
300 300
 		 * =========== */
301 301
 
302
-		if ( ! empty( $event['start'] ) ) {
303
-			$this->start = is_numeric( $event['start'] ) ? intval( $event['start'] ) : 0;
304
-			if ( ! empty( $event['start_utc'] ) ) {
305
-				$this->start_utc = is_numeric( $event['start_utc'] ) ? intval( $event['start_utc'] ) : 0;
302
+		if ( ! empty($event['start'])) {
303
+			$this->start = is_numeric($event['start']) ? intval($event['start']) : 0;
304
+			if ( ! empty($event['start_utc'])) {
305
+				$this->start_utc = is_numeric($event['start_utc']) ? intval($event['start_utc']) : 0;
306 306
 			}
307
-			if ( ! empty( $event['start_timezone'] ) ) {
308
-				$this->start_timezone = esc_attr( $event['start_timezone'] );
307
+			if ( ! empty($event['start_timezone'])) {
308
+				$this->start_timezone = esc_attr($event['start_timezone']);
309 309
 			}
310
-			$this->start_dt = Carbon::createFromTimestamp( $this->start, $this->start_timezone );
311
-			$start_location = isset( $event['start_location'] ) ? $event['start_location'] : '';
312
-			$this->start_location = $this->esc_location( $start_location );
310
+			$this->start_dt = Carbon::createFromTimestamp($this->start, $this->start_timezone);
311
+			$start_location = isset($event['start_location']) ? $event['start_location'] : '';
312
+			$this->start_location = $this->esc_location($start_location);
313 313
 		}
314 314
 
315 315
 		/* ========= *
316 316
 		 * Event End *
317 317
 		 * ========= */
318 318
 
319
-		if ( ! empty( $event['end'] ) ) {
320
-			$this->end = is_numeric( $event['end'] ) ? intval( $event['end'] ): false;
321
-			if ( ! empty( $event['end_timezone'] ) ) {
322
-				$this->end_timezone = esc_attr( $event['end_timezone'] );
319
+		if ( ! empty($event['end'])) {
320
+			$this->end = is_numeric($event['end']) ? intval($event['end']) : false;
321
+			if ( ! empty($event['end_timezone'])) {
322
+				$this->end_timezone = esc_attr($event['end_timezone']);
323 323
 			}
324
-			if ( ! empty( $event['end_utc'] ) ) {
325
-				$this->end_utc = is_numeric( $event['end_utc'] ) ? intval( $event['end_utc'] ) : false;
326
-				$this->end_dt = Carbon::createFromTimestamp( $this->end, $this->end_timezone );
324
+			if ( ! empty($event['end_utc'])) {
325
+				$this->end_utc = is_numeric($event['end_utc']) ? intval($event['end_utc']) : false;
326
+				$this->end_dt = Carbon::createFromTimestamp($this->end, $this->end_timezone);
327 327
 			}
328
-			$end_location = isset( $event['end_location'] ) ? $event['end_location'] : '';
329
-			$this->end_location = $this->esc_location( $end_location );
328
+			$end_location = isset($event['end_location']) ? $event['end_location'] : '';
329
+			$this->end_location = $this->esc_location($end_location);
330 330
 		}
331 331
 
332 332
 		/* ================== *
@@ -334,18 +334,18 @@  discard block
 block discarded – undo
334 334
 		 * ================== */
335 335
 
336 336
 		// Whole day event.
337
-		if ( ! empty( $event['whole_day'] ) ) {
338
-			$this->whole_day = true === $event['whole_day'] ? true: false;
337
+		if ( ! empty($event['whole_day'])) {
338
+			$this->whole_day = true === $event['whole_day'] ? true : false;
339 339
 		}
340 340
 
341 341
 		// Multi day event.
342
-		if ( ! empty( $event['multiple_days'] ) ) {
343
-			$this->multiple_days = max( absint( $event['multiple_days'] ), 1 );
342
+		if ( ! empty($event['multiple_days'])) {
343
+			$this->multiple_days = max(absint($event['multiple_days']), 1);
344 344
 		}
345 345
 
346 346
 		// Event recurrence.
347
-		if ( isset( $event['recurrence'] ) ) {
348
-			$this->recurrence = ! empty( $event['recurrence'] ) ? $event['recurrence'] : false;
347
+		if (isset($event['recurrence'])) {
348
+			$this->recurrence = ! empty($event['recurrence']) ? $event['recurrence'] : false;
349 349
 		}
350 350
 
351 351
 		/* ========== *
@@ -353,18 +353,18 @@  discard block
 block discarded – undo
353 353
 		 * ========== */
354 354
 
355 355
 		// Event has venue(s).
356
-		if ( $this->start_location['venue'] || $this->end_location['venue'] ) {
356
+		if ($this->start_location['venue'] || $this->end_location['venue']) {
357 357
 			$this->venue = true;
358 358
 		}
359 359
 
360 360
 		// Event meta.
361
-		if ( ! empty( $event['meta'] ) ) {
362
-			$this->meta = is_array( $event['meta'] ) ? $event['meta'] : array();
361
+		if ( ! empty($event['meta'])) {
362
+			$this->meta = is_array($event['meta']) ? $event['meta'] : array();
363 363
 		}
364 364
 
365 365
 		// Event template.
366
-		if ( ! empty( $event['template'] ) ) {
367
-			$this->template = wp_kses_post( $event['template'] );
366
+		if ( ! empty($event['template'])) {
367
+			$this->template = wp_kses_post($event['template']);
368 368
 		}
369 369
 
370 370
 	}
@@ -379,27 +379,27 @@  discard block
 block discarded – undo
379 379
 	 *
380 380
 	 * @return array
381 381
 	 */
382
-	private function esc_location( $var = '' ) {
382
+	private function esc_location($var = '') {
383 383
 
384 384
 		$location = array();
385 385
 
386
-		if ( is_string( $var ) ) {
386
+		if (is_string($var)) {
387 387
 			$var = array(
388 388
 				'name'    => $var,
389 389
 				'address' => $var,
390 390
 			);
391
-		} elseif ( is_bool( $var ) || is_null( $var ) ) {
391
+		} elseif (is_bool($var) || is_null($var)) {
392 392
 			$var = array();
393 393
 		} else {
394 394
 			$var = (array) $var;
395 395
 		}
396 396
 
397
-		$location['name']    = isset( $var['name'] )    ? esc_attr( strip_tags( $var['name'] ) ) : '';
398
-		$location['address'] = isset( $var['address'] ) ? esc_attr( strip_tags( $var['address'] ) ) : '';
399
-		$location['lat']     = isset( $var['lat'] )     ? $this->esc_coordinate( $var['lat'] ) : 0;
400
-		$location['lng']     = isset( $var['lng'] )     ? $this->esc_coordinate( $var['lng'] ) : 0;
397
+		$location['name']    = isset($var['name']) ? esc_attr(strip_tags($var['name'])) : '';
398
+		$location['address'] = isset($var['address']) ? esc_attr(strip_tags($var['address'])) : '';
399
+		$location['lat']     = isset($var['lat']) ? $this->esc_coordinate($var['lat']) : 0;
400
+		$location['lng']     = isset($var['lng']) ? $this->esc_coordinate($var['lng']) : 0;
401 401
 
402
-		if ( ! empty( $location['name'] ) || ! empty( $location['address'] ) ) {
402
+		if ( ! empty($location['name']) || ! empty($location['address'])) {
403 403
 			$location['venue'] = true;
404 404
 		} else {
405 405
 			$location['venue'] = false;
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	 *
419 419
 	 * @return int|float
420 420
 	 */
421
-	private function esc_coordinate( $latlng = 0 ) {
422
-		return is_numeric( $latlng ) ? floatval( $latlng ) : 0;
421
+	private function esc_coordinate($latlng = 0) {
422
+		return is_numeric($latlng) ? floatval($latlng) : 0;
423 423
 	}
424 424
 
425 425
 	/**
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
 	 *
433 433
 	 * @return bool
434 434
 	 */
435
-	public function set_timezone( $tz ) {
436
-		if ( in_array( $tz, timezone_identifiers_list() ) ) {
435
+	public function set_timezone($tz) {
436
+		if (in_array($tz, timezone_identifiers_list())) {
437 437
 			$this->timezone = $tz;
438 438
 			return true;
439 439
 		}
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 * @return bool
460 460
 	 */
461 461
 	public function starts_today() {
462
-		return $this->start_dt->setTimezone( $this->timezone )->isToday();
462
+		return $this->start_dt->setTimezone($this->timezone)->isToday();
463 463
 	}
464 464
 
465 465
 	/**
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	 * @return bool
471 471
 	 */
472 472
 	public function ends_today() {
473
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isToday() : true;
473
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isToday() : true;
474 474
 	}
475 475
 
476 476
 	/**
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 	 * @return bool
482 482
 	 */
483 483
 	public function starts_tomorrow() {
484
-		return $this->start_dt->setTimezone( $this->timezone )->isTomorrow();
484
+		return $this->start_dt->setTimezone($this->timezone)->isTomorrow();
485 485
 	}
486 486
 
487 487
 	/**
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 	 * @return bool
493 493
 	 */
494 494
 	public function ends_tomorrow() {
495
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isTomorrow() : false;
495
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isTomorrow() : false;
496 496
 	}
497 497
 
498 498
 	/**
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	 * @return bool
504 504
 	 */
505 505
 	public function started_yesterday() {
506
-		return $this->start_dt->setTimezone( $this->timezone )->isYesterday();
506
+		return $this->start_dt->setTimezone($this->timezone)->isYesterday();
507 507
 	}
508 508
 
509 509
 	/**
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 	 * @return bool
515 515
 	 */
516 516
 	public function ended_yesterday() {
517
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isYesterday() : false;
517
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isYesterday() : false;
518 518
 	}
519 519
 
520 520
 	/**
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 	 * @return bool
526 526
 	 */
527 527
 	public function starts_future() {
528
-		return $this->start_dt->setTimezone( $this->timezone )->isFuture();
528
+		return $this->start_dt->setTimezone($this->timezone)->isFuture();
529 529
 	}
530 530
 
531 531
 	/**
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	 * @return bool
537 537
 	 */
538 538
 	public function ends_future() {
539
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isFuture() : false;
539
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isFuture() : false;
540 540
 	}
541 541
 
542 542
 	/**
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	 * @return bool
548 548
 	 */
549 549
 	public function started_past() {
550
-		return $this->start_dt->setTimezone( $this->timezone )->isPast();
550
+		return $this->start_dt->setTimezone($this->timezone)->isPast();
551 551
 	}
552 552
 
553 553
 	/**
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	 * @return bool
559 559
 	 */
560 560
 	public function ended_past() {
561
-		return ! is_null( $this->end_dt ) ? $this->end_dt->setTimezone( $this->timezone )->isPast() : false;
561
+		return ! is_null($this->end_dt) ? $this->end_dt->setTimezone($this->timezone)->isPast() : false;
562 562
 	}
563 563
 
564 564
 	/**
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
 	 *
571 571
 	 * @return string
572 572
 	 */
573
-	public function get_color( $default = '' ) {
574
-		if ( isset( $this->meta['color'] ) ) {
575
-			return ! empty( $this->meta['color'] ) ? esc_attr( $this->meta['color'] ) : $default;
573
+	public function get_color($default = '') {
574
+		if (isset($this->meta['color'])) {
575
+			return ! empty($this->meta['color']) ? esc_attr($this->meta['color']) : $default;
576 576
 		}
577 577
 		return $default;
578 578
 	}
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 	 * @return array
586 586
 	 */
587 587
 	public function get_attachments() {
588
-		return isset( $this->meta['attachments'] ) ? $this->meta['attachments'] : array();
588
+		return isset($this->meta['attachments']) ? $this->meta['attachments'] : array();
589 589
 	}
590 590
 
591 591
 	/**
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	 * @return array
597 597
 	 */
598 598
 	public function get_attendees() {
599
-		return isset( $this->meta['attendees'] ) ? $this->meta['attendees'] : array();
599
+		return isset($this->meta['attendees']) ? $this->meta['attendees'] : array();
600 600
 	}
601 601
 
602 602
 	/**
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	 * @return array
608 608
 	 */
609 609
 	public function get_organizer() {
610
-		return isset( $this->meta['organizer'] ) ? $this->meta['organizer'] : array();
610
+		return isset($this->meta['organizer']) ? $this->meta['organizer'] : array();
611 611
 	}
612 612
 
613 613
 }
Please login to merge, or discard this patch.
includes/functions/admin.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @package SimpleCalendar/Admin/Functions
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return null|\SimpleCalendar\Abstracts\Admin_Page
34 34
  */
35
-function simcal_get_admin_page( $page ) {
35
+function simcal_get_admin_page($page) {
36 36
 	$objects = \SimpleCalendar\plugin()->objects;
37
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_admin_page( $page ) : null;
37
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_admin_page($page) : null;
38 38
 }
39 39
 
40 40
 /**
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
  *
48 48
  * @return null|\SimpleCalendar\Abstracts\Field
49 49
  */
50
-function simcal_get_field( $args, $name = '' ) {
50
+function simcal_get_field($args, $name = '') {
51 51
 	$objects = \SimpleCalendar\plugin()->objects;
52
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_field( $args, $name ) : null;
52
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_field($args, $name) : null;
53 53
 }
54 54
 
55 55
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return void
64 64
  */
65
-function simcal_print_field( $args, $name = '' ) {
65
+function simcal_print_field($args, $name = '') {
66 66
 
67
-	$field = simcal_get_field( $args, $name );
67
+	$field = simcal_get_field($args, $name);
68 68
 
69
-	if ( $field instanceof \SimpleCalendar\Abstracts\Field ) {
69
+	if ($field instanceof \SimpleCalendar\Abstracts\Field) {
70 70
 		$field->html();
71 71
 	}
72 72
 }
@@ -84,33 +84,33 @@  discard block
 block discarded – undo
84 84
  *
85 85
  * @return array|string Sanitized variable
86 86
  */
87
-function simcal_sanitize_input( $var, $func = 'sanitize_text_field'  ) {
87
+function simcal_sanitize_input($var, $func = 'sanitize_text_field') {
88 88
 
89
-	if ( is_null( $var ) ) {
89
+	if (is_null($var)) {
90 90
 		return '';
91 91
 	}
92 92
 
93
-	if ( is_bool( $var ) ) {
94
-		if ( $var === true ) {
93
+	if (is_bool($var)) {
94
+		if ($var === true) {
95 95
 			return 'yes';
96 96
 		} else {
97 97
 			return 'no';
98 98
 		}
99 99
 	}
100 100
 
101
-	if ( is_string( $var ) || is_numeric( $var ) ) {
102
-		$func = is_string( $func ) && function_exists( $func ) ? $func : 'sanitize_text_field';
103
-		return call_user_func( $func, trim( strval( $var ) ) );
101
+	if (is_string($var) || is_numeric($var)) {
102
+		$func = is_string($func) && function_exists($func) ? $func : 'sanitize_text_field';
103
+		return call_user_func($func, trim(strval($var)));
104 104
 	}
105 105
 
106
-	if ( is_object( $var ) ) {
106
+	if (is_object($var)) {
107 107
 		$var = (array) $var;
108 108
 	}
109 109
 
110
-	if ( is_array( $var ) ) {
110
+	if (is_array($var)) {
111 111
 		$array = array();
112
-		foreach ( $var as $k => $v ) {
113
-			$array[ $k ] = simcal_sanitize_input( $v );
112
+		foreach ($var as $k => $v) {
113
+			$array[$k] = simcal_sanitize_input($v);
114 114
 		}
115 115
 		return $array;
116 116
 	}
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
  */
129 129
 function simcal_is_admin_screen() {
130 130
 
131
-	$view = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
131
+	$view = function_exists('get_current_screen') ? get_current_screen() : false;
132 132
 
133
-	if ( $view instanceof WP_Screen ) {
133
+	if ($view instanceof WP_Screen) {
134 134
 
135 135
 		// Screens used by this plugin.
136 136
 		$screens = array(
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'dashboard_page_simple-calendar_credits',
146 146
 			'dashboard_page_simple-calendar_translators',
147 147
 		);
148
-		if ( in_array( $view->id, $screens ) ) {
148
+		if (in_array($view->id, $screens)) {
149 149
 			return $view->id;
150 150
 		}
151 151
 	}
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
  *
165 165
  * @return \SimpleCalendar\Admin\Updater
166 166
  */
167
-function simcal_addon_updater( $_api_url, $_plugin_file, $_api_data = null ) {
168
-	return new \SimpleCalendar\Admin\Updater( $_api_url, $_plugin_file, $_api_data );
167
+function simcal_addon_updater($_api_url, $_plugin_file, $_api_data = null) {
168
+	return new \SimpleCalendar\Admin\Updater($_api_url, $_plugin_file, $_api_data);
169 169
 }
170 170
 
171 171
 /**
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return null|string
179 179
  */
180
-function simcal_get_license_key( $addon ) {
181
-	$licenses = get_option( 'simple-calendar_settings_licenses', array() );
182
-	if ( isset( $licenses['keys'][ $addon ] ) ) {
183
-		return empty( $licenses['keys'][ $addon ] ) ? null : $licenses['keys'][ $addon ];
180
+function simcal_get_license_key($addon) {
181
+	$licenses = get_option('simple-calendar_settings_licenses', array());
182
+	if (isset($licenses['keys'][$addon])) {
183
+		return empty($licenses['keys'][$addon]) ? null : $licenses['keys'][$addon];
184 184
 	}
185 185
 	return null;
186 186
 }
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
  *
197 197
  * @return array|string
198 198
  */
199
-function simcal_get_license_status( $addon = null ) {
200
-	$licenses = get_option( 'simple-calendar_licenses_status', array() );
201
-	return isset( $licenses[ $addon ] ) ? $licenses[ $addon ] : $licenses;
199
+function simcal_get_license_status($addon = null) {
200
+	$licenses = get_option('simple-calendar_licenses_status', array());
201
+	return isset($licenses[$addon]) ? $licenses[$addon] : $licenses;
202 202
 }
203 203
 
204 204
 /**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
  * @since 3.0.0
220 220
  */
221 221
 function simcal_delete_admin_notices() {
222
-	delete_option( 'simple-calendar_admin_notices' );
222
+	delete_option('simple-calendar_admin_notices');
223 223
 }
224 224
 
225 225
 /**
@@ -231,22 +231,22 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @return void
233 233
  */
234
-function simcal_print_shortcode_tip( $post_id ) {
234
+function simcal_print_shortcode_tip($post_id) {
235 235
 
236 236
 	$browser = new \SimpleCalendar\Browser();
237
-	if ( $browser::PLATFORM_APPLE == $browser->getPlatform() ) {
237
+	if ($browser::PLATFORM_APPLE == $browser->getPlatform()) {
238 238
 		$cmd = '&#8984;&#43;C';
239 239
 	} else {
240 240
 		$cmd = 'Ctrl&#43;C';
241 241
 	}
242 242
 
243
-	$shortcut  = sprintf( __( 'Press %s to copy.', 'google-calendar-events' ), $cmd );
244
-	$shortcode = sprintf( '[calendar id="%s"]', $post_id );
243
+	$shortcut  = sprintf(__('Press %s to copy.', 'google-calendar-events'), $cmd);
244
+	$shortcode = sprintf('[calendar id="%s"]', $post_id);
245 245
 
246
-	echo "<input readonly='readonly' " .
247
-				"class='simcal-shortcode simcal-calendar-shortcode simcal-shortcode-tip' " .
248
-				"title='" . $shortcut . "' " .
249
-				"onclick='this.select();' value='" . $shortcode . "' />";
246
+	echo "<input readonly='readonly' ".
247
+				"class='simcal-shortcode simcal-calendar-shortcode simcal-shortcode-tip' ".
248
+				"title='".$shortcut."' ".
249
+				"onclick='this.select();' value='".$shortcode."' />";
250 250
 }
251 251
 
252 252
 /**
@@ -261,20 +261,20 @@  discard block
 block discarded – undo
261 261
  *
262 262
  * @return  string  $url        Full Google Analytics campaign URL
263 263
  */
264
-function simcal_ga_campaign_url( $base_url, $campaign, $content, $raw = false ) {
264
+function simcal_ga_campaign_url($base_url, $campaign, $content, $raw = false) {
265 265
 
266
-	$url = add_query_arg( array(
266
+	$url = add_query_arg(array(
267 267
 		'utm_source'   => 'inside-plugin',
268 268
 		'utm_medium'   => 'link',
269 269
 		'utm_campaign' => $campaign, // i.e. 'core-plugin', 'gcal-pro'
270 270
 		'utm_content'  => $content // i.e. 'sidebar-link', 'settings-link'
271
-	), $base_url );
271
+	), $base_url);
272 272
 
273
-	if ( $raw ) {
274
-		return esc_url_raw( $url );
273
+	if ($raw) {
274
+		return esc_url_raw($url);
275 275
 	}
276 276
 
277
-	return esc_url( $url );
277
+	return esc_url($url);
278 278
 }
279 279
 
280 280
 /**
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
  */
287 287
 function simcal_newsletter_signup() {
288 288
 
289
-	if ( $screen = simcal_is_admin_screen() ) {
289
+	if ($screen = simcal_is_admin_screen()) {
290 290
 
291 291
 		global $current_user;
292 292
 		wp_get_current_user();
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 		<div id="simcal-drip" class="<?php echo $screen; ?>">
298 298
 			<div class="signup">
299 299
 				<p>
300
-					<?php _e( "Enter your name and email and we'll send you a coupon code for <strong>20% off</strong> all Pro Add-on purchases.", 'google-calendar-events' ); ?>
300
+					<?php _e("Enter your name and email and we'll send you a coupon code for <strong>20% off</strong> all Pro Add-on purchases.", 'google-calendar-events'); ?>
301 301
 				</p>
302 302
 
303 303
 				<p>
304
-					<label for="simcal-drip-field-email"><?php _e( 'Your Email', 'google-calendar-events' ); ?></label><br />
304
+					<label for="simcal-drip-field-email"><?php _e('Your Email', 'google-calendar-events'); ?></label><br />
305 305
 					<input type="email"
306 306
 					       id="simcal-drip-field-email"
307 307
 					       name="fields[email]"
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				</p>
310 310
 
311 311
 				<p>
312
-					<label for="simcal-drip-field-first_name"><?php _e( 'First Name', 'google-calendar-events' ); ?></label><br />
312
+					<label for="simcal-drip-field-first_name"><?php _e('First Name', 'google-calendar-events'); ?></label><br />
313 313
 					<input type="text"
314 314
 					       id="simcal-drip-field-first_name"
315 315
 					       name="fields[first_name]"
@@ -318,17 +318,17 @@  discard block
 block discarded – undo
318 318
 				<p class="textright">
319 319
 					<a href="#"
320 320
 					   id="simcal-drip-signup"
321
-					   class="button button-primary"><?php _e( 'Send me the coupon', 'google-calendar-events' ); ?></a>
321
+					   class="button button-primary"><?php _e('Send me the coupon', 'google-calendar-events'); ?></a>
322 322
 				</p>
323 323
 				<div class="textright">
324
-					<em><?php _e( 'No spam. Unsubscribe anytime.', 'google-calendar-events' ); ?></em>
324
+					<em><?php _e('No spam. Unsubscribe anytime.', 'google-calendar-events'); ?></em>
325 325
 					<br/>
326
-					<a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'sidebar-link' ); ?>"
327
-					   target="_blank"><?php _e( 'Just take me the add-ons', 'google-calendar-events' ); ?></a>
326
+					<a href="<?php echo simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'sidebar-link'); ?>"
327
+					   target="_blank"><?php _e('Just take me the add-ons', 'google-calendar-events'); ?></a>
328 328
 				</div>
329 329
 			</div>
330 330
 			<div class="thank-you" style="display: none;">
331
-				<?php _e( 'Thank you!', 'google-calendar-events' ); ?>
331
+				<?php _e('Thank you!', 'google-calendar-events'); ?>
332 332
 			</div>
333 333
 			<div class="clear">
334 334
 			</div>
Please login to merge, or discard this patch.
includes/abstracts/field.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Abstracts;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -150,71 +150,71 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @param array $field Field data.
152 152
 	 */
153
-	public function __construct( $field ) {
153
+	public function __construct($field) {
154 154
 
155 155
 		// Field properties.
156
-		if ( isset( $field['title'] ) ) {
157
-			$this->title = esc_attr( $field['title'] );
156
+		if (isset($field['title'])) {
157
+			$this->title = esc_attr($field['title']);
158 158
 		}
159
-		if ( isset( $field['description'] ) ) {
160
-			$this->description = wp_kses_post( $field['description'] );
159
+		if (isset($field['description'])) {
160
+			$this->description = wp_kses_post($field['description']);
161 161
 		}
162
-		if ( isset( $field['type'] ) ) {
163
-			$this->type = esc_attr( $field['type'] );
162
+		if (isset($field['type'])) {
163
+			$this->type = esc_attr($field['type']);
164 164
 		}
165
-		if ( isset( $field['name'] ) ) {
166
-			$this->name = esc_attr( $field['name'] );
165
+		if (isset($field['name'])) {
166
+			$this->name = esc_attr($field['name']);
167 167
 		}
168
-		if ( isset( $field['id'] ) ) {
169
-			$this->id = esc_attr( $field['id'] );
168
+		if (isset($field['id'])) {
169
+			$this->id = esc_attr($field['id']);
170 170
 		}
171
-		if ( isset( $field['placeholder'] ) ) {
172
-			$this->placeholder = esc_attr( $field['placeholder'] );
171
+		if (isset($field['placeholder'])) {
172
+			$this->placeholder = esc_attr($field['placeholder']);
173 173
 		}
174
-		if ( isset( $field['options'] ) && is_array( $field['options'] ) ) {
175
-			$this->options = array_map( 'esc_attr', $field['options'] );
174
+		if (isset($field['options']) && is_array($field['options'])) {
175
+			$this->options = array_map('esc_attr', $field['options']);
176 176
 		}
177
-		if ( isset( $field['text'] ) ) {
177
+		if (isset($field['text'])) {
178 178
 			$this->text = $field['text'];
179 179
 		}
180 180
 
181 181
 		// Escaping.
182
-		if ( ! empty( $field['escaping'] ) && ( is_string( $field['escaping'] ) || is_array( $field['escaping'] ) ) ) {
183
-			if ( isset( $field['default'] ) ) {
184
-				$this->default = $this->escape_callback( $field['escaping'], $field['default'] );
182
+		if ( ! empty($field['escaping']) && (is_string($field['escaping']) || is_array($field['escaping']))) {
183
+			if (isset($field['default'])) {
184
+				$this->default = $this->escape_callback($field['escaping'], $field['default']);
185 185
 			}
186
-			if ( isset( $field['value'] ) ) {
187
-				$this->value = $this->escape_callback( $field['escaping'], $field['value'] );
186
+			if (isset($field['value'])) {
187
+				$this->value = $this->escape_callback($field['escaping'], $field['value']);
188 188
 			}
189 189
 		} else {
190
-			if ( isset( $field['default'] ) ) {
191
-				$this->default = $this->escape( $field['default'] );
190
+			if (isset($field['default'])) {
191
+				$this->default = $this->escape($field['default']);
192 192
 			}
193
-			if ( isset( $field['value'] ) ) {
194
-				$this->value = $this->escape( $field['value'] );
193
+			if (isset($field['value'])) {
194
+				$this->value = $this->escape($field['value']);
195 195
 			}
196 196
 		}
197 197
 
198 198
 		// Validation.
199
-		if ( ! empty( $field['validation'] ) ) {
200
-			$this->validation = $this->validate( $field['validation'], $this->value );
199
+		if ( ! empty($field['validation'])) {
200
+			$this->validation = $this->validate($field['validation'], $this->value);
201 201
 		}
202 202
 
203 203
 		// CSS classes and styles.
204
-		$classes = isset( $field['class'] ) ? $field['class'] : '';
205
-		$this->set_class( $classes );
206
-		if ( isset( $field['style'] ) ) {
207
-			$this->set_style( $field['style'] );
204
+		$classes = isset($field['class']) ? $field['class'] : '';
205
+		$this->set_class($classes);
206
+		if (isset($field['style'])) {
207
+			$this->set_style($field['style']);
208 208
 		}
209 209
 
210 210
 		// Custom attributes.
211
-		if ( isset( $field['attributes'] ) ) {
212
-			$this->set_attributes( $field['attributes'] );
211
+		if (isset($field['attributes'])) {
212
+			$this->set_attributes($field['attributes']);
213 213
 		}
214 214
 
215 215
 		// Tooltip markup.
216
-		if ( isset( $field['tooltip'] ) ) {
217
-			$this->tooltip = ' <i class="simcal-icon-help simcal-help-tip" data-tip="' . esc_attr( $field['tooltip'] ) . '"></i> ' ;
216
+		if (isset($field['tooltip'])) {
217
+			$this->tooltip = ' <i class="simcal-icon-help simcal-help-tip" data-tip="'.esc_attr($field['tooltip']).'"></i> ';
218 218
 		}
219 219
 	}
220 220
 
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @return void
229 229
 	 */
230
-	public function set_attributes( $attributes ) {
230
+	public function set_attributes($attributes) {
231 231
 
232 232
 		$attr = '';
233 233
 
234
-		if ( ! empty( $attributes ) && is_array( $attributes ) ) {
235
-			foreach ( $attributes as $k => $v ) {
236
-				$attr .= esc_attr( $k ) . '="' . esc_attr( $v ) . '" ';
234
+		if ( ! empty($attributes) && is_array($attributes)) {
235
+			foreach ($attributes as $k => $v) {
236
+				$attr .= esc_attr($k).'="'.esc_attr($v).'" ';
237 237
 			}
238 238
 		}
239 239
 
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @return void
251 251
 	 */
252
-	public function set_style( $css ) {
252
+	public function set_style($css) {
253 253
 
254 254
 		$styles = '';
255 255
 
256
-		if ( ! empty( $css ) && is_array( $css ) ) {
257
-			foreach ( $css as $k => $v ) {
258
-				$styles .= esc_attr( $k ) . ': ' . esc_attr( $v ) . '; ';
256
+		if ( ! empty($css) && is_array($css)) {
257
+			foreach ($css as $k => $v) {
258
+				$styles .= esc_attr($k).': '.esc_attr($v).'; ';
259 259
 			}
260 260
 		}
261 261
 
@@ -271,23 +271,23 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @return void
273 273
 	 */
274
-	public function set_class( $class ) {
274
+	public function set_class($class) {
275 275
 
276 276
 		$classes = '';
277 277
 		$type_class = '';
278 278
 		$error = '';
279 279
 
280
-		if ( ! empty( $class ) && is_array( $class ) ) {
281
-			$classes = implode( ' ', array_map( 'esc_attr', $class ) );
280
+		if ( ! empty($class) && is_array($class)) {
281
+			$classes = implode(' ', array_map('esc_attr', $class));
282 282
 		}
283
-		if ( ! empty( $this->type_class ) ) {
284
-			$type_class = esc_attr( $this->type_class );
283
+		if ( ! empty($this->type_class)) {
284
+			$type_class = esc_attr($this->type_class);
285 285
 		}
286
-		if ( true !== $this->validation && ! empty( $this->validation ) ) {
286
+		if (true !== $this->validation && ! empty($this->validation)) {
287 287
 			$error = 'simcal-field-error ';
288 288
 		}
289 289
 
290
-		$this->class = trim( $error . 'simcal-field ' . $type_class . ' ' . $classes );
290
+		$this->class = trim($error.'simcal-field '.$type_class.' '.$classes);
291 291
 	}
292 292
 
293 293
 	/**
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 	 *
303 303
 	 * @return array|string
304 304
 	 */
305
-	protected function escape( $value )  {
306
-		return ! empty( $value ) ? ( is_array( $value ) ? array_map( 'esc_attr', $value ) : esc_attr( $value ) ) : '';
305
+	protected function escape($value) {
306
+		return ! empty($value) ? (is_array($value) ? array_map('esc_attr', $value) : esc_attr($value)) : '';
307 307
 	}
308 308
 
309 309
 	/**
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
 	 *
320 320
 	 * @return mixed
321 321
 	 */
322
-	protected function escape_callback( $callback, $value ) {
323
-		if ( $callback && ( is_string( $callback ) || is_array( $callback ) ) ) {
324
-			return call_user_func( $callback, $value );
322
+	protected function escape_callback($callback, $value) {
323
+		if ($callback && (is_string($callback) || is_array($callback))) {
324
+			return call_user_func($callback, $value);
325 325
 		}
326
-		return esc_attr( $value );
326
+		return esc_attr($value);
327 327
 	}
328 328
 
329 329
 	/**
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
 	 *
340 340
 	 * @return true|string Expected to return bool (true) if passes, message string if not.
341 341
 	 */
342
-	protected function validate( $callback, $value ) {
343
-		if ( $callback && ( is_string( $callback ) || is_array( $callback ) ) ) {
344
-			$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : '';
345
-			return call_user_func( $callback, $value, $screen );
342
+	protected function validate($callback, $value) {
343
+		if ($callback && (is_string($callback) || is_array($callback))) {
344
+			$screen = function_exists('get_current_screen') ? get_current_screen() : '';
345
+			return call_user_func($callback, $value, $screen);
346 346
 		}
347 347
 		return true;
348 348
 	}
Please login to merge, or discard this patch.
includes/assets.php 1 patch
Spacing   +67 added lines, -67 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
 	/**
@@ -118,34 +118,34 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$types = simcal_get_calendar_types();
120 120
 
121
-		foreach ( $types as $calendar => $views ) {
122
-			foreach( $views as $key => $view ) {
121
+		foreach ($types as $calendar => $views) {
122
+			foreach ($views as $key => $view) {
123 123
 
124
-				$view = simcal_get_calendar_view( 0, $calendar . '-' . $view );
124
+				$view = simcal_get_calendar_view(0, $calendar.'-'.$view);
125 125
 
126
-				$scripts[] = $view->scripts( $this->min );
127
-				$styles[] = $view->styles( $this->min );
126
+				$scripts[] = $view->scripts($this->min);
127
+				$styles[] = $view->styles($this->min);
128 128
 			}
129 129
 		}
130 130
 
131 131
 		$this->get_widgets_assets();
132
-		$this->scripts = apply_filters( 'simcal_front_end_scripts', $scripts, $this->min );
132
+		$this->scripts = apply_filters('simcal_front_end_scripts', $scripts, $this->min);
133 133
 		// First check if there is a multi-dimensional array of scripts
134
-		if ( isset( $this->scripts[0] ) ) {
135
-			foreach ( $this->scripts as $script ) {
136
-				$this->load_scripts ( $script );
134
+		if (isset($this->scripts[0])) {
135
+			foreach ($this->scripts as $script) {
136
+				$this->load_scripts($script);
137 137
 			}
138 138
 		} else {
139
-			$this->load_scripts( $this->scripts );
139
+			$this->load_scripts($this->scripts);
140 140
 		}
141
-		$this->styles = apply_filters( 'simcal_front_end_styles', $styles, $this->min );
141
+		$this->styles = apply_filters('simcal_front_end_styles', $styles, $this->min);
142 142
 		// First check if there is a multi-dimensional array of styles
143
-		if ( isset( $this->styles[0] ) ) {
144
-			foreach( $this->styles as $style ) {
145
-				$this->load_styles( $style );
143
+		if (isset($this->styles[0])) {
144
+			foreach ($this->styles as $style) {
145
+				$this->load_styles($style);
146 146
 			}
147 147
 		} else {
148
-			$this->load_styles( $this->styles );
148
+			$this->load_styles($this->styles);
149 149
 		}
150 150
 	}
151 151
 
@@ -156,25 +156,25 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public function get_widgets_assets() {
158 158
 
159
-		$widgets = get_option( 'widget_gce_widget' );
159
+		$widgets = get_option('widget_gce_widget');
160 160
 
161
-		if ( ! empty( $widgets ) && is_array( $widgets ) ) {
161
+		if ( ! empty($widgets) && is_array($widgets)) {
162 162
 
163
-			foreach ( $widgets as $settings ) {
163
+			foreach ($widgets as $settings) {
164 164
 
165
-				if ( ! empty( $settings ) && is_array( $settings ) ) {
165
+				if ( ! empty($settings) && is_array($settings)) {
166 166
 
167
-					if ( isset( $settings['calendar_id'] ) ) {
167
+					if (isset($settings['calendar_id'])) {
168 168
 
169
-						$view = simcal_get_calendar_view( absint( $settings['calendar_id'] ) );
169
+						$view = simcal_get_calendar_view(absint($settings['calendar_id']));
170 170
 
171
-						if ( $view instanceof Calendar_View ) {
172
-							add_filter( 'simcal_front_end_scripts', function ( $scripts, $min ) use ( $view ) {
173
-								return array_merge( $scripts, $view->scripts( $min ) );
174
-							}, 100, 2 );
175
-							add_filter( 'simcal_front_end_styles', function ( $styles, $min ) use ( $view ) {
176
-								return array_merge( $styles, $view->styles( $min ) );
177
-							}, 100, 2 );
171
+						if ($view instanceof Calendar_View) {
172
+							add_filter('simcal_front_end_scripts', function($scripts, $min) use ($view) {
173
+								return array_merge($scripts, $view->scripts($min));
174
+							}, 100, 2);
175
+							add_filter('simcal_front_end_styles', function($styles, $min) use ($view) {
176
+								return array_merge($styles, $view->styles($min));
177
+							}, 100, 2);
178 178
 						}
179 179
 
180 180
 					}
@@ -192,42 +192,42 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @param array $scripts
194 194
 	 */
195
-	public function load_scripts( $scripts ) {
195
+	public function load_scripts($scripts) {
196 196
 
197 197
 		// Only load if not disabled in the settings
198
-		if ( ! empty( $scripts ) && is_array( $scripts ) ) {
198
+		if ( ! empty($scripts) && is_array($scripts)) {
199 199
 
200
-			foreach ( $scripts as $script => $v ) {
200
+			foreach ($scripts as $script => $v) {
201 201
 
202 202
 				/** Plugin compatibility fixes */
203 203
 
204 204
 				// Dequeue moment.js if detected from WP Simple Pay Pro.
205
-				if ( ( wp_script_is( 'stripe-checkout-pro-moment', 'enqueued' ) ) && $script == 'simcal-fullcal-moment' ) {
205
+				if ((wp_script_is('stripe-checkout-pro-moment', 'enqueued')) && $script == 'simcal-fullcal-moment') {
206 206
 					continue;
207 207
 				}
208 208
 
209
-				if ( ! empty( $v['src'] ) ) {
209
+				if ( ! empty($v['src'])) {
210 210
 
211 211
 					// Enqueued individually so we can dequeue if already enqueued by another plugin.
212 212
 					// TODO Rework dependencies part (or remove completely).
213 213
 
214
-					$src        = esc_url( $v['src'] );
214
+					$src        = esc_url($v['src']);
215 215
 					//$deps       = isset( $v['deps'] )        ? $v['deps']       : array();
216
-					$ver        = isset( $v['ver'] )         ? $v['ver']        : SIMPLE_CALENDAR_VERSION;
217
-					$in_footer  = isset( $v['in_footer'] )   ? $v['in_footer']  : false;
216
+					$ver        = isset($v['ver']) ? $v['ver'] : SIMPLE_CALENDAR_VERSION;
217
+					$in_footer  = isset($v['in_footer']) ? $v['in_footer'] : false;
218 218
 
219 219
 					//wp_enqueue_script( $script, $src, $deps, $ver, $in_footer );
220
-					wp_enqueue_script( $script, $src, array(), $ver, $in_footer );
220
+					wp_enqueue_script($script, $src, array(), $ver, $in_footer);
221 221
 
222
-					if ( ! empty( $v['localize'] ) && is_array( $v['localize'] ) ) {
223
-						foreach ( $v['localize'] as $object => $l10n ) {
224
-							wp_localize_script( $script, $object, $l10n );
222
+					if ( ! empty($v['localize']) && is_array($v['localize'])) {
223
+						foreach ($v['localize'] as $object => $l10n) {
224
+							wp_localize_script($script, $object, $l10n);
225 225
 						}
226 226
 					}
227 227
 
228
-				} elseif ( is_string( $v ) && ! empty( $v ) ) {
228
+				} elseif (is_string($v) && ! empty($v)) {
229 229
 
230
-					wp_enqueue_script( $v );
230
+					wp_enqueue_script($v);
231 231
 				}
232 232
 			}
233 233
 
@@ -241,29 +241,29 @@  discard block
 block discarded – undo
241 241
 	 *
242 242
 	 * @param array $styles
243 243
 	 */
244
-	public function load_styles( $styles ) {
244
+	public function load_styles($styles) {
245 245
 
246 246
 		// Only load if not disabled in the settings
247
-		if ( ! empty( $styles ) && is_array( $styles ) && false === $this->disable_styles ) {
247
+		if ( ! empty($styles) && is_array($styles) && false === $this->disable_styles) {
248 248
 
249
-			foreach ( $styles as $style => $v ) {
249
+			foreach ($styles as $style => $v) {
250 250
 
251
-				if ( ! empty( $v['src'] ) ) {
251
+				if ( ! empty($v['src'])) {
252 252
 
253 253
 					// Enqueued individually so we can dequeue if already enqueued by another plugin.
254 254
 					// TODO Rework dependencies part (or remove completely).
255 255
 
256
-					$src    = esc_url( $v['src'] );
256
+					$src    = esc_url($v['src']);
257 257
 					//$deps   = isset( $v['deps'] )   ? $v['deps']    : array();
258
-					$ver    = isset( $v['ver'] )    ? $v['ver']     : SIMPLE_CALENDAR_VERSION;
259
-					$media  = isset( $v['media'] )  ? $v['media']   : 'all';
258
+					$ver    = isset($v['ver']) ? $v['ver'] : SIMPLE_CALENDAR_VERSION;
259
+					$media  = isset($v['media']) ? $v['media'] : 'all';
260 260
 
261 261
 					//wp_enqueue_style( $style, $src, $deps, $ver, $media );
262
-					wp_enqueue_style( $style, $src, array(), $ver, $media );
262
+					wp_enqueue_style($style, $src, array(), $ver, $media);
263 263
 
264
-				} elseif ( is_string( $v ) && ! empty( $v ) ) {
264
+				} elseif (is_string($v) && ! empty($v)) {
265 265
 
266
-					wp_enqueue_style( $v );
266
+					wp_enqueue_style($v);
267 267
 				}
268 268
 
269 269
 			}
Please login to merge, or discard this patch.
includes/admin/pages/calendars.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use SimpleCalendar\Abstracts\Calendar;
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               = 'calendars';
41 41
 		$this->option_group     = 'settings';
42
-		$this->label            = __( 'Calendars', 'google-calendar-events' );
42
+		$this->label            = __('Calendars', 'google-calendar-events');
43 43
 		//$this->description      = __( 'Manage calendar preferences and calendar types settings and options.', 'google-calendar-events' );
44 44
 
45 45
 		$calendars = simcal_get_calendar_types();
46 46
 		$calendar_settings = array();
47
-		if ( ! empty( $calendars ) && is_array( $calendars ) ) {
48
-			foreach ( $calendars as $calendar => $views ) {
47
+		if ( ! empty($calendars) && is_array($calendars)) {
48
+			foreach ($calendars as $calendar => $views) {
49 49
 
50
-				$calendar_type = simcal_get_calendar( $calendar );
50
+				$calendar_type = simcal_get_calendar($calendar);
51 51
 
52
-				if ( $calendar_type instanceof Calendar ) {
52
+				if ($calendar_type instanceof Calendar) {
53 53
 					$settings = $calendar_type->settings_fields();
54
-					if ( ! empty( $settings ) ) {
55
-						$calendar_settings[ $calendar ] = $settings;
54
+					if ( ! empty($settings)) {
55
+						$calendar_settings[$calendar] = $settings;
56 56
 					}
57 57
 				}
58 58
 			}
@@ -74,17 +74,17 @@  discard block
 block discarded – undo
74 74
 
75 75
 		$sections = array(
76 76
 			'general' => array(
77
-				'title'       => __( 'General', 'google-calendar-events' ),
77
+				'title'       => __('General', 'google-calendar-events'),
78 78
 				'description' => '',
79 79
 			),
80 80
 		);
81 81
 
82 82
 		$calendar_types = $this->calendar_types;
83 83
 
84
-		if ( ! empty( $calendar_types ) && is_array( $calendar_types ) ) {
85
-			foreach ( $calendar_types as $calendar_type => $type ) {
84
+		if ( ! empty($calendar_types) && is_array($calendar_types)) {
85
+			foreach ($calendar_types as $calendar_type => $type) {
86 86
 
87
-				$sections[ $calendar_type ] = array(
87
+				$sections[$calendar_type] = array(
88 88
 					'title' => $type['name'],
89 89
 					'description' => $type['description'],
90 90
 				);
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 			}
93 93
 		}
94 94
 
95
-		arsort( $calendar_types );
95
+		arsort($calendar_types);
96 96
 
97
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', $sections );
97
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', $sections);
98 98
 	}
99 99
 
100 100
 	/**
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 
109 109
 		$fields       = array();
110 110
 		$feed_types   = $this->calendar_types;
111
-		$this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id );
111
+		$this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id);
112 112
 
113
-		foreach ( $this->sections as $section => $contents ) :
113
+		foreach ($this->sections as $section => $contents) :
114 114
 
115
-			if ( 'general' == $section ) {
115
+			if ('general' == $section) {
116 116
 
117 117
 				$options    = array();
118 118
 				$post_types = get_post_types(
@@ -124,36 +124,36 @@  discard block
 block discarded – undo
124 124
 					'objects',
125 125
 					'not'
126 126
 				);
127
-				unset( $post_types['attachment'] );
128
-				unset( $post_types['calendar'] );
129
-				unset( $post_types['gce_feed'] );
130
-				foreach ( $post_types as $slug => $post_type ) {
131
-					$options[ $slug ] = $post_type->label;
127
+				unset($post_types['attachment']);
128
+				unset($post_types['calendar']);
129
+				unset($post_types['gce_feed']);
130
+				foreach ($post_types as $slug => $post_type) {
131
+					$options[$slug] = $post_type->label;
132 132
 				}
133
-				asort( $options );
133
+				asort($options);
134 134
 
135
-				$fields[ $section ][] = array(
135
+				$fields[$section][] = array(
136 136
 					'type'        => 'select',
137 137
 					'multiselect' => 'multiselect',
138 138
 					'enhanced'    => 'enhanced',
139
-					'title'       => __( 'Attach Calendars', 'google-calendar-events' ),
140
-					'tooltip'     => __( 'You can choose on which content types to add the ability to attach calendars.', 'google-calendar-events' ),
141
-					'name'        => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][attach_calendars_posts]',
142
-					'id'          => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-attach-calendars-posts',
143
-					'value'       => $this->get_option_value( $section, 'attach_calendars_posts' ),
139
+					'title'       => __('Attach Calendars', 'google-calendar-events'),
140
+					'tooltip'     => __('You can choose on which content types to add the ability to attach calendars.', 'google-calendar-events'),
141
+					'name'        => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][attach_calendars_posts]',
142
+					'id'          => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-attach-calendars-posts',
143
+					'value'       => $this->get_option_value($section, 'attach_calendars_posts'),
144 144
 					'default'     => 'post,page',
145 145
 					'options'     => $options,
146 146
 				);
147 147
 
148
-			} elseif ( isset( $feed_types[ $section ]['fields'] ) ) {
148
+			} elseif (isset($feed_types[$section]['fields'])) {
149 149
 
150
-				foreach ( $feed_types[ $section ]['fields'] as $key => $args ) {
150
+				foreach ($feed_types[$section]['fields'] as $key => $args) {
151 151
 
152
-					$fields[ $section ][] = array_merge( $args, array(
153
-						'name'  => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][' . $key . ']',
154
-						'id'    => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $key,
155
-						'value' => $this->get_option_value( $section, $key )
156
-					) );
152
+					$fields[$section][] = array_merge($args, array(
153
+						'name'  => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.']['.$key.']',
154
+						'id'    => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$key,
155
+						'value' => $this->get_option_value($section, $key)
156
+					));
157 157
 
158 158
 				}
159 159
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 		endforeach;
163 163
 
164
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields );
164
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields);
165 165
 	}
166 166
 
167 167
 }
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 namespace SimpleCalendar\Admin;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function __construct() {
38 38
 
39
-		$this->install = isset( $_GET['simcal_install'] ) ? esc_attr( $_GET['simcal_install'] ) : '';
39
+		$this->install = isset($_GET['simcal_install']) ? esc_attr($_GET['simcal_install']) : '';
40 40
 
41
-		add_action( 'admin_menu', array( $this, 'welcome_page_tabs' ) );
42
-		add_action( 'admin_head', array( $this, 'remove_submenu_pages' ) );
41
+		add_action('admin_menu', array($this, 'welcome_page_tabs'));
42
+		add_action('admin_head', array($this, 'remove_submenu_pages'));
43 43
 	}
44 44
 
45 45
 	/**
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function welcome_page_tabs() {
51 51
 
52
-		$welcome_page_name  = __( 'About Simple Calendar', 'google-calendar-events' );
53
-		$welcome_page_title = __( 'Welcome to Simple Calendar', 'google-calendar-events' );
52
+		$welcome_page_name  = __('About Simple Calendar', 'google-calendar-events');
53
+		$welcome_page_title = __('Welcome to Simple Calendar', 'google-calendar-events');
54 54
 
55
-		$page = isset( $_GET['page'] ) ? $_GET['page'] : 'simple-calendar_about';
55
+		$page = isset($_GET['page']) ? $_GET['page'] : 'simple-calendar_about';
56 56
 
57
-		switch ( $page ) {
57
+		switch ($page) {
58 58
 
59 59
 			case 'simple-calendar_about' :
60 60
 				$page = add_dashboard_page(
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 					$welcome_page_name,
63 63
 					'manage_options',
64 64
 					'simple-calendar_about',
65
-					array( $this, 'about_screen' )
65
+					array($this, 'about_screen')
66 66
 				);
67
-				add_action( 'admin_print_styles-' . $page, array( $this, 'styles' ) );
67
+				add_action('admin_print_styles-'.$page, array($this, 'styles'));
68 68
 				break;
69 69
 
70 70
 			case 'simple-calendar_credits' :
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 					$welcome_page_name,
74 74
 					'manage_options',
75 75
 					'simple-calendar_credits',
76
-					array( $this, 'credits_screen' )
76
+					array($this, 'credits_screen')
77 77
 				);
78
-				add_action( 'admin_print_styles-' . $page, array( $this, 'styles' ) );
78
+				add_action('admin_print_styles-'.$page, array($this, 'styles'));
79 79
 				break;
80 80
 
81 81
 			case 'simple-calendar_translators' :
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 					$welcome_page_name,
85 85
 					'manage_options',
86 86
 					'simple-calendar_translators',
87
-					array( $this, 'translators_screen' )
87
+					array($this, 'translators_screen')
88 88
 				);
89
-				add_action( 'admin_print_styles-' . $page, array( $this, 'styles' ) );
89
+				add_action('admin_print_styles-'.$page, array($this, 'styles'));
90 90
 				break;
91 91
 		}
92 92
 
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 	 * @since 3.0.0
99 99
 	 */
100 100
 	public function remove_submenu_pages() {
101
-		remove_submenu_page( 'index.php', 'simple-calendar_about' );
102
-		remove_submenu_page( 'index.php', 'simple-calendar_credits' );
103
-		remove_submenu_page( 'index.php', 'simple-calendar_translators' );
101
+		remove_submenu_page('index.php', 'simple-calendar_about');
102
+		remove_submenu_page('index.php', 'simple-calendar_credits');
103
+		remove_submenu_page('index.php', 'simple-calendar_translators');
104 104
 	}
105 105
 
106 106
 	/**
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
 
130 130
 		?>
131 131
 		<p>
132
-			<a href="<?php echo admin_url( 'edit.php?post_type=calendar' ); ?>"
132
+			<a href="<?php echo admin_url('edit.php?post_type=calendar'); ?>"
133 133
 			   class="button button-primary"
134
-				><?php _e( 'Calendars', 'google-calendar-events' ); ?></a>
135
-			<a href="<?php echo esc_url( add_query_arg( 'page', 'simple-calendar_settings', admin_url( 'admin.php' ) ) ); ?>"
134
+				><?php _e('Calendars', 'google-calendar-events'); ?></a>
135
+			<a href="<?php echo esc_url(add_query_arg('page', 'simple-calendar_settings', admin_url('admin.php'))); ?>"
136 136
 			   class="button button-primary"
137
-				><?php _e( 'Settings', 'google-calendar-events' ); ?></a>
138
-			<a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'welcome-page' ); ?>"
137
+				><?php _e('Settings', 'google-calendar-events'); ?></a>
138
+			<a href="<?php echo simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'welcome-page'); ?>"
139 139
 			   class="docs button button-primary" target="_blank"
140
-				><?php _e( 'Add-ons', 'google-calendar-events' ); ?></a>
141
-			<a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'docs' ), 'core-plugin', 'welcome-page' ); ?>"
140
+				><?php _e('Add-ons', 'google-calendar-events'); ?></a>
141
+			<a href="<?php echo simcal_ga_campaign_url(simcal_get_url('docs'), 'core-plugin', 'welcome-page'); ?>"
142 142
 			   class="docs button button-primary" target="_blank"
143
-				><?php _e( 'Documentation', 'google-calendar-events' ); ?></a>
143
+				><?php _e('Documentation', 'google-calendar-events'); ?></a>
144 144
 		</p>
145 145
 		<?php
146 146
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		<h1>
158 158
 			<?php
159 159
 			/* translators: %s prints the current version of the plugin. */
160
-			printf( __( 'Welcome to Simple Calendar %s', 'google-calendar-events' ), SIMPLE_CALENDAR_VERSION );
160
+			printf(__('Welcome to Simple Calendar %s', 'google-calendar-events'), SIMPLE_CALENDAR_VERSION);
161 161
 			?>
162 162
 		</h1>
163 163
 
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 			<?php
166 166
 
167 167
 			// Difference message if updating vs fresh install.
168
-			if ( 'update' == $this->install ) {
169
-				$message = __( 'Thanks for updating to the latest version!', 'google-calendar-events' );
168
+			if ('update' == $this->install) {
169
+				$message = __('Thanks for updating to the latest version!', 'google-calendar-events');
170 170
 			} else {
171
-				$message = __( 'Thanks for installing!', 'google-calendar-events' );
171
+				$message = __('Thanks for installing!', 'google-calendar-events');
172 172
 			}
173 173
 
174 174
 			echo $message;
175 175
 
176 176
 			/* translators: %s prints the current version of the plugin. */
177
-			printf( ' ' . __( "Simple Calendar %s has a few display options to configure. ", 'google-calendar-events' ), SIMPLE_CALENDAR_VERSION );
177
+			printf(' '.__("Simple Calendar %s has a few display options to configure. ", 'google-calendar-events'), SIMPLE_CALENDAR_VERSION);
178 178
 			?>
179
-			<a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'docs' ), 'core-plugin', 'welcome-page' ); ?>"
179
+			<a href="<?php echo simcal_ga_campaign_url(simcal_get_url('docs'), 'core-plugin', 'welcome-page'); ?>"
180 180
 			   target="_blank"
181
-			><?php _e( 'Check out our documentation', 'google-calendar-events' ); ?></a>
182
-			<?php _e( 'to get started now.', 'google-calendar-events' ); ?>
181
+			><?php _e('Check out our documentation', 'google-calendar-events'); ?></a>
182
+			<?php _e('to get started now.', 'google-calendar-events'); ?>
183 183
 		</div>
184 184
 
185 185
 		<div class="simcal-badge">&nbsp;</div>
@@ -187,21 +187,21 @@  discard block
 block discarded – undo
187 187
 		<?php $this->main_nav_links(); ?>
188 188
 
189 189
 		<h2 class="nav-tab-wrapper">
190
-			<a class="nav-tab <?php if ( $_GET['page'] == 'simple-calendar_about' ) {
190
+			<a class="nav-tab <?php if ($_GET['page'] == 'simple-calendar_about') {
191 191
 				echo 'nav-tab-active';
192 192
 			} ?>"
193
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'simple-calendar_about' ), 'index.php' ) ) ); ?>"
194
-				><?php _e( "What's New", 'google-calendar-events' ); ?></a>
195
-			<a class="nav-tab <?php if ( $_GET['page'] == 'simple-calendar_credits' ) {
193
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'simple-calendar_about'), 'index.php'))); ?>"
194
+				><?php _e("What's New", 'google-calendar-events'); ?></a>
195
+			<a class="nav-tab <?php if ($_GET['page'] == 'simple-calendar_credits') {
196 196
 				echo 'nav-tab-active';
197 197
 			} ?>"
198
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'simple-calendar_credits' ), 'index.php' ) ) ); ?>"
199
-				><?php _e( 'Credits', 'google-calendar-events' ); ?></a>
200
-			<a class="nav-tab <?php if ( $_GET['page'] == 'simple-calendar_translators' ) {
198
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'simple-calendar_credits'), 'index.php'))); ?>"
199
+				><?php _e('Credits', 'google-calendar-events'); ?></a>
200
+			<a class="nav-tab <?php if ($_GET['page'] == 'simple-calendar_translators') {
201 201
 				echo 'nav-tab-active';
202 202
 			} ?>"
203
-			   href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'simple-calendar_translators' ), 'index.php' ) ) ); ?>"
204
-				><?php _e( 'Translators', 'google-calendar-events' ); ?></a>
203
+			   href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'simple-calendar_translators'), 'index.php'))); ?>"
204
+				><?php _e('Translators', 'google-calendar-events'); ?></a>
205 205
 		</h2>
206 206
 		<?php
207 207
 
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	 * @since 3.0.0
214 214
 	 */
215 215
 	public function about_screen() {
216
-		$welcome_image_about_path = SIMPLE_CALENDAR_ASSETS . '/images/welcome';
217
-		$welcome_addons_link = simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'welcome-page' );
216
+		$welcome_image_about_path = SIMPLE_CALENDAR_ASSETS.'/images/welcome';
217
+		$welcome_addons_link = simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'welcome-page');
218 218
 
219 219
 		?>
220 220
 		<div id="simcal-welcome">
@@ -222,20 +222,20 @@  discard block
 block discarded – undo
222 222
 
223 223
 				<?php $this->intro(); ?>
224 224
 
225
-				<h3><?php _e( 'Configure event colors, number of events to display, grid or list style and more.', 'google-calendar-events' ); ?></h3>
226
-				<img src="<?php echo $welcome_image_about_path . '/grid-view-basic.png'; ?>" />
225
+				<h3><?php _e('Configure event colors, number of events to display, grid or list style and more.', 'google-calendar-events'); ?></h3>
226
+				<img src="<?php echo $welcome_image_about_path.'/grid-view-basic.png'; ?>" />
227 227
 
228
-				<h3><?php _e( 'Mobile responsive and widget ready.', 'google-calendar-events' ); ?></h3>
229
-				<img src="<?php echo $welcome_image_about_path . '/list-view-widget.png'; ?>" />
230
-				<img src="<?php echo $welcome_image_about_path . '/grid-view-widget-dark-theme.png'; ?>" />
228
+				<h3><?php _e('Mobile responsive and widget ready.', 'google-calendar-events'); ?></h3>
229
+				<img src="<?php echo $welcome_image_about_path.'/list-view-widget.png'; ?>" />
230
+				<img src="<?php echo $welcome_image_about_path.'/grid-view-widget-dark-theme.png'; ?>" />
231 231
 
232 232
 				<h3>
233
-					<?php _e( 'Add even more display options with add-ons like', 'google-calendar-events' ); ?>
234
-					<a href="<?php echo $welcome_addons_link; ?>" target="_blank"><?php _e( 'FullCalendar and Google Calendar Pro', 'google-calendar-events' ); ?></a>.
233
+					<?php _e('Add even more display options with add-ons like', 'google-calendar-events'); ?>
234
+					<a href="<?php echo $welcome_addons_link; ?>" target="_blank"><?php _e('FullCalendar and Google Calendar Pro', 'google-calendar-events'); ?></a>.
235 235
 				</h3>
236
-				<a href="<?php echo $welcome_addons_link; ?>" target="_blank"><img src="<?php echo $welcome_image_about_path . '/fullcalendar-google-calendar-pro-grid-view.png'; ?>" /></a>
236
+				<a href="<?php echo $welcome_addons_link; ?>" target="_blank"><img src="<?php echo $welcome_image_about_path.'/fullcalendar-google-calendar-pro-grid-view.png'; ?>" /></a>
237 237
 
238
-				<h3><a href="<?php echo $welcome_addons_link; ?>" target="_blank"><?php _e( 'View Pricing and Try a Demo of our Simple Calendar Pro Add-ons.', 'google-calendar-events' ); ?></a></h3>
238
+				<h3><a href="<?php echo $welcome_addons_link; ?>" target="_blank"><?php _e('View Pricing and Try a Demo of our Simple Calendar Pro Add-ons.', 'google-calendar-events'); ?></a></h3>
239 239
 
240 240
 				<hr/>
241 241
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 					<?php
263 263
 
264 264
 					printf(
265
-						__( "Simple Calendar is created by a worldwide team of developers. If you'd like to contribute please visit our <a href='%s' target='_blank'>GitHub repo</a>.", 'google-calendar-events' ),
266
-						simcal_get_url( 'github' )
265
+						__("Simple Calendar is created by a worldwide team of developers. If you'd like to contribute please visit our <a href='%s' target='_blank'>GitHub repo</a>.", 'google-calendar-events'),
266
+						simcal_get_url('github')
267 267
 					);
268 268
 
269 269
 					?>
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 			<div class="wrap about-wrap translators-wrap">
288 288
 				<?php $this->intro(); ?>
289 289
 				<p class="about-description">
290
-					<?php _e( 'Simple Calendar has been kindly translated into several other languages by contributors from all over the world.', 'google-calendar-events' ); ?>
290
+					<?php _e('Simple Calendar has been kindly translated into several other languages by contributors from all over the world.', 'google-calendar-events'); ?>
291 291
 				</p>
292 292
 				<p class="about-description">
293
-					<a href="https://translate.wordpress.org/projects/wp-plugins/google-calendar-events" target="_blank"><?php _e( 'Click here to help translate', 'google-calendar-events' ); ?></a>
293
+					<a href="https://translate.wordpress.org/projects/wp-plugins/google-calendar-events" target="_blank"><?php _e('Click here to help translate', 'google-calendar-events'); ?></a>
294 294
 				</p>
295 295
 				<?php
296 296
 
@@ -319,31 +319,31 @@  discard block
 block discarded – undo
319 319
 
320 320
 		$contributors = $this->get_contributors();
321 321
 
322
-		if ( empty( $contributors ) ) {
322
+		if (empty($contributors)) {
323 323
 			return '';
324 324
 		}
325 325
 
326 326
 		$contributor_list = '<ul class="wp-people-group">';
327 327
 
328
-		foreach ( $contributors as $contributor ) {
328
+		foreach ($contributors as $contributor) {
329 329
 
330 330
 			// Skip contributor bots
331
-			$contributor_bots = array( 'gitter-badger' );
332
-			if ( in_array( $contributor->login, $contributor_bots ) ) {
331
+			$contributor_bots = array('gitter-badger');
332
+			if (in_array($contributor->login, $contributor_bots)) {
333 333
 				continue;
334 334
 			}
335 335
 
336 336
 			$contributor_list .= '<li class="wp-person">';
337 337
 			$contributor_list .= sprintf(
338 338
 				'<a href="%s" title="%s" target="_blank">%s</a>',
339
-				esc_url( 'https://github.com/' . $contributor->login ),
340
-				esc_html( sprintf( __( 'View %s', 'google-calendar-events' ), $contributor->login ) ),
341
-				sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) )
339
+				esc_url('https://github.com/'.$contributor->login),
340
+				esc_html(sprintf(__('View %s', 'google-calendar-events'), $contributor->login)),
341
+				sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login))
342 342
 			);
343 343
 			$contributor_list .= sprintf(
344 344
 				'<a class="web" href="%s" target="_blank">%s</a>',
345
-				esc_url( 'https://github.com/' . $contributor->login ),
346
-				esc_html( $contributor->login )
345
+				esc_url('https://github.com/'.$contributor->login),
346
+				esc_html($contributor->login)
347 347
 			);
348 348
 			$contributor_list .= '</li>';
349 349
 
@@ -363,24 +363,24 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	public function get_contributors() {
365 365
 
366
-		$contributors = get_transient( '_simple-calendar_contributors' );
367
-		if ( false !== $contributors ) {
366
+		$contributors = get_transient('_simple-calendar_contributors');
367
+		if (false !== $contributors) {
368 368
 			return $contributors;
369 369
 		}
370 370
 
371 371
 		$response = wp_safe_remote_get(
372 372
 			'https://api.github.com/repos/moonstonemedia/Simple-Calendar/contributors'
373 373
 		);
374
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
374
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
375 375
 			return array();
376 376
 		}
377 377
 
378
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
379
-		if ( ! is_array( $contributors ) ) {
378
+		$contributors = json_decode(wp_remote_retrieve_body($response));
379
+		if ( ! is_array($contributors)) {
380 380
 			return array();
381 381
 		}
382 382
 
383
-		set_transient( '_simple-calendar_contributors', $contributors, HOUR_IN_SECONDS );
383
+		set_transient('_simple-calendar_contributors', $contributors, HOUR_IN_SECONDS);
384 384
 
385 385
 		return $contributors;
386 386
 	}
Please login to merge, or discard this patch.