Completed
Push — master ( 62b222...3fdac6 )
by
unknown
07:01
created
google-calendar-events.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,24 +14,24 @@  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
 // Plugin constants.
22
-$this_plugin_path      = trailingslashit( dirname( __FILE__ ) );
23
-$this_plugin_dir       = plugin_dir_url( __FILE__ );
22
+$this_plugin_path      = trailingslashit(dirname(__FILE__));
23
+$this_plugin_dir       = plugin_dir_url(__FILE__);
24 24
 $this_plugin_constants = array(
25 25
 	'SIMPLE_CALENDAR_VERSION'   => '3.0.15',
26 26
 	'SIMPLE_CALENDAR_MAIN_FILE' => __FILE__,
27 27
 	'SIMPLE_CALENDAR_URL'       => $this_plugin_dir,
28
-	'SIMPLE_CALENDAR_ASSETS'    => $this_plugin_dir . 'assets/',
28
+	'SIMPLE_CALENDAR_ASSETS'    => $this_plugin_dir.'assets/',
29 29
 	'SIMPLE_CALENDAR_PATH'      => $this_plugin_path,
30
-	'SIMPLE_CALENDAR_INC'       => $this_plugin_path . 'includes/',
30
+	'SIMPLE_CALENDAR_INC'       => $this_plugin_path.'includes/',
31 31
 );
