Completed
Push — master ( fce50c...06d306 )
by
unknown
02:56
created
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/functions/deprecated.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @deprecated
9 9
  */
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -16,18 +16,18 @@  discard block
 block discarded – undo
16 16
  * Print a calendar.
17 17
  * @deprecated Use simcal_print_calendar()
18 18
  */
19
-function gce_print_calendar( $feed_ids, $display, $args  ) {
19
+function gce_print_calendar($feed_ids, $display, $args) {
20 20
 
21 21
 	$id = 0;
22 22
 
23
-	if ( is_numeric( $feed_ids ) ) {
24
-		$id = intval( $feed_ids );
25
-	} elseif ( is_array( $feed_ids ) ) {
26
-		$id = isset( $feed_ids[0] ) ? intval( $feed_ids[0] ) : '';
23
+	if (is_numeric($feed_ids)) {
24
+		$id = intval($feed_ids);
25
+	} elseif (is_array($feed_ids)) {
26
+		$id = isset($feed_ids[0]) ? intval($feed_ids[0]) : '';
27 27
 	}
28 28
 
29
-	if ( $id > 0 ) {
30
-		simcal_print_calendar( $id );
29
+	if ($id > 0) {
30
+		simcal_print_calendar($id);
31 31
 	}
32 32
 }
33 33
 
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
  * Convert date from mm/dd/yyyy to unix timestamp.
36 36
  * @deprecated Assumes a US-only time format.
37 37
  */
38
-function gce_date_unix( $date = '' ) {
39
-	if ( empty( $date ) ) {
40
-		$current_time = current_time( 'timestamp' );
41
-		$timestamp = mktime( 0, 0, 0, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );
38
+function gce_date_unix($date = '') {
39
+	if (empty($date)) {
40
+		$current_time = current_time('timestamp');
41
+		$timestamp = mktime(0, 0, 0, date('m', $current_time), date('d', $current_time), date('Y', $current_time));
42 42
 	} else {
43
-		$date = explode( '/', $date );
43
+		$date = explode('/', $date);
44 44
 		$month = $date[0];
45 45
 		$day   = $date[1];
46 46
 		$year  = $date[2];
47
-		$timestamp = mktime( 0, 0, 0, $month, $day, $year );
47
+		$timestamp = mktime(0, 0, 0, $month, $day, $year);
48 48
 	}
49 49
 	return $timestamp;
50 50
 }
Please login to merge, or discard this patch.
includes/functions/shared.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Shared functions
4
- *
5
- * Functions shared by both back end and front end components.
6
- *
7
- * @package SimpleCalendar/Functions
8
- */
3
+	 * Shared functions
4
+	 *
5
+	 * Functions shared by both back end and front end components.
6
+	 *
7
+	 * @package SimpleCalendar/Functions
8
+	 */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11 11
 	exit;
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @package SimpleCalendar/Functions
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function is_simple_calendar() {
22 22
 
23
-	if ( is_singular() ) {
23
+	if (is_singular()) {
24 24
 
25 25
 		global $post, $post_type;
26 26
 
27
-		if ( 'calendar' == $post_type ) {
27
+		if ('calendar' == $post_type) {
28 28
 			return true;
29 29
 		} else {
30
-			if ( false !== get_post_meta( $post->ID, '_simcal_attach_calendar_id', true ) ) {
30
+			if (false !== get_post_meta($post->ID, '_simcal_attach_calendar_id', true)) {
31 31
 				return true;
32 32
 			}
33
-			if ( has_shortcode( $post->post_content, 'calendar' ) ) {
33
+			if (has_shortcode($post->post_content, 'calendar')) {
34 34
 				return true;
35 35
 			}
36 36
 		}
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return string
48 48
  */
49
-function simcal_get_url( $url ) {
50
-	return \SimpleCalendar\plugin()->get_url( $url );
49
+function simcal_get_url($url) {
50
+	return \SimpleCalendar\plugin()->get_url($url);
51 51
 }
52 52
 
53 53
 /**
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
  *
72 72
  * @return null|\SimpleCalendar\Abstracts\Feed
73 73
  */
74
-function simcal_get_feed( $object ) {
74
+function simcal_get_feed($object) {
75 75
 	$objects = \SimpleCalendar\plugin()->objects;
76
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_feed( $object ) : null;
76
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_feed($object) : null;
77 77
 }
78 78
 
79 79
 /**
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
  *
98 98
  * @return null|\SimpleCalendar\Abstracts\Calendar
99 99
  */
100
-function simcal_get_calendar( $object ) {
100
+function simcal_get_calendar($object) {
101 101
 	$objects = \SimpleCalendar\plugin()->objects;
102
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_calendar( $object ) : null;
102
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_calendar($object) : null;
103 103
 }
104 104
 
105 105
 /**
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
  *
113 113
  * @return mixed
114 114
  */
115
-function simcal_get_calendar_view( $id = 0, $name = '' ) {
115
+function simcal_get_calendar_view($id = 0, $name = '') {
116 116
 	$objects = \SimpleCalendar\plugin()->objects;
117
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_calendar_view( $id, $name ) : false;
117
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_calendar_view($id, $name) : false;
118 118
 }
119 119
 
120 120
 /**
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
  *
127 127
  * @return void
128 128
  */
129
-function simcal_print_calendar( $object ) {
129
+function simcal_print_calendar($object) {
130 130
 
131
-	$calendar = simcal_get_calendar( $object );
131
+	$calendar = simcal_get_calendar($object);
132 132
 
133
-	if ( $calendar instanceof \SimpleCalendar\Abstracts\Calendar ) {
133
+	if ($calendar instanceof \SimpleCalendar\Abstracts\Calendar) {
134 134
 		$calendar->html();
135 135
 	}
136 136
 }
@@ -148,21 +148,21 @@  discard block
 block discarded – undo
148 148
 
149 149
 	$vars = array(
150 150
 		'ajax_url'  => \SimpleCalendar\plugin()->ajax_url(),
151
-		'nonce'     => wp_create_nonce( 'simcal' ),
151
+		'nonce'     => wp_create_nonce('simcal'),
152 152
 		'locale'    => \SimpleCalendar\plugin()->locale,
153 153
 		'text_dir'  => is_rtl() ? 'rtl' : 'ltr',
154 154
 		'months'    => array(
155
-			'full'  => simcal_get_calendar_names_i18n( 'month', 'full' ),
156
-			'short' => simcal_get_calendar_names_i18n( 'month', 'short' ),
155
+			'full'  => simcal_get_calendar_names_i18n('month', 'full'),
156
+			'short' => simcal_get_calendar_names_i18n('month', 'short'),
157 157
 		),
158 158
 		'days'      => array(
159
-			'full'  => simcal_get_calendar_names_i18n( 'day', 'full' ),
160
-			'short' => simcal_get_calendar_names_i18n( 'day', 'short' ),
159
+			'full'  => simcal_get_calendar_names_i18n('day', 'full'),
160
+			'short' => simcal_get_calendar_names_i18n('day', 'short'),
161 161
 		),
162
-		'meridiem' => simcal_get_calendar_names_i18n( 'meridiem' ),
162
+		'meridiem' => simcal_get_calendar_names_i18n('meridiem'),
163 163
 	);
164 164
 
165
-	return array_merge( $vars, apply_filters( 'simcal_common_scripts_variables', array() ) );
165
+	return array_merge($vars, apply_filters('simcal_common_scripts_variables', array()));
166 166
 }
167 167
 
168 168
 /**
@@ -175,31 +175,31 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return array Associative array with ids as keys and feed titles as values.
177 177
  */
178
-function simcal_get_calendars( $exclude = '', $cached = true ) {
178
+function simcal_get_calendars($exclude = '', $cached = true) {
179 179
 
180
-	$calendars = get_transient( '_simple-calendar_feed_ids' );
180
+	$calendars = get_transient('_simple-calendar_feed_ids');
181 181
 
182
-	if ( ! $calendars || $cached === false ) {
182
+	if ( ! $calendars || $cached === false) {
183 183
 
184
-		$posts = get_posts( array(
184
+		$posts = get_posts(array(
185 185
 			'post_type' => 'calendar',
186 186
 			'nopaging'  => true,
187
-		) );
187
+		));
188 188
 
189 189
 		$calendars = array();
190
-		foreach ( $posts as $post ) {
191
-			$calendars[ $post->ID ] = $post->post_title;
190
+		foreach ($posts as $post) {
191
+			$calendars[$post->ID] = $post->post_title;
192 192
 		}
193
-		asort( $calendars );
193
+		asort($calendars);
194 194
 
195
-		set_transient( '_simple-calendar_feed_ids', $calendars, 604800 );
195
+		set_transient('_simple-calendar_feed_ids', $calendars, 604800);
196 196
 	}
197 197
 
198
-	if ( ! empty( $exclude ) ) {
199
-		if ( is_numeric( $exclude ) ) {
200
-			unset( $calendars[ intval( $exclude ) ] );
201
-		} elseif ( is_array( $exclude ) ) {
202
-			array_diff_key( $calendars, array_map( 'intval', array_keys( $exclude ) ) );
198
+	if ( ! empty($exclude)) {
199
+		if (is_numeric($exclude)) {
200
+			unset($calendars[intval($exclude)]);
201
+		} elseif (is_array($exclude)) {
202
+			array_diff_key($calendars, array_map('intval', array_keys($exclude)));
203 203
 		}
204 204
 	}
205 205
 
@@ -218,45 +218,45 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @return array
220 220
  */
221
-function simcal_get_calendar_names_i18n( $group, $style = 'full' ) {
221
+function simcal_get_calendar_names_i18n($group, $style = 'full') {
222 222
 
223 223
 	$names = array();
224 224
 
225
-	if ( in_array( $group, array( 'month', 'day', 'meridiem' ) ) ) {
225
+	if (in_array($group, array('month', 'day', 'meridiem'))) {
226 226
 
227 227
 		$format = '';
228 228
 		$length = 0;
229 229
 
230 230
 		$date = Carbon\Carbon::now();
231 231
 
232
-		if ( 'month' == $group ) {
233
-			$date->month( 0 )->startOfMonth();
232
+		if ('month' == $group) {
233
+			$date->month(0)->startOfMonth();
234 234
 			$format = 'short' == $style ? 'M' : 'F';
235 235
 			$length = 11;
236
-		} elseif ( 'day' == $group ) {
237
-			$date->next( 6 );
236
+		} elseif ('day' == $group) {
237
+			$date->next(6);
238 238
 			$format = 'short' == $style ? 'D' : 'l';
239 239
 			$length = 6;
240
-		} elseif ( 'meridiem' == $group ) {
240
+		} elseif ('meridiem' == $group) {
241 241
 			$date->startOfDay();
242
-			$am = $date->addHour( 1 )->getTimestamp();
243
-			$pm = $date->addHours( 13 )->getTimestamp();
242
+			$am = $date->addHour(1)->getTimestamp();
243
+			$pm = $date->addHours(13)->getTimestamp();
244 244
 			return array(
245
-				'AM' => date_i18n( 'A', $am ),
246
-				'am' => date_i18n( 'a', $am ),
247
-				'PM' => date_i18n( 'A', $pm ),
248
-				'pm' => date_i18n( 'a', $pm ),
245
+				'AM' => date_i18n('A', $am),
246
+				'am' => date_i18n('a', $am),
247
+				'PM' => date_i18n('A', $pm),
248
+				'pm' => date_i18n('a', $pm),
249 249
 			);
250 250
 		}
251 251
 
252 252
 		$i = 0;
253
-		while ( $i <= $length ) {
254
-			if ( 'month' == $group ) {
255
-				$date->addMonths( 1 );
253
+		while ($i <= $length) {
254
+			if ('month' == $group) {
255
+				$date->addMonths(1);
256 256
 			} else {
257
-				$date->addDays( 1 );
257
+				$date->addDays(1);
258 258
 			}
259
-			$names[ strval( $i ) ] = date_i18n( $format, $date->getTimestamp() );
259
+			$names[strval($i)] = date_i18n($format, $date->getTimestamp());
260 260
 			$i++;
261 261
 		}
262 262
 
@@ -274,15 +274,15 @@  discard block
 block discarded – undo
274 274
  */
275 275
 function simcal_default_event_template() {
276 276
 
277
-	$content  = '<strong>' . '[title]' . '</strong>';
277
+	$content  = '<strong>'.'[title]'.'</strong>';
278 278
 	$content .= '<p>';
279
-	$content .= '[when]' . "\n";
279
+	$content .= '[when]'."\n";
280 280
 	$content .= '[location]';
281 281
 	$content .= '</p>';
282
-	$content .= '<div>' . '[description]' . '</div>';
283
-	$content .= '<p>' . '[link newwindow="yes"]' . __( 'See more details', 'google-calendar-events' ) . '[/link]' . '</p>';
282
+	$content .= '<div>'.'[description]'.'</div>';
283
+	$content .= '<p>'.'[link newwindow="yes"]'.__('See more details', 'google-calendar-events').'[/link]'.'</p>';
284 284
 
285
-	return apply_filters( 'simcal_default_event_template', $content );
285
+	return apply_filters('simcal_default_event_template', $content);
286 286
 }
287 287
 
288 288
 /**
@@ -297,21 +297,21 @@  discard block
 block discarded – undo
297 297
  *
298 298
  * @return array
299 299
  */
300
-function simcal_get_date_format_order( $date_format ) {
300
+function simcal_get_date_format_order($date_format) {
301 301
 
302 302
 	$pos = array(
303
-		'd' => strpos( $date_format, strpbrk( $date_format, 'Dj' ) ),
304
-		'm' => strpos( $date_format, strpbrk( $date_format, 'FMmn' ) ),
305
-		'y' => strpos( $date_format, strpbrk( $date_format, 'Yy' ) ),
303
+		'd' => strpos($date_format, strpbrk($date_format, 'Dj')),
304
+		'm' => strpos($date_format, strpbrk($date_format, 'FMmn')),
305
+		'y' => strpos($date_format, strpbrk($date_format, 'Yy')),
306 306
 	);
307 307
 
308 308
 	// @TODO When one date piece is not found, perhaps fallback to ISO standard position.
309 309
 
310 310
 	$order = array();
311
-	foreach ( $pos as $k => $v ) {
312
-		$order[ $k ] = $v;
311
+	foreach ($pos as $k => $v) {
312
+		$order[$k] = $v;
313 313
 	}
314
-	ksort( $order );
314
+	ksort($order);
315 315
 
316 316
 	return $order;
317 317
 }
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function simcal_get_wp_timezone() {
329 329
 
330
-	$timezone = get_option( 'timezone_string' );
330
+	$timezone = get_option('timezone_string');
331 331
 
332
-	if ( empty( $timezone ) ) {
333
-		$gmt = get_option( 'gmt_offset' );
334
-		$timezone = simcal_get_timezone_from_gmt_offset( $gmt );
332
+	if (empty($timezone)) {
333
+		$gmt = get_option('gmt_offset');
334
+		$timezone = simcal_get_timezone_from_gmt_offset($gmt);
335 335
 	}
336 336
 
337 337
 	return $timezone;
@@ -348,26 +348,26 @@  discard block
 block discarded – undo
348 348
  *
349 349
  * @return null|string
350 350
  */
351
-function simcal_get_timezone_from_gmt_offset( $offset ) {
351
+function simcal_get_timezone_from_gmt_offset($offset) {
352 352
 
353
-	if ( is_numeric( $offset ) ) {
353
+	if (is_numeric($offset)) {
354 354
 
355
-		if ( 0 === intval( $offset ) ) {
355
+		if (0 === intval($offset)) {
356 356
 			return 'UTC';
357 357
 		} else {
358
-			$offset = floatval( $offset ) * 3600;
358
+			$offset = floatval($offset) * 3600;
359 359
 		}
360 360
 
361
-		$timezone = timezone_name_from_abbr( null, $offset, false );
361
+		$timezone = timezone_name_from_abbr(null, $offset, false);
362 362
 		// This is buggy and might return false:
363 363
 		// @see http://php.net/manual/en/function.timezone-name-from-abbr.php#86928
364 364
 		// Therefore:
365
-		if ( false == $timezone ) {
365
+		if (false == $timezone) {
366 366
 
367 367
 			$list = timezone_abbreviations_list();
368
-			foreach ( $list as $abbr ) {
369
-				foreach ( $abbr as $city ) {
370
-					if ( $offset == $city['offset'] ) {
368
+			foreach ($list as $abbr) {
369
+				foreach ($abbr as $city) {
370
+					if ($offset == $city['offset']) {
371 371
 						return $city['timezone_id'];
372 372
 					}
373 373
 				}
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @return int Unix time offset
392 392
  */
393
-function simcal_get_timezone_offset( $timezone ) {
394
-	return \Carbon\Carbon::now( $timezone )->offset;
393
+function simcal_get_timezone_offset($timezone) {
394
+	return \Carbon\Carbon::now($timezone)->offset;
395 395
 }
396 396
 
397 397
 /**
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
  *
405 405
  * @return mixed|string
406 406
  */
407
-function simcal_esc_timezone( $tz, $default = 'UTC' ) {
408
-	return in_array( $tz, timezone_identifiers_list() ) ? $tz : $default;
407
+function simcal_esc_timezone($tz, $default = 'UTC') {
408
+	return in_array($tz, timezone_identifiers_list()) ? $tz : $default;
409 409
 }
410 410
 
411 411
 /**
@@ -417,57 +417,57 @@  discard block
 block discarded – undo
417 417
  *
418 418
  * @return bool
419 419
  */
420
-function simcal_delete_feed_transients( $id = '' ) {
420
+function simcal_delete_feed_transients($id = '') {
421 421
 
422
-	$grouped_ids = get_post_meta( $id, '_grouped_calendars_ids', true );
422
+	$grouped_ids = get_post_meta($id, '_grouped_calendars_ids', true);
423 423
 
424 424
 	// If there are group IDs we need to construct an array to pass along with the grouped IDs + the original $post_id
425
-	if ( is_array( $grouped_ids ) ) {
425
+	if (is_array($grouped_ids)) {
426 426
 		$temp_id = $id;
427 427
 		$id = $grouped_ids;
428 428
 		$id[] = $temp_id;
429 429
 	}
430 430
 
431
-	if ( is_numeric( $id ) ) {
432
-		$id = intval( $id ) > 0 ? absint( $id ) : simcal_get_calendars();
433
-	} elseif ( $id instanceof WP_Post ) {
431
+	if (is_numeric($id)) {
432
+		$id = intval($id) > 0 ? absint($id) : simcal_get_calendars();
433
+	} elseif ($id instanceof WP_Post) {
434 434
 		$id = $id->ID;
435
-	} elseif ( is_array( $id ) ) {
436
-		$id = array_map( 'absint', $id );
435
+	} elseif (is_array($id)) {
436
+		$id = array_map('absint', $id);
437 437
 	} else {
438
-		$id = simcal_get_calendars( '', true );
438
+		$id = simcal_get_calendars('', true);
439 439
 	}
440 440
 
441 441
 	$feed_types = simcal_get_feed_types();
442 442
 
443
-	if ( is_array( $id ) ) {
443
+	if (is_array($id)) {
444 444
 
445
-		$posts = get_posts( array(
445
+		$posts = get_posts(array(
446 446
 				'post_type' => 'calendar',
447 447
 				'fields'    => 'ids',
448 448
 				'post__in'  => $id,
449 449
 				'nopaging'  => true,
450
-		) );
450
+		));
451 451
 
452
-		foreach ( $posts as $post ) {
453
-			$calendar = simcal_get_calendar( $post );
454
-			if ( $calendar instanceof \SimpleCalendar\Abstracts\Calendar ) {
455
-				foreach ( $feed_types as $feed_type ) {
456
-					delete_transient( '_simple-calendar_feed_id_' . strval( $calendar->id ) . '_' . $feed_type );
452
+		foreach ($posts as $post) {
453
+			$calendar = simcal_get_calendar($post);
454
+			if ($calendar instanceof \SimpleCalendar\Abstracts\Calendar) {
455
+				foreach ($feed_types as $feed_type) {
456
+					delete_transient('_simple-calendar_feed_id_'.strval($calendar->id).'_'.$feed_type);
457 457
 				}
458 458
 			}
459 459
 		}
460 460
 
461 461
 	} else {
462 462
 
463
-		$post = get_post( $id );
464
-		$calendar = simcal_get_calendar( $post );
465
-		if ( $calendar instanceof \SimpleCalendar\Abstracts\Calendar ) {
466
-			foreach ( $feed_types as $feed_type ) {
467
-				delete_transient( '_simple-calendar_feed_id_' . strval( $calendar->id ) . '_' . $feed_type );
463
+		$post = get_post($id);
464
+		$calendar = simcal_get_calendar($post);
465
+		if ($calendar instanceof \SimpleCalendar\Abstracts\Calendar) {
466
+			foreach ($feed_types as $feed_type) {
467
+				delete_transient('_simple-calendar_feed_id_'.strval($calendar->id).'_'.$feed_type);
468 468
 			}
469 469
 		}
470 470
 	}
471 471
 
472
-	return delete_transient( '_simple-calendar_feed_ids' );
472
+	return delete_transient('_simple-calendar_feed_ids');
473 473
 }
474 474
\ No newline at end of file
Please login to merge, or discard this patch.
includes/installation.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Installation
4
- *
5
- * @package SimpleCalendar
6
- */
3
+	 * Installation
4
+	 *
5
+	 * @package SimpleCalendar
6
+	 */
7 7
 namespace SimpleCalendar;
8 8
 
9 9
 use SimpleCalendar\Admin\Pages;
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Admin\Pages;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		self::create_terms();
35 35
 		self::create_options();
36 36
 
37
-		do_action( 'simcal_activated' );
37
+		do_action('simcal_activated');
38 38
 	}
39 39
 
40 40
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 		flush_rewrite_rules();
48 48
 
49
-		do_action( 'simcal_deactivated' );
49
+		do_action('simcal_deactivated');
50 50
 	}
51 51
 
52 52
 	/**
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 			)
67 67
 		);
68 68
 
69
-		foreach ( $taxonomies as $taxonomy => $terms ) {
70
-			foreach ( $terms as $term ) {
71
-				if ( ! get_term_by( 'slug', sanitize_title( $term ), $taxonomy ) ) {
72
-					wp_insert_term( $term, $taxonomy );
69
+		foreach ($taxonomies as $taxonomy => $terms) {
70
+			foreach ($terms as $term) {
71
+				if ( ! get_term_by('slug', sanitize_title($term), $taxonomy)) {
72
+					wp_insert_term($term, $taxonomy);
73 73
 				}
74 74
 			}
75 75
 		}
@@ -85,33 +85,33 @@  discard block
 block discarded – undo
85 85
 
86 86
 		$default = '';
87 87
 		$page    = 'settings';
88
-		$settings_pages  = new Pages( $page );
88
+		$settings_pages  = new Pages($page);
89 89
 		$plugin_settings = $settings_pages->get_settings();
90 90
 
91
-		if ( $plugin_settings && is_array( $plugin_settings ) ) {
91
+		if ($plugin_settings && is_array($plugin_settings)) {
92 92
 
93
-			foreach ( $plugin_settings as $id => $settings ) {
93
+			foreach ($plugin_settings as $id => $settings) {
94 94
 
95
-				$group = 'simple-calendar_' . $page . '_' . $id;
95
+				$group = 'simple-calendar_'.$page.'_'.$id;
96 96
 
97
-				if ( isset( $settings['sections'] ) ) {
97
+				if (isset($settings['sections'])) {
98 98
 
99
-					if ( $settings['sections'] && is_array( $settings['sections'] ) ) {
99
+					if ($settings['sections'] && is_array($settings['sections'])) {
100 100
 
101
-						foreach ( $settings['sections'] as $section_id => $section ) {
101
+						foreach ($settings['sections'] as $section_id => $section) {
102 102
 
103
-							if ( isset( $section['fields'] ) ) {
103
+							if (isset($section['fields'])) {
104 104
 
105
-								if ( $section['fields'] && is_array( $section['fields'] ) ) {
105
+								if ($section['fields'] && is_array($section['fields'])) {
106 106
 
107
-									foreach ( $section['fields'] as $key => $field ) {
107
+									foreach ($section['fields'] as $key => $field) {
108 108
 
109
-										if ( isset ( $field['type'] ) ) {
109
+										if (isset ($field['type'])) {
110 110
 											// Maybe an associative array.
111
-											if ( is_int( $key ) ) {
112
-												$default[ $section_id ] = self::get_field_default_value( $field );
111
+											if (is_int($key)) {
112
+												$default[$section_id] = self::get_field_default_value($field);
113 113
 											} else {
114
-												$default[ $section_id ][ $key ] = self::get_field_default_value( $field );
114
+												$default[$section_id][$key] = self::get_field_default_value($field);
115 115
 											}
116 116
 										}
117 117
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
 				} // Are there sections?
129 129
 
130
-				add_option( $group, $default, '', true );
130
+				add_option($group, $default, '', true);
131 131
 
132 132
 				// Reset before looping next settings page.
133 133
 				$default = '';
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @return mixed
149 149
 	 */
150
-	private static function get_field_default_value( $field ) {
150
+	private static function get_field_default_value($field) {
151 151
 
152
-		$saved_value   = isset( $field['value'] )   ? $field['value']   : '';
153
-		$default_value = isset( $field['default'] ) ? $field['default'] : '';
152
+		$saved_value   = isset($field['value']) ? $field['value'] : '';
153
+		$default_value = isset($field['default']) ? $field['default'] : '';
154 154
 
155
-		return ! empty( $saved_value ) ? $saved_value : $default_value;
155
+		return ! empty($saved_value) ? $saved_value : $default_value;
156 156
 	}
157 157
 
158 158
 }
Please login to merge, or discard this patch.
includes/objects.php 1 patch
Spacing   +86 added lines, -86 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,34 +185,34 @@  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 );
207
-				return $this->get_object( $calendar->feed, 'feed', $calendar );
208
-			} elseif ( isset( $object->feed ) && isset( $object->id ) ) {
209
-				return $this->get_object( $object->feed, 'feed', $object );
204
+				return $this->get_object($feed_name, 'feed', $object);
205
+			} elseif ($object instanceof \WP_Post) {
206
+				$calendar = $this->get_calendar($object);
207
+				return $this->get_object($calendar->feed, 'feed', $calendar);
208
+			} elseif (isset($object->feed) && isset($object->id)) {
209
+				return $this->get_object($object->feed, 'feed', $object);
210 210
 			}
211 211
 		}
212 212
 
213
-		if ( is_int( $object ) ) {
214
-			$calendar = $this->get_calendar( $object );
215
-			return isset( $calendar->feed ) ? $this->get_object( $calendar->feed, 'feed', $calendar ) : null;
213
+		if (is_int($object)) {
214
+			$calendar = $this->get_calendar($object);
215
+			return isset($calendar->feed) ? $this->get_object($calendar->feed, 'feed', $calendar) : null;
216 216
 		}
217 217
 
218 218
 		return null;
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
 	 *
229 229
 	 * @return null|Object\Field
230 230
 	 */
231
-	public function get_field( $args, $name = '' ) {
231
+	public function get_field($args, $name = '') {
232 232
 
233
-		if ( empty( $name ) ) {
234
-			$name = isset( $args['type'] ) ? $args['type'] : false;
233
+		if (empty($name)) {
234
+			$name = isset($args['type']) ? $args['type'] : false;
235 235
 		}
236 236
 
237
-		return $name ? $this->get_object( $name, 'field', $args ) : null;
237
+		return $name ? $this->get_object($name, 'field', $args) : null;
238 238
 	}
239 239
 
240 240
 	/**
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @return null|Object\Admin_Page
248 248
 	 */
249
-	public function get_admin_page( $name ) {
250
-		return $name ? $this->get_object( $name, 'admin-page' ) : null;
249
+	public function get_admin_page($name) {
250
+		return $name ? $this->get_object($name, 'admin-page') : null;
251 251
 	}
252 252
 
253 253
 	/**
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 *
263 263
 	 * @return null|Object
264 264
 	 */
265
-	private function get_object( $name, $type, $args = '' ) {
265
+	private function get_object($name, $type, $args = '') {
266 266
 
267 267
 		$types = array(
268 268
 			'admin-page',
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 			'field',
273 273
 		);
274 274
 
275
-		if ( in_array( $type, $types ) ) {
275
+		if (in_array($type, $types)) {
276 276
 
277
-			$class_name = $this->make_class_name( $name, $type );
278
-			$parent     = '\\' . __NAMESPACE__ . '\Abstracts\\' . implode( '_', array_map( 'ucfirst', explode( '-', $type ) ) );
279
-			$class      = class_exists( $class_name ) ? new $class_name( $args ) : false;
277
+			$class_name = $this->make_class_name($name, $type);
278
+			$parent     = '\\'.__NAMESPACE__.'\Abstracts\\'.implode('_', array_map('ucfirst', explode('-', $type)));
279
+			$class      = class_exists($class_name) ? new $class_name($args) : false;
280 280
 
281 281
 			return $class instanceof $parent ? $class : null;
282 282
 		}
@@ -298,25 +298,25 @@  discard block
 block discarded – undo
298 298
 	 *
299 299
 	 * @return string The class name complete with its full namespace.
300 300
 	 */
301
-	private function make_class_name( $name, $type ) {
302
-
303
-		if ( 'calendar' == $type ) {
304
-			$namespace = '\\' . __NAMESPACE__ . '\Calendars\\';
305
-		} elseif ( 'calendar-view' == $type ) {
306
-			$namespace = '\\' . __NAMESPACE__ . '\Calendars\Views\\';
307
-		} elseif ( 'feed' == $type ) {
308
-			$namespace = '\\' . __NAMESPACE__ . '\Feeds\\';
309
-		} elseif ( 'field' == $type ) {
310
-			$namespace = '\\' . __NAMESPACE__ . '\Admin\Fields\\';
311
-		} elseif ( 'admin-page' == $type ) {
312
-			$namespace = '\\' . __NAMESPACE__ . '\Admin\Pages\\';
301
+	private function make_class_name($name, $type) {
302
+
303
+		if ('calendar' == $type) {
304
+			$namespace = '\\'.__NAMESPACE__.'\Calendars\\';
305
+		} elseif ('calendar-view' == $type) {
306
+			$namespace = '\\'.__NAMESPACE__.'\Calendars\Views\\';
307
+		} elseif ('feed' == $type) {
308
+			$namespace = '\\'.__NAMESPACE__.'\Feeds\\';
309
+		} elseif ('field' == $type) {
310
+			$namespace = '\\'.__NAMESPACE__.'\Admin\Fields\\';
311
+		} elseif ('admin-page' == $type) {
312
+			$namespace = '\\'.__NAMESPACE__.'\Admin\Pages\\';
313 313
 		} else {
314 314
 			return '';
315 315
 		}
316 316
 
317
-		$class_name = implode( '_', array_map( 'ucfirst', explode( '-', $name ) ) );
317
+		$class_name = implode('_', array_map('ucfirst', explode('-', $name)));
318 318
 
319
-		return $namespace . $class_name;
319
+		return $namespace.$class_name;
320 320
 	}
321 321
 
322 322
 }
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function __construct() {
28 28
 		// Register custom taxonomies.
29
-		add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 5 );
29
+		add_action('init', array(__CLASS__, 'register_taxonomies'), 5);
30 30
 		// Register custom post types.
31
-		add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 );
31
+		add_action('init', array(__CLASS__, 'register_post_types'), 5);
32 32
 		// Filter the calendar feed post content to display a calendar view.
33
-		add_filter( 'the_content', array( $this, 'filter_post_content' ), 100 );
33
+		add_filter('the_content', array($this, 'filter_post_content'), 100);
34 34
 		// Delete calendar transients and notices upon post deletion.
35
-		add_action( 'before_delete_post', array( $this, 'upon_deletion' ), 10, 1 );
35
+		add_action('before_delete_post', array($this, 'upon_deletion'), 10, 1);
36 36
 	}
37 37
 
38 38
 	/**
@@ -42,32 +42,32 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public static function register_taxonomies() {
44 44
 
45
-		do_action( 'simcal_register_taxonomies' );
45
+		do_action('simcal_register_taxonomies');
46 46
 
47
-		if ( ! taxonomy_exists( 'calendar_feed' ) ) {
47
+		if ( ! taxonomy_exists('calendar_feed')) {
48 48
 
49 49
 			// Feed Type.
50 50
 			$labels = array(
51
-				'name'                       => __( 'Events Source Types', 'google-calendar-events' ),
52
-				'singular_name'              => __( 'Events Source Type', 'google-calendar-events' ),
53
-				'menu_name'                  => __( 'Events Source Type', 'google-calendar-events' ),
54
-				'all_items'                  => __( 'All Events Source Types', 'google-calendar-events' ),
55
-				'parent_item'                => __( 'Parent Events Source Type', 'google-calendar-events' ),
56
-				'parent_item_colon'          => __( 'Parent Events Source Type:', 'google-calendar-events' ),
57
-				'new_item_name'              => __( 'New Events Source Type', 'google-calendar-events' ),
58
-				'add_new_item'               => __( 'Add New Events Source Type', 'google-calendar-events' ),
59
-				'edit_item'                  => __( 'Edit Events Source Type', 'google-calendar-events' ),
60
-				'update_item'                => __( 'Update Events Source Type', 'google-calendar-events' ),
61
-				'view_item'                  => __( 'View Events Source Type', 'google-calendar-events' ),
62
-				'separate_items_with_commas' => __( 'Separate events source types with commas', 'google-calendar-events' ),
63
-				'add_or_remove_items'        => __( 'Add or remove events source types', 'google-calendar-events' ),
64
-				'choose_from_most_used'      => __( 'Choose from the most used', 'google-calendar-events' ),
65
-				'popular_items'              => __( 'Popular events source types', 'google-calendar-events' ),
66
-				'search_items'               => __( 'Search Events Source Types', 'google-calendar-events' ),
67
-				'not_found'                  => __( 'Not Found', 'google-calendar-events' ),
51
+				'name'                       => __('Events Source Types', 'google-calendar-events'),
52
+				'singular_name'              => __('Events Source Type', 'google-calendar-events'),
53
+				'menu_name'                  => __('Events Source Type', 'google-calendar-events'),
54
+				'all_items'                  => __('All Events Source Types', 'google-calendar-events'),
55
+				'parent_item'                => __('Parent Events Source Type', 'google-calendar-events'),
56
+				'parent_item_colon'          => __('Parent Events Source Type:', 'google-calendar-events'),
57
+				'new_item_name'              => __('New Events Source Type', 'google-calendar-events'),
58
+				'add_new_item'               => __('Add New Events Source Type', 'google-calendar-events'),
59
+				'edit_item'                  => __('Edit Events Source Type', 'google-calendar-events'),
60
+				'update_item'                => __('Update Events Source Type', 'google-calendar-events'),
61
+				'view_item'                  => __('View Events Source Type', 'google-calendar-events'),
62
+				'separate_items_with_commas' => __('Separate events source types with commas', 'google-calendar-events'),
63
+				'add_or_remove_items'        => __('Add or remove events source types', 'google-calendar-events'),
64
+				'choose_from_most_used'      => __('Choose from the most used', 'google-calendar-events'),
65
+				'popular_items'              => __('Popular events source types', 'google-calendar-events'),
66
+				'search_items'               => __('Search Events Source Types', 'google-calendar-events'),
67
+				'not_found'                  => __('Not Found', 'google-calendar-events'),
68 68
 			);
69 69
 
70
-			$args   = array(
70
+			$args = array(
71 71
 				'hierarchical'      => true,
72 72
 				'labels'            => $labels,
73 73
 				'public'            => false,
@@ -76,34 +76,34 @@  discard block
 block discarded – undo
76 76
 				'show_tagcloud'     => false,
77 77
 				'show_ui'           => false,
78 78
 			);
79
-			register_taxonomy( 'calendar_feed', array( 'calendar' ), $args );
79
+			register_taxonomy('calendar_feed', array('calendar'), $args);
80 80
 
81 81
 		}
82 82
 
83
-		if ( ! taxonomy_exists( 'calendar_type' ) ) {
83
+		if ( ! taxonomy_exists('calendar_type')) {
84 84
 
85 85
 			// Calendar Type.
86 86
 			$labels = array(
87
-				'name'                       => __( 'Calendar Types', 'google-calendar-events' ),
88
-				'singular_name'              => __( 'Calendar Type', 'google-calendar-events' ),
89
-				'menu_name'                  => __( 'Calendar Type', 'google-calendar-events' ),
90
-				'all_items'                  => __( 'All Calendar Types', 'google-calendar-events' ),
91
-				'parent_item'                => __( 'Parent Calendar Type', 'google-calendar-events' ),
92
-				'parent_item_colon'          => __( 'Parent Calendar Type:', 'google-calendar-events' ),
93
-				'new_item_name'              => __( 'New Calendar Type', 'google-calendar-events' ),
94
-				'add_new_item'               => __( 'Add New Calendar Type', 'google-calendar-events' ),
95
-				'edit_item'                  => __( 'Edit Calendar Type', 'google-calendar-events' ),
96
-				'update_item'                => __( 'Update Calendar Type', 'google-calendar-events' ),
97
-				'view_item'                  => __( 'View Calendar Type', 'google-calendar-events' ),
98
-				'separate_items_with_commas' => __( 'Separate calendar types with commas', 'google-calendar-events' ),
99
-				'add_or_remove_items'        => __( 'Add or remove calendar types', 'google-calendar-events' ),
100
-				'choose_from_most_used'      => __( 'Choose from the most used', 'google-calendar-events' ),
101
-				'popular_items'              => __( 'Popular calendar types', 'google-calendar-events' ),
102
-				'search_items'               => __( 'Search Calendar Types', 'google-calendar-events' ),
103
-				'not_found'                  => __( 'Not Found', 'google-calendar-events' ),
87
+				'name'                       => __('Calendar Types', 'google-calendar-events'),
88
+				'singular_name'              => __('Calendar Type', 'google-calendar-events'),
89
+				'menu_name'                  => __('Calendar Type', 'google-calendar-events'),
90
+				'all_items'                  => __('All Calendar Types', 'google-calendar-events'),
91
+				'parent_item'                => __('Parent Calendar Type', 'google-calendar-events'),
92
+				'parent_item_colon'          => __('Parent Calendar Type:', 'google-calendar-events'),
93
+				'new_item_name'              => __('New Calendar Type', 'google-calendar-events'),
94
+				'add_new_item'               => __('Add New Calendar Type', 'google-calendar-events'),
95
+				'edit_item'                  => __('Edit Calendar Type', 'google-calendar-events'),
96
+				'update_item'                => __('Update Calendar Type', 'google-calendar-events'),
97
+				'view_item'                  => __('View Calendar Type', 'google-calendar-events'),
98
+				'separate_items_with_commas' => __('Separate calendar types with commas', 'google-calendar-events'),
99
+				'add_or_remove_items'        => __('Add or remove calendar types', 'google-calendar-events'),
100
+				'choose_from_most_used'      => __('Choose from the most used', 'google-calendar-events'),
101
+				'popular_items'              => __('Popular calendar types', 'google-calendar-events'),
102
+				'search_items'               => __('Search Calendar Types', 'google-calendar-events'),
103
+				'not_found'                  => __('Not Found', 'google-calendar-events'),
104 104
 			);
105 105
 
106
-			$args   = array(
106
+			$args = array(
107 107
 				'hierarchical'      => true,
108 108
 				'labels'            => $labels,
109 109
 				'public'            => false,
@@ -112,34 +112,34 @@  discard block
 block discarded – undo
112 112
 				'show_tagcloud'     => false,
113 113
 				'show_ui'           => false,
114 114
 			);
115
-			register_taxonomy( 'calendar_type', array( 'calendar' ), $args );
115
+			register_taxonomy('calendar_type', array('calendar'), $args);
116 116
 
117 117
 		}
118 118
 
119
-		if ( ! taxonomy_exists( 'calendar_category' ) ) {
119
+		if ( ! taxonomy_exists('calendar_category')) {
120 120
 
121 121
 			// Feed Category.
122 122
 			$labels = array(
123
-				'name'                       => __( 'Categories', 'google-calendar-events' ),
124
-				'singular_name'              => __( 'Category', 'google-calendar-events' ),
125
-				'menu_name'                  => __( 'Categories', 'google-calendar-events' ),
126
-				'all_items'                  => __( 'All Categories', 'google-calendar-events' ),
127
-				'parent_item'                => __( 'Parent Category', 'google-calendar-events' ),
128
-				'parent_item_colon'          => __( 'Parent Category:', 'google-calendar-events' ),
129
-				'new_item_name'              => __( 'New Category', 'google-calendar-events' ),
130
-				'add_new_item'               => __( 'Add New Category', 'google-calendar-events' ),
131
-				'edit_item'                  => __( 'Edit Category', 'google-calendar-events' ),
132
-				'update_item'                => __( 'Update Category', 'google-calendar-events' ),
133
-				'view_item'                  => __( 'View Category', 'google-calendar-events' ),
134
-				'separate_items_with_commas' => __( 'Separate categories with commas', 'google-calendar-events' ),
135
-				'add_or_remove_items'        => __( 'Add or remove categories', 'google-calendar-events' ),
136
-				'choose_from_most_used'      => __( 'Choose from the most used', 'google-calendar-events' ),
137
-				'popular_items'              => __( 'Popular Categories', 'google-calendar-events' ),
138
-				'search_items'               => __( 'Search Categories', 'google-calendar-events' ),
139
-				'not_found'                  => __( 'Not Found', 'google-calendar-events' ),
123
+				'name'                       => __('Categories', 'google-calendar-events'),
124
+				'singular_name'              => __('Category', 'google-calendar-events'),
125
+				'menu_name'                  => __('Categories', 'google-calendar-events'),
126
+				'all_items'                  => __('All Categories', 'google-calendar-events'),
127
+				'parent_item'                => __('Parent Category', 'google-calendar-events'),
128
+				'parent_item_colon'          => __('Parent Category:', 'google-calendar-events'),
129
+				'new_item_name'              => __('New Category', 'google-calendar-events'),
130
+				'add_new_item'               => __('Add New Category', 'google-calendar-events'),
131
+				'edit_item'                  => __('Edit Category', 'google-calendar-events'),
132
+				'update_item'                => __('Update Category', 'google-calendar-events'),
133
+				'view_item'                  => __('View Category', 'google-calendar-events'),
134
+				'separate_items_with_commas' => __('Separate categories with commas', 'google-calendar-events'),
135
+				'add_or_remove_items'        => __('Add or remove categories', 'google-calendar-events'),
136
+				'choose_from_most_used'      => __('Choose from the most used', 'google-calendar-events'),
137
+				'popular_items'              => __('Popular Categories', 'google-calendar-events'),
138
+				'search_items'               => __('Search Categories', 'google-calendar-events'),
139
+				'not_found'                  => __('Not Found', 'google-calendar-events'),
140 140
 			);
141 141
 
142
-			$args   = array(
142
+			$args = array(
143 143
 				'hierarchical'      => true,
144 144
 				'labels'            => $labels,
145 145
 				'public'            => true,
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 				'show_ui'           => true,
150 150
 			);
151 151
 
152
-			register_taxonomy( 'calendar_category', array( 'calendar' ), $args );
152
+			register_taxonomy('calendar_category', array('calendar'), $args);
153 153
 		}
154 154
 
155 155
 	}
@@ -161,27 +161,27 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public static function register_post_types() {
163 163
 
164
-		do_action( 'simcal_register_post_types' );
164
+		do_action('simcal_register_post_types');
165 165
 
166
-		if ( ! post_type_exists( 'calendar' ) ) {
166
+		if ( ! post_type_exists('calendar')) {
167 167
 
168 168
 			// Calendar feed post type.
169
-			$labels        = array(
170
-				'name'               => _x( 'Calendars', 'Post Type General Name', 'google-calendar-events' ),
171
-				'singular_name'      => _x( 'Calendar', 'Post Type Singular Name', 'google-calendar-events' ),
172
-				'menu_name'          => __( 'Calendars', 'google-calendar-events' ),
173
-				'name_admin_bar'     => __( 'Calendar', 'google-calendar-events' ),
174
-				'parent_item_colon'  => __( 'Parent Calendar:', 'google-calendar-events' ),
175
-				'all_items'          => __( 'All Calendars', 'google-calendar-events' ),
176
-				'add_new_item'       => __( 'Add New Calendar', 'google-calendar-events' ),
177
-				'add_new'            => __( 'Add New', 'google-calendar-events' ),
178
-				'new_item'           => __( 'New Calendar', 'google-calendar-events' ),
179
-				'edit_item'          => __( 'Edit Calendar', 'google-calendar-events' ),
180
-				'update_item'        => __( 'Update Calendar', 'google-calendar-events' ),
181
-				'view_item'          => __( 'View Calendar', 'google-calendar-events' ),
182
-				'search_items'       => __( 'Search Calendar', 'google-calendar-events' ),
183
-				'not_found'          => __( 'Calendars not found', 'google-calendar-events' ),
184
-				'not_found_in_trash' => __( 'Calendars not found in Trash', 'google-calendar-events' ),
169
+			$labels = array(
170
+				'name'               => _x('Calendars', 'Post Type General Name', 'google-calendar-events'),
171
+				'singular_name'      => _x('Calendar', 'Post Type Singular Name', 'google-calendar-events'),
172
+				'menu_name'          => __('Calendars', 'google-calendar-events'),
173
+				'name_admin_bar'     => __('Calendar', 'google-calendar-events'),
174
+				'parent_item_colon'  => __('Parent Calendar:', 'google-calendar-events'),
175
+				'all_items'          => __('All Calendars', 'google-calendar-events'),
176
+				'add_new_item'       => __('Add New Calendar', 'google-calendar-events'),
177
+				'add_new'            => __('Add New', 'google-calendar-events'),
178
+				'new_item'           => __('New Calendar', 'google-calendar-events'),
179
+				'edit_item'          => __('Edit Calendar', 'google-calendar-events'),
180
+				'update_item'        => __('Update Calendar', 'google-calendar-events'),
181
+				'view_item'          => __('View Calendar', 'google-calendar-events'),
182
+				'search_items'       => __('Search Calendar', 'google-calendar-events'),
183
+				'not_found'          => __('Calendars not found', 'google-calendar-events'),
184
+				'not_found_in_trash' => __('Calendars not found in Trash', 'google-calendar-events'),
185 185
 			);
186 186
 
187 187
 			$rewrite_rules = array(
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 
194 194
 			$svg_icon = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iU2hhcGVzX3hBMF9JbWFnZV8xXyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDEwMjQgMTAyNCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik01MTMuNCwxMDEzLjNjLTE2My44LDAtMzI3LjcsMC00OTEuNSwwYy05LjcsMC04LjgsMC45LTguOC04LjljMC0yNDMuNywwLjItNDg3LjMtMC4zLTczMWMtMC4xLTM5LjYsMjcuNy03Ni40LDY5LjYtODIuM2MzLTAuNCw2LTAuNSw5LTAuNWMzNSwwLDcwLDAuMSwxMDUtMC4xYzUuMSwwLDYuNSwxLjQsNi41LDYuNWMtMC4yLDI2LjgsMC4xLDUzLjctMC4yLDgwLjVjLTAuMiwxNS4yLDMuOSwyOC4yLDE1LjksMzguMmMyLjcsMi4yLDUsNC44LDcuNCw3LjRjOCw4LjYsMTguMSwxMi40LDI5LjYsMTIuNGMzMC43LDAuMiw2MS4zLDAuMiw5MiwwYzExLjItMC4xLDIxLjItMy45LDI5LjEtMTIuMmMzLjQtMy42LDctNy4yLDEwLjYtMTAuNmM5LTguNCwxMi43LTE4LjksMTIuNy0zMWMwLjEtMjguMiwwLTU2LjMsMC04NC41YzAtNi42LDAtNi42LDYuNi02LjZjNzEuNSwwLDE0MywwLDIxNC41LDBjNi42LDAsNi42LDAsNi42LDYuN2MwLDI2LjgsMC4yLDUzLjctMC4xLDgwLjVjLTAuMiwxNSw1LjEsMjYuOCwxNS40LDM4YzEzLjYsMTQuNywyOC45LDIwLjgsNDguNywyMC4xYzI1LjYtMSw1MS4zLTAuNCw3Ny0wLjJjMTMuOSwwLjEsMjQuOC01LjEsMzUuNC0xNC40YzE1LjktMTQsMjIuMS0zMC40LDIxLjEtNTEuM2MtMS4xLTI0LjMtMC4xLTQ4LjctMC40LTczYzAtNS4xLDEuNC02LjUsNi41LTYuNWMzNC43LDAuMiw2OS4zLDAsMTA0LDAuMWM0Mi4zLDAuMiw3OC4zLDM2LDc4LjMsNzguM2MwLjEsMjQ2LDAsNDkyLDAsNzM4YzAsNi40LDAsNi40LTcuMyw2LjRDODQyLDEwMTMuMyw2NzcuNywxMDEzLjMsNTEzLjQsMTAxMy4zeiBNNDM5LjUsNjc4LjljMS42LTEsMi4yLTEuNSwzLTEuOGMxMS44LTUuOCwyMS41LTE0LjIsMjktMjQuOGMyNC4zLTM0LjEsMjQuMy03MC45LDguNi0xMDcuOGMtMTMuMy0zMS4zLTM5LjMtNDkuMy03MS01OS40Yy0yNy42LTguOC01Ni05LjQtODQuNS01LjZjLTIwLjMsMi43LTM5LjIsOS42LTU1LjUsMjIuMmMtMzUuNSwyNy4yLTQ4LjQsNjUuMS01MC40LDEwOGMtMC4yLDMuNywyLjEsMy45LDQuOCwzLjljMjIuMiwwLDQ0LjMtMC4xLDY2LjUsMGMzLjgsMCw1LjQtMS4xLDUuMy01LjFjLTAuMS03LjcsMS0xNS4zLDMtMjIuN2M1LjQtMjAsMTYuNS0zNC43LDM3LjgtMzkuN2M4LjEtMS45LDE2LjMtMi4xLDI0LjQtMS4zYzIxLjQsMi4xLDM2LjMsMTMuMSw0My41LDMzLjdjMy41LDEwLjEsMy45LDIwLjQsMi45LDMxYy0yLjIsMjMuNC0xNi4yLDM5LjctMzkuMSw0NC42Yy0xMy4yLDIuOC0yNi42LDQuMS00MC4yLDRjLTMuNywwLTUsMS4yLTQuOSw0LjljMC4xLDE2LjUsMC4yLDMzLDAsNDkuNWMwLDQsMS41LDUuMiw1LjMsNS4xYzEyLjktMC4zLDI1LjYsMC45LDM4LjMsM2MyNi4zLDQuMiw0My41LDE4LjgsNDkuMiw0MmMzLjMsMTMuNSwzLDI3LjEtMC4yLDQwLjZjLTIuMyw5LjctNi44LDE4LjQtMTMuOCwyNS43Yy0xNS40LDE2LjEtMzQuNSwyMS42LTU2LDE4LjljLTI3LjUtMy40LTQzLjUtMTgtNTAuNS00NC44Yy0xLjktNy4zLTMuMS0xNC43LTIuOC0yMi4yYzAuMi00LTEuMS01LjYtNS40LTUuNmMtMjMuNywwLjItNDcuMywwLjItNzEsMGMtNCwwLTUuNCwxLjItNC45LDUuMmMxLjQsMTMuMiwyLjcsMjYuNSw1LjksMzkuNWMxMS4xLDQ1LjIsMzguMiw3NS42LDgzLjQsODguMmMzNi43LDEwLjMsNzMuOCwxMC4xLDExMC41LDAuMWMyNC41LTYuNiw0NC43LTIwLjEsNjEtMzkuOGMyNC41LTI5LjcsMzQuNC02My45LDMxLjQtMTAxLjljLTIuMi0yNy40LTEyLjUtNTEuMy0zMy42LTY5LjhDNDYwLjcsNjg5LjMsNDUxLjksNjgyLDQzOS41LDY3OC45eiBNNzU1LDY5Mi41YzAtNjguNi0wLjEtMTM3LjMsMC4xLTIwNS45YzAtNS4xLTEuNC02LjUtNi41LTYuNGMtMTguMywwLjMtMzYuNywwLjQtNTUsMGMtNS43LTAuMS03LjIsMS45LTguMiw3Yy01LjksMzIuMS0yNC40LDUzLTU2LjMsNjEuMWMtMTcuNSw0LjUtMzUuNiw1LTUzLjUsNS44Yy0zLjksMC4yLTUuMiwxLjQtNS4yLDUuM2MwLjIsMTUuMywwLjIsMzAuNywwLDQ2Yy0wLjEsNC4zLDEuNiw1LjQsNS42LDUuM2MxNC4yLTAuMiwyOC4zLTAuMSw0Mi41LTAuMWMxNS41LDAsMzEsMC4xLDQ2LjUtMC4xYzQuMSwwLDUuOSwxLjMsNS41LDUuNGMtMC4xLDEuNywwLDMuMywwLDVjMCw5Mi4xLDAsMTg0LjMsMCwyNzYuNGMwLDcuMiwwLDcuMiw3LDcuMmMyMy41LDAsNDcsMCw3MC41LDBjNywwLDcsMCw3LTcuMkM3NTUsODI5LjEsNzU1LDc2MC44LDc1NSw2OTIuNXoiLz48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgZD0iTTM3Ni43LDE5OS4yYzAsMjQuMiwwLDQ4LjMsMCw3Mi41Yy0wLjEsMjMuMS0xNy40LDQwLjUtNDAuNCw0MC42Yy0yMy4zLDAuMS00Ni42LDAuMS03MCwwYy0yMi44LTAuMS00MC4zLTE3LjQtNDAuMy00MC4xYy0wLjEtNDguNS0wLjEtOTYuOSwwLTE0NS40YzAtMjIuNCwxNy41LTQwLDM5LjktNDAuMWMyMy43LTAuMSw0Ny4zLTAuMSw3MSwwYzIyLjQsMC4xLDM5LjgsMTcuNywzOS44LDQwLjFDMzc2LjgsMTUwLjksMzc2LjcsMTc1LjEsMzc2LjcsMTk5LjJ6Ii8+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik04MDEuNywxOTkuNmMwLDI0LDAsNDgsMCw3MmMwLDIzLjQtMTcuMyw0MC43LTQwLjcsNDAuOGMtMjMuMiwwLjEtNDYuMywwLjEtNjkuNSwwYy0yMy4xLTAuMS00MC41LTE3LjQtNDAuNS00MC41Yy0wLjEtNDguMy0wLjEtOTYuNiwwLTE0NC45YzAtMjIuNywxNy41LTQwLjIsNDAuMi00MC4zYzIzLjMtMC4xLDQ2LjYtMC4xLDcwLDBjMjMuMSwwLjEsNDAuNCwxNy40LDQwLjUsNDAuNUM4MDEuOCwxNTEuMyw4MDEuNywxNzUuNCw4MDEuNywxOTkuNnoiLz48L3N2Zz4=';
195 195
 
196
-			$args          = array(
196
+			$args = array(
197 197
 				'capability_type'     => 'post',
198 198
 				'exclude_from_search' => false,
199 199
 				'has_archive'         => false,
200 200
 				'hierarchical'        => false,
201
-				'label'               => __( 'Calendar', 'google-calendar-events' ),
201
+				'label'               => __('Calendar', 'google-calendar-events'),
202 202
 				'labels'              => $labels,
203 203
 				'query_var'           => true,
204 204
 				'public'              => true,
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 				'show_in_menu'        => true,
211 211
 				'show_in_nav_menus'   => true,
212 212
 				'show_ui'             => true,
213
-				'supports'            => array( 'title', 'editor' ),
213
+				'supports'            => array('title', 'editor'),
214 214
 				'taxonomies'          => array(
215 215
 					'calendar_category',
216 216
 					'calendar_feed',
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 				),
219 219
 			);
220 220
 
221
-			register_post_type( 'calendar', $args );
221
+			register_post_type('calendar', $args);
222 222
 		}
223 223
 
224 224
 	}
@@ -232,49 +232,49 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @return string
234 234
 	 */
235
-	public function filter_post_content( $the_content ) {
235
+	public function filter_post_content($the_content) {
236 236
 
237
-		if ( is_singular() ) {
237
+		if (is_singular()) {
238 238
 
239 239
 			global $post;
240 240
 
241
-			if ( 'calendar' == $post->post_type ) {
241
+			if ('calendar' == $post->post_type) {
242 242
 
243
-				if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
243
+				if (is_admin() && ! defined('DOING_AJAX')) {
244 244
 					return '';
245 245
 				} else {
246 246
 					ob_start();
247
-					simcal_print_calendar( $post );
247
+					simcal_print_calendar($post);
248 248
 					return ob_get_clean();
249 249
 				}
250 250
 
251 251
 			} else {
252 252
 
253 253
 				$post_types = array();
254
-				$settings   = get_option( 'simple-calendar_settings_calendars' );
255
-				if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
254
+				$settings   = get_option('simple-calendar_settings_calendars');
255
+				if (isset($settings['general']['attach_calendars_posts'])) {
256 256
 					$post_types = $settings['general']['attach_calendars_posts'];
257 257
 				}
258 258
 
259
-				if ( empty( $post_types ) ) {
259
+				if (empty($post_types)) {
260 260
 					return $the_content;
261 261
 				}
262 262
 
263
-				if ( in_array( $post->post_type, (array) $post_types ) ) {
263
+				if (in_array($post->post_type, (array) $post_types)) {
264 264
 
265
-					$id = absint( get_post_meta( $post->ID, '_simcal_attach_calendar_id', true ) );
265
+					$id = absint(get_post_meta($post->ID, '_simcal_attach_calendar_id', true));
266 266
 
267
-					if ( $id > 0 ) {
267
+					if ($id > 0) {
268 268
 
269
-						$pos = esc_attr( get_post_meta( $post->ID, '_simcal_attach_calendar_position', true ) );
269
+						$pos = esc_attr(get_post_meta($post->ID, '_simcal_attach_calendar_position', true));
270 270
 
271 271
 						ob_start();
272 272
 
273
-						if ( 'after' == $pos ) {
273
+						if ('after' == $pos) {
274 274
 							echo $the_content;
275
-							simcal_print_calendar( $id );
276
-						} elseif ( 'before' == $pos ) {
277
-							simcal_print_calendar( $id );
275
+							simcal_print_calendar($id);
276
+						} elseif ('before' == $pos) {
277
+							simcal_print_calendar($id);
278 278
 							echo $the_content;
279 279
 						} else {
280 280
 							echo $the_content;
@@ -300,20 +300,20 @@  discard block
 block discarded – undo
300 300
 	 *
301 301
 	 * @param $post_id
302 302
 	 */
303
-	public function upon_deletion( $post_id ) {
303
+	public function upon_deletion($post_id) {
304 304
 
305
-		$post_type = get_post_type( $post_id );
305
+		$post_type = get_post_type($post_id);
306 306
 
307
-		if ( 'calendar' == $post_type ) {
307
+		if ('calendar' == $post_type) {
308 308
 
309
-			$notices = get_option( 'simple-calendar_admin_notices', array() );
309
+			$notices = get_option('simple-calendar_admin_notices', array());
310 310
 
311
-			if ( ! empty( $notices ) && isset( $notices[ 'calendar_' . strval( $post_id ) ] ) ) {
312
-				unset( $notices[ 'calendar_' . strval( $post_id ) ] );
313
-				update_option( 'simple-calendar_admin_notices', $notices );
311
+			if ( ! empty($notices) && isset($notices['calendar_'.strval($post_id)])) {
312
+				unset($notices['calendar_'.strval($post_id)]);
313
+				update_option('simple-calendar_admin_notices', $notices);
314 314
 			}
315 315
 
316
-			simcal_delete_feed_transients( $post_id );
316
+			simcal_delete_feed_transients($post_id);
317 317
 		}
318 318
 	}
319 319
 
Please login to merge, or discard this patch.
includes/shortcodes.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Calendar;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function __construct() {
30 30
 
31 31
 		// Add shortcodes.
32
-		add_action( 'init', array( $this, 'register' ) );
32
+		add_action('init', array($this, 'register'));
33 33
 	}
34 34
 
35 35
 	/**
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function register() {
41 41
 
42
-		add_shortcode( 'calendar', array( $this, 'print_calendar' ) );
42
+		add_shortcode('calendar', array($this, 'print_calendar'));
43 43
 		// @deprecated legacy shortcode
44
-		add_shortcode( 'gcal', array( $this, 'print_calendar' ) );
44
+		add_shortcode('gcal', array($this, 'print_calendar'));
45 45
 
46
-		do_action( 'simcal_add_shortcodes' );
46
+		do_action('simcal_add_shortcodes');
47 47
 	}
48 48
 
49 49
 	/**
@@ -55,19 +55,19 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return string
57 57
 	 */
58
-	public function print_calendar( $attributes ) {
58
+	public function print_calendar($attributes) {
59 59
 
60
-		$args = shortcode_atts( array(
60
+		$args = shortcode_atts(array(
61 61
 			'id' => null,
62
-		), $attributes );
62
+		), $attributes);
63 63
 
64
-		$id = absint( $args['id'] );
64
+		$id = absint($args['id']);
65 65
 
66
-		if ( $id > 0 ) {
66
+		if ($id > 0) {
67 67
 
68
-			$calendar = simcal_get_calendar( $id );
68
+			$calendar = simcal_get_calendar($id);
69 69
 
70
-			if ( $calendar instanceof Calendar ) {
70
+			if ($calendar instanceof Calendar) {
71 71
 				ob_start();
72 72
 				$calendar->html();
73 73
 				return ob_get_clean();
Please login to merge, or discard this patch.
includes/updates/update-v210.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Updates;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -20,21 +20,21 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @param array $posts
22 22
 	 */
23
-	public function __construct( $posts ) {
23
+	public function __construct($posts) {
24 24
 
25
-		if ( ! empty( $posts ) && is_array( $posts ) ) {
25
+		if ( ! empty($posts) && is_array($posts)) {
26 26
 
27
-			foreach ( $posts as $post ) {
27
+			foreach ($posts as $post) {
28 28
 
29
-				$url = get_post_meta( $post->ID, 'gce_feed_url', true );
29
+				$url = get_post_meta($post->ID, 'gce_feed_url', true);
30 30
 
31
-				if ( $url ) {
31
+				if ($url) {
32 32
 
33
-					$url = str_replace( 'https://www.google.com/calendar/feeds/', '', $url );
34
-					$url = str_replace( '/public/basic', '', $url );
35
-					$url = str_replace( '%40', '@', $url );
33
+					$url = str_replace('https://www.google.com/calendar/feeds/', '', $url);
34
+					$url = str_replace('/public/basic', '', $url);
35
+					$url = str_replace('%40', '@', $url);
36 36
 
37
-					update_post_meta( $post->ID, 'gce_feed_url', $url );
37
+					update_post_meta($post->ID, 'gce_feed_url', $url);
38 38
 				}
39 39
 
40 40
 			}
Please login to merge, or discard this patch.
includes/updates/update-v220.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Updates;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -20,28 +20,28 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @param array $posts
22 22
 	 */
23
-	public function __construct( $posts ) {
23
+	public function __construct($posts) {
24 24
 
25
-		if ( ! empty( $posts ) && is_array( $posts ) ) {
25
+		if ( ! empty($posts) && is_array($posts)) {
26 26
 
27
-			foreach ( $posts as $post ) {
27
+			foreach ($posts as $post) {
28 28
 
29
-				$gce_list_max_num        = get_post_meta( $post->ID, 'gce_list_max_num', true );
30
-				$gce_list_max_length     = get_post_meta( $post->ID, 'gce_list_max_length', true );
31
-				$gce_feed_start_interval = get_post_meta( $post->ID, 'gce_feed_start_interval', true );
32
-				$gce_feed_start          = get_post_meta( $post->ID, 'gce_feed_start', true );
33
-				$gce_feed_end_interval   = get_post_meta( $post->ID, 'gce_feed_end_interval', true );
34
-				$gce_feed_end            = get_post_meta( $post->ID, 'gce_feed_end', true );
29
+				$gce_list_max_num        = get_post_meta($post->ID, 'gce_list_max_num', true);
30
+				$gce_list_max_length     = get_post_meta($post->ID, 'gce_list_max_length', true);
31
+				$gce_feed_start_interval = get_post_meta($post->ID, 'gce_feed_start_interval', true);
32
+				$gce_feed_start          = get_post_meta($post->ID, 'gce_feed_start', true);
33
+				$gce_feed_end_interval   = get_post_meta($post->ID, 'gce_feed_end_interval', true);
34
+				$gce_feed_end            = get_post_meta($post->ID, 'gce_feed_end', true);
35 35
 
36
-				update_post_meta( $post->ID, 'gce_per_page_num', $gce_list_max_num );
37
-				update_post_meta( $post->ID, 'gce_events_per_page', $gce_list_max_length );
38
-				update_post_meta( $post->ID, 'gce_feed_start', $gce_feed_start_interval );
39
-				update_post_meta( $post->ID, 'gce_feed_start_num', $gce_feed_start );
40
-				update_post_meta( $post->ID, 'gce_feed_end', $gce_feed_end_interval );
41
-				update_post_meta( $post->ID, 'gce_feed_end_num', $gce_feed_end );
36
+				update_post_meta($post->ID, 'gce_per_page_num', $gce_list_max_num);
37
+				update_post_meta($post->ID, 'gce_events_per_page', $gce_list_max_length);
38
+				update_post_meta($post->ID, 'gce_feed_start', $gce_feed_start_interval);
39
+				update_post_meta($post->ID, 'gce_feed_start_num', $gce_feed_start);
40
+				update_post_meta($post->ID, 'gce_feed_end', $gce_feed_end_interval);
41
+				update_post_meta($post->ID, 'gce_feed_end_num', $gce_feed_end);
42 42
 
43 43
 				// Add new show tooltips option checked as default.
44
-				update_post_meta( $post->ID, 'gce_show_tooltips', 1 );
44
+				update_post_meta($post->ID, 'gce_show_tooltips', 1);
45 45
 			}
46 46
 
47 47
 		}
Please login to merge, or discard this patch.