32
-foreach ( $this_plugin_constants as $constant => $value ) {
33
-	if ( ! defined( $constant ) ) {
34
-		define( $constant, $value );
32
+foreach ($this_plugin_constants as $constant => $value) {
33
+	if ( ! defined($constant)) {
34
+		define($constant, $value);
35 35
 	}
36 36
 }
37 37
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 include_once 'includes/wp-requirements.php';
41 41
 
42 42
 // Check plugin requirements before loading plugin.
43
-$this_plugin_checks = new SimCal_WP_Requirements( 'Simple Calendar', plugin_basename( __FILE__ ), array(
43
+$this_plugin_checks = new SimCal_WP_Requirements('Simple Calendar', plugin_basename(__FILE__), array(
44 44
 		'PHP'        => '5.3.3',
45 45
 		'WordPress'  => '4.1',
46 46
 		'Extensions' => array(
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 			'json',
50 50
 			'mbstring',
51 51
 		),
52
-	) );
53
-if ( $this_plugin_checks->pass() === false ) {
52
+	));
53
+if ($this_plugin_checks->pass() === false) {
54 54
 	$this_plugin_checks->halt();
55 55
 
56 56
 	return;
Please login to merge, or discard this patch.
includes/browser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -353,9 +353,9 @@
 block discarded – undo
353 353
          */
354 354
         public function __toString()
355 355
         {
356
-            return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" .
357
-            "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" .
358
-            "<strong>Browser User Agent String:</strong> {$this->getUserAgent()}<br/>\n" .
356
+            return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n".
357
+            "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n".
358
+            "<strong>Browser User Agent String:</strong> {$this->getUserAgent()}<br/>\n".
359 359
             "<strong>Platform:</strong> {$this->getPlatform()}<br/>";
360 360
         }
361 361
 
Please login to merge, or discard this patch.
includes/feeds/grouped-calendars.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use SimpleCalendar\Abstracts\Feed;
11 11
 use SimpleCalendar\Feeds\Admin\Grouped_Calendars_Admin;
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param string|Calendar $calendar
40 40
 	 */
41
-	public function __construct( $calendar = '' ) {
41
+	public function __construct($calendar = '') {
42 42
 
43
-		parent::__construct( $calendar );
43
+		parent::__construct($calendar);
44 44
 
45 45
 		$this->type = 'grouped-calendars';
46
-		$this->name = __( 'Grouped Calendar', 'google-calendar-events' );
46
+		$this->name = __('Grouped Calendar', 'google-calendar-events');
47 47
 
48
-		if ( $this->post_id > 0 ) {
48
+		if ($this->post_id > 0) {
49 49
 			$this->set_source();
50
-			if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
50
+			if ( ! is_admin() || defined('DOING_AJAX')) {
51 51
 				$this->events = $this->get_events();
52 52
 			}
53 53
 		}
54 54
 
55
-		if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
56
-			new Grouped_Calendars_Admin( $this );
55
+		if (is_admin() && ! defined('DOING_AJAX')) {
56
+			new Grouped_Calendars_Admin($this);
57 57
 		}
58 58
 	}
59 59
 
@@ -64,38 +64,38 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param array $ids Array of calendar ids.
66 66
 	 */
67
-	public function set_source( $ids = array() ) {
67
+	public function set_source($ids = array()) {
68 68
 
69
-		$source = get_post_meta( $this->post_id, '_grouped_calendars_source', true );
69
+		$source = get_post_meta($this->post_id, '_grouped_calendars_source', true);
70 70
 
71
-		if ( 'ids' == $source ) {
71
+		if ('ids' == $source) {
72 72
 
73
-			if ( empty( $ids ) ) {
74
-				$ids = get_post_meta( $this->post_id, '_grouped_calendars_ids', true );
73
+			if (empty($ids)) {
74
+				$ids = get_post_meta($this->post_id, '_grouped_calendars_ids', true);
75 75
 			}
76 76
 
77
-			$this->calendars_ids = ! empty( $ids ) && is_array( $ids ) ? array_map( 'absint', $ids ) : array();
77
+			$this->calendars_ids = ! empty($ids) && is_array($ids) ? array_map('absint', $ids) : array();
78 78
 
79
-		} elseif ( 'category' == $source ) {
79
+		} elseif ('category' == $source) {
80 80
 
81
-			$categories = get_post_meta( $this->post_id, '_grouped_calendars_category', true );
81
+			$categories = get_post_meta($this->post_id, '_grouped_calendars_category', true);
82 82
 
83
-			if ( $categories && is_array( $categories ) ) {
83
+			if ($categories && is_array($categories)) {
84 84
 
85 85
 				$tax_query = array(
86 86
 					'taxonomy' => 'calendar_category',
87 87
 					'field'    => 'term_id',
88
-					'terms'    => array_map( 'absint', $categories ),
88
+					'terms'    => array_map('absint', $categories),
89 89
 				);
90 90
 
91
-				$calendars = get_posts( array(
91
+				$calendars = get_posts(array(
92 92
 					'post_type' => 'calendar',
93
-					'tax_query' => array( $tax_query ),
93
+					'tax_query' => array($tax_query),
94 94
 					'nopaging'  => true,
95 95
 					'fields'    => 'ids',
96
-				) );
96
+				));
97 97
 
98
-				$this->calendars_ids = ! empty( $calendars ) && is_array( $calendars ) ? $calendars : array();
98
+				$this->calendars_ids = ! empty($calendars) && is_array($calendars) ? $calendars : array();
99 99
 			}
100 100
 
101 101
 		}
@@ -111,57 +111,57 @@  discard block
 block discarded – undo
111 111
 	public function get_events() {
112 112
 
113 113
 		$ids    = $this->calendars_ids;
114
-		$events = get_transient( '_simple-calendar_feed_id_' . strval( $this->post_id ) . '_' . $this->type );
114
+		$events = get_transient('_simple-calendar_feed_id_'.strval($this->post_id).'_'.$this->type);
115 115
 
116
-		if ( empty( $events ) && ! empty( $ids ) && is_array( $ids ) ) {
116
+		if (empty($events) && ! empty($ids) && is_array($ids)) {
117 117
 
118 118
 			$events = array();
119 119
 
120
-			foreach ( $ids as $cal_id ) {
120
+			foreach ($ids as $cal_id) {
121 121
 
122
-				$calendar = simcal_get_calendar( intval( $cal_id ) );
122
+				$calendar = simcal_get_calendar(intval($cal_id));
123 123
 
124
-				simcal_delete_feed_transients( $cal_id );
124
+				simcal_delete_feed_transients($cal_id);
125 125
 
126
-				if ( $calendar instanceof Calendar ) {
126
+				if ($calendar instanceof Calendar) {
127 127
 
128 128
 					// Sometimes the calendars might have events at the same time from different calendars
129 129
 					// When merging the arrays together some of the events will be lost because the keys are the same and one will overwrite the other
130 130
 					// This snippet checks if the key already exists in the master events array and if it does it subtracts 1 from it to make the key unique and then unsets the original key.
131
-					foreach( $calendar->events as $k => $v ) {
132
-						$calendar->events[ $this->update_array_timestamp( $events, $k ) ] = $v;
131
+					foreach ($calendar->events as $k => $v) {
132
+						$calendar->events[$this->update_array_timestamp($events, $k)] = $v;
133 133
 					}
134 134
 
135
-					$events = is_array( $calendar->events ) ? $events + $calendar->events : $events;
135
+					$events = is_array($calendar->events) ? $events + $calendar->events : $events;
136 136
 				}
137 137
 
138 138
 			}
139 139
 
140
-			if ( ! empty( $events ) ) {
140
+			if ( ! empty($events)) {
141 141
 
142 142
 				// Trim events to set the earliest one as specified in feed settings.
143
-				$earliest_event = intval( $this->time_min );
144
-				if ( $earliest_event > 0 ) {
145
-					$events = $this->array_filter_key( $events, array( $this, 'filter_events_before' ) );
143
+				$earliest_event = intval($this->time_min);
144
+				if ($earliest_event > 0) {
145
+					$events = $this->array_filter_key($events, array($this, 'filter_events_before'));
146 146
 				}
147 147
 
148 148
 				// Trim events to set the latest one as specified in feed settings.
149
-				$latest_event = intval( $this->time_max );
150
-				if ( $latest_event > 0 ) {
151
-					$events = $this->array_filter_key( $events, array( $this, 'filter_events_after' ) );
149
+				$latest_event = intval($this->time_max);
150
+				if ($latest_event > 0) {
151
+					$events = $this->array_filter_key($events, array($this, 'filter_events_after'));
152 152
 				}
153 153
 
154 154
 				set_transient(
155
-					'_simple-calendar_feed_id_' . strval( $this->post_id ) . '_' . $this->type,
155
+					'_simple-calendar_feed_id_'.strval($this->post_id).'_'.$this->type,
156 156
 					$events,
157
-					absint( $this->cache )
157
+					absint($this->cache)
158 158
 				);
159 159
 			}
160 160
 
161 161
 		}
162 162
 	
163 163
 		// Sort events by start time before returning
164
-		uasort( $events, array( $this, 'sort_by_start_time' ) );
164
+		uasort($events, array($this, 'sort_by_start_time'));
165 165
 
166 166
 		return $events;
167 167
 	}
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 	/*
170 170
 	 * Recursive function to adjust the timestamp array indices that are the same.
171 171
 	 */
172
-	public function update_array_timestamp( $arr, $i ) {
172
+	public function update_array_timestamp($arr, $i) {
173 173
 
174
-		if ( array_key_exists( $i, $arr ) ) {
175
-			$i = $this->update_array_timestamp( $arr, $i - 1 );
174
+		if (array_key_exists($i, $arr)) {
175
+			$i = $this->update_array_timestamp($arr, $i - 1);
176 176
 		}
177 177
 
178 178
 		return $i;
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 	 * @since  3.0.13
185 185
 	 * @access private
186 186
 	 */
187
-	private function sort_by_start_time( $a, $b ) {
188
-		if ( $a == $b ) {
187
+	private function sort_by_start_time($a, $b) {
188
+		if ($a == $b) {
189 189
 			return 0;
190 190
 		}
191 191
 
192
-		return ( $a[0]->start < $b[0]->start ) ? -1 : 1;
192
+		return ($a[0]->start < $b[0]->start) ? -1 : 1;
193 193
 	}
194 194
 
195 195
 
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return array
209 209
 	 */
210
-	private function array_filter_key( array $array, $callback ) {
211
-		$matched_keys = array_filter( array_keys( $array ), $callback );
212
-		return array_intersect_key( $array, array_flip( $matched_keys ) );
210
+	private function array_filter_key(array $array, $callback) {
211
+		$matched_keys = array_filter(array_keys($array), $callback);
212
+		return array_intersect_key($array, array_flip($matched_keys));
213 213
 	}
214 214
 
215 215
 	/**
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @return bool
224 224
 	 */
225
-	private function filter_events_before( $event ) {
226
-		if ( $this->time_min !== 0 ) {
227
-			return intval( $event ) > intval( $this->time_min );
225
+	private function filter_events_before($event) {
226
+		if ($this->time_min !== 0) {
227
+			return intval($event) > intval($this->time_min);
228 228
 		}
229 229
 		return true;
230 230
 	}
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return bool
241 241
 	 */
242
-	private function filter_events_after( $event ) {
243
-		if ( $this->time_max !== 0 ) {
244
-			return intval( $event ) < intval( $this->time_max );
242
+	private function filter_events_after($event) {
243
+		if ($this->time_max !== 0) {
244
+			return intval($event) < intval($this->time_max);
245 245
 		}
246 246
 		return true;
247 247
 	}
Please login to merge, or discard this patch.
includes/objects.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts as Object;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
 	public function __construct() {
32 32
 
33 33
 		// Add default feed type.
34
-		add_filter( 'simcal_get_feed_types', function( $feed_types ) {
35
-			return array_merge( $feed_types, array(
34
+		add_filter('simcal_get_feed_types', function($feed_types) {
35
+			return array_merge($feed_types, array(
36 36
 				'google',
37 37
 				'grouped-calendars',
38
-			) );
39
-		}, 10, 1 );
38
+			));
39
+		}, 10, 1);
40 40
 
41 41
 		// Add default calendar type.
42
-		add_filter( 'simcal_get_calendar_types', function( $calendar_types ) {
43
-			return array_merge( $calendar_types, array(
42
+		add_filter('simcal_get_calendar_types', function($calendar_types) {
43
+			return array_merge($calendar_types, array(
44 44
 				'default-calendar' => array(
45 45
 					'grid',
46 46
 					'list',
47 47
 				),
48
-			) );
49
-		}, 10, 1 );
48
+			));
49
+		}, 10, 1);
50 50
 
51 51
 		// Add default admin objects.
52
-		if ( $is_admin = is_admin() ) {
53
-			add_filter( 'simcal_get_admin_pages', function( $admin_pages ) {
54
-				return array_merge( $admin_pages, array(
52
+		if ($is_admin = is_admin()) {
53
+			add_filter('simcal_get_admin_pages', function($admin_pages) {
54
+				return array_merge($admin_pages, array(
55 55
 					'add-ons' => array(
56 56
 						'add-ons',
57 57
 					),
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 					'tools' => array(
64 64
 						'system-status',
65 65
 					),
66
-				) );
67
-			}, 10, 1 );
66
+				));
67
+			}, 10, 1);
68 68
 		}
69 69
 
70
-		do_action( 'simcal_load_objects', $is_admin );
70
+		do_action('simcal_load_objects', $is_admin);
71 71
 	}
72 72
 
73 73
 	/**
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 * @return array
79 79
 	 */
80 80
 	public function get_feed_types() {
81
-		$array = apply_filters( 'simcal_get_feed_types', array() );
82
-		ksort( $array );
81
+		$array = apply_filters('simcal_get_feed_types', array());
82
+		ksort($array);
83 83
 		return $array;
84 84
 	}
85 85
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 	 * @return array
92 92
 	 */
93 93
 	public function get_calendar_types() {
94
-		$array = apply_filters( 'simcal_get_calendar_types', array() );
95
-		ksort( $array );
94
+		$array = apply_filters('simcal_get_calendar_types', array());
95
+		ksort($array);
96 96
 		return $array;
97 97
 	}
98 98
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @return array
105 105
 	 */
106 106
 	public function get_admin_pages() {
107
-		return apply_filters( 'simcal_get_admin_pages', array() );
107
+		return apply_filters('simcal_get_admin_pages', array());
108 108
 	}
109 109
 
110 110
 	/**
@@ -118,30 +118,30 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return null|Object\Calendar
120 120
 	 */
121
-	public function get_calendar( $object ) {
121
+	public function get_calendar($object) {
122 122
 
123
-		if ( is_string( $object ) ) {
124
-			return ! empty( $object ) ? $this->get_object( $object, 'calendar', '' ) : null;
123
+		if (is_string($object)) {
124
+			return ! empty($object) ? $this->get_object($object, 'calendar', '') : null;
125 125
 		}
126 126
 
127
-		if ( is_object( $object ) ) {
128
-			if ( $object instanceof Object\Calendar ) {
129
-				return $this->get_object( $object->type, 'feed', $object );
130
-			} elseif ( $object instanceof \WP_Post ) {
131
-				if ( $type = wp_get_object_terms( $object->ID, 'calendar_type' ) ) {
132
-					$name = sanitize_title( current( $type )->name );
133
-					return $this->get_object( $name, 'calendar', $object );
127
+		if (is_object($object)) {
128
+			if ($object instanceof Object\Calendar) {
129
+				return $this->get_object($object->type, 'feed', $object);
130
+			} elseif ($object instanceof \WP_Post) {
131
+				if ($type = wp_get_object_terms($object->ID, 'calendar_type')) {
132
+					$name = sanitize_title(current($type)->name);
133
+					return $this->get_object($name, 'calendar', $object);
134 134
 				}
135
-			} elseif ( isset( $object->type ) && isset( $object->id ) ) {
136
-				return $this->get_object( $object->type, 'calendar', $object->id );
135
+			} elseif (isset($object->type) && isset($object->id)) {
136
+				return $this->get_object($object->type, 'calendar', $object->id);
137 137
 			}
138 138
 		}
139 139
 
140
-		if ( is_int( $object ) ) {
141
-			$post = get_post( $object );
142
-			if ( $post && ( $type = wp_get_object_terms( $post->ID, 'calendar_type' ) ) ) {
143
-				$name = sanitize_title( current( $type )->name );
144
-				return $this->get_object( $name, 'calendar', $post );
140
+		if (is_int($object)) {
141
+			$post = get_post($object);
142
+			if ($post && ($type = wp_get_object_terms($post->ID, 'calendar_type'))) {
143
+				$name = sanitize_title(current($type)->name);
144
+				return $this->get_object($name, 'calendar', $post);
145 145
 			}
146 146
 		}
147 147
 
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
 	 *
159 159
 	 * @return null|Object\Calendar_View
160 160
 	 */
161
-	public function get_calendar_view( $id = 0, $name = '' ) {
161
+	public function get_calendar_view($id = 0, $name = '') {
162 162
 
163
-		if ( ! $name && $id > 0 ) {
163
+		if ( ! $name && $id > 0) {
164 164
 
165
-			$calendar_view = get_post_meta( $id, '_calendar_view', true );
165
+			$calendar_view = get_post_meta($id, '_calendar_view', true);
166 166
 
167
-			if ( $terms = wp_get_object_terms( $id, 'calendar_type' ) ) {
168
-				$calendar_type = sanitize_title( current( $terms )->name );
169
-				$name = isset( $calendar_view[ $calendar_type ] ) ? $calendar_type . '-' . $calendar_view[ $calendar_type ] : '';
167
+			if ($terms = wp_get_object_terms($id, 'calendar_type')) {
168
+				$calendar_type = sanitize_title(current($terms)->name);
169
+				$name = isset($calendar_view[$calendar_type]) ? $calendar_type.'-'.$calendar_view[$calendar_type] : '';
170 170
 			}
171 171
 
172 172
 		}
173 173
 
174
-		return $name ? $this->get_object( $name, 'calendar-view', '' ) : null;
174
+		return $name ? $this->get_object($name, 'calendar-view', '') : null;
175 175
 	}
176 176
 
177 177
 	/**
@@ -185,41 +185,41 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return null|Object\Feed
187 187
 	 */
188
-	public function get_feed( $object ) {
188
+	public function get_feed($object) {
189 189
 
190
-		if ( is_string( $object ) ) {
191
-			return ! empty( $object ) ? $this->get_object( $object, 'feed', '' ) : null;
190
+		if (is_string($object)) {
191
+			return ! empty($object) ? $this->get_object($object, 'feed', '') : null;
192 192
 		}
193 193
 
194
-		if ( is_object( $object ) ) {
195
-			if ( $object instanceof Object\Calendar ) {
194
+		if (is_object($object)) {
195
+			if ($object instanceof Object\Calendar) {
196 196
 				$feed_name = '';
197
-				if ( empty( $object->feed ) ) {
198
-					if ( $feed_type = wp_get_object_terms( $object->id, 'feed_type' ) ) {
199
-						$feed_name = sanitize_title( current( $feed_type )->name );
197
+				if (empty($object->feed)) {
198
+					if ($feed_type = wp_get_object_terms($object->id, 'feed_type')) {
199
+						$feed_name = sanitize_title(current($feed_type)->name);
200 200
 					}
201 201
 				} else {
202 202
 					$feed_name = $object->feed;
203 203
 				}
204
-				return $this->get_object( $feed_name, 'feed', $object );
205
-			} elseif ( $object instanceof \WP_Post ) {
206
-				$calendar = $this->get_calendar( $object );
204
+				return $this->get_object($feed_name, 'feed', $object);
205
+			} elseif ($object instanceof \WP_Post) {
206
+				$calendar = $this->get_calendar($object);
207 207
 
208
-				if ( isset( $calendar->feed ) ) {
209
-					return $this->get_object( $calendar->feed, 'feed', $calendar );
208
+				if (isset($calendar->feed)) {
209
+					return $this->get_object($calendar->feed, 'feed', $calendar);
210 210
 				} else {
211 211
 					return null;
212 212
 				}
213 213
 
214 214
 
215
-			} elseif ( isset( $object->feed ) && isset( $object->id ) ) {
216
-				return $this->get_object( $object->feed, 'feed', $object );
215
+			} elseif (isset($object->feed) && isset($object->id)) {
216
+				return $this->get_object($object->feed, 'feed', $object);
217 217
 			}
218 218
 		}
219 219
 
220
-		if ( is_int( $object ) ) {
221
-			$calendar = $this->get_calendar( $object );
222
-			return isset( $calendar->feed ) ? $this->get_object( $calendar->feed, 'feed', $calendar ) : null;
220
+		if (is_int($object)) {
221
+			$calendar = $this->get_calendar($object);
222
+			return isset($calendar->feed) ? $this->get_object($calendar->feed, 'feed', $calendar) : null;
223 223
 		}
224 224
 
225 225
 		return null;
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @return null|Object\Field
237 237
 	 */
238
-	public function get_field( $args, $name = '' ) {
238
+	public function get_field($args, $name = '') {
239 239
 
240
-		if ( empty( $name ) ) {
241
-			$name = isset( $args['type'] ) ? $args['type'] : false;
240
+		if (empty($name)) {
241
+			$name = isset($args['type']) ? $args['type'] : false;
242 242
 		}
243 243
 
244
-		return $name ? $this->get_object( $name, 'field', $args ) : null;
244
+		return $name ? $this->get_object($name, 'field', $args) : null;
245 245
 	}
246 246
 
247 247
 	/**
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return null|Object\Admin_Page
255 255
 	 */
256
-	public function get_admin_page( $name ) {
257
-		return $name ? $this->get_object( $name, 'admin-page' ) : null;
256
+	public function get_admin_page($name) {
257
+		return $name ? $this->get_object($name, 'admin-page') : null;
258 258
 	}
259 259
 
260 260
 	/**
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return null|Object
271 271
 	 */
272
-	private function get_object( $name, $type, $args = '' ) {
272
+	private function get_object($name, $type, $args = '') {
273 273
 
274 274
 		$types = array(
275 275
 			'admin-page',
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
 			'field',
280 280
 		);
281 281
 
282
-		if ( in_array( $type, $types ) ) {
282
+		if (in_array($type, $types)) {
283 283
 
284
-			$class_name = $this->make_class_name( $name, $type );
285
-			$parent     = '\\' . __NAMESPACE__ . '\Abstracts\\' . implode( '_', array_map( 'ucfirst', explode( '-', $type ) ) );
286
-			$class      = class_exists( $class_name ) ? new $class_name( $args ) : false;
284
+			$class_name = $this->make_class_name($name, $type);
285
+			$parent     = '\\'.__NAMESPACE__.'\Abstracts\\'.implode('_', array_map('ucfirst', explode('-', $type)));
286
+			$class      = class_exists($class_name) ? new $class_name($args) : false;
287 287
 
288 288
 			return $class instanceof $parent ? $class : null;
289 289
 		}
@@ -305,25 +305,25 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * @return string The class name complete with its full namespace.
307 307
 	 */
308
-	private function make_class_name( $name, $type ) {
309
-
310
-		if ( 'calendar' == $type ) {
311
-			$namespace = '\\' . __NAMESPACE__ . '\Calendars\\';
312
-		} elseif ( 'calendar-view' == $type ) {
313
-			$namespace = '\\' . __NAMESPACE__ . '\Calendars\Views\\';
314
-		} elseif ( 'feed' == $type ) {
315
-			$namespace = '\\' . __NAMESPACE__ . '\Feeds\\';
316
-		} elseif ( 'field' == $type ) {
317
-			$namespace = '\\' . __NAMESPACE__ . '\Admin\Fields\\';
318
-		} elseif ( 'admin-page' == $type ) {
319
-			$namespace = '\\' . __NAMESPACE__ . '\Admin\Pages\\';
308
+	private function make_class_name($name, $type) {
309
+
310
+		if ('calendar' == $type) {
311
+			$namespace = '\\'.__NAMESPACE__.'\Calendars\\';
312
+		} elseif ('calendar-view' == $type) {
313
+			$namespace = '\\'.__NAMESPACE__.'\Calendars\Views\\';
314
+		} elseif ('feed' == $type) {
315
+			$namespace = '\\'.__NAMESPACE__.'\Feeds\\';
316
+		} elseif ('field' == $type) {
317
+			$namespace = '\\'.__NAMESPACE__.'\Admin\Fields\\';
318
+		} elseif ('admin-page' == $type) {
319
+			$namespace = '\\'.__NAMESPACE__.'\Admin\Pages\\';
320 320
 		} else {
321 321
 			return '';
322 322
 		}
323 323
 
324
-		$class_name = implode( '_', array_map( 'ucfirst', explode( '-', $name ) ) );
324
+		$class_name = implode('_', array_map('ucfirst', explode('-', $name)));
325 325
 
326
-		return $namespace . $class_name;
326
+		return $namespace.$class_name;
327 327
 	}
328 328
 
329 329
 }
Please login to merge, or discard this patch.
includes/feeds/admin/google-admin.php 1 patch
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use SimpleCalendar\Admin\Notice;
11 11
 use SimpleCalendar\Feeds\Google;
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param string $google_api_key
55 55
 	 * @param string $google_calendar_id
56 56
 	 */
57
-	public function __construct( Google $feed, $google_api_key, $google_calendar_id ) {
57
+	public function __construct(Google $feed, $google_api_key, $google_calendar_id) {
58 58
 
59 59
 		$this->feed = $feed;
60 60
 		$this->google_api_key = $google_api_key;
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 
63 63
 		$screen = simcal_is_admin_screen();
64 64
 
65
-		if ( 'calendar' == $screen ) {
66
-			$this->test_api_key_connection( $this->google_calendar_id );
67
-			add_filter( 'simcal_settings_meta_tabs_li', array( $this, 'add_settings_meta_tab_li' ), 10, 1 );
68
-			add_action( 'simcal_settings_meta_panels', array( $this, 'add_settings_meta_panel' ), 10, 1 );
65
+		if ('calendar' == $screen) {
66
+			$this->test_api_key_connection($this->google_calendar_id);
67
+			add_filter('simcal_settings_meta_tabs_li', array($this, 'add_settings_meta_tab_li'), 10, 1);
68
+			add_action('simcal_settings_meta_panels', array($this, 'add_settings_meta_panel'), 10, 1);
69 69
 		}
70 70
 
71
-		add_action( 'simcal_process_settings_meta', array( $this, 'process_meta' ), 10, 1 );
71
+		add_action('simcal_process_settings_meta', array($this, 'process_meta'), 10, 1);
72 72
 	}
73 73
 
74 74
 	/**
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
 	public function settings_fields() {
82 82
 		return array(
83 83
 			'name' => $this->feed->name,
84
-			'description' => __( "To read events from your public Google Calendars you'll need create a Google API key and save it here.", 'google-calendar-events' ) .
85
-			                 '<br/><br/>' .
86
-			                 '<em style="font-size: 14px;">' .
87
-			                 sprintf( __( '<strong>Note:</strong> Calendars configured to use the <strong><a href="%s" target="_blank">Google Calendar Pro add-on</a></strong> use a different method of authorization.', 'google-calendar-events' ),
88
-				                 simcal_ga_campaign_url( simcal_get_url( 'gcal-pro' ), 'core-plugin', 'settings-link' )
89
-			                 ) .
84
+			'description' => __("To read events from your public Google Calendars you'll need create a Google API key and save it here.", 'google-calendar-events').
85
+			                 '<br/><br/>'.
86
+			                 '<em style="font-size: 14px;">'.
87
+			                 sprintf(__('<strong>Note:</strong> Calendars configured to use the <strong><a href="%s" target="_blank">Google Calendar Pro add-on</a></strong> use a different method of authorization.', 'google-calendar-events'),
88
+				                 simcal_ga_campaign_url(simcal_get_url('gcal-pro'), 'core-plugin', 'settings-link')
89
+			                 ).
90 90
 			                 '</em>',
91 91
 			'fields' => array(
92 92
 				'api_key' => array(
93 93
 					'type'       => 'standard',
94 94
 					'subtype'    => 'text',
95
-					'class'      => array( 'simcal-wide-text regular-text', 'ltr' ),
96
-					'title'      => __( 'Google API Key', 'google-calendar-events' ),
97
-					'validation' => array( $this, 'check_google_api_key' ),
95
+					'class'      => array('simcal-wide-text regular-text', 'ltr'),
96
+					'title'      => __('Google API Key', 'google-calendar-events'),
97
+					'validation' => array($this, 'check_google_api_key'),
98 98
 				),
99 99
 			),
100 100
 		);
@@ -113,27 +113,27 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return true|string
115 115
 	 */
116
-	public function check_google_api_key( $api_key = '' ) {
116
+	public function check_google_api_key($api_key = '') {
117 117
 
118 118
 		$message    = '';
119 119
 		$has_errors = false;
120 120
 
121
-		if ( empty( $api_key ) ){
121
+		if (empty($api_key)) {
122 122
 			$api_key = $this->google_api_key;
123
-			if ( empty( $api_key ) ) {
124
-				$settings = get_option( 'simple-calendar_settings_feeds' );
125
-				$api_key = isset( $settings['google']['api_key'] ) ? esc_attr( $settings['google']['api_key'] ) : '';
123
+			if (empty($api_key)) {
124
+				$settings = get_option('simple-calendar_settings_feeds');
125
+				$api_key = isset($settings['google']['api_key']) ? esc_attr($settings['google']['api_key']) : '';
126 126
 			}
127 127
 		}
128 128
 
129
-		$message = '<p class="description">' .
130
-				   sprintf( __( '<a href="%s" target="_blank">Step-by-step instructions</a> ', 'google-calendar-events' ),
131
-					   simcal_ga_campaign_url( simcal_get_url( 'docs' ) . '/google-api-key/', 'core-plugin', 'settings-link' )
132
-				   ) .
133
-				   '<br/>' .
134
-				   sprintf( __( '<a href="%s" target="_blank">Google Developers Console</a> ', 'google-calendar-events' ),
135
-					   simcal_get_url( 'gdev-console' )
136
-				   ) .
129
+		$message = '<p class="description">'.
130
+				   sprintf(__('<a href="%s" target="_blank">Step-by-step instructions</a> ', 'google-calendar-events'),
131
+					   simcal_ga_campaign_url(simcal_get_url('docs').'/google-api-key/', 'core-plugin', 'settings-link')
132
+				   ).
133
+				   '<br/>'.
134
+				   sprintf(__('<a href="%s" target="_blank">Google Developers Console</a> ', 'google-calendar-events'),
135
+					   simcal_get_url('gdev-console')
136
+				   ).
137 137
 				   '</p>';
138 138
 
139 139
 		return $message;
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return array
150 150
 	 */
151
-	public function add_settings_meta_tab_li( $tabs ) {
152
-		return array_merge( $tabs, array(
151
+	public function add_settings_meta_tab_li($tabs) {
152
+		return array_merge($tabs, array(
153 153
 			'google' => array(
154 154
 				'label'   => $this->feed->name,
155 155
 				'target'  => 'google-settings-panel',
156
-				'class'   => array( 'simcal-feed-type', 'simcal-feed-type-google' ),
156
+				'class'   => array('simcal-feed-type', 'simcal-feed-type-google'),
157 157
 				'icon'    => 'simcal-icon-google',
158 158
 			),
159
-		) );
159
+		));
160 160
 	}
161 161
 
162 162
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @param int $post_id
168 168
 	 */
169
-	public function add_settings_meta_panel( $post_id ) {
169
+	public function add_settings_meta_panel($post_id) {
170 170
 
171 171
 		$inputs = array(
172 172
 			$this->feed->type => array(
@@ -175,30 +175,30 @@  discard block
 block discarded – undo
175 175
 					'subtype'     => 'text',
176 176
 					'name'        => '_google_calendar_id',
177 177
 					'id'          => '_google_calendar_id',
178
-					'title'       => __( 'Calendar ID', 'google-calendar-events' ),
179
-					'tooltip'     => __( 'Visit your Google Calendar account, copy your public calendar ID, then paste it here.', 'google-calendar-events' ),
180
-					'placeholder' => __( 'Enter a valid Google Calendar ID from a public calendar', 'google-calendar-events' ),
181
-					'escaping'    => array( $this->feed, 'esc_google_calendar_id' ),
182
-					'validation'  => array( $this, 'test_api_key_connection' ),
178
+					'title'       => __('Calendar ID', 'google-calendar-events'),
179
+					'tooltip'     => __('Visit your Google Calendar account, copy your public calendar ID, then paste it here.', 'google-calendar-events'),
180
+					'placeholder' => __('Enter a valid Google Calendar ID from a public calendar', 'google-calendar-events'),
181
+					'escaping'    => array($this->feed, 'esc_google_calendar_id'),
182
+					'validation'  => array($this, 'test_api_key_connection'),
183 183
 				),
184 184
 				'_google_events_search_query' => array(
185 185
 					'type'        => 'standard',
186 186
 					'subtype'     => 'text',
187 187
 					'name'        => '_google_events_search_query',
188 188
 					'id'          => '_google_events_search_query',
189
-					'title'       => __( 'Search Query', 'google-calendar-events' ),
190
-					'tooltip'     => __( 'Type in keywords if you only want display events that match these terms. You can use basic boolean search operators too.', 'google-calendar-events' ),
191
-					'placeholder' => __( 'Filter events to display by search terms...', 'google-calendar-events' ),
189
+					'title'       => __('Search Query', 'google-calendar-events'),
190
+					'tooltip'     => __('Type in keywords if you only want display events that match these terms. You can use basic boolean search operators too.', 'google-calendar-events'),
191
+					'placeholder' => __('Filter events to display by search terms...', 'google-calendar-events'),
192 192
 				),
193 193
 				'_google_events_recurring' => array(
194 194
 					'type'    => 'select',
195 195
 					'name'    => '_google_events_recurring',
196 196
 					'id'      => '_google_events_recurring',
197
-					'title'   => __( 'Recurring Events', 'google-calendar-events' ),
198
-					'tooltip' => __( 'Events that are programmed to repeat themselves periodically.', 'google-calendar-events' ),
197
+					'title'   => __('Recurring Events', 'google-calendar-events'),
198
+					'tooltip' => __('Events that are programmed to repeat themselves periodically.', 'google-calendar-events'),
199 199
 					'options' => array(
200
-						'show' => __( 'Show all', 'google-calendar-events' ),
201
-						'first-only' => __( 'Only show first occurrence', 'google-calendar-events' ),
200
+						'show' => __('Show all', 'google-calendar-events'),
201
+						'first-only' => __('Only show first occurrence', 'google-calendar-events'),
202 202
 					),
203 203
 				),
204 204
 				'_google_events_max_results' => array(
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 					'subtype'     => 'number',
207 207
 					'name'        => '_google_events_max_results',
208 208
 					'id'          => '_google_events_max_results',
209
-					'title'       => __( 'Maximum Events', 'google-calendar-events' ),
210
-					'tooltip'     => __( 'Google Calendar only allows to query for a maximum amount of 2500 events from a calendar each time.', 'google-calendar-events' ),
209
+					'title'       => __('Maximum Events', 'google-calendar-events'),
210
+					'tooltip'     => __('Google Calendar only allows to query for a maximum amount of 2500 events from a calendar each time.', 'google-calendar-events'),
211 211
 					'class'       => array(
212 212
 						'simcal-field-small',
213 213
 					),
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 		<div id="google-settings-panel" class="simcal-panel">
225 225
 			<table>
226 226
 				<thead>
227
-					<tr><th colspan="2"><?php _e( 'Google Calendar Settings', 'google-calendar-events' ); ?></th></tr>
227
+					<tr><th colspan="2"><?php _e('Google Calendar Settings', 'google-calendar-events'); ?></th></tr>
228 228
 				</thead>
229
-				<?php Settings::print_panel_fields( $inputs, $post_id ); ?>
229
+				<?php Settings::print_panel_fields($inputs, $post_id); ?>
230 230
 			</table>
231 231
 		</div>
232 232
 		<?php
@@ -242,47 +242,47 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return true|string
244 244
 	 */
245
-	public function test_api_key_connection( $google_calendar_id ) {
245
+	public function test_api_key_connection($google_calendar_id) {
246 246
 
247 247
 		global $post;
248 248
 
249
-		$post_id = isset( $post->ID ) ? $post->ID : 0;
249
+		$post_id = isset($post->ID) ? $post->ID : 0;
250 250
 		$feed = null;
251
-		if ( $feed_type = wp_get_object_terms( $post_id, 'calendar_feed' ) ) {
252
-			$feed = sanitize_title( current( $feed_type )->name );
251
+		if ($feed_type = wp_get_object_terms($post_id, 'calendar_feed')) {
252
+			$feed = sanitize_title(current($feed_type)->name);
253 253
 		}
254 254
 
255 255
 		$message = '';
256 256
 		$error = '';
257 257
 		$has_errors = false;
258 258
 
259
-		$message .= '<p class="description">' .
259
+		$message .= '<p class="description">'.
260 260
 					sprintf(
261
-						__( 'Step 1: Set the Google Calendar you want to use as <strong>"public."</strong> <a href="%1s" target="_blank">Detailed instructions</a>', 'google-calendar-events' ) . '<br />' .
262
-						__( 'Step 2: Copy and paste your Google Calendar ID here. <a href="%2s" target="_blank">Detailed instructions</a>', 'google-calendar-events' ),
263
-						simcal_ga_campaign_url( simcal_get_url( 'docs' ) . '/make-google-calendar-public/', 'core-plugin', 'settings-link' ),
264
-						simcal_ga_campaign_url( simcal_get_url( 'docs' ) . '/find-google-calendar-id/', 'core-plugin', 'settings-link' )
265
-					) . '</p>';
261
+						__('Step 1: Set the Google Calendar you want to use as <strong>"public."</strong> <a href="%1s" target="_blank">Detailed instructions</a>', 'google-calendar-events').'<br />'.
262
+						__('Step 2: Copy and paste your Google Calendar ID here. <a href="%2s" target="_blank">Detailed instructions</a>', 'google-calendar-events'),
263
+						simcal_ga_campaign_url(simcal_get_url('docs').'/make-google-calendar-public/', 'core-plugin', 'settings-link'),
264
+						simcal_ga_campaign_url(simcal_get_url('docs').'/find-google-calendar-id/', 'core-plugin', 'settings-link')
265
+					).'</p>';
266 266
 
267
-		if ( $post_id > 0 && ! is_null( $feed ) && ! empty( $this->feed->type ) ) {
267
+		if ($post_id > 0 && ! is_null($feed) && ! empty($this->feed->type)) {
268 268
 
269
-			$no_key_notice = new Notice( array(
270
-					'id'          => array( 'calendar_' . $post_id => 'google-no-api-key' ),
269
+			$no_key_notice = new Notice(array(
270
+					'id'          => array('calendar_'.$post_id => 'google-no-api-key'),
271 271
 					'type'        => 'error',
272 272
 					'screen'      => 'calendar',
273 273
 					'post'        => $post_id,
274 274
 					'dismissable' => false,
275
-					'content'     => '<p>' .
276
-					                 '<i class="simcal-icon-warning"></i> ' .
275
+					'content'     => '<p>'.
276
+					                 '<i class="simcal-icon-warning"></i> '.
277 277
 					                 sprintf(
278
-						                 __( 'Your Google Calendar events will not show up until you <a href="%s">create and save a Google API key</a>.', 'google-calendar-events' ),
279
-						                 admin_url( 'edit.php?post_type=calendar&page=simple-calendar_settings&tab=feeds' )
280
-					                 ) .
278
+						                 __('Your Google Calendar events will not show up until you <a href="%s">create and save a Google API key</a>.', 'google-calendar-events'),
279
+						                 admin_url('edit.php?post_type=calendar&page=simple-calendar_settings&tab=feeds')
280
+					                 ).
281 281
 					                 '</p>',
282 282
 				)
283 283
 			);
284 284
 
285
-			if ( empty( $this->google_api_key ) && ( $feed == $this->feed->type ) ) {
285
+			if (empty($this->google_api_key) && ($feed == $this->feed->type)) {
286 286
 
287 287
 				$has_errors = true;
288 288
 				$no_key_notice->add();
@@ -292,28 +292,28 @@  discard block
 block discarded – undo
292 292
 				$no_key_notice->remove();
293 293
 
294 294
 				try {
295
-					$this->feed->make_request( $google_calendar_id );
296
-				} catch ( \Exception $e ) {
295
+					$this->feed->make_request($google_calendar_id);
296
+				} catch (\Exception $e) {
297 297
 					$error   = $e->getMessage();
298
-					$message = ! empty( $error ) ? '<blockquote>' . $error . '</blockquote>' : '';
298
+					$message = ! empty($error) ? '<blockquote>'.$error.'</blockquote>' : '';
299 299
 				}
300 300
 
301
-				$error_notice = new Notice( array(
302
-						'id'          => array( 'calendar_' . $post_id => 'google-error-response' ),
301
+				$error_notice = new Notice(array(
302
+						'id'          => array('calendar_'.$post_id => 'google-error-response'),
303 303
 						'type'        => 'error',
304 304
 						'screen'      => 'calendar',
305 305
 						'post'        => $post_id,
306 306
 						'dismissable' => false,
307
-						'content'     => '<p>' .
308
-						                 '<i class="simcal-icon-warning"></i> ' .
309
-						                 __( 'While trying to retrieve events, Google returned an error:', 'google-calendar-events' ) .
310
-						                 '<br>' . $message . '<br>' .
311
-						                 __( 'Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events' ) .
307
+						'content'     => '<p>'.
308
+						                 '<i class="simcal-icon-warning"></i> '.
309
+						                 __('While trying to retrieve events, Google returned an error:', 'google-calendar-events').
310
+						                 '<br>'.$message.'<br>'.
311
+						                 __('Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events').
312 312
 						                 '</p>',
313 313
 					)
314 314
 				);
315 315
 
316
-				if ( ! empty( $error ) && ( $feed == $this->feed->type ) ) {
316
+				if ( ! empty($error) && ($feed == $this->feed->type)) {
317 317
 					$error_notice->add();
318 318
 					$has_errors = true;
319 319
 				} else {
@@ -335,21 +335,21 @@  discard block
 block discarded – undo
335 335
 	 *
336 336
 	 * @param int $post_id
337 337
 	 */
338
-	public function process_meta( $post_id ) {
338
+	public function process_meta($post_id) {
339 339
 
340
-		$calendar_id = isset( $_POST['_google_calendar_id'] ) ? base64_encode( trim( $_POST['_google_calendar_id'] ) ): '';
341
-		update_post_meta( $post_id, '_google_calendar_id', $calendar_id );
340
+		$calendar_id = isset($_POST['_google_calendar_id']) ? base64_encode(trim($_POST['_google_calendar_id'])) : '';
341
+		update_post_meta($post_id, '_google_calendar_id', $calendar_id);
342 342
 
343
-		$search_query = isset( $_POST['_google_events_search_query'] ) ? sanitize_text_field( $_POST['_google_events_search_query'] ) : '';
344
-		update_post_meta( $post_id, '_google_events_search_query', $search_query );
343
+		$search_query = isset($_POST['_google_events_search_query']) ? sanitize_text_field($_POST['_google_events_search_query']) : '';
344
+		update_post_meta($post_id, '_google_events_search_query', $search_query);
345 345
 
346
-		$recurring = isset( $_POST['_google_events_recurring'] ) ? sanitize_key( $_POST['_google_events_recurring'] ) : 'show';
347
-		update_post_meta( $post_id, '_google_events_recurring', $recurring );
346
+		$recurring = isset($_POST['_google_events_recurring']) ? sanitize_key($_POST['_google_events_recurring']) : 'show';
347
+		update_post_meta($post_id, '_google_events_recurring', $recurring);
348 348
 
349
-		$max_results = isset( $_POST['_google_events_max_results'] ) ? absint( $_POST['_google_events_max_results'] ) : '2500';
350
-		update_post_meta( $post_id, '_google_events_max_results', $max_results );
349
+		$max_results = isset($_POST['_google_events_max_results']) ? absint($_POST['_google_events_max_results']) : '2500';
350
+		update_post_meta($post_id, '_google_events_max_results', $max_results);
351 351
 
352
-		$this->test_api_key_connection( $calendar_id );
352
+		$this->test_api_key_connection($calendar_id);
353 353
 	}
354 354
 
355 355
 }
Please login to merge, or discard this patch.
includes/feeds/admin/grouped-calendars-admin.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Feeds\Grouped_Calendars;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @param Grouped_Calendars $feed
36 36
 	 */
37
-	public function __construct( Grouped_Calendars $feed ) {
37
+	public function __construct(Grouped_Calendars $feed) {
38 38
 
39 39
 		$this->feed = $feed;
40 40
 
41
-		if ( 'calendar' == simcal_is_admin_screen() ) {
42
-			add_filter( 'simcal_settings_meta_tabs_li', array( $this, 'add_settings_meta_tab_li' ), 10, 1 );
43
-			add_action( 'simcal_settings_meta_panels', array( $this, 'add_settings_meta_panel' ), 10, 1 );
41
+		if ('calendar' == simcal_is_admin_screen()) {
42
+			add_filter('simcal_settings_meta_tabs_li', array($this, 'add_settings_meta_tab_li'), 10, 1);
43
+			add_action('simcal_settings_meta_panels', array($this, 'add_settings_meta_panel'), 10, 1);
44 44
 		}
45
-		add_action( 'simcal_process_settings_meta', array( $this, 'process_meta' ), 10, 1 );
45
+		add_action('simcal_process_settings_meta', array($this, 'process_meta'), 10, 1);
46 46
 	}
47 47
 
48 48
 	/**
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return array
56 56
 	 */
57
-	public function add_settings_meta_tab_li( $tabs ) {
58
-		return array_merge( $tabs, array(
57
+	public function add_settings_meta_tab_li($tabs) {
58
+		return array_merge($tabs, array(
59 59
 			'grouped-calendars' => array(
60 60
 				'label'   => $this->feed->name,
61 61
 				'target'  => 'grouped-calendars-settings-panel',
@@ -75,40 +75,40 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @param int $post_id
77 77
 	 */
78
-	public function add_settings_meta_panel( $post_id ) {
78
+	public function add_settings_meta_panel($post_id) {
79 79
 
80 80
 		?>
81 81
 		<div id="grouped-calendars-settings-panel" class="simcal-panel">
82 82
 			<table>
83 83
 				<thead>
84
-				<tr><th colspan="2"><?php _e( 'Grouped Calendar Settings', 'google-calendar-events' ); ?></th></tr>
84
+				<tr><th colspan="2"><?php _e('Grouped Calendar Settings', 'google-calendar-events'); ?></th></tr>
85 85
 				</thead>
86 86
 				<tbody class="simcal-panel-section">
87 87
 				<tr class="simcal-panel-field">
88
-					<th><label for="_grouped_calendars_source"><?php _e( 'Get Calendars From', 'google-calendar-events' ); ?></label></th>
88
+					<th><label for="_grouped_calendars_source"><?php _e('Get Calendars From', 'google-calendar-events'); ?></label></th>
89 89
 					<td>
90 90
 						<?php
91 91
 
92
-						$source = esc_attr( get_post_meta( $post_id, '_grouped_calendars_source', true ) );
93
-						$source = empty( $source ) ? 'ids' : $source;
92
+						$source = esc_attr(get_post_meta($post_id, '_grouped_calendars_source', true));
93
+						$source = empty($source) ? 'ids' : $source;
94 94
 
95 95
 						?>
96 96
 						<select name="_grouped_calendars_source"
97 97
 						        id="_grouped_calendars_source"
98 98
 						        class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-other"
99 99
 						        data-show-field-on-choice="true">
100
-							<option value="ids" data-show-field="_grouped_calendars_ids" <?php selected( 'ids', $source, true ); ?>><?php _e( 'Manual selection', 'google-calendar-events' ); ?></option>
101
-							<option value="category" data-show-field="_grouped_calendars_category" <?php selected( 'category', $source, true ); ?>><?php _e( 'Category', 'google-calendar-events' ); ?></option>
100
+							<option value="ids" data-show-field="_grouped_calendars_ids" <?php selected('ids', $source, true); ?>><?php _e('Manual selection', 'google-calendar-events'); ?></option>
101
+							<option value="category" data-show-field="_grouped_calendars_category" <?php selected('category', $source, true); ?>><?php _e('Category', 'google-calendar-events'); ?></option>
102 102
 						</select>
103
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Choose from which calendar feeds you want to get events from. Choose them individually or select all those belonging to calendar feed categories.', 'google-calendar-events' ); ?>"></i>
103
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('Choose from which calendar feeds you want to get events from. Choose them individually or select all those belonging to calendar feed categories.', 'google-calendar-events'); ?>"></i>
104 104
 						<br><br>
105 105
 						<?php
106 106
 
107
-						$cals = simcal_get_calendars( $post_id );
108
-						$meta = get_post_meta( $post_id, '_grouped_calendars_ids', true );
109
-						$ids  = $meta && is_array( $meta ) ? implode( ',', array_map( 'absint', $meta ) ) : absint( $meta );
107
+						$cals = simcal_get_calendars($post_id);
108
+						$meta = get_post_meta($post_id, '_grouped_calendars_ids', true);
109
+						$ids  = $meta && is_array($meta) ? implode(',', array_map('absint', $meta)) : absint($meta);
110 110
 
111
-						simcal_print_field( array(
111
+						simcal_print_field(array(
112 112
 							'type'        => 'select',
113 113
 							'multiselect' => 'multiselect',
114 114
 							'name'        => '_grouped_calendars_ids',
@@ -116,25 +116,25 @@  discard block
 block discarded – undo
116 116
 							'value'       => $ids !== 0 ? $ids : '',
117 117
 							'options'     => $cals,
118 118
 							'enhanced'    => 'enhanced',
119
-							'style'       => 'ids' == $source ? '' : array( 'display' => 'none' ),
119
+							'style'       => 'ids' == $source ? '' : array('display' => 'none'),
120 120
 							'attributes'  => array(
121
-								'data-noresults' => __( 'No results found.', 'google-calendar-events' ),
121
+								'data-noresults' => __('No results found.', 'google-calendar-events'),
122 122
 							),
123 123
 						));
124 124
 
125
-						$meta = get_post_meta( $post_id, '_grouped_calendars_category', true );
126
-						$category = $meta && is_array( $meta ) ? implode( ',', array_map( 'absint', $meta ) ): '';
125
+						$meta = get_post_meta($post_id, '_grouped_calendars_category', true);
126
+						$category = $meta && is_array($meta) ? implode(',', array_map('absint', $meta)) : '';
127 127
 
128
-						$terms = get_terms( 'calendar_category' );
128
+						$terms = get_terms('calendar_category');
129 129
 
130
-						if ( ! empty( $terms ) ) {
130
+						if ( ! empty($terms)) {
131 131
 
132 132
 							$categories = array();
133
-							foreach ( $terms as $term ) {
134
-								$categories[ $term->term_id ] = $term->name;
133
+							foreach ($terms as $term) {
134
+								$categories[$term->term_id] = $term->name;
135 135
 							}
136 136
 
137
-							simcal_print_field( array(
137
+							simcal_print_field(array(
138 138
 								'type'        => 'select',
139 139
 								'multiselect' => 'multiselect',
140 140
 								'name'        => '_grouped_calendars_category',
@@ -142,17 +142,17 @@  discard block
 block discarded – undo
142 142
 								'value'       => $category,
143 143
 								'options'     => $categories,
144 144
 								'enhanced'    => 'enhanced',
145
-								'style'       => 'category' == $source ? '' : array( 'display' => 'none' ),
145
+								'style'       => 'category' == $source ? '' : array('display' => 'none'),
146 146
 								'attributes'  => array(
147
-									'data-noresults' => __( 'No results found.', 'google-calendar-events' ),
147
+									'data-noresults' => __('No results found.', 'google-calendar-events'),
148 148
 								),
149
-							) );
149
+							));
150 150
 
151 151
 						} else {
152 152
 
153 153
 							$style = 'category' == $source ? '' : 'display: none;';
154 154
 							$style .= ' width: 100%; max-width: 500px';
155
-							echo '<input type="text" disabled="disabled" name="_grouped_calendars_category" id="_grouped_calendars_category" style="' . $style . '" placeholder="' . __( 'There are no calendar categories yet.', 'google-calendar-events' ) . '" />';
155
+							echo '<input type="text" disabled="disabled" name="_grouped_calendars_category" id="_grouped_calendars_category" style="'.$style.'" placeholder="'.__('There are no calendar categories yet.', 'google-calendar-events').'" />';
156 156
 
157 157
 						}
158 158
 
@@ -173,16 +173,16 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @param int $post_id
175 175
 	 */
176
-	public function process_meta( $post_id ) {
176
+	public function process_meta($post_id) {
177 177
 
178
-		$source = isset( $_POST['_grouped_calendars_source'] ) ? sanitize_key( $_POST['_grouped_calendars_source'] ) : 'ids';
179
-		update_post_meta( $post_id, '_grouped_calendars_source', $source );
178
+		$source = isset($_POST['_grouped_calendars_source']) ? sanitize_key($_POST['_grouped_calendars_source']) : 'ids';
179
+		update_post_meta($post_id, '_grouped_calendars_source', $source);
180 180
 
181
-		$ids = isset( $_POST['_grouped_calendars_ids'] ) ? array_map( 'absint', $_POST['_grouped_calendars_ids'] ) : '';
182
-		update_post_meta( $post_id, '_grouped_calendars_ids', $ids );
181
+		$ids = isset($_POST['_grouped_calendars_ids']) ? array_map('absint', $_POST['_grouped_calendars_ids']) : '';
182
+		update_post_meta($post_id, '_grouped_calendars_ids', $ids);
183 183
 
184
-		$category = isset( $_POST['_grouped_calendars_category'] ) ? array_map( 'absint', $_POST['_grouped_calendars_category'] ) : '';
185
-		update_post_meta( $post_id, '_grouped_calendars_category', $category );
184
+		$category = isset($_POST['_grouped_calendars_category']) ? array_map('absint', $_POST['_grouped_calendars_category']) : '';
185
+		update_post_meta($post_id, '_grouped_calendars_category', $category);
186 186
 
187 187
 	}
188 188
 
Please login to merge, or discard this patch.
includes/admin/meta-boxes.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Admin\Metaboxes as Metabox;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 
47
-		$settings = get_option( 'simple-calendar_settings_calendars' );
48
-		if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
47
+		$settings = get_option('simple-calendar_settings_calendars');
48
+		if (isset($settings['general']['attach_calendars_posts'])) {
49 49
 			$this->post_types = $settings['general']['attach_calendars_posts'];
50 50
 		}
51 51
 
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 		new Metabox\Settings();
54 54
 		new Metabox\Attach_Calendar();
55 55
 		new Metabox\Newsletter();
56
-		do_action( 'simcal_load_meta_boxes' );
56
+		do_action('simcal_load_meta_boxes');
57 57
 
58 58
 		// Add meta boxes.
59
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 30 );
59
+		add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 30);
60 60
 
61 61
 		// Process meta boxes.
62
-		add_action( 'simcal_save_settings_meta','\SimpleCalendar\Admin\Metaboxes\Settings::save', 10, 2 );
63
-		add_action( 'simcal_save_attach_calendar_meta','\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::save', 10, 2 );
62
+		add_action('simcal_save_settings_meta', '\SimpleCalendar\Admin\Metaboxes\Settings::save', 10, 2);
63
+		add_action('simcal_save_attach_calendar_meta', '\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::save', 10, 2);
64 64
 
65 65
 		// Save meta boxes data.
66
-		add_action( 'save_post', array( $this, 'save_meta_boxes' ), 1, 2 );
66
+		add_action('save_post', array($this, 'save_meta_boxes'), 1, 2);
67 67
 
68 68
 		// Uncomment this for debugging $_POST while saving a meta box.
69 69
 		// add_action( 'save_post', function() { echo '<pre>'; print_r( $_POST ); echo '</pre>'; die(); } );
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 
79 79
 		add_meta_box(
80 80
 			'simcal-calendar-settings',
81
-			__( 'Calendar Settings', 'google-calendar-events' ),
81
+			__('Calendar Settings', 'google-calendar-events'),
82 82
 			'\SimpleCalendar\Admin\Metaboxes\Settings::html',
83 83
 			'calendar',
84 84
 			'normal',
85 85
 			'core'
86 86
 		);
87 87
 
88
-		$addons = apply_filters( 'simcal_installed_addons', array() );
89
-		if ( empty( $addons ) ) {
88
+		$addons = apply_filters('simcal_installed_addons', array());
89
+		if (empty($addons)) {
90 90
 
91 91
 			add_meta_box(
92 92
 				'simcal-newsletter',
93
-				__( 'Get 20% off all Pro Add-ons', 'google-calendar-events' ),
93
+				__('Get 20% off all Pro Add-ons', 'google-calendar-events'),
94 94
 				'\SimpleCalendar\Admin\Metaboxes\Newsletter::html',
95 95
 				'calendar',
96 96
 				'side',
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
 		add_meta_box(
103 103
 			'simcal-get-shortcode',
104
-			__( 'Calendar Shortcode', 'google-calendar-events' ),
104
+			__('Calendar Shortcode', 'google-calendar-events'),
105 105
 			'\SimpleCalendar\Admin\Metaboxes\Get_Shortcode::html',
106 106
 			'calendar',
107 107
 			'side',
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 		);
110 110
 
111 111
 		// Add meta box if there are calendars.
112
-		if ( ( true == simcal_get_calendars() ) && ! empty( $this->post_types ) ) {
113
-			foreach ( $this->post_types as $post_type ) {
112
+		if ((true == simcal_get_calendars()) && ! empty($this->post_types)) {
113
+			foreach ($this->post_types as $post_type) {
114 114
 				add_meta_box(
115 115
 					'simcal-attach-calendar',
116
-					__( 'Attach Calendar', 'google-calendar-events' ),
116
+					__('Attach Calendar', 'google-calendar-events'),
117 117
 					'\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::html',
118 118
 					$post_type,
119 119
 					'side',
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			}
123 123
 		}
124 124
 
125
-		do_action( 'simcal_add_meta_boxes' );
125
+		do_action('simcal_add_meta_boxes');
126 126
 	}
127 127
 
128 128
 	/**
@@ -135,30 +135,30 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @return void
137 137
 	 */
138
-	public function save_meta_boxes( $post_id, $post ) {
138
+	public function save_meta_boxes($post_id, $post) {
139 139
 
140 140
 		// $post_id and $post are required.
141
-		if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) {
141
+		if (empty($post_id) || empty($post) || self::$saved_meta_boxes) {
142 142
 			return;
143 143
 		}
144 144
 
145 145
 		// Don't save meta boxes for revisions or autosaves.
146
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
146
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
147 147
 			return;
148 148
 		}
149 149
 
150 150
 		// Check the nonce.
151
-		if ( empty( $_POST['simcal_meta_nonce'] ) || ! wp_verify_nonce( $_POST['simcal_meta_nonce'], 'simcal_save_data' ) ) {
151
+		if (empty($_POST['simcal_meta_nonce']) || ! wp_verify_nonce($_POST['simcal_meta_nonce'], 'simcal_save_data')) {
152 152
 			return;
153 153
 		}
154 154
 
155 155
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
156
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
156
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
157 157
 			return;
158 158
 		}
159 159
 
160 160
 		// Check user has permission to edit
161
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
161
+		if ( ! current_user_can('edit_post', $post_id)) {
162 162
 			return;
163 163
 		}
164 164
 
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 		self::$saved_meta_boxes = true;
172 172
 
173 173
 		// Check the post type.
174
-		if ( 'calendar' == $post->post_type ) {
175
-			do_action( 'simcal_save_settings_meta', $post_id, $post );
176
-		} elseif ( in_array( $post->post_type, $this->post_types ) ) {
177
-			do_action( 'simcal_save_attach_calendar_meta', $post_id, $post );
174
+		if ('calendar' == $post->post_type) {
175
+			do_action('simcal_save_settings_meta', $post_id, $post);
176
+		} elseif (in_array($post->post_type, $this->post_types)) {
177
+			do_action('simcal_save_attach_calendar_meta', $post_id, $post);
178 178
 		}
179 179
 
180
-		do_action( 'simcal_save_meta_boxes', $post_id, $post );
180
+		do_action('simcal_save_meta_boxes', $post_id, $post);
181 181
 	}
182 182
 
183 183
 }
Please login to merge, or discard this patch.
includes/admin/fields/license.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Field;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @param array $field
36 36
 	 */
37
-	public function __construct( $field ) {
38
-		$this->addon      = isset( $field['addon'] ) ? esc_attr( $field['addon'] ) : '';
37
+	public function __construct($field) {
38
+		$this->addon      = isset($field['addon']) ? esc_attr($field['addon']) : '';
39 39
 		$this->type_class = 'simcal-field-license';
40
-		parent::__construct( $field );
40
+		parent::__construct($field);
41 41
 	}
42 42
 
43 43
 	/**
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function html() {
49 49
 
50
-		if ( ! empty( $this->addon ) ) {
50
+		if ( ! empty($this->addon)) {
51 51
 
52
-			$status = apply_filters( 'simcal_addon_status_' . $this->addon, simcal_get_license_status( $this->addon ) );
52
+			$status = apply_filters('simcal_addon_status_'.$this->addon, simcal_get_license_status($this->addon));
53 53
 
54
-			if ( $status !== 'valid' ) {
54
+			if ($status !== 'valid') {
55 55
 				$display_activate   = 'display: inline-block';
56 56
 				$display_deactivate = 'display: none';
57 57
 				$active             = 'valid' == $status ? 'display: block' : 'display: none';
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			} else {
60 60
 				$display_activate   = $active = 'display: none';
61 61
 				$display_deactivate = 'display: inline-block';
62
-				$disabled           = empty( $this->value ) ? '' : 'disabled="disabled"';
62
+				$disabled           = empty($this->value) ? '' : 'disabled="disabled"';
63 63
 			}
64 64
 
65 65
 			?>
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
 				<span class="simcal-addon-manage-license-buttons">
75 75
 
76 76
 					<button class="button-secondary simcal-addon-manage-license deactivate" data-add-on="<?php echo $this->addon; ?>" style="<?php echo $display_deactivate; ?>">
77
-				        <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e( 'Deactivate', 'google-calendar-events' ); ?>
77
+				        <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e('Deactivate', 'google-calendar-events'); ?>
78 78
 					</button>
79 79
 
80 80
 					<button class="button-secondary simcal-addon-manage-license activate" data-add-on="<?php echo $this->addon; ?>" style="<?php echo $display_activate; ?>">
81
-						<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e( 'Activate', 'google-calendar-events' ); ?>
81
+						<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e('Activate', 'google-calendar-events'); ?>
82 82
 					</button>
83 83
 
84 84
 					<span class="error" style="color: red; display: none"> </span>
85 85
 
86
-					<strong class="label" style="color:green; <?php echo $active; ?>"> <?php _e( '(active)', 'google-calendar-events' ); ?></strong>
86
+					<strong class="label" style="color:green; <?php echo $active; ?>"> <?php _e('(active)', 'google-calendar-events'); ?></strong>
87 87
 
88 88
 				</span>
89 89
 
Please login to merge, or discard this patch.
includes/admin/fields/checkbox.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Field;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit; // Exit if accessed directly.
13 13
 }
14 14
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param array $field
30 30
 	 */
31
-	public function __construct( $field ) {
31
+	public function __construct($field) {
32 32
 		$this->type_class = 'simcal-field-checkboxes';
33
-		parent::__construct( $field );
33
+		parent::__construct($field);
34 34
 	}
35 35
 
36 36
 	/**
@@ -40,33 +40,33 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function html() {
42 42
 
43
-		if ( ! empty( $this->options ) && count( (array) $this->options ) > 1 ) {
43
+		if ( ! empty($this->options) && count((array) $this->options) > 1) {
44 44
 
45
-			if ( ! empty( $this->description ) ) {
46
-				echo '<p class="description">' . wp_kses_post( $this->description ) . ' ' . $this->tooltip . '</p>';
45
+			if ( ! empty($this->description)) {
46
+				echo '<p class="description">'.wp_kses_post($this->description).' '.$this->tooltip.'</p>';
47 47
 			}
48 48
 
49 49
 			?>
50
-			<fieldset class="<?php echo $this->class; ?>" <?php echo ! empty( $this->style ) ? 'style="' . $this->style . '"' : ''; ?>>
50
+			<fieldset class="<?php echo $this->class; ?>" <?php echo ! empty($this->style) ? 'style="'.$this->style.'"' : ''; ?>>
51 51
 				<?php
52 52
 
53
-				if ( ! empty( $this->title ) ) {
54
-					echo '<legend class="screen-reader-text"><span>' . $this->title . '</span></legend>';
53
+				if ( ! empty($this->title)) {
54
+					echo '<legend class="screen-reader-text"><span>'.$this->title.'</span></legend>';
55 55
 				}
56 56
 
57 57
 				?>
58 58
 				<ul>
59
-					<?php foreach ( $this->options as $option => $name ) : ?>
59
+					<?php foreach ($this->options as $option => $name) : ?>
60 60
 						<li>
61
-							<label for="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>">
61
+							<label for="<?php echo $this->id.'-'.trim(strval($option)); ?>">
62 62
 								<input name="<?php echo $this->name; ?>"
63
-								       id="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>"
63
+								       id="<?php echo $this->id.'-'.trim(strval($option)); ?>"
64 64
 								       class="simcal-field simcal-field-checkbox"
65 65
 								       type="checkbox"
66
-								       value="<?php echo trim( strval( $option ) ); ?>"
67
-										<?php checked( $this->value, 'yes', true ); ?>
66
+								       value="<?php echo trim(strval($option)); ?>"
67
+										<?php checked($this->value, 'yes', true); ?>
68 68
 									<?php echo $this->attributes; ?>
69
-									/><?php echo esc_attr( $name ); ?>
69
+									/><?php echo esc_attr($name); ?>
70 70
 							</label>
71 71
 						</li>
72 72
 					<?php endforeach; ?>
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 		} else {
78 78
 
79 79
 			?>
80
-			<span class="simcal-field-bool" <?php echo $this->style ? 'style="' . $this->style . '"' : ''; ?>>
81
-				<?php if ( ! empty( $this->title ) ) : ?>
80
+			<span class="simcal-field-bool" <?php echo $this->style ? 'style="'.$this->style.'"' : ''; ?>>
81
+				<?php if ( ! empty($this->title)) : ?>
82 82
 					<span class="screen-reader-text"><?php echo $this->title; ?></span>
83 83
 				<?php endif; ?>
84 84
 				<input name="<?php echo $this->name; ?>"
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 				       id="<?php echo $this->id; ?>"
87 87
 				       class="simcal-field simcal-field-checkbox <?php echo $this->class; ?>"
88 88
 				       value="yes"
89
-					<?php checked( $this->value, 'yes', true ); ?>
90
-					<?php echo $this->attributes; ?>/><?php echo ( ! empty( $this->text ) ? $this->text : __( 'Yes', 'google-calendar-events' ) ); ?>
89
+					<?php checked($this->value, 'yes', true); ?>
90
+					<?php echo $this->attributes; ?>/><?php echo ( ! empty($this->text) ? $this->text : __('Yes', 'google-calendar-events')); ?>
91 91
 			</span>
92 92
 			<?php
93 93
 
94 94
 			echo $this->tooltip;
95 95
 
96
-			if ( ! empty( $this->description ) ) {
97
-				echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>';
96
+			if ( ! empty($this->description)) {
97
+				echo '<p class="description">'.wp_kses_post($this->description).'</p>';
98 98
 			}
99 99
 
100 100
 		}
Please login to merge, or discard this patch.