Completed
Push — master ( a00b53...3dc4d8 )
by
unknown
21:18
created
includes/assets.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Calendar_View;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function __construct() {
62 62
 
63
-		$this->min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) ? '' : '.min';
63
+		$this->min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true) ? '' : '.min';
64 64
 
65
-		$settings = get_option( 'simple-calendar_settings_advanced' );
65
+		$settings = get_option('simple-calendar_settings_advanced');
66 66
 
67
-		if ( isset( $settings['assets']['disable_css'] ) ) {
67
+		if (isset($settings['assets']['disable_css'])) {
68 68
 			$this->disable_styles = 'yes' == $settings['assets']['disable_css'] ? true : false;
69 69
 		}
70 70
 
71
-		add_action( 'init', array( $this, 'register' ), 20 );
72
-		add_action( 'init', array( $this, 'enqueue' ), 40 );
71
+		add_action('init', array($this, 'register'), 20);
72
+		add_action('init', array($this, 'enqueue'), 40);
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since 3.0.0
79 79
 	 */
80 80
 	public function register() {
81
-		do_action( 'simcal_register_assets', $this->min );
81
+		do_action('simcal_register_assets', $this->min);
82 82
 	}
83 83
 
84 84
 	/**
@@ -88,25 +88,25 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function enqueue() {
90 90
 
91
-		add_action( 'wp_enqueue_scripts', array( $this, 'load' ), 10 );
91
+		add_action('wp_enqueue_scripts', array($this, 'load'), 10);
92 92
 
93
-		do_action( 'simcal_enqueue_assets', $this->min );
93
+		do_action('simcal_enqueue_assets', $this->min);
94 94
 
95 95
 
96 96
 		$min = $this->min;
97 97
 		// Improves compatibility with themes and plugins using Isotope and Masonry.
98
-		add_action( 'wp_enqueue_scripts',
99
-			function () use ( $min ) {
100
-				if ( wp_script_is( 'simcal-qtip', 'enqueued' ) ) {
98
+		add_action('wp_enqueue_scripts',
99
+			function() use ($min) {
100
+				if (wp_script_is('simcal-qtip', 'enqueued')) {
101 101
 					wp_enqueue_script(
102 102
 						'simplecalendar-imagesloaded',
103
-						SIMPLE_CALENDAR_ASSETS . 'js/vendor/imagesloaded.pkgd' . $min . '.js',
104
-						array( 'simcal-qtip' ),
103
+						SIMPLE_CALENDAR_ASSETS.'js/vendor/imagesloaded.pkgd'.$min.'.js',
104
+						array('simcal-qtip'),
105 105
 						'3.1.8',
106 106
 						true
107 107
 					);
108 108
 				}
109
-			}, 1000 );
109
+			}, 1000);
110 110
 	}
111 111
 
112 112
 	/**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 		$scripts = $this->get_default_scripts();
120 120
 		$styles  = $this->get_default_styles();
121 121
 
122
-		$this->scripts = apply_filters( 'simcal_front_end_scripts', $scripts, $this->min );
123
-		$this->styles  = apply_filters( 'simcal_front_end_styles', $styles, $this->min );
122
+		$this->scripts = apply_filters('simcal_front_end_scripts', $scripts, $this->min);
123
+		$this->styles  = apply_filters('simcal_front_end_styles', $styles, $this->min);
124 124
 
125
-		$this->load_scripts( $this->scripts );
126
-		$this->load_styles( $this->styles );
125
+		$this->load_scripts($this->scripts);
126
+		$this->load_styles($this->styles);
127 127
 	}
128 128
 
129 129
 	/**
@@ -133,25 +133,25 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function get_widgets_assets() {
135 135
 
136
-		$widgets = get_option( 'widget_gce_widget' );
136
+		$widgets = get_option('widget_gce_widget');
137 137
 
138
-		if ( ! empty( $widgets ) && is_array( $widgets ) ) {
138
+		if ( ! empty($widgets) && is_array($widgets)) {
139 139
 
140
-			foreach ( $widgets as $settings ) {
140
+			foreach ($widgets as $settings) {
141 141
 
142
-				if ( ! empty( $settings ) && is_array( $settings ) ) {
142
+				if ( ! empty($settings) && is_array($settings)) {
143 143
 
144
-					if ( isset( $settings['calendar_id'] ) ) {
144
+					if (isset($settings['calendar_id'])) {
145 145
 
146
-						$view = simcal_get_calendar_view( absint( $settings['calendar_id'] ) );
146
+						$view = simcal_get_calendar_view(absint($settings['calendar_id']));
147 147
 
148
-						if ( $view instanceof Calendar_View ) {
149
-							add_filter( 'simcal_front_end_scripts', function ( $scripts, $min ) use ( $view ) {
150
-								return array_merge( $scripts, $view->scripts( $min ) );
151
-							}, 100, 2 );
152
-							add_filter( 'simcal_front_end_styles', function ( $styles, $min ) use ( $view ) {
153
-								return array_merge( $styles, $view->styles( $min ) );
154
-							}, 100, 2 );
148
+						if ($view instanceof Calendar_View) {
149
+							add_filter('simcal_front_end_scripts', function($scripts, $min) use ($view) {
150
+								return array_merge($scripts, $view->scripts($min));
151
+							}, 100, 2);
152
+							add_filter('simcal_front_end_styles', function($styles, $min) use ($view) {
153
+								return array_merge($styles, $view->styles($min));
154
+							}, 100, 2);
155 155
 						}
156 156
 
157 157
 					}
@@ -169,31 +169,31 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @param array $scripts
171 171
 	 */
172
-	public function load_scripts( $scripts ) {
172
+	public function load_scripts($scripts) {
173 173
 
174 174
 		// Only load if not disabled in the settings
175
-		if ( ! empty( $scripts ) && is_array( $scripts ) ) {
175
+		if ( ! empty($scripts) && is_array($scripts)) {
176 176
 
177
-			foreach ( $scripts as $script => $v ) {
177
+			foreach ($scripts as $script => $v) {
178 178
 
179
-				if ( ! empty( $v['src'] ) ) {
179
+				if ( ! empty($v['src'])) {
180 180
 
181
-					$src        = esc_url( $v['src'] );
182
-					$deps       = isset( $v['deps'] )        ? $v['deps']       : array();
183
-					$ver        = isset( $v['ver'] )         ? $v['ver']        : SIMPLE_CALENDAR_VERSION;
184
-					$in_footer  = isset( $v['in_footer'] )   ? $v['in_footer']  : false;
181
+					$src        = esc_url($v['src']);
182
+					$deps       = isset($v['deps']) ? $v['deps'] : array();
183
+					$ver        = isset($v['ver']) ? $v['ver'] : SIMPLE_CALENDAR_VERSION;
184
+					$in_footer  = isset($v['in_footer']) ? $v['in_footer'] : false;
185 185
 
186
-					wp_enqueue_script( $script, $src, $deps, $ver, $in_footer );
186
+					wp_enqueue_script($script, $src, $deps, $ver, $in_footer);
187 187
 
188
-					if ( ! empty( $v['localize'] ) && is_array( $v['localize'] ) ) {
189
-						foreach ( $v['localize'] as $object => $l10n ) {
190
-							wp_localize_script( $script, $object, $l10n );
188
+					if ( ! empty($v['localize']) && is_array($v['localize'])) {
189
+						foreach ($v['localize'] as $object => $l10n) {
190
+							wp_localize_script($script, $object, $l10n);
191 191
 						}
192 192
 					}
193 193
 
194
-				} elseif ( is_string( $v ) && ! empty( $v ) ) {
194
+				} elseif (is_string($v) && ! empty($v)) {
195 195
 
196
-					wp_enqueue_script( $v );
196
+					wp_enqueue_script($v);
197 197
 				}
198 198
 			}
199 199
 
@@ -207,25 +207,25 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param array $styles
209 209
 	 */
210
-	public function load_styles( $styles ) {
210
+	public function load_styles($styles) {
211 211
 
212 212
 		// Only load if not disabled in the settings
213
-		if ( ! empty( $styles ) && is_array( $styles ) && false === $this->disable_styles ) {
213
+		if ( ! empty($styles) && is_array($styles) && false === $this->disable_styles) {
214 214
 
215
-			foreach ( $styles as $style => $v ) {
215
+			foreach ($styles as $style => $v) {
216 216
 
217
-				if ( ! empty( $v['src'] ) ) {
217
+				if ( ! empty($v['src'])) {
218 218
 
219
-					$src    = esc_url( $v['src'] );
220
-					$deps   = isset( $v['deps'] )   ? $v['deps']    : array();
221
-					$ver    = isset( $v['ver'] )    ? $v['ver']     : SIMPLE_CALENDAR_VERSION;
222
-					$media  = isset( $v['media'] )  ? $v['media']   : 'all';
219
+					$src    = esc_url($v['src']);
220
+					$deps   = isset($v['deps']) ? $v['deps'] : array();
221
+					$ver    = isset($v['ver']) ? $v['ver'] : SIMPLE_CALENDAR_VERSION;
222
+					$media  = isset($v['media']) ? $v['media'] : 'all';
223 223
 
224
-					wp_enqueue_style( $style, $src, $deps, $ver, $media );
224
+					wp_enqueue_style($style, $src, $deps, $ver, $media);
225 225
 
226
-				} elseif ( is_string( $v ) && ! empty( $v ) ) {
226
+				} elseif (is_string($v) && ! empty($v)) {
227 227
 
228
-					wp_enqueue_style( $v );
228
+					wp_enqueue_style($v);
229 229
 				}
230 230
 
231 231
 			}
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 	public function get_default_scripts() {
242 242
 		return array(
243 243
 			'simcal-qtip' => array(
244
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/vendor/jquery.qtip' . $this->min . '.js',
245
-				'deps'      => array( 'jquery' ),
244
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/vendor/jquery.qtip'.$this->min.'.js',
245
+				'deps'      => array('jquery'),
246 246
 				'ver'       => '2.2.1',
247 247
 				'in_footer' => true,
248 248
 			),
249 249
 			'simcal-default-calendar' => array(
250
-				'src'       => SIMPLE_CALENDAR_ASSETS . 'js/default-calendar' . $this->min . '.js',
250
+				'src'       => SIMPLE_CALENDAR_ASSETS.'js/default-calendar'.$this->min.'.js',
251 251
 				'deps'      => array(
252 252
 					'jquery',
253 253
 					'simcal-qtip',
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
 	public function get_default_styles() {
270 270
 		return array(
271 271
 			'simcal-qtip' => array(
272
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/vendor/jquery.qtip' . $this->min . '.css',
272
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/vendor/jquery.qtip'.$this->min.'.css',
273 273
 				'ver'   => '2.2.1',
274 274
 				'media' => 'all',
275 275
 			),
276 276
 			'simcal-default-calendar-grid' => array(
277
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-grid' . $this->min . '.css',
277
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-grid'.$this->min.'.css',
278 278
 				'deps'  => array(
279 279
 					'simcal-qtip',
280 280
 				),
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 				'media' => 'all',
283 283
 			),
284 284
 			'simcal-default-calendar-list' => array(
285
-				'src'   => SIMPLE_CALENDAR_ASSETS . 'css/default-calendar-list' . $this->min . '.css',
285
+				'src'   => SIMPLE_CALENDAR_ASSETS.'css/default-calendar-list'.$this->min.'.css',
286 286
 				'deps'  => array(
287 287
 					'simcal-qtip',
288 288
 				),
Please login to merge, or discard this patch.
includes/admin/pages/advanced.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Admin_Page;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function __construct() {
30 30
 		$this->id           = 'advanced';
31 31
 		$this->option_group = 'settings';
32
-		$this->label        = __( 'Advanced', 'google-calendar-events' );
32
+		$this->label        = __('Advanced', 'google-calendar-events');
33 33
 		//$this->description  = __( 'Advanced settings.', 'google-calendar-events' );
34 34
 		$this->sections     = $this->add_sections();
35 35
 		$this->fields       = $this->add_fields();
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 	 * @return array
44 44
 	 */
45 45
 	public function add_sections() {
46
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', array(
46
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', array(
47 47
 			'assets' => array(
48
-				'title'       => __( 'Styles', 'google-calendar-events' ),
49
-				'description' => __( 'Manage front end assets that handle the calendars appearance.', 'google-calendar-events' )
48
+				'title'       => __('Styles', 'google-calendar-events'),
49
+				'description' => __('Manage front end assets that handle the calendars appearance.', 'google-calendar-events')
50 50
 			),
51 51
 			'installation' => array(
52
-				'title'       => __( 'Installation', 'google-calendar-events' ),
53
-				'description' => __( 'Manage your data (plugin settings and saved calendars).', 'google-calendar-events' )
52
+				'title'       => __('Installation', 'google-calendar-events'),
53
+				'description' => __('Manage your data (plugin settings and saved calendars).', 'google-calendar-events')
54 54
 			)
55
-		) );
55
+		));
56 56
 	}
57 57
 
58 58
 	/**
@@ -65,41 +65,41 @@  discard block
 block discarded – undo
65 65
 	public function add_fields() {
66 66
 
67 67
 		$fields       = array();
68
-		$this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id );
68
+		$this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id);
69 69
 
70
-		foreach ( $this->sections  as $section => $a ) :
70
+		foreach ($this->sections  as $section => $a) :
71 71
 
72
-			if ( 'assets' == $section ) {
72
+			if ('assets' == $section) {
73 73
 
74
-				$fields[ $section ] = array(
74
+				$fields[$section] = array(
75 75
 					'disable_css' => array(
76
-						'title'   => __( 'Disable CSS', 'google-calendar-events' ),
77
-						'tooltip' => __( 'If ticked, this option will prevent front end stylesheet to load.', 'google-calendar-events' ),
76
+						'title'   => __('Disable CSS', 'google-calendar-events'),
77
+						'tooltip' => __('If ticked, this option will prevent front end stylesheet to load.', 'google-calendar-events'),
78 78
 						'type'    => 'checkbox',
79
-						'name'    => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][disable_css]',
80
-						'id'      => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-disable-css',
81
-						'value'   => $this->get_option_value( $section, 'disable_css' )
79
+						'name'    => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][disable_css]',
80
+						'id'      => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-disable-css',
81
+						'value'   => $this->get_option_value($section, 'disable_css')
82 82
 					),
83 83
 				);
84 84
 
85
-			} elseif ( 'installation' == $section ) {
85
+			} elseif ('installation' == $section) {
86 86
 
87
-				$fields[ $section ] = array(
87
+				$fields[$section] = array(
88 88
 					'delete_settings' => array(
89
-						'title'   => __( 'Delete settings', 'google-calendar-events' ),
90
-						'tooltip' => __( 'Tick this option if you want to wipe this plugin settings from database when uninstalling.', 'google-calendar-events' ),
89
+						'title'   => __('Delete settings', 'google-calendar-events'),
90
+						'tooltip' => __('Tick this option if you want to wipe this plugin settings from database when uninstalling.', 'google-calendar-events'),
91 91
 						'type'    => 'checkbox',
92
-						'name'    => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][delete_settings]',
93
-						'id'      => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-delete-settings',
94
-						'value'   => $this->get_option_value( $section, 'delete_settings' ),
92
+						'name'    => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][delete_settings]',
93
+						'id'      => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-delete-settings',
94
+						'value'   => $this->get_option_value($section, 'delete_settings'),
95 95
 					),
96 96
 					'erase_data' => array(
97
-						'title'   => __( 'Erase calendar data', 'google-calendar-events' ),
98
-						'tooltip' => __( 'By default your data will be retained in database even after uninstall. Tick this option if you want to delete all your calendar data when uninstalling.', 'google-calendar-events' ),
97
+						'title'   => __('Erase calendar data', 'google-calendar-events'),
98
+						'tooltip' => __('By default your data will be retained in database even after uninstall. Tick this option if you want to delete all your calendar data when uninstalling.', 'google-calendar-events'),
99 99
 						'type'    => 'checkbox',
100
-						'name'    => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][erase_data]',
101
-						'id'      => 'simple-calendar_' . $this->option_group . '_' . $this->id . '-delete-data',
102
-						'value'   => $this->get_option_value( $section, 'erase_data' ),
100
+						'name'    => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][erase_data]',
101
+						'id'      => 'simple-calendar_'.$this->option_group.'_'.$this->id.'-delete-data',
102
+						'value'   => $this->get_option_value($section, 'erase_data'),
103 103
 					)
104 104
 				);
105 105
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 		endforeach;
109 109
 
110
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields );
110
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields);
111 111
 	}
112 112
 
113 113
 }
Please login to merge, or discard this patch.
includes/admin/assets.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Admin;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function __construct() {
36 36
 
37
-		$this->min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) ? '' : '.min';
37
+		$this->min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true) ? '' : '.min';
38 38
 
39
-		add_action( 'admin_enqueue_scripts', array( $this, 'load' ) );
39
+		add_action('admin_enqueue_scripts', array($this, 'load'));
40 40
 	}
41 41
 
42 42
 	/**
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function load() {
48 48
 
49
-		$css_path        = SIMPLE_CALENDAR_ASSETS . 'css/';
50
-		$css_path_vendor = $css_path . 'vendor/';
51
-		$js_path         = SIMPLE_CALENDAR_ASSETS . 'js/';
52
-		$js_path_vendor  = $js_path . 'vendor/';
49
+		$css_path        = SIMPLE_CALENDAR_ASSETS.'css/';
50
+		$css_path_vendor = $css_path.'vendor/';
51
+		$js_path         = SIMPLE_CALENDAR_ASSETS.'js/';
52
+		$js_path_vendor  = $js_path.'vendor/';
53 53
 
54 54
 		/* ====================== *
55 55
 		 * Register Admin Scripts *
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
 		// TipTip uses ".minified.js" filename ending.
59 59
 		wp_register_script(
60 60
 			'simcal-tiptip',
61
-			$js_path_vendor . 'jquery.tipTip' . ( ( $this->min !== '' ) ? '.minified' : '' ) . '.js',
62
-			array( 'jquery' ),
61
+			$js_path_vendor.'jquery.tipTip'.(($this->min !== '') ? '.minified' : '').'.js',
62
+			array('jquery'),
63 63
 			'1.3',
64 64
 			true
65 65
 		);
66 66
 		wp_register_script(
67 67
 			'simcal-select2',
68
-			$js_path_vendor . 'select2' . $this->min . '.js',
68
+			$js_path_vendor.'select2'.$this->min.'.js',
69 69
 			array(),
70 70
 			'4.0',
71 71
 			true
72 72
 		);
73 73
 		wp_register_script(
74 74
 			'simcal-admin',
75
-			$js_path . 'admin' . $this->min . '.js',
75
+			$js_path.'admin'.$this->min.'.js',
76 76
 			array(
77 77
 				'jquery',
78 78
 				'jquery-ui-sortable',
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		);
87 87
 		wp_register_script(
88 88
 			'simcal-admin-add-calendar',
89
-			$js_path . 'admin-add-calendar' . $this->min . '.js',
90
-			array( 'simcal-select2' ),
89
+			$js_path.'admin-add-calendar'.$this->min.'.js',
90
+			array('simcal-select2'),
91 91
 			SIMPLE_CALENDAR_VERSION,
92 92
 			true
93 93
 		);
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 
99 99
 		wp_register_style(
100 100
 			'simcal-select2',
101
-			$css_path_vendor . 'select2' . $this->min . '.css',
101
+			$css_path_vendor.'select2'.$this->min.'.css',
102 102
 			array(),
103 103
 			'4.0.0'
104 104
 		);
105 105
 		wp_register_style(
106 106
 			'simcal-admin',
107
-			$css_path . 'admin' . $this->min . '.css',
107
+			$css_path.'admin'.$this->min.'.css',
108 108
 			array(
109 109
 				'wp-color-picker',
110 110
 				'simcal-select2',
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
 		);
114 114
 		wp_register_style(
115 115
 			'simcal-admin-add-calendar',
116
-			$css_path . 'admin-add-calendar' . $this->min . '.css',
117
-			array( 'simcal-select2' ),
116
+			$css_path.'admin-add-calendar'.$this->min.'.css',
117
+			array('simcal-select2'),
118 118
 			SIMPLE_CALENDAR_VERSION
119 119
 		);
120 120
 
121
-		if ( simcal_is_admin_screen() !== false ) {
121
+		if (simcal_is_admin_screen() !== false) {
122 122
 
123
-			wp_enqueue_script( 'simcal-admin' );
123
+			wp_enqueue_script('simcal-admin');
124 124
 			wp_localize_script(
125 125
 				'simcal-admin',
126 126
 				'simcal_admin',
127 127
 				simcal_common_scripts_variables()
128 128
 			);
129 129
 
130
-			wp_enqueue_style( 'simcal-admin' );
130
+			wp_enqueue_style('simcal-admin');
131 131
 
132 132
 		} else {
133 133
 
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 			$screen = get_current_screen();
136 136
 
137 137
 			$post_types = array();
138
-			$settings = get_option( 'simple-calendar_settings_calendars' );
139
-			if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
138
+			$settings = get_option('simple-calendar_settings_calendars');
139
+			if (isset($settings['general']['attach_calendars_posts'])) {
140 140
 				$post_types = $settings['general']['attach_calendars_posts'];
141 141
 			}
142 142
 
143 143
 			$conditions = array(
144
-				in_array( $post_type, (array) $post_types ),
144
+				in_array($post_type, (array) $post_types),
145 145
 				$screen->id == 'widgets',
146 146
 			);
147 147
 
148
-			if ( in_array( true, $conditions ) ) {
148
+			if (in_array(true, $conditions)) {
149 149
 
150
-				wp_enqueue_script( 'simcal-admin-add-calendar' );
151
-				wp_localize_script( 'simcal-admin-add-calendar', 'simcal_admin', array(
150
+				wp_enqueue_script('simcal-admin-add-calendar');
151
+				wp_localize_script('simcal-admin-add-calendar', 'simcal_admin', array(
152 152
 					'locale'   => get_locale(),
153 153
 					'text_dir' => is_rtl() ? 'rtl' : 'ltr',
154
-				) );
154
+				));
155 155
 
156
-				wp_enqueue_style( 'simcal-admin-add-calendar' );
156
+				wp_enqueue_style('simcal-admin-add-calendar');
157 157
 			}
158 158
 
159 159
 		}
Please login to merge, or discard this patch.
includes/admin/fields/select.php 1 patch
Spacing   +24 added lines, -24 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
 
@@ -51,32 +51,32 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @param array $field
53 53
 	 */
54
-	public function __construct( $field ) {
54
+	public function __construct($field) {
55 55
 
56 56
 		$class = 'simcal-field-select';
57 57
 
58
-		$enhanced = isset( $field['enhanced'] ) ? $field['enhanced'] : '';
59
-		if ( 'enhanced' == $enhanced )  {
58
+		$enhanced = isset($field['enhanced']) ? $field['enhanced'] : '';
59
+		if ('enhanced' == $enhanced) {
60 60
 			$this->enhanced = true;
61 61
 			$class .= ' simcal-field-select-enhanced';
62 62
 		}
63 63
 
64
-		$multiselect = isset( $field['multiselect'] ) ? $field['multiselect'] : '';
65
-		if ( 'multiselect' == $multiselect ) {
64
+		$multiselect = isset($field['multiselect']) ? $field['multiselect'] : '';
65
+		if ('multiselect' == $multiselect) {
66 66
 			$this->multiselect = true;
67 67
 			$class .= ' simcal-field-multiselect';
68 68
 		}
69 69
 
70
-		if ( isset( $field['default'] ) ) {
70
+		if (isset($field['default'])) {
71 71
 			$this->default = $field['default'];
72 72
 		}
73 73
 
74 74
 		$this->type_class = $class;
75 75
 
76
-		$allow_void = isset( $field['allow_void'] ) ? $field['allow_void'] : '';
76
+		$allow_void = isset($field['allow_void']) ? $field['allow_void'] : '';
77 77
 		$this->allow_void = 'allow_void' == $allow_void ? true : false;
78 78
 
79
-		parent::__construct( $field );
79
+		parent::__construct($field);
80 80
 	}
81 81
 
82 82
 	/**
@@ -86,36 +86,36 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function html() {
88 88
 
89
-		if ( $this->multiselect === true && ! is_array( $this->value ) ) {
90
-			$this->value = explode( ',', $this->value );
89
+		if ($this->multiselect === true && ! is_array($this->value)) {
90
+			$this->value = explode(',', $this->value);
91 91
 		}
92 92
 
93
-		if ( $this->default ) {
94
-			if ( empty( $this->value ) || $this->value == '' ) {
93
+		if ($this->default) {
94
+			if (empty($this->value) || $this->value == '') {
95 95
 				$this->value = $this->default;
96 96
 			}
97 97
 		}
98 98
 
99 99
 		?>
100
-		<select name="<?php echo $this->name; ?><?php if ( $this->multiselect === true ) { echo '[]'; } ?>"
100
+		<select name="<?php echo $this->name; ?><?php if ($this->multiselect === true) { echo '[]'; } ?>"
101 101
 		        id="<?php echo $this->id; ?>"
102 102
 		        style="<?php echo $this->style; ?>"
103 103
 		        class="<?php echo $this->class; ?>"
104 104
 				<?php echo $this->attributes; ?>
105
-				<?php echo ( $this->multiselect === true ) ? ' multiple="multiple"' : ''; ?>>
105
+				<?php echo ($this->multiselect === true) ? ' multiple="multiple"' : ''; ?>>
106 106
 			<?php
107 107
 
108
-			if ( $this->allow_void === true ) {
109
-				echo '<option value=""' . selected( '', $this->value, false ) . '></option>';
108
+			if ($this->allow_void === true) {
109
+				echo '<option value=""'.selected('', $this->value, false).'></option>';
110 110
 			}
111 111
 
112
-			foreach ( $this->options as $option => $name ) {
113
-				if ( is_array( $this->value ) ) {
114
-					$selected =	selected( in_array( $option, $this->value ), true, false );
112
+			foreach ($this->options as $option => $name) {
113
+				if (is_array($this->value)) {
114
+					$selected = selected(in_array($option, $this->value), true, false);
115 115
 				} else {
116
-					$selected = selected( $this->value, trim( strval( $option ) ), false );
116
+					$selected = selected($this->value, trim(strval($option)), false);
117 117
 				}
118
-				echo '<option value="' . $option . '" ' . $selected . '>' . esc_attr( $name ) . '</option>';
118
+				echo '<option value="'.$option.'" '.$selected.'>'.esc_attr($name).'</option>';
119 119
 			}
120 120
 
121 121
 			?>
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 
125 125
 		echo $this->tooltip;
126 126
 
127
-		if ( ! empty( $this->description ) ) {
128
-			echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>';
127
+		if ( ! empty($this->description)) {
128
+			echo '<p class="description">'.wp_kses_post($this->description).'</p>';
129 129
 		}
130 130
 
131 131
 	}
Please login to merge, or discard this patch.
includes/admin/metaboxes/settings.php 1 patch
Spacing   +280 added lines, -280 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 use SimpleCalendar\Abstracts\Feed;
12 12
 use SimpleCalendar\Abstracts\Field;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -31,40 +31,40 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @param \WP_Post $post
33 33
 	 */
34
-	public static function html( $post ) {
34
+	public static function html($post) {
35 35
 
36 36
 		// @see Meta_Boxes::save_meta_boxes()
37
-		wp_nonce_field( 'simcal_save_data', 'simcal_meta_nonce' );
37
+		wp_nonce_field('simcal_save_data', 'simcal_meta_nonce');
38 38
 
39 39
 		?>
40 40
 		<div class="simcal-panels-wrap">
41 41
 
42 42
 			<span class="simcal-box-handle">
43
-				<?php self::settings_handle( $post ); ?>
43
+				<?php self::settings_handle($post); ?>
44 44
 			</span>
45 45
 
46 46
 			<ul class="simcal-tabs">
47
-				<?php self::settings_tabs( $post ); ?>
48
-				<?php do_action( 'simcal_settings_meta_tabs' ); ?>
47
+				<?php self::settings_tabs($post); ?>
48
+				<?php do_action('simcal_settings_meta_tabs'); ?>
49 49
 			</ul>
50 50
 
51 51
 			<div class="simcal-panels">
52 52
 				<div id="events-settings-panel" class="simcal-panel">
53
-					<?php self::events_settings_panel( $post ); ?>
54
-					<?php do_action( 'simcal_settings_meta_events_panel', $post->ID ); ?>
53
+					<?php self::events_settings_panel($post); ?>
54
+					<?php do_action('simcal_settings_meta_events_panel', $post->ID); ?>
55 55
 				</div>
56 56
 				<div id="calendar-settings-panel" class="simcal-panel">
57
-					<?php do_action( 'simcal_settings_meta_calendar_panel', $post->ID ); ?>
58
-					<?php self::calendar_settings_panel( $post ); ?>
57
+					<?php do_action('simcal_settings_meta_calendar_panel', $post->ID); ?>
58
+					<?php self::calendar_settings_panel($post); ?>
59 59
 				</div>
60 60
 				<?php
61 61
 				// Hook for additional settings panels.
62
-				do_action( 'simcal_settings_meta_panels', $post->ID );
62
+				do_action('simcal_settings_meta_panels', $post->ID);
63 63
 				// Thus advanced panel is always the last one:
64 64
 				?>
65 65
 				<div id="advanced-settings-panel" class="simcal-panel">
66
-					<?php self::advanced_settings_panel( $post ) ?>
67
-					<?php do_action( 'simcal_settings_meta_advanced_panel', $post->ID ); ?>
66
+					<?php self::advanced_settings_panel($post) ?>
67
+					<?php do_action('simcal_settings_meta_advanced_panel', $post->ID); ?>
68 68
 				</div>
69 69
 			</div>
70 70
 
@@ -84,45 +84,45 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @param \WP_Post $post
86 86
 	 */
87
-	private static function settings_handle( $post ) {
87
+	private static function settings_handle($post) {
88 88
 
89 89
 		$feed_options = $calendar_options = $calendar_views = array();
90 90
 
91 91
 		$feed_types = simcal_get_feed_types();
92
-		foreach ( $feed_types as $feed_type ) {
92
+		foreach ($feed_types as $feed_type) {
93 93
 
94
-			$feed = simcal_get_feed( $feed_type );
94
+			$feed = simcal_get_feed($feed_type);
95 95
 
96
-			if ( $feed instanceof Feed ) {
97
-				$feed_options[ $feed_type ] = $feed->name;
96
+			if ($feed instanceof Feed) {
97
+				$feed_options[$feed_type] = $feed->name;
98 98
 			}
99 99
 		}
100 100
 
101 101
 		$calendar_types = simcal_get_calendar_types();
102
-		foreach ( $calendar_types as $calendar_type => $views ) {
102
+		foreach ($calendar_types as $calendar_type => $views) {
103 103
 
104
-			$calendar = simcal_get_calendar( $calendar_type );
104
+			$calendar = simcal_get_calendar($calendar_type);
105 105
 
106
-			if ( $calendar instanceof Calendar ) {
107
-				$calendar_options[ $calendar_type ] = $calendar->name;
108
-				$calendar_views[ $calendar_type ]   = $calendar->views;
106
+			if ($calendar instanceof Calendar) {
107
+				$calendar_options[$calendar_type] = $calendar->name;
108
+				$calendar_views[$calendar_type]   = $calendar->views;
109 109
 			}
110 110
 		}
111 111
 
112
-		if ( $feed_options ) {
112
+		if ($feed_options) {
113 113
 
114
-			if ( $feed_types = wp_get_object_terms( $post->ID, 'calendar_feed' ) ) {
115
-				$feed_type = sanitize_title( current( $feed_types )->name );
114
+			if ($feed_types = wp_get_object_terms($post->ID, 'calendar_feed')) {
115
+				$feed_type = sanitize_title(current($feed_types)->name);
116 116
 			} else {
117
-				$feed_type = apply_filters( 'simcal_default_feed_type', 'google' );
117
+				$feed_type = apply_filters('simcal_default_feed_type', 'google');
118 118
 			}
119 119
 
120 120
 			?>
121
-			<label for="_feed_type"><span><?php _e( 'Event Source', 'google-calendar-events' ); ?></span>
121
+			<label for="_feed_type"><span><?php _e('Event Source', 'google-calendar-events'); ?></span>
122 122
 				<select name="_feed_type" id="_feed_type">
123
-					<optgroup label="<?php _ex( 'Get events from', 'From which calendar source to load events from', 'google-calendar-events' ) ?>">
124
-						<?php foreach ( $feed_options as $feed => $name ) { ?>
125
-							<option value="<?php echo $feed; ?>" <?php selected( $feed, $feed_type, true ); ?>><?php echo $name; ?></option>
123
+					<optgroup label="<?php _ex('Get events from', 'From which calendar source to load events from', 'google-calendar-events') ?>">
124
+						<?php foreach ($feed_options as $feed => $name) { ?>
125
+							<option value="<?php echo $feed; ?>" <?php selected($feed, $feed_type, true); ?>><?php echo $name; ?></option>
126 126
 						<?php } ?>
127 127
 					</optgroup>
128 128
 				</select>
@@ -131,40 +131,40 @@  discard block
 block discarded – undo
131 131
 
132 132
 		}
133 133
 
134
-		if ( $calendar_options ) {
134
+		if ($calendar_options) {
135 135
 
136
-			if ( $calendar_types = wp_get_object_terms( $post->ID, 'calendar_type' ) ) {
137
-				$calendar_type = sanitize_title( current( $calendar_types )->name );
136
+			if ($calendar_types = wp_get_object_terms($post->ID, 'calendar_type')) {
137
+				$calendar_type = sanitize_title(current($calendar_types)->name);
138 138
 			} else {
139
-				$calendar_type = apply_filters( 'simcal_default_calendar_type', 'default-calendar' );
139
+				$calendar_type = apply_filters('simcal_default_calendar_type', 'default-calendar');
140 140
 			}
141 141
 
142 142
 			?>
143
-			<label for="_calendar_type"><span><?php _e( 'Calendar', 'google-calendar-events' ); ?></span>
143
+			<label for="_calendar_type"><span><?php _e('Calendar', 'google-calendar-events'); ?></span>
144 144
 				<select name="_calendar_type" id="_calendar_type">
145
-					<optgroup label="<?php _e( 'Calendar to use', 'google-calendar-events' ); ?>">
146
-						<?php foreach ( $calendar_options as $calendar => $name ) { ?>
147
-							<option value="<?php echo $calendar; ?>" <?php selected( $calendar, $calendar_type, true ); ?>><?php echo $name; ?></option>
145
+					<optgroup label="<?php _e('Calendar to use', 'google-calendar-events'); ?>">
146
+						<?php foreach ($calendar_options as $calendar => $name) { ?>
147
+							<option value="<?php echo $calendar; ?>" <?php selected($calendar, $calendar_type, true); ?>><?php echo $name; ?></option>
148 148
 						<?php } ?>
149 149
 					</optgroup>
150 150
 				</select>
151 151
 			</label>
152 152
 			<?php
153 153
 
154
-			if ( $calendar_views ) {
154
+			if ($calendar_views) {
155 155
 
156
-				$calendar_view = get_post_meta( $post->ID, '_calendar_view', true );
156
+				$calendar_view = get_post_meta($post->ID, '_calendar_view', true);
157 157
 
158
-				foreach ( $calendar_views as $calendar => $views ) {
158
+				foreach ($calendar_views as $calendar => $views) {
159 159
 
160
-					$calendar_type_view = isset( $calendar_view[ $calendar ] ) ? $calendar_view[ $calendar ] : '';
160
+					$calendar_type_view = isset($calendar_view[$calendar]) ? $calendar_view[$calendar] : '';
161 161
 
162 162
 					?>
163
-					<label for="_calendar_view_<?php echo $calendar; ?>"><span><?php _e( 'View', 'google-calendar-events' ); ?></span>
163
+					<label for="_calendar_view_<?php echo $calendar; ?>"><span><?php _e('View', 'google-calendar-events'); ?></span>
164 164
 						<select name="_calendar_view[<?php echo $calendar; ?>]" id="_calendar_view_<?php echo $calendar; ?>">
165
-							<optgroup label="<?php _e( 'View to display', 'google-calendar-events' ); ?>">
166
-								<?php foreach ( $views as $view => $name ) { ?>
167
-									<option value="<?php echo $view; ?>" <?php selected( $view, $calendar_type_view, true ); ?>><?php echo $name; ?></option>
165
+							<optgroup label="<?php _e('View to display', 'google-calendar-events'); ?>">
166
+								<?php foreach ($views as $view => $name) { ?>
167
+									<option value="<?php echo $view; ?>" <?php selected($view, $calendar_type_view, true); ?>><?php echo $name; ?></option>
168 168
 								<?php } ?>
169 169
 							</optgroup>
170 170
 						</select>
@@ -184,42 +184,42 @@  discard block
 block discarded – undo
184 184
 	 *
185 185
 	 * @param  \WP_Post $post
186 186
 	 */
187
-	private static function settings_tabs( $post ) {
187
+	private static function settings_tabs($post) {
188 188
 
189 189
 		// Hook to add more tabs.
190
-		$tabs = apply_filters( 'simcal_settings_meta_tabs_li', array(
190
+		$tabs = apply_filters('simcal_settings_meta_tabs_li', array(
191 191
 			'events' => array(
192
-				'label'   => __( 'Events', 'google-calendar-events' ),
192
+				'label'   => __('Events', 'google-calendar-events'),
193 193
 				'target'  => 'events-settings-panel',
194
-				'class'   => array( 'active' ),
194
+				'class'   => array('active'),
195 195
 				'icon'    => 'simcal-icon-event',
196 196
 			),
197 197
 			'calendar' => array(
198
-				'label'  => __( 'Appearance', 'google-calendar-events' ),
198
+				'label'  => __('Appearance', 'google-calendar-events'),
199 199
 				'target' => 'calendar-settings-panel',
200 200
 				'class'  => array(),
201 201
 				'icon'   => 'simcal-icon-calendar',
202 202
 			),
203
-		), $post->ID );
203
+		), $post->ID);
204 204
 
205 205
 		// Always keep advanced tab as the last one.
206 206
 		$tabs['advanced'] = array(
207
-			'label'   => __( 'Advanced', 'google-calendar-events' ),
207
+			'label'   => __('Advanced', 'google-calendar-events'),
208 208
 			'target'  => 'advanced-settings-panel',
209 209
 			'class'   => array(),
210 210
 			'icon'    => 'simcal-icon-settings',
211 211
 		);
212 212
 
213 213
 		// Output the tabs as list items.
214
-		foreach ( $tabs as $key => $tab ) {
214
+		foreach ($tabs as $key => $tab) {
215 215
 
216
-			if ( isset( $tab['target'] ) && isset( $tab['label'] ) ) {
216
+			if (isset($tab['target']) && isset($tab['label'])) {
217 217
 
218 218
 				$icon  = $tab['icon'] ? $tab['icon'] : 'simcal-icon-panel';
219 219
 				$class = $tab['class'] ? $tab['class'] : array();
220 220
 
221
-				echo '<li class="' . $key . '-settings ' . $key . '-tab ' . implode( ' ', $class ) . '" data-tab="' . $key . '">';
222
-				echo    '<a href="#' . $tab['target'] . '"><i class="' . $icon . '" ></i> <span>' . esc_html( $tab['label'] ) . '</span></a>';
221
+				echo '<li class="'.$key.'-settings '.$key.'-tab '.implode(' ', $class).'" data-tab="'.$key.'">';
222
+				echo    '<a href="#'.$tab['target'].'"><i class="'.$icon.'" ></i> <span>'.esc_html($tab['label']).'</span></a>';
223 223
 				echo '</li>';
224 224
 			}
225 225
 		}
@@ -233,22 +233,22 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @param  \WP_Post $post
235 235
 	 */
236
-	private static function events_settings_panel( $post ) {
236
+	private static function events_settings_panel($post) {
237 237
 
238 238
 		?>
239 239
 		<table>
240 240
 			<thead>
241
-				<tr><th colspan="2"><?php _e( 'Events setting', 'google-calendar-events' ); ?></th></tr>
241
+				<tr><th colspan="2"><?php _e('Events setting', 'google-calendar-events'); ?></th></tr>
242 242
 			</thead>
243 243
 			<tbody class="simcal-panel-section simcal-panel-section-events-range">
244 244
 				<tr class="simcal-panel-field">
245
-					<th><label for="_calendar_begins"><?php _e( 'Calendar start', 'google-calendar-events' ); ?></label></th>
245
+					<th><label for="_calendar_begins"><?php _e('Calendar start', 'google-calendar-events'); ?></label></th>
246 246
 					<td>
247 247
 						<?php
248 248
 
249
-						$calendar_begins = esc_attr( get_post_meta( $post->ID, '_calendar_begins', true ) );
250
-						$calendar_begins_nth = max( absint( get_post_meta( $post->ID, '_calendar_begins_nth', true ) ), 1 );
251
-						$calendar_begins_nth_show = in_array( $calendar_begins, array(
249
+						$calendar_begins = esc_attr(get_post_meta($post->ID, '_calendar_begins', true));
250
+						$calendar_begins_nth = max(absint(get_post_meta($post->ID, '_calendar_begins_nth', true)), 1);
251
+						$calendar_begins_nth_show = in_array($calendar_begins, array(
252 252
 							'days_before',
253 253
 							'days_after',
254 254
 							'weeks_before',
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
 							'months_after',
258 258
 							'years_before',
259 259
 							'years_after',
260
-						) );
260
+						));
261 261
 
262
-						simcal_print_field( array(
262
+						simcal_print_field(array(
263 263
 							'type'       => 'standard',
264 264
 							'subtype'    => 'number',
265 265
 							'name'       => '_calendar_begins_nth',
266 266
 							'id'         => '_calendar_begins_nth',
267
-							'value'      => strval( $calendar_begins_nth ),
267
+							'value'      => strval($calendar_begins_nth),
268 268
 							'attributes' => array(
269 269
 								'min' => '1',
270 270
 							),
@@ -272,97 +272,97 @@  discard block
 block discarded – undo
272 272
 								'simcal-field-inline',
273 273
 								'simcal-field-tiny',
274 274
 							),
275
-							'style'      => ! $calendar_begins_nth_show ? array( 'display' => 'none' ) : '',
276
-						) );
275
+							'style'      => ! $calendar_begins_nth_show ? array('display' => 'none') : '',
276
+						));
277 277
 
278 278
 						?>
279 279
 						<select name="_calendar_begins"
280 280
 						        id="_calendar_begins"
281 281
 						        class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
282
-							<optgroup label="<?php _e( 'Days range', 'google-calendar-events' ); ?>">
282
+							<optgroup label="<?php _e('Days range', 'google-calendar-events'); ?>">
283 283
 								<option value="today"
284 284
 								        data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
285
-								        <?php selected( 'today', $calendar_begins, true ); ?>><?php _e( 'Today', 'google-calendar-events' ); ?></option>
285
+								        <?php selected('today', $calendar_begins, true); ?>><?php _e('Today', 'google-calendar-events'); ?></option>
286 286
 								<option value="now"
287 287
 								        data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
288
-								        <?php selected( 'now', $calendar_begins, true ); ?>><?php _e( 'Now', 'google-calendar-events' ); ?></option>
288
+								        <?php selected('now', $calendar_begins, true); ?>><?php _e('Now', 'google-calendar-events'); ?></option>
289 289
 								<option value="days_before"
290 290
 								        data-hide-field="_calendar_begins_custom_date"
291
-								        data-show-field="_calendar_begins_nth" <?php selected( 'days_before', $calendar_begins, true ); ?>><?php _e( 'Day(s) before today', 'google-calendar-events' ); ?></option>
291
+								        data-show-field="_calendar_begins_nth" <?php selected('days_before', $calendar_begins, true); ?>><?php _e('Day(s) before today', 'google-calendar-events'); ?></option>
292 292
 								<option value="days_after"
293 293
 								        data-hide-field="_calendar_begins_custom_date"
294
-								        data-show-field="_calendar_begins_nth" <?php selected( 'days_after', $calendar_begins, true ); ?>><?php _e( 'Day(s) after today', 'google-calendar-events' ); ?></option>
294
+								        data-show-field="_calendar_begins_nth" <?php selected('days_after', $calendar_begins, true); ?>><?php _e('Day(s) after today', 'google-calendar-events'); ?></option>
295 295
 							</optgroup>
296
-							<optgroup label="<?php _e( 'Weeks range', 'google-calendar-events' ); ?>">
296
+							<optgroup label="<?php _e('Weeks range', 'google-calendar-events'); ?>">
297 297
 								<option value="this_week"
298 298
 								        data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
299
-								        <?php selected( 'this_week', $calendar_begins, true ); ?>><?php _e( 'This week', 'google-calendar-events' ); ?></option>
299
+								        <?php selected('this_week', $calendar_begins, true); ?>><?php _e('This week', 'google-calendar-events'); ?></option>
300 300
 								<option value="weeks_before"
301 301
 								        data-hide-field="_calendar_begins_custom_date"
302
-								        data-show-field="_calendar_begins_nth" <?php selected( 'weeks_before', $calendar_begins, true ); ?>><?php _e( 'Week(s) before current', 'google-calendar-events' ); ?></option>
302
+								        data-show-field="_calendar_begins_nth" <?php selected('weeks_before', $calendar_begins, true); ?>><?php _e('Week(s) before current', 'google-calendar-events'); ?></option>
303 303
 								<option value="weeks_after"
304 304
 								        data-hide-field="_calendar_begins_custom_date"
305
-								        data-show-field="_calendar_begins_nth" <?php selected( 'weeks_after', $calendar_begins, true ); ?>><?php _e( 'Week(s) after current', 'google-calendar-events' ); ?></option>
305
+								        data-show-field="_calendar_begins_nth" <?php selected('weeks_after', $calendar_begins, true); ?>><?php _e('Week(s) after current', 'google-calendar-events'); ?></option>
306 306
 							</optgroup>
307
-							<optgroup label="<?php _e( 'Months range', 'google-calendar-events' ); ?>">
307
+							<optgroup label="<?php _e('Months range', 'google-calendar-events'); ?>">
308 308
 								<option value="this_month"
309 309
 								        data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
310
-								        <?php selected( 'this_month', $calendar_begins, true ); ?>><?php _e( 'This month', 'google-calendar-events' ); ?></option>
310
+								        <?php selected('this_month', $calendar_begins, true); ?>><?php _e('This month', 'google-calendar-events'); ?></option>
311 311
 								<option value="months_before"
312 312
 								        data-hide-field="_calendar_begins_custom_date"
313
-								        data-show-field="_calendar_begins_nth" <?php selected( 'months_before', $calendar_begins, true ); ?>><?php _e( 'Month(s) before current', 'google-calendar-events' ); ?></option>
313
+								        data-show-field="_calendar_begins_nth" <?php selected('months_before', $calendar_begins, true); ?>><?php _e('Month(s) before current', 'google-calendar-events'); ?></option>
314 314
 								<option value="months_after"
315 315
 								        data-hide-field="_calendar_begins_custom_date"
316
-								        data-show-field="_calendar_begins_nth" <?php selected( 'months_after', $calendar_begins, true ); ?>><?php _e( 'Month(s) after current', 'google-calendar-events' ); ?></option>
316
+								        data-show-field="_calendar_begins_nth" <?php selected('months_after', $calendar_begins, true); ?>><?php _e('Month(s) after current', 'google-calendar-events'); ?></option>
317 317
 							</optgroup>
318
-							<optgroup label="<?php _e( 'Years range', 'google-calendar-events' ); ?>">
318
+							<optgroup label="<?php _e('Years range', 'google-calendar-events'); ?>">
319 319
 								<option value="this_year"
320 320
 								        data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
321
-								        <?php selected( 'this_year', $calendar_begins, true ); ?>><?php _e( 'This year', 'google-calendar-events' ); ?></option>
321
+								        <?php selected('this_year', $calendar_begins, true); ?>><?php _e('This year', 'google-calendar-events'); ?></option>
322 322
 								<option value="years_before"
323
-								        data-show-field="_calendar_begins_nth" <?php selected( 'years_before', $calendar_begins, true ); ?>><?php _e( 'Year(s) before current', 'google-calendar-events' ); ?></option>
323
+								        data-show-field="_calendar_begins_nth" <?php selected('years_before', $calendar_begins, true); ?>><?php _e('Year(s) before current', 'google-calendar-events'); ?></option>
324 324
 								<option value="years_after"
325 325
 								        data-hide-field="_calendar_begins_custom_date"
326
-								        data-show-field="_calendar_begins_nth" <?php selected( 'years_after', $calendar_begins, true ); ?>><?php _e( 'Year(s) after current', 'google-calendar-events' ); ?></option>
326
+								        data-show-field="_calendar_begins_nth" <?php selected('years_after', $calendar_begins, true); ?>><?php _e('Year(s) after current', 'google-calendar-events'); ?></option>
327 327
 							</optgroup>
328
-							<optgroup label="<?php _e( 'Other', 'google-calendar-events' ); ?>">
328
+							<optgroup label="<?php _e('Other', 'google-calendar-events'); ?>">
329 329
 								<option value="custom_date"
330 330
 								        data-hide-field="_calendar_begins_nth"
331
-								        data-show-field="_calendar_begins_custom_date" <?php selected( 'custom_date', $calendar_begins, true ); ?>><?php _e( 'Specific date', 'google-calendar-events' ); ?></option>
331
+								        data-show-field="_calendar_begins_custom_date" <?php selected('custom_date', $calendar_begins, true); ?>><?php _e('Specific date', 'google-calendar-events'); ?></option>
332 332
 							</optgroup>
333 333
 						</select>
334 334
 						<?php
335 335
 
336
-						simcal_print_field( array(
336
+						simcal_print_field(array(
337 337
 							'type'    => 'date-picker',
338 338
 							'name'    => '_calendar_begins_custom_date',
339 339
 							'id'      => '_calendar_begins_custom_date',
340
-							'value'   => get_post_meta( $post->ID, '_calendar_begins_custom_date', true ),
340
+							'value'   => get_post_meta($post->ID, '_calendar_begins_custom_date', true),
341 341
 							'class' => array(
342 342
 								'simcal-field-inline',
343 343
 							),
344
-							'style'   => 'custom_date' != $calendar_begins ? array( 'display' => 'none' ) : '',
345
-						) );
344
+							'style'   => 'custom_date' != $calendar_begins ? array('display' => 'none') : '',
345
+						));
346 346
 
347 347
 						?>
348 348
 						<i class="simcal-icon-help simcal-help-tip"
349
-						   data-tip="<?php _e( 'The calendar default opening date. It will automatically adapt based on the chosen calendar type.', 'google-calendar-events' ); ?>"></i>
349
+						   data-tip="<?php _e('The calendar default opening date. It will automatically adapt based on the chosen calendar type.', 'google-calendar-events'); ?>"></i>
350 350
 					</td>
351 351
 				</tr>
352 352
 				<tr class="simcal-panel-field">
353
-					<th><label for="_feed_earliest_event_date"><?php _e( 'Earliest event', 'google-calendar-events' ); ?></label></th>
353
+					<th><label for="_feed_earliest_event_date"><?php _e('Earliest event', 'google-calendar-events'); ?></label></th>
354 354
 					<td>
355 355
 						<?php
356 356
 
357
-						$earliest_event_saved = get_post_meta( $post->ID, '_feed_earliest_event_date', true );
358
-						$earliest_event = false == $earliest_event_saved ? 'months_before' : esc_attr( $earliest_event_saved );
357
+						$earliest_event_saved = get_post_meta($post->ID, '_feed_earliest_event_date', true);
358
+						$earliest_event = false == $earliest_event_saved ? 'months_before' : esc_attr($earliest_event_saved);
359 359
 
360
-						simcal_print_field( array(
360
+						simcal_print_field(array(
361 361
 							'type'       => 'standard',
362 362
 							'subtype'    => 'number',
363 363
 							'name'       => '_feed_earliest_event_date_range',
364 364
 							'id'         => '_feed_earliest_event_date_range',
365
-							'value'      => strval( max( absint( get_post_meta( $post->ID, '_feed_earliest_event_date_range', true ) ), 1 ) ),
365
+							'value'      => strval(max(absint(get_post_meta($post->ID, '_feed_earliest_event_date_range', true)), 1)),
366 366
 							'attributes' => array(
367 367
 								'min' => '1',
368 368
 							),
@@ -370,37 +370,37 @@  discard block
 block discarded – undo
370 370
 								'simcal-field-inline',
371 371
 								'simcal-field-tiny',
372 372
 							),
373
-							'style'      => ( 'now' != $earliest_event ) && ( 'today' != $earliest_event ) ? array( 'display' => 'none' ) : '',
374
-						) );
373
+							'style'      => ('now' != $earliest_event) && ('today' != $earliest_event) ? array('display' => 'none') : '',
374
+						));
375 375
 
376 376
 						?>
377 377
 						<select name="_feed_earliest_event_date"
378 378
 						        id="_feed_earliest_event_date"
379 379
 						        class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
380
-							<option value="calendar_start" data-hide-field="_feed_earliest_event_date_range" <?php selected( 'calendar_start', $earliest_event, true ); ?>><?php _e( 'Same as start date', 'google-calendar-events' ); ?></option>
381
-							<option value="days_before"    data-show-field="_feed_earliest_event_date_range" <?php selected( 'days_before', $earliest_event, true ); ?>><?php _e( 'Day(s) before start date', 'google-calendar-events' ); ?></option>
382
-							<option value="weeks_before"   data-show-field="_feed_earliest_event_date_range" <?php selected( 'weeks_before', $earliest_event, true ); ?>><?php _e( 'Week(s) before start date', 'google-calendar-events' ); ?></option>
383
-							<option value="months_before"  data-show-field="_feed_earliest_event_date_range" <?php selected( 'months_before', $earliest_event, true ); ?>><?php _e( 'Month(s) before start date', 'google-calendar-events' ); ?></option>
384
-							<option value="years_before"   data-show-field="_feed_earliest_event_date_range" <?php selected( 'years_before', $earliest_event, true ); ?>><?php _e( 'Year(s) before start date', 'google-calendar-events' ); ?></option>
380
+							<option value="calendar_start" data-hide-field="_feed_earliest_event_date_range" <?php selected('calendar_start', $earliest_event, true); ?>><?php _e('Same as start date', 'google-calendar-events'); ?></option>
381
+							<option value="days_before"    data-show-field="_feed_earliest_event_date_range" <?php selected('days_before', $earliest_event, true); ?>><?php _e('Day(s) before start date', 'google-calendar-events'); ?></option>
382
+							<option value="weeks_before"   data-show-field="_feed_earliest_event_date_range" <?php selected('weeks_before', $earliest_event, true); ?>><?php _e('Week(s) before start date', 'google-calendar-events'); ?></option>
383
+							<option value="months_before"  data-show-field="_feed_earliest_event_date_range" <?php selected('months_before', $earliest_event, true); ?>><?php _e('Month(s) before start date', 'google-calendar-events'); ?></option>
384
+							<option value="years_before"   data-show-field="_feed_earliest_event_date_range" <?php selected('years_before', $earliest_event, true); ?>><?php _e('Year(s) before start date', 'google-calendar-events'); ?></option>
385 385
 						</select>
386 386
 						<i class="simcal-icon-help simcal-help-tip"
387
-						   data-tip="<?php _e( 'Set the date for the earliest possible event to show in calendar. There will not be events before this date.', 'google-calendar-events' ); ?>"></i>
387
+						   data-tip="<?php _e('Set the date for the earliest possible event to show in calendar. There will not be events before this date.', 'google-calendar-events'); ?>"></i>
388 388
 					</td>
389 389
 				</tr>
390 390
 				<tr class="simcal-panel-field">
391
-					<th><label for="_feed_latest_event_date"><?php _e( 'Latest event', 'google-calendar-events' ); ?></label></th>
391
+					<th><label for="_feed_latest_event_date"><?php _e('Latest event', 'google-calendar-events'); ?></label></th>
392 392
 					<td>
393 393
 						<?php
394 394
 
395
-						$latest_event_saved = get_post_meta( $post->ID, '_feed_latest_event_date', true );
396
-						$latest_event = false == $latest_event_saved ? 'years_after' : esc_attr( $latest_event_saved );
395
+						$latest_event_saved = get_post_meta($post->ID, '_feed_latest_event_date', true);
396
+						$latest_event = false == $latest_event_saved ? 'years_after' : esc_attr($latest_event_saved);
397 397
 
398
-						simcal_print_field( array(
398
+						simcal_print_field(array(
399 399
 							'type'       => 'standard',
400 400
 							'subtype'    => 'number',
401 401
 							'name'       => '_feed_latest_event_date_range',
402 402
 							'id'         => '_feed_latest_event_date_range',
403
-							'value'      => strval( max( absint( get_post_meta( $post->ID, '_feed_latest_event_date_range', true ) ), 1 ) ),
403
+							'value'      => strval(max(absint(get_post_meta($post->ID, '_feed_latest_event_date_range', true)), 1)),
404 404
 							'attributes' => array(
405 405
 								'min' => '1',
406 406
 							),
@@ -408,21 +408,21 @@  discard block
 block discarded – undo
408 408
 								'simcal-field-inline',
409 409
 								'simcal-field-tiny',
410 410
 							),
411
-							'style'      => 'indefinite' != $latest_event ? array( 'display' => 'none' ) : '',
412
-						) );
411
+							'style'      => 'indefinite' != $latest_event ? array('display' => 'none') : '',
412
+						));
413 413
 
414 414
 						?>
415 415
 						<select name="_feed_latest_event_date"
416 416
 						        id="_feed_latest_event_date"
417 417
 						        class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
418
-							<option value="calendar_start" data-hide-field="_feed_latest_event_date_range" <?php selected( 'calendar_start', $earliest_event, true ); ?>><?php _e( 'Day end of start date', 'google-calendar-events' ); ?></option>
419
-							<option value="days_after"     data-show-field="_feed_latest_event_date_range" <?php selected( 'days_after', $latest_event, true ); ?>><?php _e( 'Day(s) after start date', 'google-calendar-events' ); ?></option>
420
-							<option value="weeks_after"    data-show-field="_feed_latest_event_date_range" <?php selected( 'weeks_after', $latest_event, true ); ?>><?php _e( 'Weeks(s) after start date', 'google-calendar-events' ); ?></option>
421
-							<option value="months_after"   data-show-field="_feed_latest_event_date_range" <?php selected( 'months_after', $latest_event, true ); ?>><?php _e( 'Month(s) after start date', 'google-calendar-events' ); ?></option>
422
-							<option value="years_after"    data-show-field="_feed_latest_event_date_range" <?php selected( 'years_after', $latest_event, true ); ?>><?php _e( 'Year(s) after start date', 'google-calendar-events' ); ?></option>
418
+							<option value="calendar_start" data-hide-field="_feed_latest_event_date_range" <?php selected('calendar_start', $earliest_event, true); ?>><?php _e('Day end of start date', 'google-calendar-events'); ?></option>
419
+							<option value="days_after"     data-show-field="_feed_latest_event_date_range" <?php selected('days_after', $latest_event, true); ?>><?php _e('Day(s) after start date', 'google-calendar-events'); ?></option>
420
+							<option value="weeks_after"    data-show-field="_feed_latest_event_date_range" <?php selected('weeks_after', $latest_event, true); ?>><?php _e('Weeks(s) after start date', 'google-calendar-events'); ?></option>
421
+							<option value="months_after"   data-show-field="_feed_latest_event_date_range" <?php selected('months_after', $latest_event, true); ?>><?php _e('Month(s) after start date', 'google-calendar-events'); ?></option>
422
+							<option value="years_after"    data-show-field="_feed_latest_event_date_range" <?php selected('years_after', $latest_event, true); ?>><?php _e('Year(s) after start date', 'google-calendar-events'); ?></option>
423 423
 						</select>
424 424
 						<i class="simcal-icon-help simcal-help-tip"
425
-						   data-tip="<?php _e( 'Set the date for the latest possible event to show on calendar. There will not be events after this date.', 'google-calendar-events' ); ?>"></i>
425
+						   data-tip="<?php _e('Set the date for the latest possible event to show on calendar. There will not be events after this date.', 'google-calendar-events'); ?>"></i>
426 426
 					</td>
427 427
 				</tr>
428 428
 			</tbody>
@@ -439,68 +439,68 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * @param  \WP_Post $post
441 441
 	 */
442
-	private static function calendar_settings_panel( $post ) {
442
+	private static function calendar_settings_panel($post) {
443 443
 
444 444
 		?>
445 445
 		<table>
446 446
 			<thead>
447
-				<tr><th colspan="2"><?php _e( 'Miscellaneous', 'google-calendar-events' ); ?></th></tr>
447
+				<tr><th colspan="2"><?php _e('Miscellaneous', 'google-calendar-events'); ?></th></tr>
448 448
 			</thead>
449 449
 			<tbody class="simcal-panel-section">
450 450
 				<tr class="simcal-panel-field">
451
-					<th><label for="_calendar_is_static"><?php _e( 'Static calendar', 'google-calendar-events' ); ?></label></th>
451
+					<th><label for="_calendar_is_static"><?php _e('Static calendar', 'google-calendar-events'); ?></label></th>
452 452
 					<td>
453 453
 						<?php
454 454
 
455
-						$fixed = get_post_meta( $post->ID, '_calendar_is_static', true );
455
+						$fixed = get_post_meta($post->ID, '_calendar_is_static', true);
456 456
 
457
-						simcal_print_field( array(
457
+						simcal_print_field(array(
458 458
 							'type'    => 'checkbox',
459 459
 							'name'    => '_calendar_is_static',
460 460
 							'id'      => '_calendar_is_static',
461
-							'tooltip' => __( 'Remove the navigation arrows and fix the calendar view to its initial state.', 'google-calendar-events' ),
461
+							'tooltip' => __('Remove the navigation arrows and fix the calendar view to its initial state.', 'google-calendar-events'),
462 462
 							'value'   => 'yes' == $fixed ? 'yes' : 'no',
463
-						) );
463
+						));
464 464
 
465 465
 						?>
466 466
 					</td>
467 467
 				</tr>
468 468
 				<tr class="simcal-panel-field">
469
-					<th><label for="_no_events_message"><?php _e( 'No events message', 'google-calendar-events' ); ?></label></th>
469
+					<th><label for="_no_events_message"><?php _e('No events message', 'google-calendar-events'); ?></label></th>
470 470
 					<td>
471 471
 						<?php
472 472
 
473
-						simcal_print_field( array(
473
+						simcal_print_field(array(
474 474
 							'type'    => 'textarea',
475 475
 							'name'    => '_no_events_message',
476 476
 							'id'      => '_no_events_message',
477
-							'tooltip' => __( 'Some calendars may display a message when no events are found. You can change the default message here.', 'google-calendar-events' ),
478
-							'value'   => get_post_meta( $post->ID, '_no_events_message', true ),
479
-						) );
477
+							'tooltip' => __('Some calendars may display a message when no events are found. You can change the default message here.', 'google-calendar-events'),
478
+							'value'   => get_post_meta($post->ID, '_no_events_message', true),
479
+						));
480 480
 
481 481
 						?>
482 482
 					</td>
483 483
 				</tr>
484 484
 				<tr class="simcal-panel-field">
485
-					<th><label for="_event_formatting"><?php _e( 'Event Formatting', 'google-calendar-events' ); ?></label></th>
485
+					<th><label for="_event_formatting"><?php _e('Event Formatting', 'google-calendar-events'); ?></label></th>
486 486
 					<td>
487 487
 						<?php
488 488
 
489
-						$event_formatting = get_post_meta( $post->ID, '_event_formatting', true );
489
+						$event_formatting = get_post_meta($post->ID, '_event_formatting', true);
490 490
 
491
-						simcal_print_field( array(
491
+						simcal_print_field(array(
492 492
 							'type'    => 'select',
493 493
 							'name'    => '_event_formatting',
494 494
 							'id'      => '_event_formatting',
495
-							'tooltip' => __( 'How to preserve line breaks and paragraphs in the event template builder.', 'google-calendar-events' ),
495
+							'tooltip' => __('How to preserve line breaks and paragraphs in the event template builder.', 'google-calendar-events'),
496 496
 							'value'   => $event_formatting,
497 497
 							'default' => 'preserve_linebreaks',
498 498
 							'options' => array(
499
-								'preserve_linebreaks' => __( 'Preserve line breaks, auto paragraphs (default)', 'google-calendar-events' ),
500
-								'no_linebreaks'       => __( 'No line breaks, auto paragraphs', 'google-calendar-events' ),
501
-								'none'                => __( 'No line breaks, no auto paragraphs', 'google-calendar-events' ),
499
+								'preserve_linebreaks' => __('Preserve line breaks, auto paragraphs (default)', 'google-calendar-events'),
500
+								'no_linebreaks'       => __('No line breaks, auto paragraphs', 'google-calendar-events'),
501
+								'none'                => __('No line breaks, no auto paragraphs', 'google-calendar-events'),
502 502
 							),
503
-						) );
503
+						));
504 504
 
505 505
 						?>
506 506
 					</td>
@@ -519,23 +519,23 @@  discard block
 block discarded – undo
519 519
 	 *
520 520
 	 * @param  \WP_Post $post
521 521
 	 */
522
-	private static function advanced_settings_panel( $post ) {
522
+	private static function advanced_settings_panel($post) {
523 523
 
524 524
 		?>
525 525
 		<table>
526 526
 			<thead>
527
-				<tr><th colspan="2"><?php _e( 'Date and Time', 'google-calendar-events' ); ?></th></tr>
527
+				<tr><th colspan="2"><?php _e('Date and Time', 'google-calendar-events'); ?></th></tr>
528 528
 			</thead>
529 529
 			<tbody class="simcal-panel-section simcal-panel-datetime-formatting">
530 530
 				<tr class="simcal-panel-field">
531
-					<th><label for="_calendar_timezone_setting"><?php _e( 'Timezone', 'google-calendar-events' ); ?></label></th>
531
+					<th><label for="_calendar_timezone_setting"><?php _e('Timezone', 'google-calendar-events'); ?></label></th>
532 532
 					<td>
533 533
 						<?php
534 534
 
535 535
 						$timezone_wordpress = simcal_get_wp_timezone();
536 536
 						$timezone_default = $timezone_wordpress ? $timezone_wordpress : 'UTC';
537
-						$timezone_setting = esc_attr( get_post_meta( $post->ID, '_feed_timezone_setting', true ) );
538
-						$timezone = esc_attr( get_post_meta( $post->ID, '_feed_timezone', true ) );
537
+						$timezone_setting = esc_attr(get_post_meta($post->ID, '_feed_timezone_setting', true));
538
+						$timezone = esc_attr(get_post_meta($post->ID, '_feed_timezone', true));
539 539
 						$timezone = $timezone ? $timezone : $timezone_default;
540 540
 
541 541
 						?>
@@ -543,51 +543,51 @@  discard block
 block discarded – undo
543 543
 						        id="_feed_timezone_setting"
544 544
 						        class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-next"
545 545
 						        data-show-next-if-value="use_custom">
546
-							<option value="use_calendar" <?php selected( 'use_calendar', $timezone_setting, true ); ?>><?php _ex( 'Events source default', 'Use the calendar default setting', 'google-calendar-events' ); ?></option>
547
-							<option value="use_site" <?php selected( 'use_site', $timezone_setting, true ); ?>><?php printf( _x( 'Site default', 'Use this site default setting', 'google-calendar-events' ) . ' (%s)', $timezone_default ); ?></option>
548
-							<option value="use_custom" <?php selected( 'use_custom', $timezone_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
546
+							<option value="use_calendar" <?php selected('use_calendar', $timezone_setting, true); ?>><?php _ex('Events source default', 'Use the calendar default setting', 'google-calendar-events'); ?></option>
547
+							<option value="use_site" <?php selected('use_site', $timezone_setting, true); ?>><?php printf(_x('Site default', 'Use this site default setting', 'google-calendar-events').' (%s)', $timezone_default); ?></option>
548
+							<option value="use_custom" <?php selected('use_custom', $timezone_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
549 549
 						</select>
550 550
 						<select name="_feed_timezone"
551 551
 						        id="_feed_timezone"
552 552
 						        class="simcal-field simcal-field-select simcal-field-inline"
553 553
 							<?php echo 'use_custom' != $timezone_setting ? 'style="display: none;"' : ''; ?>>
554
-							<?php echo wp_timezone_choice( $timezone ); ?>
554
+							<?php echo wp_timezone_choice($timezone); ?>
555 555
 						</select>
556
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Using a different timezone may alter the date and time display of your calendar events. It is recommended to keep the calendar default timezone.', 'google-calendar-events' ); ?>"></i>
556
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('Using a different timezone may alter the date and time display of your calendar events. It is recommended to keep the calendar default timezone.', 'google-calendar-events'); ?>"></i>
557 557
 					</td>
558 558
 				</tr>
559 559
 				<tr class="simcal-panel-field">
560
-					<th><label for="_calendar_date_format_setting"><?php _e( 'Date format', 'google-calendar-events' ); ?></label></th>
560
+					<th><label for="_calendar_date_format_setting"><?php _e('Date format', 'google-calendar-events'); ?></label></th>
561 561
 					<td>
562 562
 						<?php
563 563
 
564
-						$date_format_setting = esc_attr( get_post_meta( $post->ID, '_calendar_date_format_setting', true ) );
565
-						$date_format_default = esc_attr( get_option( 'date_format' ) );
566
-						$date_format = esc_attr( get_post_meta( $post->ID, '_calendar_date_format', true ) );
567
-						$date_format_php = esc_attr( get_post_meta( $post->ID, '_calendar_date_format_php', true ) );
564
+						$date_format_setting = esc_attr(get_post_meta($post->ID, '_calendar_date_format_setting', true));
565
+						$date_format_default = esc_attr(get_option('date_format'));
566
+						$date_format = esc_attr(get_post_meta($post->ID, '_calendar_date_format', true));
567
+						$date_format_php = esc_attr(get_post_meta($post->ID, '_calendar_date_format_php', true));
568 568
 						$date_format_php = $date_format_php ? $date_format_php : $date_format_default;
569 569
 
570 570
 						?>
571 571
 						<select name="_calendar_date_format_setting"
572 572
 						        id="_calendar_date_format_setting"
573 573
 								class="simcal-field simcal-field-select simcal-field-show-other">
574
-							<option value="use_site" data-show-field="_calendar_date_format_default" <?php selected( 'use_site', $date_format_setting, true ); ?>><?php  _ex( 'Site default', 'Use this site default setting', 'google-calendar-events' ); ?></option>
575
-							<option value="use_custom" data-show-field="_calendar_date_format" <?php selected( 'use_custom', $date_format_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
576
-							<option value="use_custom_php" data-show-field="_calendar_date_format_php_field" <?php selected( 'use_custom_php', $date_format_setting, true ); ?>><?php _e( 'Custom (PHP format)', 'google-calendar-events' ); ?></option>
574
+							<option value="use_site" data-show-field="_calendar_date_format_default" <?php selected('use_site', $date_format_setting, true); ?>><?php  _ex('Site default', 'Use this site default setting', 'google-calendar-events'); ?></option>
575
+							<option value="use_custom" data-show-field="_calendar_date_format" <?php selected('use_custom', $date_format_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
576
+							<option value="use_custom_php" data-show-field="_calendar_date_format_php_field" <?php selected('use_custom_php', $date_format_setting, true); ?>><?php _e('Custom (PHP format)', 'google-calendar-events'); ?></option>
577 577
 						</select>
578
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'This option sets how calendars display event dates. It is recommended to keep your site default setting.', 'google-calendar-events' ); ?>"></i>
578
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('This option sets how calendars display event dates. It is recommended to keep your site default setting.', 'google-calendar-events'); ?>"></i>
579 579
 						<p id="_calendar_date_format_default" style="<?php echo $date_format_setting != 'use_site' ? 'display: none;' : ''; ?>">
580
-							<em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
581
-							<code><?php echo date_i18n( $date_format_default, time() ); ?></code>
580
+							<em><?php _e('Preview', 'google-calendar-events') ?>:</em>&nbsp;&nbsp;
581
+							<code><?php echo date_i18n($date_format_default, time()); ?></code>
582 582
 						</p>
583
-						<?php simcal_print_field( array(
583
+						<?php simcal_print_field(array(
584 584
 							'type'    => 'datetime-format',
585 585
 							'subtype' => 'date',
586 586
 							'name'    => '_calendar_date_format',
587 587
 							'id'      => '_calendar_date_format',
588 588
 							'value'   => $date_format,
589
-							'style'   => $date_format_setting != 'use_custom' ? array( 'display' => 'none' ) : '',
590
-						) ); ?>
589
+							'style'   => $date_format_setting != 'use_custom' ? array('display' => 'none') : '',
590
+						)); ?>
591 591
 						<div class="simcal-field-datetime-format-php" id="_calendar_date_format_php_field" style="<?php echo $date_format_setting != 'use_custom_php' ? 'display: none;' : ''; ?>">
592 592
 							<br>
593 593
 							<label for="_calendar_date_format_php">
@@ -596,70 +596,70 @@  discard block
 block discarded – undo
596 596
 								       id="_calendar_date_format_php"
597 597
 								       class="simcal-field simcal-field-text simcal-field-small"
598 598
 								       value="<?php echo $date_format_php; ?>" />
599
-								<?php printf( __( 'Enter a date format using %s values.', 'google-calendar-events' ), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>' ); ?>
599
+								<?php printf(__('Enter a date format using %s values.', 'google-calendar-events'), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>'); ?>
600 600
 							</label>
601 601
 							<p>
602
-								<em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
603
-								<code><?php echo date_i18n( $date_format_php, time() ); ?></code>
602
+								<em><?php _e('Preview', 'google-calendar-events') ?>:</em>&nbsp;&nbsp;
603
+								<code><?php echo date_i18n($date_format_php, time()); ?></code>
604 604
 							</p>
605 605
 						</div>
606 606
 					</td>
607 607
 				</tr>
608 608
 				<tr class="simcal-panel-field">
609
-					<th><label for="_calendar_datetime_separator"><?php _e( 'Separator', 'google-calendar-events' ); ?></label></th>
609
+					<th><label for="_calendar_datetime_separator"><?php _e('Separator', 'google-calendar-events'); ?></label></th>
610 610
 					<td>
611 611
 						<?php
612 612
 
613
-						$separator = get_post_meta( $post->ID, '_calendar_datetime_separator', true );
613
+						$separator = get_post_meta($post->ID, '_calendar_datetime_separator', true);
614 614
 						$separator = false == $separator ? '@' : $separator;
615 615
 
616
-						simcal_print_field( array(
616
+						simcal_print_field(array(
617 617
 							'type'    => 'standard',
618 618
 							'subtype' => 'text',
619 619
 							'name'    => '_calendar_datetime_separator',
620 620
 							'id'      => '_calendar_datetime_separator',
621 621
 							'value'   => $separator,
622
-							'tooltip' => __( 'Used to divide date and time when both are shown.', 'google-calendar-events' ),
622
+							'tooltip' => __('Used to divide date and time when both are shown.', 'google-calendar-events'),
623 623
 							'class'   => array(
624 624
 								'simcal-field-tiny',
625 625
 							),
626
-						) );
626
+						));
627 627
 
628 628
 						?>
629 629
 					</td>
630 630
 				</tr>
631 631
 				<tr class="simcal-panel-field">
632
-					<th><label for="_calendar_time_format_setting"><?php _e( 'Time format', 'google-calendar-events' ); ?></label></th>
632
+					<th><label for="_calendar_time_format_setting"><?php _e('Time format', 'google-calendar-events'); ?></label></th>
633 633
 					<td>
634 634
 						<?php
635 635
 
636
-						$time_format_setting = esc_attr( get_post_meta( $post->ID, '_calendar_time_format_setting', true ) );
637
-						$time_format_default = esc_attr( get_option( 'time_format' ) );
638
-						$time_format = esc_attr( get_post_meta( $post->ID, '_calendar_time_format', true ) );
639
-						$time_format_php = esc_attr( get_post_meta( $post->ID, '_calendar_time_format_php', true ) );
636
+						$time_format_setting = esc_attr(get_post_meta($post->ID, '_calendar_time_format_setting', true));
637
+						$time_format_default = esc_attr(get_option('time_format'));
638
+						$time_format = esc_attr(get_post_meta($post->ID, '_calendar_time_format', true));
639
+						$time_format_php = esc_attr(get_post_meta($post->ID, '_calendar_time_format_php', true));
640 640
 						$time_format_php = $time_format_php ? $time_format_php : $time_format_default;
641 641
 
642 642
 						?>
643 643
 						<select name="_calendar_time_format_setting"
644 644
 						        id="_calendar_time_format_setting"
645 645
 						        class="simcal-field simcal-field-select simcal-field-show-other">
646
-							<option value="use_site" data-show-field="_calendar_time_format_default" <?php selected( 'use_site', $time_format_setting, true ); ?>><?php _ex( 'Site default', 'Use this site default setting', 'google-calendar-events' ); ?></option>
647
-							<option value="use_custom" data-show-field="_calendar_time_format" <?php selected( 'use_custom', $time_format_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
648
-							<option value="use_custom_php" data-show-field="_calendar_time_format_php_field" <?php selected( 'use_custom_php', $time_format_setting, true ); ?>><?php _e( 'Custom (PHP format)', 'google-calendar-events' ); ?></option>
646
+							<option value="use_site" data-show-field="_calendar_time_format_default" <?php selected('use_site', $time_format_setting, true); ?>><?php _ex('Site default', 'Use this site default setting', 'google-calendar-events'); ?></option>
647
+							<option value="use_custom" data-show-field="_calendar_time_format" <?php selected('use_custom', $time_format_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
648
+							<option value="use_custom_php" data-show-field="_calendar_time_format_php_field" <?php selected('use_custom_php', $time_format_setting, true); ?>><?php _e('Custom (PHP format)', 'google-calendar-events'); ?></option>
649 649
 						</select>
650
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'This option sets how calendars display event times. It is recommended to keep your site default setting.', 'google-calendar-events' ); ?>"></i>
650
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('This option sets how calendars display event times. It is recommended to keep your site default setting.', 'google-calendar-events'); ?>"></i>
651 651
 						<p id="_calendar_time_format_default" style="<?php echo $time_format_setting != 'use_site' ? 'display: none;' : ''; ?>">
652
-							<em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
653
-							<code><?php echo date_i18n( $time_format_default, time() ); ?></code>
652
+							<em><?php _e('Preview', 'google-calendar-events') ?>:</em>&nbsp;&nbsp;
653
+							<code><?php echo date_i18n($time_format_default, time()); ?></code>
654 654
 						</p>
655
-						<?php simcal_print_field( array(
655
+						<?php simcal_print_field(array(
656 656
 							'type'    => 'datetime-format',
657 657
 							'subtype' => 'time',
658 658
 							'name'    => '_calendar_time_format',
659 659
 							'id'      => '_calendar_time_format',
660 660
 							'value'   => $time_format,
661
-							'style'   => $time_format_setting != 'use_custom' ? array( 'display' => 'none' ) : '',
662
-						) ); ?>
661
+							'style'   => $time_format_setting != 'use_custom' ? array('display' => 'none') : '',
662
+						)); ?>
663 663
 						<div class="simcal-field-datetime-format-php" id="_calendar_time_format_php_field" style="<?php echo $time_format_setting != 'use_custom_php' ? 'display: none;' : ''; ?>">
664 664
 							<br>
665 665
 							<label for="_calendar_date_format_php">
@@ -668,24 +668,24 @@  discard block
 block discarded – undo
668 668
 								       id="_calendar_time_format_php"
669 669
 								       class="simcal-field simcal-field-text simcal-field-small"
670 670
 								       value="<?php echo $time_format_php; ?>"/>
671
-								<?php printf( __( 'Enter a time format using %s values.', 'google-calendar-events' ), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>' ); ?>
671
+								<?php printf(__('Enter a time format using %s values.', 'google-calendar-events'), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>'); ?>
672 672
 							</label>
673 673
 							<p>
674
-								<em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em>&nbsp;&nbsp;
675
-								<code><?php echo date_i18n( $time_format_php, time() ); ?></code>
674
+								<em><?php _e('Preview', 'google-calendar-events') ?>:</em>&nbsp;&nbsp;
675
+								<code><?php echo date_i18n($time_format_php, time()); ?></code>
676 676
 							</p>
677 677
 						</div>
678 678
 					</td>
679 679
 				</tr>
680 680
 				<tr class="simcal-panel-field">
681
-					<th><label for="_calendar_week_starts_on_setting"><?php _e( 'Week starts on', 'google-calendar-events' ); ?></label></th>
681
+					<th><label for="_calendar_week_starts_on_setting"><?php _e('Week starts on', 'google-calendar-events'); ?></label></th>
682 682
 					<td>
683 683
 						<?php
684 684
 
685
-						$week_starts_setting = esc_attr( get_post_meta( $post->ID, '_calendar_week_starts_on_setting', true ) );
686
-						$week_starts_default = esc_attr( get_option( 'start_of_week' ) );
687
-						$week_starts = intval( get_post_meta( $post->ID, '_calendar_week_starts_on', true ) );
688
-						$week_starts = is_numeric( $week_starts ) ? strval( $week_starts ) : $week_starts_default;
685
+						$week_starts_setting = esc_attr(get_post_meta($post->ID, '_calendar_week_starts_on_setting', true));
686
+						$week_starts_default = esc_attr(get_option('start_of_week'));
687
+						$week_starts = intval(get_post_meta($post->ID, '_calendar_week_starts_on', true));
688
+						$week_starts = is_numeric($week_starts) ? strval($week_starts) : $week_starts_default;
689 689
 
690 690
 						?>
691 691
 						<select
@@ -693,39 +693,39 @@  discard block
 block discarded – undo
693 693
 							id="_calendar_week_starts_on_setting"
694 694
 							class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-next"
695 695
 							data-show-next-if-value="use_custom">
696
-							<option value="use_site" <?php selected( 'use_site', $week_starts_setting, true ); ?>><?php printf( _x( 'Site default', 'Use this site default setting', 'google-calendar-events' ) . ' (%s)', date_i18n( 'l', strtotime( "Sunday + $week_starts_default Days" ) ) ); ?></option>
697
-							<option value="use_custom" <?php selected( 'use_custom', $week_starts_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option>
696
+							<option value="use_site" <?php selected('use_site', $week_starts_setting, true); ?>><?php printf(_x('Site default', 'Use this site default setting', 'google-calendar-events').' (%s)', date_i18n('l', strtotime("Sunday + $week_starts_default Days"))); ?></option>
697
+							<option value="use_custom" <?php selected('use_custom', $week_starts_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
698 698
 						</select>
699 699
 						<select
700 700
 							name="_calendar_week_starts_on"
701 701
 							id="_calendar_week_starts_on"
702 702
 							class="simcal-field simcal-field-select simcal-field-inline"
703 703
 							<?php echo 'use_custom' != $week_starts_setting ? 'style="display: none;"' : ''; ?>>
704
-							<?php $day_names = simcal_get_calendar_names_i18n( 'day', 'full' ); ?>
705
-							<?php for ( $i = 0; $i <= 6; $i++ ) : ?>
706
-								<option value="<?php echo $i; ?>" <?php selected( $i, $week_starts, true ); ?>><?php echo $day_names[ $i ]; ?></option>
704
+							<?php $day_names = simcal_get_calendar_names_i18n('day', 'full'); ?>
705
+							<?php for ($i = 0; $i <= 6; $i++) : ?>
706
+								<option value="<?php echo $i; ?>" <?php selected($i, $week_starts, true); ?>><?php echo $day_names[$i]; ?></option>
707 707
 							<?php endfor; ?>
708 708
 						</select>
709
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Some calendars may use this setting to display the start of the week. It is recommended to keep the site default setting.', 'google-calendar-events' ); ?>"></i>
709
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('Some calendars may use this setting to display the start of the week. It is recommended to keep the site default setting.', 'google-calendar-events'); ?>"></i>
710 710
 					</td>
711 711
 				</tr>
712 712
 			</tbody>
713 713
 		</table>
714 714
 		<table>
715 715
 			<thead>
716
-				<tr><th colspan="2"><?php _e( 'Cache', 'google-calendar-events' ); ?></th></tr>
716
+				<tr><th colspan="2"><?php _e('Cache', 'google-calendar-events'); ?></th></tr>
717 717
 			</thead>
718 718
 			<tbody class="simcal-panel-section simcal-panel-section-cache">
719 719
 				<?php
720 720
 
721
-				$cache_freq = esc_attr( get_post_meta( $post->ID, '_feed_cache_user_amount', true ) );
722
-				$cache_unit = esc_attr( get_post_meta( $post->ID, '_feed_cache_user_unit', true ) );
721
+				$cache_freq = esc_attr(get_post_meta($post->ID, '_feed_cache_user_amount', true));
722
+				$cache_unit = esc_attr(get_post_meta($post->ID, '_feed_cache_user_unit', true));
723 723
 				$cache_freq = $cache_freq >= 0 ? $cache_freq : '2';
724 724
 				$cache_unit = $cache_unit ? $cache_unit : '3600';
725 725
 
726 726
 				?>
727 727
 				<tr class="simcal-panel-field">
728
-					<th><label for="_feed_cache_user_amount"><?php _ex( 'Refresh interval', 'Cache maximum interval', 'google-calendar-events' ); ?></label></th>
728
+					<th><label for="_feed_cache_user_amount"><?php _ex('Refresh interval', 'Cache maximum interval', 'google-calendar-events'); ?></label></th>
729 729
 					<td>
730 730
 						<input type="number"
731 731
 						       name="_feed_cache_user_amount"
@@ -736,12 +736,12 @@  discard block
 block discarded – undo
736 736
 						<select name="_feed_cache_user_unit"
737 737
 						        id="_feed_cache_user_unit"
738 738
 						        class="simcal-field simcalfield-select simcal-field-inline">
739
-							<option value="60" <?php selected( '60', $cache_unit, true ); ?>><?php _e( 'Minute(s)', 'google-calendar-events' ); ?></option>
740
-							<option value="3600" <?php selected( '3600', $cache_unit, true ); ?>><?php _e( 'Hour(s)', 'google-calendar-events' ); ?></option>
741
-							<option value="86400" <?php selected( '86400', $cache_unit, true ); ?>><?php _e( 'Day(s)', 'google-calendar-events' ); ?></option>
742
-							<option value="604800" <?php selected( '604800', $cache_unit, true ); ?>><?php _e( 'Week(s)', 'google-calendar-events' ); ?></option>
739
+							<option value="60" <?php selected('60', $cache_unit, true); ?>><?php _e('Minute(s)', 'google-calendar-events'); ?></option>
740
+							<option value="3600" <?php selected('3600', $cache_unit, true); ?>><?php _e('Hour(s)', 'google-calendar-events'); ?></option>
741
+							<option value="86400" <?php selected('86400', $cache_unit, true); ?>><?php _e('Day(s)', 'google-calendar-events'); ?></option>
742
+							<option value="604800" <?php selected('604800', $cache_unit, true); ?>><?php _e('Week(s)', 'google-calendar-events'); ?></option>
743 743
 						</select>
744
-						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'If you add, edit or remove events in your calendar very often, you can set a lower interval to refresh the events displayed. Set a higher interval for best performance.', 'google-calendar-events' ); ?>"></i>
744
+						<i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('If you add, edit or remove events in your calendar very often, you can set a lower interval to refresh the events displayed. Set a higher interval for best performance.', 'google-calendar-events'); ?>"></i>
745 745
 					</td>
746 746
 				</tr>
747 747
 			</tbody>
@@ -760,21 +760,21 @@  discard block
 block discarded – undo
760 760
 	 *
761 761
 	 * @return void
762 762
 	 */
763
-	public static function print_panel_fields( $array, $post_id ) {
763
+	public static function print_panel_fields($array, $post_id) {
764 764
 
765
-		foreach ( $array as $section => $fields ) :
765
+		foreach ($array as $section => $fields) :
766 766
 
767
-			if ( $fields && is_array( $fields ) ) :
767
+			if ($fields && is_array($fields)) :
768 768
 
769 769
 				?>
770
-				<tbody class="simcal-panel-section simcal-panel-section-<?php echo esc_attr( $section ); ?>">
771
-					<?php foreach ( $fields as $key => $field ) :
770
+				<tbody class="simcal-panel-section simcal-panel-section-<?php echo esc_attr($section); ?>">
771
+					<?php foreach ($fields as $key => $field) :
772 772
 
773
-						$value            = get_post_meta( $post_id, $key, true );
774
-						$field['value']   = $value ? $value : ( isset( $field['default'] ) ? $field['default'] : '' );
775
-						$the_field = simcal_get_field( $field ); ?>
773
+						$value            = get_post_meta($post_id, $key, true);
774
+						$field['value']   = $value ? $value : (isset($field['default']) ? $field['default'] : '');
775
+						$the_field = simcal_get_field($field); ?>
776 776
 
777
-						<?php if ( $the_field instanceof Field ) : ?>
777
+						<?php if ($the_field instanceof Field) : ?>
778 778
 							<tr class="simcal-panel-field">
779 779
 								<th><label for="<?php echo $the_field->id ?>"><?php echo $the_field->title; ?></label></th>
780 780
 								<td><?php $the_field->html(); ?></td>
@@ -801,30 +801,30 @@  discard block
 block discarded – undo
801 801
 	 *
802 802
 	 * @return void
803 803
 	 */
804
-	public static function save( $post_id, $post ) {
804
+	public static function save($post_id, $post) {
805 805
 
806 806
 		/* ====================== *
807 807
 		 * Calendar type and view *
808 808
 		 * ====================== */
809 809
 
810 810
 		// Unlink existing terms for feed type and calendar type.
811
-		wp_delete_object_term_relationships( $post_id, array(
811
+		wp_delete_object_term_relationships($post_id, array(
812 812
 			'calendar_feed',
813 813
 			'calendar_type',
814
-		) );
814
+		));
815 815
 
816 816
 		// Set the feed type as term.
817
-		$feed_type = isset( $_POST['_feed_type'] ) ? sanitize_title( stripslashes( $_POST['_feed_type'] ) ) : apply_filters( 'simcal_default_feed_type', 'google' );
818
-		wp_set_object_terms( $post_id, $feed_type, 'calendar_feed' );
817
+		$feed_type = isset($_POST['_feed_type']) ? sanitize_title(stripslashes($_POST['_feed_type'])) : apply_filters('simcal_default_feed_type', 'google');
818
+		wp_set_object_terms($post_id, $feed_type, 'calendar_feed');
819 819
 
820 820
 		// Set the calendar type as a term.
821
-		$calendar_type = isset( $_POST['_calendar_type'] ) ? sanitize_title( stripslashes( $_POST['_calendar_type'] ) ) : apply_filters( 'simcal_default_calendar_type', 'default-calendar' );
822
-		wp_set_object_terms( $post_id, $calendar_type, 'calendar_type' );
821
+		$calendar_type = isset($_POST['_calendar_type']) ? sanitize_title(stripslashes($_POST['_calendar_type'])) : apply_filters('simcal_default_calendar_type', 'default-calendar');
822
+		wp_set_object_terms($post_id, $calendar_type, 'calendar_type');
823 823
 		// Set the calendar type view as post meta.
824
-		$calendar_view = isset( $_POST['_calendar_view'] ) ? $_POST['_calendar_view'] : '';
825
-		if ( $calendar_view && is_array( $calendar_view ) ) {
826
-			$views = array_map( 'sanitize_title', $calendar_view );
827
-			update_post_meta( $post_id, '_calendar_view', $views );
824
+		$calendar_view = isset($_POST['_calendar_view']) ? $_POST['_calendar_view'] : '';
825
+		if ($calendar_view && is_array($calendar_view)) {
826
+			$views = array_map('sanitize_title', $calendar_view);
827
+			update_post_meta($post_id, '_calendar_view', $views);
828 828
 		}
829 829
 
830 830
 		/* ===================== *
@@ -832,102 +832,102 @@  discard block
 block discarded – undo
832 832
 		 * ===================== */
833 833
 
834 834
 		// Calendar opening.
835
-		$calendar_begins = isset( $_POST['_calendar_begins'] ) ? sanitize_key( $_POST['_calendar_begins'] ) : 'this_month';
836
-		update_post_meta( $post_id, '_calendar_begins', $calendar_begins );
837
-		$calendar_begins_nth = isset( $_POST['_calendar_begins_nth'] ) ? absint( $_POST['_calendar_begins_nth'] ) : 2;
838
-		update_post_meta( $post_id, '_calendar_begins_nth', $calendar_begins_nth );
839
-		$calendar_begins_custom_date = isset( $_POST['_calendar_begins_custom_date'] ) ? sanitize_title( $_POST['_calendar_begins_custom_date'] ) : '';
840
-		update_post_meta( $post_id, '_calendar_begins_custom_date', $calendar_begins_custom_date );
835
+		$calendar_begins = isset($_POST['_calendar_begins']) ? sanitize_key($_POST['_calendar_begins']) : 'this_month';
836
+		update_post_meta($post_id, '_calendar_begins', $calendar_begins);
837
+		$calendar_begins_nth = isset($_POST['_calendar_begins_nth']) ? absint($_POST['_calendar_begins_nth']) : 2;
838
+		update_post_meta($post_id, '_calendar_begins_nth', $calendar_begins_nth);
839
+		$calendar_begins_custom_date = isset($_POST['_calendar_begins_custom_date']) ? sanitize_title($_POST['_calendar_begins_custom_date']) : '';
840
+		update_post_meta($post_id, '_calendar_begins_custom_date', $calendar_begins_custom_date);
841 841
 
842 842
 		// Feed earliest events date.
843
-		$earliest_events = isset( $_POST['_feed_earliest_event_date'] ) ? sanitize_key( $_POST['_feed_earliest_event_date'] ) : '';
844
-		update_post_meta( $post_id, '_feed_earliest_event_date', $earliest_events );
845
-		$earliest_events_range = isset( $_POST['_feed_earliest_event_date_range'] ) ? max( absint( $_POST['_feed_earliest_event_date_range'] ), 1 ) : 1;
846
-		update_post_meta( $post_id, '_feed_earliest_event_date_range', $earliest_events_range );
843
+		$earliest_events = isset($_POST['_feed_earliest_event_date']) ? sanitize_key($_POST['_feed_earliest_event_date']) : '';
844
+		update_post_meta($post_id, '_feed_earliest_event_date', $earliest_events);
845
+		$earliest_events_range = isset($_POST['_feed_earliest_event_date_range']) ? max(absint($_POST['_feed_earliest_event_date_range']), 1) : 1;
846
+		update_post_meta($post_id, '_feed_earliest_event_date_range', $earliest_events_range);
847 847
 
848 848
 		// Feed latest events date.
849
-		$latest_events = isset( $_POST['_feed_latest_event_date'] ) ? sanitize_key( $_POST['_feed_latest_event_date'] ) : '';
850
-		update_post_meta( $post_id, '_feed_latest_event_date', $latest_events );
851
-		$latest_events_range = isset( $_POST['_feed_latest_event_date_range'] ) ? max( absint( $_POST['_feed_latest_event_date_range'] ), 1 ) : 1;
852
-		update_post_meta( $post_id, '_feed_latest_event_date_range', $latest_events_range );
849
+		$latest_events = isset($_POST['_feed_latest_event_date']) ? sanitize_key($_POST['_feed_latest_event_date']) : '';
850
+		update_post_meta($post_id, '_feed_latest_event_date', $latest_events);
851
+		$latest_events_range = isset($_POST['_feed_latest_event_date_range']) ? max(absint($_POST['_feed_latest_event_date_range']), 1) : 1;
852
+		update_post_meta($post_id, '_feed_latest_event_date_range', $latest_events_range);
853 853
 
854 854
 		/* ======================= *
855 855
 		 * Calendar settings panel *
856 856
 		 * ======================= */
857 857
 
858 858
 		// Static calendar.
859
-		$static = isset( $_POST['_calendar_is_static'] ) ? 'yes' : 'no';
860
-		update_post_meta( $post_id, '_calendar_is_static', $static );
859
+		$static = isset($_POST['_calendar_is_static']) ? 'yes' : 'no';
860
+		update_post_meta($post_id, '_calendar_is_static', $static);
861 861
 
862 862
 		// No events message.
863
-		$message = isset( $_POST['_no_events_message'] ) ? wp_kses_post( $_POST['_no_events_message'] ) : '';
864
-		update_post_meta( $post_id, '_no_events_message', $message );
863
+		$message = isset($_POST['_no_events_message']) ? wp_kses_post($_POST['_no_events_message']) : '';
864
+		update_post_meta($post_id, '_no_events_message', $message);
865 865
 
866 866
 		// _event_formatting
867
-		$event_formatting = isset( $_POST['_event_formatting'] ) ? sanitize_key( $_POST['_event_formatting'] ) : 'preserve_linebreaks';
868
-		update_post_meta( $post_id, '_event_formatting', $event_formatting );
867
+		$event_formatting = isset($_POST['_event_formatting']) ? sanitize_key($_POST['_event_formatting']) : 'preserve_linebreaks';
868
+		update_post_meta($post_id, '_event_formatting', $event_formatting);
869 869
 
870 870
 		/* ======================= *
871 871
 		 * Advanced settings panel *
872 872
 		 * ======================= */
873 873
 
874 874
 		// Timezone.
875
-		$feed_timezone_setting = isset( $_POST['_feed_timezone_setting'] ) ? sanitize_key( $_POST['_feed_timezone_setting'] ) : 'use_calendar';
876
-		update_post_meta( $post_id, '_feed_timezone_setting', $feed_timezone_setting );
875
+		$feed_timezone_setting = isset($_POST['_feed_timezone_setting']) ? sanitize_key($_POST['_feed_timezone_setting']) : 'use_calendar';
876
+		update_post_meta($post_id, '_feed_timezone_setting', $feed_timezone_setting);
877 877
 		$default_timezone = simcal_get_wp_timezone();
878 878
 		$feed_timezone = $default_timezone ? $default_timezone : 'UTC';
879
-		$feed_timezone = isset( $_POST['_feed_timezone'] ) ? sanitize_text_field( $_POST['_feed_timezone'] ) : $feed_timezone;
880
-		update_post_meta( $post_id, '_feed_timezone', $feed_timezone );
879
+		$feed_timezone = isset($_POST['_feed_timezone']) ? sanitize_text_field($_POST['_feed_timezone']) : $feed_timezone;
880
+		update_post_meta($post_id, '_feed_timezone', $feed_timezone);
881 881
 
882 882
 		// Date format.
883
-		$date_format_setting = isset( $_POST['_calendar_date_format_setting'] ) ? sanitize_key( $_POST['_calendar_date_format_setting'] ) : 'use_site';
884
-		update_post_meta( $post_id, '_calendar_date_format_setting', $date_format_setting );
885
-		$date_format = isset( $_POST['_calendar_date_format'] ) ? sanitize_text_field( trim( $_POST['_calendar_date_format'] ) ) : get_option( 'date_format' );
886
-		update_post_meta( $post_id, '_calendar_date_format', $date_format );
887
-		$date_format_php = isset( $_POST['_calendar_date_format_php'] ) ? sanitize_text_field( trim( $_POST['_calendar_date_format_php'] ) ) : get_option( 'date_format' );
888
-		update_post_meta( $post_id, '_calendar_date_format_php', $date_format_php );
883
+		$date_format_setting = isset($_POST['_calendar_date_format_setting']) ? sanitize_key($_POST['_calendar_date_format_setting']) : 'use_site';
884
+		update_post_meta($post_id, '_calendar_date_format_setting', $date_format_setting);
885
+		$date_format = isset($_POST['_calendar_date_format']) ? sanitize_text_field(trim($_POST['_calendar_date_format'])) : get_option('date_format');
886
+		update_post_meta($post_id, '_calendar_date_format', $date_format);
887
+		$date_format_php = isset($_POST['_calendar_date_format_php']) ? sanitize_text_field(trim($_POST['_calendar_date_format_php'])) : get_option('date_format');
888
+		update_post_meta($post_id, '_calendar_date_format_php', $date_format_php);
889 889
 
890 890
 		// Time format.
891
-		$time_format_setting = isset( $_POST['_calendar_time_format_setting'] ) ? sanitize_key( $_POST['_calendar_time_format_setting'] ) : 'use_site';
892
-		update_post_meta( $post_id, '_calendar_time_format_setting', $time_format_setting );
893
-		$time_format = isset( $_POST['_calendar_time_format'] ) ? sanitize_text_field( trim( $_POST['_calendar_time_format'] ) ) : get_option( 'time_format' );
894
-		update_post_meta( $post_id, '_calendar_time_format', $time_format );
895
-		$time_format_php = isset( $_POST['_calendar_time_format_php'] ) ? sanitize_text_field( trim( $_POST['_calendar_time_format_php'] ) ) : get_option( 'time_format' );
896
-		update_post_meta( $post_id, '_calendar_time_format_php', $time_format_php );
891
+		$time_format_setting = isset($_POST['_calendar_time_format_setting']) ? sanitize_key($_POST['_calendar_time_format_setting']) : 'use_site';
892
+		update_post_meta($post_id, '_calendar_time_format_setting', $time_format_setting);
893
+		$time_format = isset($_POST['_calendar_time_format']) ? sanitize_text_field(trim($_POST['_calendar_time_format'])) : get_option('time_format');
894
+		update_post_meta($post_id, '_calendar_time_format', $time_format);
895
+		$time_format_php = isset($_POST['_calendar_time_format_php']) ? sanitize_text_field(trim($_POST['_calendar_time_format_php'])) : get_option('time_format');
896
+		update_post_meta($post_id, '_calendar_time_format_php', $time_format_php);
897 897
 
898 898
 		// Date-time separator.
899
-		$datetime_separator = isset( $_POST['_calendar_datetime_separator'] ) ? sanitize_text_field( $_POST['_calendar_datetime_separator'] ) : ' ';
900
-		update_post_meta( $post_id, '_calendar_datetime_separator', $datetime_separator );
899
+		$datetime_separator = isset($_POST['_calendar_datetime_separator']) ? sanitize_text_field($_POST['_calendar_datetime_separator']) : ' ';
900
+		update_post_meta($post_id, '_calendar_datetime_separator', $datetime_separator);
901 901
 
902 902
 		// Week start.
903
-		$week_start_setting = isset( $_POST['_calendar_week_starts_on_setting'] ) ? sanitize_key( $_POST['_calendar_week_starts_on_setting'] ) : 'use_site';
904
-		update_post_meta( $post_id, '_calendar_week_starts_on_setting', $week_start_setting );
905
-		$week_start = isset( $_POST['_calendar_week_starts_on'] ) ? intval( $_POST['_calendar_week_starts_on'] ) : get_option( 'start_of_week' );
906
-		update_post_meta( $post_id, '_calendar_week_starts_on', $week_start );
903
+		$week_start_setting = isset($_POST['_calendar_week_starts_on_setting']) ? sanitize_key($_POST['_calendar_week_starts_on_setting']) : 'use_site';
904
+		update_post_meta($post_id, '_calendar_week_starts_on_setting', $week_start_setting);
905
+		$week_start = isset($_POST['_calendar_week_starts_on']) ? intval($_POST['_calendar_week_starts_on']) : get_option('start_of_week');
906
+		update_post_meta($post_id, '_calendar_week_starts_on', $week_start);
907 907
 
908 908
 		// Cache interval.
909 909
 		$cache = 7200;
910
-		if ( isset( $_POST['_feed_cache_user_amount'] ) && isset( $_POST['_feed_cache_user_unit'] ) ) {
911
-			$amount = is_numeric( $_POST['_feed_cache_user_amount'] ) || $_POST['_feed_cache_user_amount'] == 0 ? absint( $_POST['_feed_cache_user_amount'] ) : 1;
912
-			$unit   = is_numeric( $_POST['_feed_cache_user_unit'] ) ? absint( $_POST['_feed_cache_user_unit'] ) : 3600;
913
-			update_post_meta( $post_id, '_feed_cache_user_amount', $amount );
914
-			update_post_meta( $post_id, '_feed_cache_user_unit', $unit );
915
-			$cache  = ( ( $amount * $unit ) > 0 ) ? $amount * $unit : 1;
910
+		if (isset($_POST['_feed_cache_user_amount']) && isset($_POST['_feed_cache_user_unit'])) {
911
+			$amount = is_numeric($_POST['_feed_cache_user_amount']) || $_POST['_feed_cache_user_amount'] == 0 ? absint($_POST['_feed_cache_user_amount']) : 1;
912
+			$unit   = is_numeric($_POST['_feed_cache_user_unit']) ? absint($_POST['_feed_cache_user_unit']) : 3600;
913
+			update_post_meta($post_id, '_feed_cache_user_amount', $amount);
914
+			update_post_meta($post_id, '_feed_cache_user_unit', $unit);
915
+			$cache  = (($amount * $unit) > 0) ? $amount * $unit : 1;
916 916
 		}
917
-		update_post_meta( $post_id, '_feed_cache', $cache );
917
+		update_post_meta($post_id, '_feed_cache', $cache);
918 918
 
919 919
 		/* ============= *
920 920
 		 * Miscellaneous *
921 921
 		 * ============= */
922 922
 
923 923
 		// Update version.
924
-		update_post_meta( $post_id, '_calendar_version', SIMPLE_CALENDAR_VERSION );
924
+		update_post_meta($post_id, '_calendar_version', SIMPLE_CALENDAR_VERSION);
925 925
 
926 926
 		// Action hook.
927
-		do_action( 'simcal_process_settings_meta', $post_id );
927
+		do_action('simcal_process_settings_meta', $post_id);
928 928
 
929 929
 		// Clear cache.
930
-		simcal_delete_feed_transients( $post_id );
930
+		simcal_delete_feed_transients($post_id);
931 931
 	}
932 932
 
933 933
 }
Please login to merge, or discard this patch.
includes/abstracts/calendar.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -784,8 +784,8 @@
 block discarded – undo
784 784
 				if ( 'yes' == $poweredby ) {
785 785
 					$align = is_rtl() ? 'left' : 'right';
786 786
 					echo '<small class="simcal-powered simcal-align-' . $align .'">' .
787
-					     sprintf( __( 'Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events' ), simcal_get_url( 'home' ) ) .
788
-					     '</small>';
787
+						 sprintf( __( 'Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events' ), simcal_get_url( 'home' ) ) .
788
+						 '</small>';
789 789
 				}
790 790
 
791 791
 				echo '</div>';
Please login to merge, or discard this patch.
Spacing   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 use SimpleCalendar\Events\Event_Builder;
12 12
 use SimpleCalendar\Events\Events;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 	 * @param int|object|\WP_Post|Calendar $calendar
235 235
 	 * @param string $view
236 236
 	 */
237
-	public function __construct( $calendar, $view = '' ) {
237
+	public function __construct($calendar, $view = '') {
238 238
 
239 239
 		// Set the post object.
240
-		$this->set_post_object( $calendar );
240
+		$this->set_post_object($calendar);
241 241
 
242
-		if ( ! is_null( $this->post ) ) {
242
+		if ( ! is_null($this->post)) {
243 243
 
244 244
 			// Set calendar type and events source.
245 245
 			$this->set_taxonomies();
@@ -256,23 +256,23 @@  discard block
 block discarded – undo
256 256
 			$this->set_events_template();
257 257
 
258 258
 			// Get events source data.
259
-			$feed = simcal_get_feed( $this );
260
-			if ( $feed instanceof Feed ) {
261
-				if ( ! empty( $feed->events ) ) {
262
-					if ( is_array( $feed->events ) ) {
263
-						$this->set_events( $feed->events );
264
-						if ( 'use_calendar' == get_post_meta( $this->id, '_feed_timezone_setting', true ) ) {
259
+			$feed = simcal_get_feed($this);
260
+			if ($feed instanceof Feed) {
261
+				if ( ! empty($feed->events)) {
262
+					if (is_array($feed->events)) {
263
+						$this->set_events($feed->events);
264
+						if ('use_calendar' == get_post_meta($this->id, '_feed_timezone_setting', true)) {
265 265
 							$this->timezone = $feed->timezone;
266
-							$this->set_start( $feed->timezone );
266
+							$this->set_start($feed->timezone);
267 267
 						}
268
-					} elseif ( is_string( $feed->events ) ) {
268
+					} elseif (is_string($feed->events)) {
269 269
 						$this->errors[] = $feed->events;
270 270
 					}
271 271
 				}
272 272
 			}
273 273
 
274 274
 			// Set general purpose timestamps.
275
-			$now = Carbon::now( $this->timezone );
275
+			$now = Carbon::now($this->timezone);
276 276
 			$this->now    = $now->getTimestamp();
277 277
 			$this->today  = $now->startOfDay()->getTimestamp();
278 278
 			$this->offset = $now->getOffset();
@@ -283,26 +283,26 @@  discard block
 block discarded – undo
283 283
 			$this->set_datetime_separator();
284 284
 
285 285
 			// Set earliest and latest event timestamps.
286
-			if ( $this->events && is_array( $this->events ) ) {
287
-				$this->earliest_event = intval( current( array_keys( $this->events ) ) );
288
-				$this->latest_event   = intval( key( array_slice( $this->events, -1, 1, true ) ) );
286
+			if ($this->events && is_array($this->events)) {
287
+				$this->earliest_event = intval(current(array_keys($this->events)));
288
+				$this->latest_event   = intval(key(array_slice($this->events, -1, 1, true)));
289 289
 			}
290 290
 
291 291
 			// Set calendar end.
292 292
 			$this->set_end();
293 293
 
294 294
 			// Set view.
295
-			if ( ! $view ) {
295
+			if ( ! $view) {
296 296
 
297
-				$calendar_view = get_post_meta( $this->id, '_calendar_view', true );
298
-				$calendar_view = isset( $calendar_view[ $this->type ] ) ? $calendar_view[ $this->type ] : '';
297
+				$calendar_view = get_post_meta($this->id, '_calendar_view', true);
298
+				$calendar_view = isset($calendar_view[$this->type]) ? $calendar_view[$this->type] : '';
299 299
 
300
-				$view = esc_attr( $calendar_view );
300
+				$view = esc_attr($calendar_view);
301 301
 			}
302 302
 		}
303 303
 
304 304
 		// Get view.
305
-		$this->view = $this->get_view( $view );
305
+		$this->view = $this->get_view($view);
306 306
 	}
307 307
 
308 308
 	/**
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @return bool
316 316
 	 */
317
-	public function __isset( $key ) {
318
-		return metadata_exists( 'post', $this->id, '_' . $key );
317
+	public function __isset($key) {
318
+		return metadata_exists('post', $this->id, '_'.$key);
319 319
 	}
320 320
 
321 321
 	/**
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @return mixed
329 329
 	 */
330
-	public function __get( $key ) {
331
-		$value = get_post_meta( $this->id, '_' . $key, true );
332
-		if ( ! empty( $value ) ) {
330
+	public function __get($key) {
331
+		$value = get_post_meta($this->id, '_'.$key, true);
332
+		if ( ! empty($value)) {
333 333
 			$this->$key = $value;
334 334
 		}
335 335
 		return $value;
@@ -342,17 +342,17 @@  discard block
 block discarded – undo
342 342
 	 *
343 343
 	 * @param int|object|\WP_Post|Calendar $calendar
344 344
 	 */
345
-	public function set_post_object( $calendar ) {
346
-		if ( is_numeric( $calendar ) ) {
347
-			$this->id   = absint( $calendar );
348
-			$this->post = get_post( $this->id );
349
-		} elseif ( $calendar instanceof Calendar ) {
350
-			$this->id   = absint( $calendar->id );
345
+	public function set_post_object($calendar) {
346
+		if (is_numeric($calendar)) {
347
+			$this->id   = absint($calendar);
348
+			$this->post = get_post($this->id);
349
+		} elseif ($calendar instanceof Calendar) {
350
+			$this->id   = absint($calendar->id);
351 351
 			$this->post = $calendar->post;
352
-		} elseif ( $calendar instanceof \WP_Post ) {
353
-			$this->id   = absint( $calendar->ID );
352
+		} elseif ($calendar instanceof \WP_Post) {
353
+			$this->id   = absint($calendar->ID);
354 354
 			$this->post = $calendar;
355
-		} elseif ( isset( $calendar->id ) && isset( $calendar->post ) ) {
355
+		} elseif (isset($calendar->id) && isset($calendar->post)) {
356 356
 			$this->id   = $calendar->id;
357 357
 			$this->post = $calendar->post;
358 358
 		}
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 	 * @return string
367 367
 	 */
368 368
 	public function get_title() {
369
-		$title = isset( $this->post->post_title ) ? $this->post->post_title : '';
370
-		return apply_filters( 'simcal_calendar_title', $title );
369
+		$title = isset($this->post->post_title) ? $this->post->post_title : '';
370
+		return apply_filters('simcal_calendar_title', $title);
371 371
 	}
372 372
 
373 373
 	/**
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 	 */
390 390
 	protected function set_taxonomies() {
391 391
 		// Set calendar type.
392
-		if ( $type = wp_get_object_terms( $this->id, 'calendar_type' ) ) {
393
-			$this->type = sanitize_title( current( $type )->name );
392
+		if ($type = wp_get_object_terms($this->id, 'calendar_type')) {
393
+			$this->type = sanitize_title(current($type)->name);
394 394
 		} else {
395
-			$this->type = apply_filters( 'simcal_calendar_default_type', 'default-calendar' );
395
+			$this->type = apply_filters('simcal_calendar_default_type', 'default-calendar');
396 396
 		}
397 397
 		// Set feed type.
398
-		if ( $feed_type = wp_get_object_terms( $this->id, 'calendar_feed' ) ) {
399
-			$this->feed = sanitize_title( current( $feed_type )->name );
398
+		if ($feed_type = wp_get_object_terms($this->id, 'calendar_feed')) {
399
+			$this->feed = sanitize_title(current($feed_type)->name);
400 400
 		} else {
401
-			$this->feed = apply_filters( 'simcal_calendar_default_feed', 'google' );
401
+			$this->feed = apply_filters('simcal_calendar_default_feed', 'google');
402 402
 		}
403 403
 	}
404 404
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @return Events
411 411
 	 */
412 412
 	public function get_events() {
413
-		return new Events( $this->events, $this->timezone );
413
+		return new Events($this->events, $this->timezone);
414 414
 	}
415 415
 
416 416
 	/**
@@ -420,14 +420,14 @@  discard block
 block discarded – undo
420 420
 	 *
421 421
 	 * @param array $array
422 422
 	 */
423
-	public function set_events( array $array ) {
423
+	public function set_events(array $array) {
424 424
 
425 425
 		$events = array();
426 426
 
427
-		if ( ! empty( $array ) ) {
428
-			foreach ( $array as $tz => $e ) {
429
-				foreach ( $e as $event ) {
430
-					$events[ $tz ][] = $event instanceof Event ? $event : new Event( $event );
427
+		if ( ! empty($array)) {
428
+			foreach ($array as $tz => $e) {
429
+				foreach ($e as $event) {
430
+					$events[$tz][] = $event instanceof Event ? $event : new Event($event);
431 431
 				}
432 432
 			}
433 433
 		}
@@ -444,24 +444,24 @@  discard block
 block discarded – undo
444 444
 	 *
445 445
 	 * @return string
446 446
 	 */
447
-	public function set_events_template( $template = '' ) {
448
-		if ( empty( $template ) ) {
449
-			$template = isset( $this->post->post_content ) ? $this->post->post_content : '';
447
+	public function set_events_template($template = '') {
448
+		if (empty($template)) {
449
+			$template = isset($this->post->post_content) ? $this->post->post_content : '';
450 450
 		}
451 451
 
452 452
 		// TODO: Removed wpautop() call.
453 453
 
454
-		$event_formatting = get_post_meta( $this->id, '_event_formatting', true );
454
+		$event_formatting = get_post_meta($this->id, '_event_formatting', true);
455 455
 
456
-		switch( $event_formatting ) {
456
+		switch ($event_formatting) {
457 457
 			case 'none':
458
-				$this->events_template =  wp_kses_post( trim( $template ) );
458
+				$this->events_template = wp_kses_post(trim($template));
459 459
 				break;
460 460
 			case 'no_linebreaks':
461
-				$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), false );
461
+				$this->events_template = wpautop(wp_kses_post(trim($template)), false);
462 462
 				break;
463 463
 			default:
464
-				$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), true );
464
+				$this->events_template = wpautop(wp_kses_post(trim($template)), true);
465 465
 		}
466 466
 
467 467
 		//$this->events_template =  wpautop( wp_kses_post( trim( $template ) ), true );
@@ -474,32 +474,32 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @param string $tz Timezone.
476 476
 	 */
477
-	public function set_timezone( $tz = '' ) {
477
+	public function set_timezone($tz = '') {
478 478
 
479
-		$site_tz = esc_attr( simcal_get_wp_timezone() );
479
+		$site_tz = esc_attr(simcal_get_wp_timezone());
480 480
 
481
-		if ( empty( $tz ) ) {
481
+		if (empty($tz)) {
482 482
 
483
-			$timezone_setting = get_post_meta( $this->id, '_feed_timezone_setting', true );
483
+			$timezone_setting = get_post_meta($this->id, '_feed_timezone_setting', true);
484 484
 
485
-			if ( 'use_site' == $timezone_setting ) {
485
+			if ('use_site' == $timezone_setting) {
486 486
 				$tz = $site_tz;
487
-			} elseif ( 'use_custom' == $timezone_setting ) {
488
-				$custom_timezone = esc_attr( get_post_meta( $this->id, '_feed_timezone', true ) );
487
+			} elseif ('use_custom' == $timezone_setting) {
488
+				$custom_timezone = esc_attr(get_post_meta($this->id, '_feed_timezone', true));
489 489
 				// One may be using a non standard timezone in GMT (UTC) offset format.
490
-				if ( ( strpos( $custom_timezone, 'UTC+' ) === 0 ) || ( strpos( $custom_timezone, 'UTC-' ) === 0 ) ) {
491
-					$tz = simcal_get_timezone_from_gmt_offset( substr( $custom_timezone, 3 ) );
490
+				if ((strpos($custom_timezone, 'UTC+') === 0) || (strpos($custom_timezone, 'UTC-') === 0)) {
491
+					$tz = simcal_get_timezone_from_gmt_offset(substr($custom_timezone, 3));
492 492
 				} else {
493
-					$tz = ! empty( $custom_timezone ) ? $custom_timezone : 'UTC';
493
+					$tz = ! empty($custom_timezone) ? $custom_timezone : 'UTC';
494 494
 				}
495 495
 			}
496 496
 
497
-			$this->timezone = empty( $tz ) ? 'UTC' : $tz;
497
+			$this->timezone = empty($tz) ? 'UTC' : $tz;
498 498
 			return;
499 499
 		}
500 500
 
501 501
 		$this->site_timezone = $site_tz;
502
-		$this->timezone = simcal_esc_timezone( $tz, $this->timezone );
502
+		$this->timezone = simcal_esc_timezone($tz, $this->timezone);
503 503
 	}
504 504
 
505 505
 	/**
@@ -509,20 +509,20 @@  discard block
 block discarded – undo
509 509
 	 *
510 510
 	 * @param string $format PHP datetime format.
511 511
 	 */
512
-	public function set_date_format( $format = '' ) {
512
+	public function set_date_format($format = '') {
513 513
 
514 514
 		$date_format_custom = $date_format_default = $format;
515 515
 
516
-		if ( empty( $date_format_custom ) ) {
516
+		if (empty($date_format_custom)) {
517 517
 
518
-			$date_format_option  = esc_attr( get_post_meta( $this->id, '_calendar_date_format_setting', true ) );
519
-			$date_format_default = esc_attr( get_option( 'date_format' ) );
518
+			$date_format_option  = esc_attr(get_post_meta($this->id, '_calendar_date_format_setting', true));
519
+			$date_format_default = esc_attr(get_option('date_format'));
520 520
 			$date_format_custom  = '';
521 521
 
522
-			if ( 'use_custom' == $date_format_option ) {
523
-				$date_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_date_format', true ) );
524
-			} elseif ( 'use_custom_php' == $date_format_option ) {
525
-				$date_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_date_format_php', true ) );
522
+			if ('use_custom' == $date_format_option) {
523
+				$date_format_custom = esc_attr(get_post_meta($this->id, '_calendar_date_format', true));
524
+			} elseif ('use_custom_php' == $date_format_option) {
525
+				$date_format_custom = esc_attr(get_post_meta($this->id, '_calendar_date_format_php', true));
526 526
 			}
527 527
 		}
528 528
 
@@ -536,20 +536,20 @@  discard block
 block discarded – undo
536 536
 	 *
537 537
 	 * @param string $format PHP datetime format.
538 538
 	 */
539
-	public function set_time_format( $format = '' ) {
539
+	public function set_time_format($format = '') {
540 540
 
541 541
 		$time_format_custom = $time_format_default = $format;
542 542
 
543
-		if ( empty( $time_format_custom ) ) {
543
+		if (empty($time_format_custom)) {
544 544
 
545
-			$time_format_option  = esc_attr( get_post_meta( $this->id, '_calendar_time_format_setting', true ) );
546
-			$time_format_default = esc_attr( get_option( 'time_format' ) );
545
+			$time_format_option  = esc_attr(get_post_meta($this->id, '_calendar_time_format_setting', true));
546
+			$time_format_default = esc_attr(get_option('time_format'));
547 547
 			$time_format_custom  = '';
548 548
 
549
-			if ( 'use_custom' == $time_format_option ) {
550
-				$time_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_time_format', true ) );
551
-			} elseif ( 'use_custom_php' == $time_format_option ) {
552
-				$time_format_custom = esc_attr( get_post_meta( $this->id, '_calendar_time_format_php', true ) );
549
+			if ('use_custom' == $time_format_option) {
550
+				$time_format_custom = esc_attr(get_post_meta($this->id, '_calendar_time_format', true));
551
+			} elseif ('use_custom_php' == $time_format_option) {
552
+				$time_format_custom = esc_attr(get_post_meta($this->id, '_calendar_time_format_php', true));
553 553
 			}
554 554
 		}
555 555
 
@@ -563,13 +563,13 @@  discard block
 block discarded – undo
563 563
 	 *
564 564
 	 * @param string $separator A UTF8 character used as separator.
565 565
 	 */
566
-	public function set_datetime_separator( $separator = '' ) {
566
+	public function set_datetime_separator($separator = '') {
567 567
 
568
-		if ( empty( $separator ) ) {
569
-			$separator = get_post_meta( $this->id, '_calendar_datetime_separator', true );
568
+		if (empty($separator)) {
569
+			$separator = get_post_meta($this->id, '_calendar_datetime_separator', true);
570 570
 		}
571 571
 
572
-		$this->datetime_separator = esc_attr( $separator );
572
+		$this->datetime_separator = esc_attr($separator);
573 573
 	}
574 574
 
575 575
 	/**
@@ -579,18 +579,18 @@  discard block
 block discarded – undo
579 579
 	 *
580 580
 	 * @param int $weekday From 0 (Sunday) to 6 (Friday).
581 581
 	 */
582
-	public function set_start_of_week( $weekday = -1 ) {
582
+	public function set_start_of_week($weekday = -1) {
583 583
 
584
-		$week_starts = is_int( $weekday ) ? $weekday : -1;
584
+		$week_starts = is_int($weekday) ? $weekday : -1;
585 585
 
586
-		if ( $week_starts < 0 || $week_starts > 6 ) {
586
+		if ($week_starts < 0 || $week_starts > 6) {
587 587
 
588
-			$week_starts_setting = get_post_meta( $this->id, '_calendar_week_starts_on_setting', true );
589
-			$week_starts         = intval( get_option( 'start_of_week' ) );
588
+			$week_starts_setting = get_post_meta($this->id, '_calendar_week_starts_on_setting', true);
589
+			$week_starts         = intval(get_option('start_of_week'));
590 590
 
591
-			if ( 'use_custom' == $week_starts_setting ) {
592
-				$week_starts_on = get_post_meta( $this->id, '_calendar_week_starts_on', true );
593
-				$week_starts    = is_numeric( $week_starts_on ) ? intval( $week_starts_on ) : $week_starts;
591
+			if ('use_custom' == $week_starts_setting) {
592
+				$week_starts_on = get_post_meta($this->id, '_calendar_week_starts_on', true);
593
+				$week_starts    = is_numeric($week_starts_on) ? intval($week_starts_on) : $week_starts;
594 594
 			}
595 595
 		}
596 596
 
@@ -604,51 +604,51 @@  discard block
 block discarded – undo
604 604
 	 *
605 605
 	 * @param int $timestamp
606 606
 	 */
607
-	public function set_start( $timestamp = 0 ) {
607
+	public function set_start($timestamp = 0) {
608 608
 
609
-		if ( is_int( $timestamp ) && $timestamp !== 0 ) {
609
+		if (is_int($timestamp) && $timestamp !== 0) {
610 610
 			$this->start = $timestamp;
611 611
 			return;
612 612
 		}
613 613
 
614
-		$this->start = Carbon::now( $this->timezone )->getTimestamp();
614
+		$this->start = Carbon::now($this->timezone)->getTimestamp();
615 615
 
616
-		$calendar_begins = esc_attr( get_post_meta( $this->id, '_calendar_begins', true ) );
617
-		$nth = max( absint( get_post_meta( $this->id, '_calendar_begins_nth', true ) ), 1 );
616
+		$calendar_begins = esc_attr(get_post_meta($this->id, '_calendar_begins', true));
617
+		$nth = max(absint(get_post_meta($this->id, '_calendar_begins_nth', true)), 1);
618 618
 
619
-		if ( 'today' == $calendar_begins ) {
620
-			$this->start = Carbon::today( $this->timezone )->getTimestamp();
621
-		} elseif ( 'days_before' == $calendar_begins ) {
622
-			$this->start = Carbon::today( $this->timezone )->subDays( $nth )->getTimestamp();
623
-		} elseif ( 'days_after' == $calendar_begins ) {
624
-			$this->start = Carbon::today( $this->timezone )->addDays( $nth )->getTimestamp();
625
-		} elseif ( 'this_week' == $calendar_begins ) {
626
-			$week = new Carbon( 'now', $this->timezone );
627
-			$week->setWeekStartsAt( $this->week_starts );
619
+		if ('today' == $calendar_begins) {
620
+			$this->start = Carbon::today($this->timezone)->getTimestamp();
621
+		} elseif ('days_before' == $calendar_begins) {
622
+			$this->start = Carbon::today($this->timezone)->subDays($nth)->getTimestamp();
623
+		} elseif ('days_after' == $calendar_begins) {
624
+			$this->start = Carbon::today($this->timezone)->addDays($nth)->getTimestamp();
625
+		} elseif ('this_week' == $calendar_begins) {
626
+			$week = new Carbon('now', $this->timezone);
627
+			$week->setWeekStartsAt($this->week_starts);
628 628
 			$this->start = $week->startOfWeek()->getTimestamp();
629
-		} elseif ( 'weeks_before' == $calendar_begins ) {
630
-			$week = new Carbon( 'now', $this->timezone );
631
-			$week->setWeekStartsAt( $this->week_starts );
632
-			$this->start = $week->startOfWeek()->subWeeks( $nth )->getTimestamp();
633
-		} elseif ( 'weeks_after' == $calendar_begins ) {
634
-			$week = new Carbon( 'now', $this->timezone );
635
-			$week->setWeekStartsAt( $this->week_starts );
636
-			$this->start = $week->startOfWeek()->addWeeks( $nth )->getTimestamp();
637
-		} elseif ( 'this_month' == $calendar_begins ) {
638
-			$this->start = Carbon::today( $this->timezone )->startOfMonth()->getTimeStamp();
639
-		} elseif ( 'months_before' == $calendar_begins ) {
640
-			$this->start = Carbon::today( $this->timezone )->subMonths( $nth )->startOfMonth()->getTimeStamp();
641
-		} elseif ( 'months_after' == $calendar_begins ) {
642
-			$this->start = Carbon::today( $this->timezone )->addMonths( $nth )->startOfMonth()->getTimeStamp();
643
-		} elseif ( 'this_year' == $calendar_begins ) {
644
-			$this->start = Carbon::today( $this->timezone )->startOfYear()->getTimestamp();
645
-		} elseif ( 'years_before' == $calendar_begins ) {
646
-			$this->start = Carbon::today( $this->timezone )->subYears( $nth )->startOfYear()->getTimeStamp();
647
-		} elseif ( 'years_after' == $calendar_begins ) {
648
-			$this->start = Carbon::today( $this->timezone )->addYears( $nth )->startOfYear()->getTimeStamp();
649
-		} elseif ( 'custom_date' == $calendar_begins ) {
650
-			if ( $date = get_post_meta( $this->id, '_calendar_begins_custom_date', true ) ) {
651
-				$this->start = Carbon::createFromFormat( 'Y-m-d', esc_attr( $date ) )->setTimezone( $this->timezone )->startOfDay()->getTimestamp();
629
+		} elseif ('weeks_before' == $calendar_begins) {
630
+			$week = new Carbon('now', $this->timezone);
631
+			$week->setWeekStartsAt($this->week_starts);
632
+			$this->start = $week->startOfWeek()->subWeeks($nth)->getTimestamp();
633
+		} elseif ('weeks_after' == $calendar_begins) {
634
+			$week = new Carbon('now', $this->timezone);
635
+			$week->setWeekStartsAt($this->week_starts);
636
+			$this->start = $week->startOfWeek()->addWeeks($nth)->getTimestamp();
637
+		} elseif ('this_month' == $calendar_begins) {
638
+			$this->start = Carbon::today($this->timezone)->startOfMonth()->getTimeStamp();
639
+		} elseif ('months_before' == $calendar_begins) {
640
+			$this->start = Carbon::today($this->timezone)->subMonths($nth)->startOfMonth()->getTimeStamp();
641
+		} elseif ('months_after' == $calendar_begins) {
642
+			$this->start = Carbon::today($this->timezone)->addMonths($nth)->startOfMonth()->getTimeStamp();
643
+		} elseif ('this_year' == $calendar_begins) {
644
+			$this->start = Carbon::today($this->timezone)->startOfYear()->getTimestamp();
645
+		} elseif ('years_before' == $calendar_begins) {
646
+			$this->start = Carbon::today($this->timezone)->subYears($nth)->startOfYear()->getTimeStamp();
647
+		} elseif ('years_after' == $calendar_begins) {
648
+			$this->start = Carbon::today($this->timezone)->addYears($nth)->startOfYear()->getTimeStamp();
649
+		} elseif ('custom_date' == $calendar_begins) {
650
+			if ($date = get_post_meta($this->id, '_calendar_begins_custom_date', true)) {
651
+				$this->start = Carbon::createFromFormat('Y-m-d', esc_attr($date))->setTimezone($this->timezone)->startOfDay()->getTimestamp();
652 652
 			}
653 653
 		}
654 654
 	}
@@ -660,8 +660,8 @@  discard block
 block discarded – undo
660 660
 	 *
661 661
 	 * @param int $timestamp
662 662
 	 */
663
-	public function set_end( $timestamp = 0 ) {
664
-		$latest = is_int( $timestamp ) && $timestamp !== 0 ? $timestamp : $this->latest_event;
663
+	public function set_end($timestamp = 0) {
664
+		$latest = is_int($timestamp) && $timestamp !== 0 ? $timestamp : $this->latest_event;
665 665
 		$this->end = $latest > $this->start ? $latest : $this->start;
666 666
 	}
667 667
 
@@ -672,14 +672,14 @@  discard block
 block discarded – undo
672 672
 	 *
673 673
 	 * @param string|bool $static
674 674
 	 */
675
-	public function set_static( $static = '' ) {
675
+	public function set_static($static = '') {
676 676
 
677
-		if ( ! empty( $static ) && is_bool( $static ) ) {
677
+		if ( ! empty($static) && is_bool($static)) {
678 678
 			$this->static = $static;
679 679
 			return;
680 680
 		}
681 681
 
682
-		if ( 'yes' == get_post_meta( $this->id, '_calendar_is_static', true ) ) {
682
+		if ('yes' == get_post_meta($this->id, '_calendar_is_static', true)) {
683 683
 			$this->static = true;
684 684
 			return;
685 685
 		}
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 *
708 708
 	 * @return Calendar_View
709 709
 	 */
710
-	abstract public function get_view( $view = '' );
710
+	abstract public function get_view($view = '');
711 711
 
712 712
 	/**
713 713
 	 * Get event HTML parsed by template.
@@ -719,11 +719,11 @@  discard block
 block discarded – undo
719 719
 	 *
720 720
 	 * @return string
721 721
 	 */
722
-	public function get_event_html( Event $event, $template = '' ) {
723
-		$event_builder = new Event_Builder( $event, $this );
722
+	public function get_event_html(Event $event, $template = '') {
723
+		$event_builder = new Event_Builder($event, $this);
724 724
 		// Use the event template to parse tags; if empty, fallback to calendar post content.
725
-		$template = empty( $template ) ? ( empty( $event->template ) ? $this->events_template : $event->template ) : $template;
726
-		return $event_builder->parse_event_template_tags( $template );
725
+		$template = empty($template) ? (empty($event->template) ? $this->events_template : $event->template) : $template;
726
+		return $event_builder->parse_event_template_tags($template);
727 727
 	}
728 728
 
729 729
 	/**
@@ -733,58 +733,58 @@  discard block
 block discarded – undo
733 733
 	 *
734 734
 	 * @param string $view The calendar view to display.
735 735
 	 */
736
-	public function html( $view = '' ) {
736
+	public function html($view = '') {
737 737
 
738
-		$view = empty( $view ) ? $this->view : $this->get_view( $view );
738
+		$view = empty($view) ? $this->view : $this->get_view($view);
739 739
 
740
-		if ( $view instanceof Calendar_View ) {
740
+		if ($view instanceof Calendar_View) {
741 741
 
742
-			if ( ! empty( $this->errors ) ) {
742
+			if ( ! empty($this->errors)) {
743 743
 
744
-				if ( current_user_can( 'manage_options' )  ) {
744
+				if (current_user_can('manage_options')) {
745 745
 					echo '<pre><code>';
746
-					foreach ( $this->errors as $error ) { echo $error; }
746
+					foreach ($this->errors as $error) { echo $error; }
747 747
 					echo '</code></pre>';
748 748
 				}
749 749
 
750 750
 			} else {
751 751
 
752 752
 				// Get a CSS class from the class name of the calendar view (minus namespace part).
753
-				$view_name  = implode( '-', array_map( 'lcfirst', explode( '_', strtolower( get_class( $view ) ) ) ) );
754
-				$view_class = substr( $view_name, strrpos( $view_name, '\\' ) + 1 );
753
+				$view_name  = implode('-', array_map('lcfirst', explode('_', strtolower(get_class($view)))));
754
+				$view_class = substr($view_name, strrpos($view_name, '\\') + 1);
755 755
 
756
-				$calendar_class = trim( implode( ' simcal-', apply_filters( 'simcal_calendar_class', array(
756
+				$calendar_class = trim(implode(' simcal-', apply_filters('simcal_calendar_class', array(
757 757
 					'simcal-calendar',
758 758
 					$this->type,
759 759
 					$view_class,
760
-				), $this->id ) ) );
761
-
762
-				echo '<div class="' . $calendar_class . '" '
763
-									. 'data-calendar-id="'    . $this->id . '" '
764
-									. 'data-timezone="'       . $this->timezone . '" '
765
-									. 'data-offset="'         . $this->offset . '" '
766
-									. 'data-week-start="'     . $this->week_starts . '" '
767
-									. 'data-calendar-start="' . $this->start .'" '
768
-									. 'data-calendar-end="'   . $this->end . '" '
769
-									. 'data-events-first="'   . $this->earliest_event .'" '
770
-									. 'data-events-last="'    . $this->latest_event . '"'
760
+				), $this->id)));
761
+
762
+				echo '<div class="'.$calendar_class.'" '
763
+									. 'data-calendar-id="'.$this->id.'" '
764
+									. 'data-timezone="'.$this->timezone.'" '
765
+									. 'data-offset="'.$this->offset.'" '
766
+									. 'data-week-start="'.$this->week_starts.'" '
767
+									. 'data-calendar-start="'.$this->start.'" '
768
+									. 'data-calendar-end="'.$this->end.'" '
769
+									. 'data-events-first="'.$this->earliest_event.'" '
770
+									. 'data-events-last="'.$this->latest_event.'"'
771 771
 									. '>';
772 772
 
773
-				date_default_timezone_set( $this->timezone );
774
-				do_action( 'simcal_calendar_html_before', $this->id );
773
+				date_default_timezone_set($this->timezone);
774
+				do_action('simcal_calendar_html_before', $this->id);
775 775
 
776 776
 				$view->html();
777 777
 
778
-				do_action( 'simcal_calendar_html_after', $this->id );
779
-				date_default_timezone_set( $this->site_timezone );
778
+				do_action('simcal_calendar_html_after', $this->id);
779
+				date_default_timezone_set($this->site_timezone);
780 780
 
781
-				$settings = get_option( 'simple-calendar_settings_calendars' );
782
-				$poweredby = isset( $settings['poweredby']['opt_in'] ) ? $settings['poweredby']['opt_in'] : '';
781
+				$settings = get_option('simple-calendar_settings_calendars');
782
+				$poweredby = isset($settings['poweredby']['opt_in']) ? $settings['poweredby']['opt_in'] : '';
783 783
 
784
-				if ( 'yes' == $poweredby ) {
784
+				if ('yes' == $poweredby) {
785 785
 					$align = is_rtl() ? 'left' : 'right';
786
-					echo '<small class="simcal-powered simcal-align-' . $align .'">' .
787
-					     sprintf( __( 'Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events' ), simcal_get_url( 'home' ) ) .
786
+					echo '<small class="simcal-powered simcal-align-'.$align.'">'.
787
+					     sprintf(__('Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events'), simcal_get_url('home')).
788 788
 					     '</small>';
789 789
 				}
790 790
 
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +115 added lines, -115 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,16 +26,16 @@  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
 		// Remove the rich editor so users are forced to use the HTML editor for our CPT
37 37
 		// TODO: Added
38
-		add_filter( 'user_can_richedit', array( $this, 'disable_wysiwyg' ) );
38
+		add_filter('user_can_richedit', array($this, 'disable_wysiwyg'));
39 39
 	}
40 40
 
41 41
 	/**
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 	 * @since 3.0.13
45 45
 	 */
46 46
 	// TODO: Added
47
-	function disable_wysiwyg( $default ) {
47
+	function disable_wysiwyg($default) {
48 48
 		global $post;
49 49
 
50
-		if ( $post->post_type === 'calendar' ) {
50
+		if ($post->post_type === 'calendar') {
51 51
 			return false;
52 52
 		}
53 53
 
@@ -61,32 +61,32 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public static function register_taxonomies() {
63 63
 
64
-		do_action( 'simcal_register_taxonomies' );
64
+		do_action('simcal_register_taxonomies');
65 65
 
66
-		if ( ! taxonomy_exists( 'calendar_feed' ) ) {
66
+		if ( ! taxonomy_exists('calendar_feed')) {
67 67
 
68 68
 			// Feed Type.
69 69
 			$labels = array(
70
-				'name'                       => __( 'Events Source Types', 'google-calendar-events' ),
71
-				'singular_name'              => __( 'Events Source Type', 'google-calendar-events' ),
72
-				'menu_name'                  => __( 'Events Source Type', 'google-calendar-events' ),
73
-				'all_items'                  => __( 'All Events Source Types', 'google-calendar-events' ),
74
-				'parent_item'                => __( 'Parent Events Source Type', 'google-calendar-events' ),
75
-				'parent_item_colon'          => __( 'Parent Events Source Type:', 'google-calendar-events' ),
76
-				'new_item_name'              => __( 'New Events Source Type', 'google-calendar-events' ),
77
-				'add_new_item'               => __( 'Add New Events Source Type', 'google-calendar-events' ),
78
-				'edit_item'                  => __( 'Edit Events Source Type', 'google-calendar-events' ),
79
-				'update_item'                => __( 'Update Events Source Type', 'google-calendar-events' ),
80
-				'view_item'                  => __( 'View Events Source Type', 'google-calendar-events' ),
81
-				'separate_items_with_commas' => __( 'Separate events source types with commas', 'google-calendar-events' ),
82
-				'add_or_remove_items'        => __( 'Add or remove events source types', 'google-calendar-events' ),
83
-				'choose_from_most_used'      => __( 'Choose from the most used', 'google-calendar-events' ),
84
-				'popular_items'              => __( 'Popular events source types', 'google-calendar-events' ),
85
-				'search_items'               => __( 'Search Events Source Types', 'google-calendar-events' ),
86
-				'not_found'                  => __( 'Not Found', 'google-calendar-events' ),
70
+				'name'                       => __('Events Source Types', 'google-calendar-events'),
71
+				'singular_name'              => __('Events Source Type', 'google-calendar-events'),
72
+				'menu_name'                  => __('Events Source Type', 'google-calendar-events'),
73
+				'all_items'                  => __('All Events Source Types', 'google-calendar-events'),
74
+				'parent_item'                => __('Parent Events Source Type', 'google-calendar-events'),
75
+				'parent_item_colon'          => __('Parent Events Source Type:', 'google-calendar-events'),
76
+				'new_item_name'              => __('New Events Source Type', 'google-calendar-events'),
77
+				'add_new_item'               => __('Add New Events Source Type', 'google-calendar-events'),
78
+				'edit_item'                  => __('Edit Events Source Type', 'google-calendar-events'),
79
+				'update_item'                => __('Update Events Source Type', 'google-calendar-events'),
80
+				'view_item'                  => __('View Events Source Type', 'google-calendar-events'),
81
+				'separate_items_with_commas' => __('Separate events source types with commas', 'google-calendar-events'),
82
+				'add_or_remove_items'        => __('Add or remove events source types', 'google-calendar-events'),
83
+				'choose_from_most_used'      => __('Choose from the most used', 'google-calendar-events'),
84
+				'popular_items'              => __('Popular events source types', 'google-calendar-events'),
85
+				'search_items'               => __('Search Events Source Types', 'google-calendar-events'),
86
+				'not_found'                  => __('Not Found', 'google-calendar-events'),
87 87
 			);
88 88
 
89
-			$args   = array(
89
+			$args = array(
90 90
 				'hierarchical'      => true,
91 91
 				'labels'            => $labels,
92 92
 				'public'            => false,
@@ -95,34 +95,34 @@  discard block
 block discarded – undo
95 95
 				'show_tagcloud'     => false,
96 96
 				'show_ui'           => false,
97 97
 			);
98
-			register_taxonomy( 'calendar_feed', array( 'calendar' ), $args );
98
+			register_taxonomy('calendar_feed', array('calendar'), $args);
99 99
 
100 100
 		}
101 101
 
102
-		if ( ! taxonomy_exists( 'calendar_type' ) ) {
102
+		if ( ! taxonomy_exists('calendar_type')) {
103 103
 
104 104
 			// Calendar Type.
105 105
 			$labels = array(
106
-				'name'                       => __( 'Calendar Types', 'google-calendar-events' ),
107
-				'singular_name'              => __( 'Calendar Type', 'google-calendar-events' ),
108
-				'menu_name'                  => __( 'Calendar Type', 'google-calendar-events' ),
109
-				'all_items'                  => __( 'All Calendar Types', 'google-calendar-events' ),
110
-				'parent_item'                => __( 'Parent Calendar Type', 'google-calendar-events' ),
111
-				'parent_item_colon'          => __( 'Parent Calendar Type:', 'google-calendar-events' ),
112
-				'new_item_name'              => __( 'New Calendar Type', 'google-calendar-events' ),
113
-				'add_new_item'               => __( 'Add New Calendar Type', 'google-calendar-events' ),
114
-				'edit_item'                  => __( 'Edit Calendar Type', 'google-calendar-events' ),
115
-				'update_item'                => __( 'Update Calendar Type', 'google-calendar-events' ),
116
-				'view_item'                  => __( 'View Calendar Type', 'google-calendar-events' ),
117
-				'separate_items_with_commas' => __( 'Separate calendar types with commas', 'google-calendar-events' ),
118
-				'add_or_remove_items'        => __( 'Add or remove calendar types', 'google-calendar-events' ),
119
-				'choose_from_most_used'      => __( 'Choose from the most used', 'google-calendar-events' ),
120
-				'popular_items'              => __( 'Popular calendar types', 'google-calendar-events' ),
121
-				'search_items'               => __( 'Search Calendar Types', 'google-calendar-events' ),
122
-				'not_found'                  => __( 'Not Found', 'google-calendar-events' ),
106
+				'name'                       => __('Calendar Types', 'google-calendar-events'),
107
+				'singular_name'              => __('Calendar Type', 'google-calendar-events'),
108
+				'menu_name'                  => __('Calendar Type', 'google-calendar-events'),
109
+				'all_items'                  => __('All Calendar Types', 'google-calendar-events'),
110
+				'parent_item'                => __('Parent Calendar Type', 'google-calendar-events'),
111
+				'parent_item_colon'          => __('Parent Calendar Type:', 'google-calendar-events'),
112
+				'new_item_name'              => __('New Calendar Type', 'google-calendar-events'),
113
+				'add_new_item'               => __('Add New Calendar Type', 'google-calendar-events'),
114
+				'edit_item'                  => __('Edit Calendar Type', 'google-calendar-events'),
115
+				'update_item'                => __('Update Calendar Type', 'google-calendar-events'),
116
+				'view_item'                  => __('View Calendar Type', 'google-calendar-events'),
117
+				'separate_items_with_commas' => __('Separate calendar types with commas', 'google-calendar-events'),
118
+				'add_or_remove_items'        => __('Add or remove calendar types', 'google-calendar-events'),
119
+				'choose_from_most_used'      => __('Choose from the most used', 'google-calendar-events'),
120
+				'popular_items'              => __('Popular calendar types', 'google-calendar-events'),
121
+				'search_items'               => __('Search Calendar Types', 'google-calendar-events'),
122
+				'not_found'                  => __('Not Found', 'google-calendar-events'),
123 123
 			);
124 124
 
125
-			$args   = array(
125
+			$args = array(
126 126
 				'hierarchical'      => true,
127 127
 				'labels'            => $labels,
128 128
 				'public'            => false,
@@ -131,34 +131,34 @@  discard block
 block discarded – undo
131 131
 				'show_tagcloud'     => false,
132 132
 				'show_ui'           => false,
133 133
 			);
134
-			register_taxonomy( 'calendar_type', array( 'calendar' ), $args );
134
+			register_taxonomy('calendar_type', array('calendar'), $args);
135 135
 
136 136
 		}
137 137
 
138
-		if ( ! taxonomy_exists( 'calendar_category' ) ) {
138
+		if ( ! taxonomy_exists('calendar_category')) {
139 139
 
140 140
 			// Feed Category.
141 141
 			$labels = array(
142
-				'name'                       => __( 'Categories', 'google-calendar-events' ),
143
-				'singular_name'              => __( 'Category', 'google-calendar-events' ),
144
-				'menu_name'                  => __( 'Categories', 'google-calendar-events' ),
145
-				'all_items'                  => __( 'All Categories', 'google-calendar-events' ),
146
-				'parent_item'                => __( 'Parent Category', 'google-calendar-events' ),
147
-				'parent_item_colon'          => __( 'Parent Category:', 'google-calendar-events' ),
148
-				'new_item_name'              => __( 'New Category', 'google-calendar-events' ),
149
-				'add_new_item'               => __( 'Add New Category', 'google-calendar-events' ),
150
-				'edit_item'                  => __( 'Edit Category', 'google-calendar-events' ),
151
-				'update_item'                => __( 'Update Category', 'google-calendar-events' ),
152
-				'view_item'                  => __( 'View Category', 'google-calendar-events' ),
153
-				'separate_items_with_commas' => __( 'Separate categories with commas', 'google-calendar-events' ),
154
-				'add_or_remove_items'        => __( 'Add or remove categories', 'google-calendar-events' ),
155
-				'choose_from_most_used'      => __( 'Choose from the most used', 'google-calendar-events' ),
156
-				'popular_items'              => __( 'Popular Categories', 'google-calendar-events' ),
157
-				'search_items'               => __( 'Search Categories', 'google-calendar-events' ),
158
-				'not_found'                  => __( 'Not Found', 'google-calendar-events' ),
142
+				'name'                       => __('Categories', 'google-calendar-events'),
143
+				'singular_name'              => __('Category', 'google-calendar-events'),
144
+				'menu_name'                  => __('Categories', 'google-calendar-events'),
145
+				'all_items'                  => __('All Categories', 'google-calendar-events'),
146
+				'parent_item'                => __('Parent Category', 'google-calendar-events'),
147
+				'parent_item_colon'          => __('Parent Category:', 'google-calendar-events'),
148
+				'new_item_name'              => __('New Category', 'google-calendar-events'),
149
+				'add_new_item'               => __('Add New Category', 'google-calendar-events'),
150
+				'edit_item'                  => __('Edit Category', 'google-calendar-events'),
151
+				'update_item'                => __('Update Category', 'google-calendar-events'),
152
+				'view_item'                  => __('View Category', 'google-calendar-events'),
153
+				'separate_items_with_commas' => __('Separate categories with commas', 'google-calendar-events'),
154
+				'add_or_remove_items'        => __('Add or remove categories', 'google-calendar-events'),
155
+				'choose_from_most_used'      => __('Choose from the most used', 'google-calendar-events'),
156
+				'popular_items'              => __('Popular Categories', 'google-calendar-events'),
157
+				'search_items'               => __('Search Categories', 'google-calendar-events'),
158
+				'not_found'                  => __('Not Found', 'google-calendar-events'),
159 159
 			);
160 160
 
161
-			$args   = array(
161
+			$args = array(
162 162
 				'hierarchical'      => true,
163 163
 				'labels'            => $labels,
164 164
 				'public'            => true,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 				'show_ui'           => true,
169 169
 			);
170 170
 
171
-			register_taxonomy( 'calendar_category', array( 'calendar' ), $args );
171
+			register_taxonomy('calendar_category', array('calendar'), $args);
172 172
 		}
173 173
 
174 174
 	}
@@ -180,27 +180,27 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public static function register_post_types() {
182 182
 
183
-		do_action( 'simcal_register_post_types' );
183
+		do_action('simcal_register_post_types');
184 184
 
185
-		if ( ! post_type_exists( 'calendar' ) ) {
185
+		if ( ! post_type_exists('calendar')) {
186 186
 
187 187
 			// Calendar feed post type.
188
-			$labels        = array(
189
-				'name'               => _x( 'Calendars', 'Post Type General Name', 'google-calendar-events' ),
190
-				'singular_name'      => _x( 'Calendar', 'Post Type Singular Name', 'google-calendar-events' ),
191
-				'menu_name'          => __( 'Calendars', 'google-calendar-events' ),
192
-				'name_admin_bar'     => __( 'Calendar', 'google-calendar-events' ),
193
-				'parent_item_colon'  => __( 'Parent Calendar:', 'google-calendar-events' ),
194
-				'all_items'          => __( 'All Calendars', 'google-calendar-events' ),
195
-				'add_new_item'       => __( 'Add New Calendar', 'google-calendar-events' ),
196
-				'add_new'            => __( 'Add New', 'google-calendar-events' ),
197
-				'new_item'           => __( 'New Calendar', 'google-calendar-events' ),
198
-				'edit_item'          => __( 'Edit Calendar', 'google-calendar-events' ),
199
-				'update_item'        => __( 'Update Calendar', 'google-calendar-events' ),
200
-				'view_item'          => __( 'View Calendar', 'google-calendar-events' ),
201
-				'search_items'       => __( 'Search Calendar', 'google-calendar-events' ),
202
-				'not_found'          => __( 'Calendars not found', 'google-calendar-events' ),
203
-				'not_found_in_trash' => __( 'Calendars not found in Trash', 'google-calendar-events' ),
188
+			$labels = array(
189
+				'name'               => _x('Calendars', 'Post Type General Name', 'google-calendar-events'),
190
+				'singular_name'      => _x('Calendar', 'Post Type Singular Name', 'google-calendar-events'),
191
+				'menu_name'          => __('Calendars', 'google-calendar-events'),
192
+				'name_admin_bar'     => __('Calendar', 'google-calendar-events'),
193
+				'parent_item_colon'  => __('Parent Calendar:', 'google-calendar-events'),
194
+				'all_items'          => __('All Calendars', 'google-calendar-events'),
195
+				'add_new_item'       => __('Add New Calendar', 'google-calendar-events'),
196
+				'add_new'            => __('Add New', 'google-calendar-events'),
197
+				'new_item'           => __('New Calendar', 'google-calendar-events'),
198
+				'edit_item'          => __('Edit Calendar', 'google-calendar-events'),
199
+				'update_item'        => __('Update Calendar', 'google-calendar-events'),
200
+				'view_item'          => __('View Calendar', 'google-calendar-events'),
201
+				'search_items'       => __('Search Calendar', 'google-calendar-events'),
202
+				'not_found'          => __('Calendars not found', 'google-calendar-events'),
203
+				'not_found_in_trash' => __('Calendars not found in Trash', 'google-calendar-events'),
204 204
 			);
205 205
 
206 206
 			$rewrite_rules = array(
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
 
213 213
 			$svg_icon = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iU2hhcGVzX3hBMF9JbWFnZV8xXyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDEwMjQgMTAyNCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik01MTMuNCwxMDEzLjNjLTE2My44LDAtMzI3LjcsMC00OTEuNSwwYy05LjcsMC04LjgsMC45LTguOC04LjljMC0yNDMuNywwLjItNDg3LjMtMC4zLTczMWMtMC4xLTM5LjYsMjcuNy03Ni40LDY5LjYtODIuM2MzLTAuNCw2LTAuNSw5LTAuNWMzNSwwLDcwLDAuMSwxMDUtMC4xYzUuMSwwLDYuNSwxLjQsNi41LDYuNWMtMC4yLDI2LjgsMC4xLDUzLjctMC4yLDgwLjVjLTAuMiwxNS4yLDMuOSwyOC4yLDE1LjksMzguMmMyLjcsMi4yLDUsNC44LDcuNCw3LjRjOCw4LjYsMTguMSwxMi40LDI5LjYsMTIuNGMzMC43LDAuMiw2MS4zLDAuMiw5MiwwYzExLjItMC4xLDIxLjItMy45LDI5LjEtMTIuMmMzLjQtMy42LDctNy4yLDEwLjYtMTAuNmM5LTguNCwxMi43LTE4LjksMTIuNy0zMWMwLjEtMjguMiwwLTU2LjMsMC04NC41YzAtNi42LDAtNi42LDYuNi02LjZjNzEuNSwwLDE0MywwLDIxNC41LDBjNi42LDAsNi42LDAsNi42LDYuN2MwLDI2LjgsMC4yLDUzLjctMC4xLDgwLjVjLTAuMiwxNSw1LjEsMjYuOCwxNS40LDM4YzEzLjYsMTQuNywyOC45LDIwLjgsNDguNywyMC4xYzI1LjYtMSw1MS4zLTAuNCw3Ny0wLjJjMTMuOSwwLjEsMjQuOC01LjEsMzUuNC0xNC40YzE1LjktMTQsMjIuMS0zMC40LDIxLjEtNTEuM2MtMS4xLTI0LjMtMC4xLTQ4LjctMC40LTczYzAtNS4xLDEuNC02LjUsNi41LTYuNWMzNC43LDAuMiw2OS4zLDAsMTA0LDAuMWM0Mi4zLDAuMiw3OC4zLDM2LDc4LjMsNzguM2MwLjEsMjQ2LDAsNDkyLDAsNzM4YzAsNi40LDAsNi40LTcuMyw2LjRDODQyLDEwMTMuMyw2NzcuNywxMDEzLjMsNTEzLjQsMTAxMy4zeiBNNDM5LjUsNjc4LjljMS42LTEsMi4yLTEuNSwzLTEuOGMxMS44LTUuOCwyMS41LTE0LjIsMjktMjQuOGMyNC4zLTM0LjEsMjQuMy03MC45LDguNi0xMDcuOGMtMTMuMy0zMS4zLTM5LjMtNDkuMy03MS01OS40Yy0yNy42LTguOC01Ni05LjQtODQuNS01LjZjLTIwLjMsMi43LTM5LjIsOS42LTU1LjUsMjIuMmMtMzUuNSwyNy4yLTQ4LjQsNjUuMS01MC40LDEwOGMtMC4yLDMuNywyLjEsMy45LDQuOCwzLjljMjIuMiwwLDQ0LjMtMC4xLDY2LjUsMGMzLjgsMCw1LjQtMS4xLDUuMy01LjFjLTAuMS03LjcsMS0xNS4zLDMtMjIuN2M1LjQtMjAsMTYuNS0zNC43LDM3LjgtMzkuN2M4LjEtMS45LDE2LjMtMi4xLDI0LjQtMS4zYzIxLjQsMi4xLDM2LjMsMTMuMSw0My41LDMzLjdjMy41LDEwLjEsMy45LDIwLjQsMi45LDMxYy0yLjIsMjMuNC0xNi4yLDM5LjctMzkuMSw0NC42Yy0xMy4yLDIuOC0yNi42LDQuMS00MC4yLDRjLTMuNywwLTUsMS4yLTQuOSw0LjljMC4xLDE2LjUsMC4yLDMzLDAsNDkuNWMwLDQsMS41LDUuMiw1LjMsNS4xYzEyLjktMC4zLDI1LjYsMC45LDM4LjMsM2MyNi4zLDQuMiw0My41LDE4LjgsNDkuMiw0MmMzLjMsMTMuNSwzLDI3LjEtMC4yLDQwLjZjLTIuMyw5LjctNi44LDE4LjQtMTMuOCwyNS43Yy0xNS40LDE2LjEtMzQuNSwyMS42LTU2LDE4LjljLTI3LjUtMy40LTQzLjUtMTgtNTAuNS00NC44Yy0xLjktNy4zLTMuMS0xNC43LTIuOC0yMi4yYzAuMi00LTEuMS01LjYtNS40LTUuNmMtMjMuNywwLjItNDcuMywwLjItNzEsMGMtNCwwLTUuNCwxLjItNC45LDUuMmMxLjQsMTMuMiwyLjcsMjYuNSw1LjksMzkuNWMxMS4xLDQ1LjIsMzguMiw3NS42LDgzLjQsODguMmMzNi43LDEwLjMsNzMuOCwxMC4xLDExMC41LDAuMWMyNC41LTYuNiw0NC43LTIwLjEsNjEtMzkuOGMyNC41LTI5LjcsMzQuNC02My45LDMxLjQtMTAxLjljLTIuMi0yNy40LTEyLjUtNTEuMy0zMy42LTY5LjhDNDYwLjcsNjg5LjMsNDUxLjksNjgyLDQzOS41LDY3OC45eiBNNzU1LDY5Mi41YzAtNjguNi0wLjEtMTM3LjMsMC4xLTIwNS45YzAtNS4xLTEuNC02LjUtNi41LTYuNGMtMTguMywwLjMtMzYuNywwLjQtNTUsMGMtNS43LTAuMS03LjIsMS45LTguMiw3Yy01LjksMzIuMS0yNC40LDUzLTU2LjMsNjEuMWMtMTcuNSw0LjUtMzUuNiw1LTUzLjUsNS44Yy0zLjksMC4yLTUuMiwxLjQtNS4yLDUuM2MwLjIsMTUuMywwLjIsMzAuNywwLDQ2Yy0wLjEsNC4zLDEuNiw1LjQsNS42LDUuM2MxNC4yLTAuMiwyOC4zLTAuMSw0Mi41LTAuMWMxNS41LDAsMzEsMC4xLDQ2LjUtMC4xYzQuMSwwLDUuOSwxLjMsNS41LDUuNGMtMC4xLDEuNywwLDMuMywwLDVjMCw5Mi4xLDAsMTg0LjMsMCwyNzYuNGMwLDcuMiwwLDcuMiw3LDcuMmMyMy41LDAsNDcsMCw3MC41LDBjNywwLDcsMCw3LTcuMkM3NTUsODI5LjEsNzU1LDc2MC44LDc1NSw2OTIuNXoiLz48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgZD0iTTM3Ni43LDE5OS4yYzAsMjQuMiwwLDQ4LjMsMCw3Mi41Yy0wLjEsMjMuMS0xNy40LDQwLjUtNDAuNCw0MC42Yy0yMy4zLDAuMS00Ni42LDAuMS03MCwwYy0yMi44LTAuMS00MC4zLTE3LjQtNDAuMy00MC4xYy0wLjEtNDguNS0wLjEtOTYuOSwwLTE0NS40YzAtMjIuNCwxNy41LTQwLDM5LjktNDAuMWMyMy43LTAuMSw0Ny4zLTAuMSw3MSwwYzIyLjQsMC4xLDM5LjgsMTcuNywzOS44LDQwLjFDMzc2LjgsMTUwLjksMzc2LjcsMTc1LjEsMzc2LjcsMTk5LjJ6Ii8+PHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGQ9Ik04MDEuNywxOTkuNmMwLDI0LDAsNDgsMCw3MmMwLDIzLjQtMTcuMyw0MC43LTQwLjcsNDAuOGMtMjMuMiwwLjEtNDYuMywwLjEtNjkuNSwwYy0yMy4xLTAuMS00MC41LTE3LjQtNDAuNS00MC41Yy0wLjEtNDguMy0wLjEtOTYuNiwwLTE0NC45YzAtMjIuNywxNy41LTQwLjIsNDAuMi00MC4zYzIzLjMtMC4xLDQ2LjYtMC4xLDcwLDBjMjMuMSwwLjEsNDAuNCwxNy40LDQwLjUsNDAuNUM4MDEuOCwxNTEuMyw4MDEuNywxNzUuNCw4MDEuNywxOTkuNnoiLz48L3N2Zz4=';
214 214
 
215
-			$args          = array(
215
+			$args = array(
216 216
 				'capability_type'     => 'post',
217 217
 				'exclude_from_search' => false,
218 218
 				'has_archive'         => false,
219 219
 				'hierarchical'        => false,
220
-				'label'               => __( 'Calendar', 'google-calendar-events' ),
220
+				'label'               => __('Calendar', 'google-calendar-events'),
221 221
 				'labels'              => $labels,
222 222
 				'query_var'           => true,
223 223
 				'public'              => true,
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 				'show_in_menu'        => true,
230 230
 				'show_in_nav_menus'   => true,
231 231
 				'show_ui'             => true,
232
-				'supports'            => array( 'title', 'editor' ),
232
+				'supports'            => array('title', 'editor'),
233 233
 				'taxonomies'          => array(
234 234
 					'calendar_category',
235 235
 					'calendar_feed',
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 				),
238 238
 			);
239 239
 
240
-			register_post_type( 'calendar', $args );
240
+			register_post_type('calendar', $args);
241 241
 		}
242 242
 
243 243
 	}
@@ -251,49 +251,49 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @return string
253 253
 	 */
254
-	public function filter_post_content( $the_content ) {
254
+	public function filter_post_content($the_content) {
255 255
 
256
-		if ( is_singular() ) {
256
+		if (is_singular()) {
257 257
 
258 258
 			global $post;
259 259
 
260
-			if ( 'calendar' == $post->post_type ) {
260
+			if ('calendar' == $post->post_type) {
261 261
 
262
-				if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
262
+				if (is_admin() && ! defined('DOING_AJAX')) {
263 263
 					return '';
264 264
 				} else {
265 265
 					ob_start();
266
-					simcal_print_calendar( $post );
266
+					simcal_print_calendar($post);
267 267
 					return ob_get_clean();
268 268
 				}
269 269
 
270 270
 			} else {
271 271
 
272 272
 				$post_types = array();
273
-				$settings   = get_option( 'simple-calendar_settings_calendars' );
274
-				if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
273
+				$settings   = get_option('simple-calendar_settings_calendars');
274
+				if (isset($settings['general']['attach_calendars_posts'])) {
275 275
 					$post_types = $settings['general']['attach_calendars_posts'];
276 276
 				}
277 277
 
278
-				if ( empty( $post_types ) ) {
278
+				if (empty($post_types)) {
279 279
 					return $the_content;
280 280
 				}
281 281
 
282
-				if ( in_array( $post->post_type, (array) $post_types ) ) {
282
+				if (in_array($post->post_type, (array) $post_types)) {
283 283
 
284
-					$id = absint( get_post_meta( $post->ID, '_simcal_attach_calendar_id', true ) );
284
+					$id = absint(get_post_meta($post->ID, '_simcal_attach_calendar_id', true));
285 285
 
286
-					if ( $id > 0 ) {
286
+					if ($id > 0) {
287 287
 
288
-						$pos = esc_attr( get_post_meta( $post->ID, '_simcal_attach_calendar_position', true ) );
288
+						$pos = esc_attr(get_post_meta($post->ID, '_simcal_attach_calendar_position', true));
289 289
 
290 290
 						ob_start();
291 291
 
292
-						if ( 'after' == $pos ) {
292
+						if ('after' == $pos) {
293 293
 							echo $the_content;
294
-							simcal_print_calendar( $id );
295
-						} elseif ( 'before' == $pos ) {
296
-							simcal_print_calendar( $id );
294
+							simcal_print_calendar($id);
295
+						} elseif ('before' == $pos) {
296
+							simcal_print_calendar($id);
297 297
 							echo $the_content;
298 298
 						} else {
299 299
 							echo $the_content;
@@ -319,20 +319,20 @@  discard block
 block discarded – undo
319 319
 	 *
320 320
 	 * @param $post_id
321 321
 	 */
322
-	public function upon_deletion( $post_id ) {
322
+	public function upon_deletion($post_id) {
323 323
 
324
-		$post_type = get_post_type( $post_id );
324
+		$post_type = get_post_type($post_id);
325 325
 
326
-		if ( 'calendar' == $post_type ) {
326
+		if ('calendar' == $post_type) {
327 327
 
328
-			$notices = get_option( 'simple-calendar_admin_notices', array() );
328
+			$notices = get_option('simple-calendar_admin_notices', array());
329 329
 
330
-			if ( ! empty( $notices ) && isset( $notices[ 'calendar_' . strval( $post_id ) ] ) ) {
331
-				unset( $notices[ 'calendar_' . strval( $post_id ) ] );
332
-				update_option( 'simple-calendar_admin_notices', $notices );
330
+			if ( ! empty($notices) && isset($notices['calendar_'.strval($post_id)])) {
331
+				unset($notices['calendar_'.strval($post_id)]);
332
+				update_option('simple-calendar_admin_notices', $notices);
333 333
 			}
334 334
 
335
-			simcal_delete_feed_transients( $post_id );
335
+			simcal_delete_feed_transients($post_id);
336 336
 		}
337 337
 	}
338 338
 
Please login to merge, or discard this patch.
includes/feeds/grouped-calendars.php 1 patch
Spacing   +55 added lines, -55 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,60 +111,60 @@  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
-						if ( array_key_exists( $k, $events ) ) {
133
-							$calendar->events[ $k - 1 ] = $v;
134
-							unset( $k );
131
+					foreach ($calendar->events as $k => $v) {
132
+						if (array_key_exists($k, $events)) {
133
+							$calendar->events[$k - 1] = $v;
134
+							unset($k);
135 135
 						}
136 136
 					}
137 137
 
138
-					$events = is_array( $calendar->events ) ? $events + $calendar->events : $events;
138
+					$events = is_array($calendar->events) ? $events + $calendar->events : $events;
139 139
 				}
140 140
 
141 141
 			}
142 142
 
143
-			if ( ! empty( $events ) ) {
143
+			if ( ! empty($events)) {
144 144
 
145 145
 				// Trim events to set the earliest one as specified in feed settings.
146
-				$earliest_event = intval( $this->time_min );
147
-				if ( $earliest_event > 0 ) {
148
-					$events = $this->array_filter_key( $events, array( $this, 'filter_events_before' ) );
146
+				$earliest_event = intval($this->time_min);
147
+				if ($earliest_event > 0) {
148
+					$events = $this->array_filter_key($events, array($this, 'filter_events_before'));
149 149
 				}
150 150
 
151 151
 				// Trim events to set the latest one as specified in feed settings.
152
-				$latest_event = intval( $this->time_max );
153
-				if ( $latest_event > 0 ) {
154
-					$events = $this->array_filter_key( $events, array( $this, 'filter_events_after' ) );
152
+				$latest_event = intval($this->time_max);
153
+				if ($latest_event > 0) {
154
+					$events = $this->array_filter_key($events, array($this, 'filter_events_after'));
155 155
 				}
156 156
 
157 157
 				set_transient(
158
-					'_simple-calendar_feed_id_' . strval( $this->post_id ) . '_' . $this->type,
158
+					'_simple-calendar_feed_id_'.strval($this->post_id).'_'.$this->type,
159 159
 					$events,
160
-					absint( $this->cache )
160
+					absint($this->cache)
161 161
 				);
162 162
 			}
163 163
 
164 164
 		}
165 165
 	
166 166
 		// Sort events by start time before returning
167
-		uasort( $events, array( $this, 'sort_by_start_time' ) );
167
+		uasort($events, array($this, 'sort_by_start_time'));
168 168
 
169 169
 		return $events;
170 170
 	}
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
 	 * @since  3.0.13
176 176
 	 * @access private
177 177
 	 */
178
-	private function sort_by_start_time( $a, $b ) {
179
-		if ( $a == $b ) {
178
+	private function sort_by_start_time($a, $b) {
179
+		if ($a == $b) {
180 180
 			return 0;
181 181
 		}
182 182
 
183
-		return ( $a[0]->start < $b[0]->start ) ? -1 : 1;
183
+		return ($a[0]->start < $b[0]->start) ? -1 : 1;
184 184
 	}
185 185
 
186 186
 
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return array
200 200
 	 */
201
-	private function array_filter_key( array $array, $callback ) {
202
-		$matched_keys = array_filter( array_keys( $array ), $callback );
203
-		return array_intersect_key( $array, array_flip( $matched_keys ) );
201
+	private function array_filter_key(array $array, $callback) {
202
+		$matched_keys = array_filter(array_keys($array), $callback);
203
+		return array_intersect_key($array, array_flip($matched_keys));
204 204
 	}
205 205
 
206 206
 	/**
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 	 *
214 214
 	 * @return bool
215 215
 	 */
216
-	private function filter_events_before( $event ) {
217
-		if ( $this->time_min !== 0 ) {
218
-			return intval( $event ) > intval( $this->time_min );
216
+	private function filter_events_before($event) {
217
+		if ($this->time_min !== 0) {
218
+			return intval($event) > intval($this->time_min);
219 219
 		}
220 220
 		return true;
221 221
 	}
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @return bool
232 232
 	 */
233
-	private function filter_events_after( $event ) {
234
-		if ( $this->time_max !== 0 ) {
235
-			return intval( $event ) < intval( $this->time_max );
233
+	private function filter_events_after($event) {
234
+		if ($this->time_max !== 0) {
235
+			return intval($event) < intval($this->time_max);
236 236
 		}
237 237
 		return true;
238 238
 	}
Please login to merge, or discard this patch.
includes/events/event-builder.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -594,21 +594,21 @@  discard block
 block discarded – undo
594 594
 		if ( ! $event->whole_day ) {
595 595
 
596 596
 			$time_start = $this->calendar->datetime_separator .
597
-			              ' <span class="simcal-event-start simcal-event-start-time" ' .
598
-			              'data-event-start="' . $start->getTimestamp() . '" ' .
599
-			              'data-event-format="' . $this->calendar->time_format . '" ' .
600
-			              'itemprop="startDate" content="' . $start->toIso8601String() . '">' .
601
-			              date_i18n( $this->calendar->time_format, $start->getTimestamp() ) .
602
-			              '</span> ';
597
+						  ' <span class="simcal-event-start simcal-event-start-time" ' .
598
+						  'data-event-start="' . $start->getTimestamp() . '" ' .
599
+						  'data-event-format="' . $this->calendar->time_format . '" ' .
600
+						  'itemprop="startDate" content="' . $start->toIso8601String() . '">' .
601
+						  date_i18n( $this->calendar->time_format, $start->getTimestamp() ) .
602
+						  '</span> ';
603 603
 
604 604
 			if ( $end instanceof Carbon ) {
605 605
 
606 606
 				$time_end = ' <span class="simcal-event-end simcal-event-end-time" ' .
607
-				            'data-event-end="' . $end->getTimestamp() . '" ' .
608
-				            'data-event-format="' . $this->calendar->time_format . '" ' .
609
-				            'itemprop="endDate" content="' . $end->toIso8601String() . '">' .
610
-				            date_i18n( $this->calendar->time_format, $end->getTimestamp() ) .
611
-				            '</span> ';
607
+							'data-event-end="' . $end->getTimestamp() . '" ' .
608
+							'data-event-format="' . $this->calendar->time_format . '" ' .
609
+							'itemprop="endDate" content="' . $end->toIso8601String() . '">' .
610
+							date_i18n( $this->calendar->time_format, $end->getTimestamp() ) .
611
+							'</span> ';
612 612
 
613 613
 			}
614 614
 
@@ -617,23 +617,23 @@  discard block
 block discarded – undo
617 617
 		if ( $event->multiple_days ) {
618 618
 
619 619
 			$output = ' <span class="simcal-event-start simcal-event-start-date" ' .
620
-			          'data-event-start="' . $start->getTimestamp() . '" ' .
621
-			          'data-event-format="' . $this->calendar->date_format . '" ' .
622
-			          'itemprop="startDate" content="' . $start->toIso8601String() . '">' .
623
-			          date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
624
-			          '</span> ' .
625
-			          $time_start;
620
+					  'data-event-start="' . $start->getTimestamp() . '" ' .
621
+					  'data-event-format="' . $this->calendar->date_format . '" ' .
622
+					  'itemprop="startDate" content="' . $start->toIso8601String() . '">' .
623
+					  date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
624
+					  '</span> ' .
625
+					  $time_start;
626 626
 
627 627
 			if ( $end instanceof Carbon ) {
628 628
 
629 629
 				$output .= '-' .
630
-				           ' <span class="simcal-event-start simcal-event-end-date" ' .
631
-				           'data-event-start="' . $end->getTimestamp() . '" ' .
632
-				           'data-event-format="' . $this->calendar->date_format . '" ' .
633
-				           'itemprop="endDate" content="' . $end->toIso8601String() . '">' .
634
-				           date_i18n( $this->calendar->date_format, $end->getTimestamp() ) .
635
-				           '</span> ' .
636
-				           $time_end;
630
+						   ' <span class="simcal-event-start simcal-event-end-date" ' .
631
+						   'data-event-start="' . $end->getTimestamp() . '" ' .
632
+						   'data-event-format="' . $this->calendar->date_format . '" ' .
633
+						   'itemprop="endDate" content="' . $end->toIso8601String() . '">' .
634
+						   date_i18n( $this->calendar->date_format, $end->getTimestamp() ) .
635
+						   '</span> ' .
636
+						   $time_end;
637 637
 			}
638 638
 
639 639
 		} else {
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
 			$time_end = ! empty( $time_start ) && ! empty( $time_end ) ? ' - ' . $time_end : '';
642 642
 
643 643
 			$output = ' <span class="simcal-event-start simcal-event-start-date" ' .
644
-			          'data-event-start="' . $start->getTimestamp() . '" ' .
645
-			          'data-event-format="' . $this->calendar->date_format . '">' .
646
-			          date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
647
-			          '</span> ' .
648
-			          $time_start .
649
-			          $time_end;
644
+					  'data-event-start="' . $start->getTimestamp() . '" ' .
645
+					  'data-event-format="' . $this->calendar->date_format . '">' .
646
+					  date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
647
+					  '</span> ' .
648
+					  $time_start .
649
+					  $time_end;
650 650
 
651 651
 		}
652 652
 
@@ -705,11 +705,11 @@  discard block
 block discarded – undo
705 705
 		}
706 706
 
707 707
 		return '<span class="simcal-event-' . $bound . ' ' . 'simcal-event-' . $bound . '-' . $format . '" ' .
708
-		       'data-event-' . $bound . '="' . $event_dt->getTimestamp() . '" ' .
709
-		       'data-event-format="' . $dt_format . '" ' .
710
-		       'itemprop="' . $bound . 'Date" content="' . $event_dt->toIso8601String() . '">' .
711
-		       $value .
712
-		       '</span>';
708
+			   'data-event-' . $bound . '="' . $event_dt->getTimestamp() . '" ' .
709
+			   'data-event-format="' . $dt_format . '" ' .
710
+			   'itemprop="' . $bound . 'Date" content="' . $event_dt->toIso8601String() . '">' .
711
+			   $value .
712
+			   '</span>';
713 713
 	}
714 714
 
715 715
 	/**
@@ -928,35 +928,35 @@  discard block
 block discarded – undo
928 928
 		$tagregexp = implode( '|', array_values( $this->tags ) );
929 929
 
930 930
 		return '/'
931
-		       . '\\['                              // Opening bracket
932
-		       . '(\\[?)'                           // 1: Optional second opening bracket for escaping tags: [[tag]]
933
-		       . "($tagregexp)"                     // 2: Tag name
934
-		       . '(?![\\w-])'                       // Not followed by word character or hyphen
935
-		       . '('                                // 3: Unroll the loop: Inside the opening tag
936
-		       .     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
937
-		       .     '(?:'
938
-		       .         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
939
-		       .         '[^\\]\\/]*'               // Not a closing bracket or forward slash
940
-		       .     ')*?'
941
-		       . ')'
942
-		       . '(?:'
943
-		       .     '(\\/)'                        // 4: Self closing tag ...
944
-		       .     '\\]'                          // ... and closing bracket
945
-		       . '|'
946
-		       .     '\\]'                          // Closing bracket
947
-		       .     '(?:'
948
-		       .         '('                        // 5: Unroll the loop: Optionally, anything between the opening and closing tags
949
-		       .             '[^\\[]*+'             // Not an opening bracket
950
-		       .             '(?:'
951
-		       .                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing tag
952
-		       .                 '[^\\[]*+'         // Not an opening bracket
953
-		       .             ')*+'
954
-		       .         ')'
955
-		       .         '\\[\\/\\2\\]'             // Closing tag
956
-		       .     ')?'
957
-		       . ')'
958
-		       . '(\\]?)'                           // 6: Optional second closing bracket for escaping tags: [[tag]]
959
-		       . '/s';
931
+			   . '\\['                              // Opening bracket
932
+			   . '(\\[?)'                           // 1: Optional second opening bracket for escaping tags: [[tag]]
933
+			   . "($tagregexp)"                     // 2: Tag name
934
+			   . '(?![\\w-])'                       // Not followed by word character or hyphen
935
+			   . '('                                // 3: Unroll the loop: Inside the opening tag
936
+			   .     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
937
+			   .     '(?:'
938
+			   .         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
939
+			   .         '[^\\]\\/]*'               // Not a closing bracket or forward slash
940
+			   .     ')*?'
941
+			   . ')'
942
+			   . '(?:'
943
+			   .     '(\\/)'                        // 4: Self closing tag ...
944
+			   .     '\\]'                          // ... and closing bracket
945
+			   . '|'
946
+			   .     '\\]'                          // Closing bracket
947
+			   .     '(?:'
948
+			   .         '('                        // 5: Unroll the loop: Optionally, anything between the opening and closing tags
949
+			   .             '[^\\[]*+'             // Not an opening bracket
950
+			   .             '(?:'
951
+			   .                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing tag
952
+			   .                 '[^\\[]*+'         // Not an opening bracket
953
+			   .             ')*+'
954
+			   .         ')'
955
+			   .         '\\[\\/\\2\\]'             // Closing tag
956
+			   .     ')?'
957
+			   . ')'
958
+			   . '(\\]?)'                           // 6: Optional second closing bracket for escaping tags: [[tag]]
959
+			   . '/s';
960 960
 	}
961 961
 
962 962
 }
Please login to merge, or discard this patch.
Spacing   +310 added lines, -310 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use Carbon\Carbon;
10 10
 use SimpleCalendar\Abstracts\Calendar;
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param Event    $event
55 55
 	 * @param Calendar $calendar
56 56
 	 */
57
-	public function __construct( Event $event, Calendar $calendar ) {
57
+	public function __construct(Event $event, Calendar $calendar) {
58 58
 		$this->event    = $event;
59 59
 		$this->calendar = $calendar;
60 60
 		$this->tags     = $this->get_content_tags();
@@ -74,84 +74,84 @@  discard block
 block discarded – undo
74 74
 			 * Content Tags *
75 75
 			 * ============ */
76 76
 
77
-			'title',                 // The event title.
78
-			'event-title',           // @deprecated An alias for 'title' tag.
79
-			'description',           // The event description.
80
-
81
-			'when',                  // Date and time of the event.
82
-			'start-time',            // Start time of the event.
83
-			'start-date',            // Start date of the event.
84
-			'start-custom',          // @deprecated Start time in a user defined format (set by tag 'format' attribute).
85
-			'start-human',           // Start time in a human friendly format.
86
-			'end-time',              // End time of the event.
87
-			'end-date',              // End date of the event.
88
-			'end-custom',            // @deprecated End date-time in a user defined format (set by tag 'format' attribute).
89
-			'end-human',             // End date-time in a human friendly format.
90
-
91
-			'duration',              // How long the events lasts, in a human-readable format.
92
-			'length',                // @deprecated An alias of 'duration' tag.
93
-
94
-			'location',              // Alias of start-location.
95
-			'start-location',        // Location name where the event starts.
96
-			'maps-link',             // @deprecated An alias for 'start-location-link' tag.
97
-			'start-location-link',   // Link to Google Maps querying the event start location address.
98
-			'end-location',          // Location name where the event ends.
99
-			'end-location-link',     // Link to Google Maps querying the event end location address.
100
-
101
-			'link',                  // An HTML link to the event URL.
102
-			'url',                   // A string with the raw event link URL.
103
-
104
-			'calendar',              // The title of the source calendar.
105
-			'feed-title',            // @deprecated An alias of 'calendar'.
106
-
107
-			'id',                    // The event unique ID.
108
-			'uid',                   // An alias of ID.
109
-			'event-id',              // @deprecated An alias for 'id' tag.
110
-			'calendar-id',           // The calendar ID.
111
-			'feed-id',               // @deprecated An alias for 'calendar-id' tag.
112
-			'cal-id',                // @deprecated An alias for 'calendar-id' tag.
77
+			'title', // The event title.
78
+			'event-title', // @deprecated An alias for 'title' tag.
79
+			'description', // The event description.
80
+
81
+			'when', // Date and time of the event.
82
+			'start-time', // Start time of the event.
83
+			'start-date', // Start date of the event.
84
+			'start-custom', // @deprecated Start time in a user defined format (set by tag 'format' attribute).
85
+			'start-human', // Start time in a human friendly format.
86
+			'end-time', // End time of the event.
87
+			'end-date', // End date of the event.
88
+			'end-custom', // @deprecated End date-time in a user defined format (set by tag 'format' attribute).
89
+			'end-human', // End date-time in a human friendly format.
90
+
91
+			'duration', // How long the events lasts, in a human-readable format.
92
+			'length', // @deprecated An alias of 'duration' tag.
93
+
94
+			'location', // Alias of start-location.
95
+			'start-location', // Location name where the event starts.
96
+			'maps-link', // @deprecated An alias for 'start-location-link' tag.
97
+			'start-location-link', // Link to Google Maps querying the event start location address.
98
+			'end-location', // Location name where the event ends.
99
+			'end-location-link', // Link to Google Maps querying the event end location address.
100
+
101
+			'link', // An HTML link to the event URL.
102
+			'url', // A string with the raw event link URL.
103
+
104
+			'calendar', // The title of the source calendar.
105
+			'feed-title', // @deprecated An alias of 'calendar'.
106
+
107
+			'id', // The event unique ID.
108
+			'uid', // An alias of ID.
109
+			'event-id', // @deprecated An alias for 'id' tag.
110
+			'calendar-id', // The calendar ID.
111
+			'feed-id', // @deprecated An alias for 'calendar-id' tag.
112
+			'cal-id', // @deprecated An alias for 'calendar-id' tag.
113 113
 
114 114
 			/* ========= *
115 115
 			 * Meta Tags *
116 116
 			 * ========= */
117 117
 
118
-			'attachments',          // List of attachments.
119
-			'attendees',            // List of attendees.
120
-			'organizer',            // Creator info.
118
+			'attachments', // List of attachments.
119
+			'attendees', // List of attendees.
120
+			'organizer', // Creator info.
121 121
 
122 122
 			/* ================ *
123 123
 			 * Conditional Tags *
124 124
 			 * ================ */
125 125
 
126
-			'if-title',              // If the event has a title.
127
-			'if-description',        // If the event has a description.
128
-
129
-			'if-now',                // If the event is taking place now.
130
-			'if-not-now',            // If the event is not taking place now (may have ended or just not started yet).
131
-			'if-started',            // If the event has started (and may as well as ended).
132
-			'if-not-started',        // If the event has NOT started yet (event could be any time in the future).
133
-			'if-ended',              // If the event has ended (event could be any time in the past).
134
-			'if-not-ended',          // If the event has NOT ended (may as well as not started yet).
135
-
136
-			'if-whole-day',          // If the event lasts the whole day.
137
-			'if-all-day',            // @deprecated Alias for 'if-whole-day'.
138
-			'if-not-whole-day',      // If the event does NOT last the whole day.
139
-			'if-not-all-day',        // @deprecated Alias for 'if-not-whole-day'.
140
-			'if-end-time',           // If the event has a set end time.
141
-			'if-no-end-time',        // If the event has NOT a set end time.
142
-
143
-			'if-multi-day',          // If the event spans multiple days.
144
-			'if-single-day',         // If the event does not span multiple days.
145
-
146
-			'if-recurring',          // If the event is a recurring event.
147
-			'if-not-recurring',      // If the event is NOT a recurring event.
148
-
149
-			'if-location',           // @deprecated Alias for 'if-start-location'.
150
-			'if-start-location',     // Does the event has a start location?
151
-			'if-end-location',       // Does the event has an end location?
152
-			'if-not-location',       // @deprecated Alias for 'if-not-start-location'.
126
+			'if-title', // If the event has a title.
127
+			'if-description', // If the event has a description.
128
+
129
+			'if-now', // If the event is taking place now.
130
+			'if-not-now', // If the event is not taking place now (may have ended or just not started yet).
131
+			'if-started', // If the event has started (and may as well as ended).
132
+			'if-not-started', // If the event has NOT started yet (event could be any time in the future).
133
+			'if-ended', // If the event has ended (event could be any time in the past).
134
+			'if-not-ended', // If the event has NOT ended (may as well as not started yet).
135
+
136
+			'if-whole-day', // If the event lasts the whole day.
137
+			'if-all-day', // @deprecated Alias for 'if-whole-day'.
138
+			'if-not-whole-day', // If the event does NOT last the whole day.
139
+			'if-not-all-day', // @deprecated Alias for 'if-not-whole-day'.
140
+			'if-end-time', // If the event has a set end time.
141
+			'if-no-end-time', // If the event has NOT a set end time.
142
+
143
+			'if-multi-day', // If the event spans multiple days.
144
+			'if-single-day', // If the event does not span multiple days.
145
+
146
+			'if-recurring', // If the event is a recurring event.
147
+			'if-not-recurring', // If the event is NOT a recurring event.
148
+
149
+			'if-location', // @deprecated Alias for 'if-start-location'.
150
+			'if-start-location', // Does the event has a start location?
151
+			'if-end-location', // Does the event has an end location?
152
+			'if-not-location', // @deprecated Alias for 'if-not-start-location'.
153 153
 			'if-not-start-location', // Does the event has NOT a start location?
154
-			'if-not-end-location',   // Does the event has NOT an end location?
154
+			'if-not-end-location', // Does the event has NOT an end location?
155 155
 
156 156
 		);
157 157
 	}
@@ -165,19 +165,19 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return string
167 167
 	 */
168
-	public function parse_event_template_tags( $template_tags = '' ) {
168
+	public function parse_event_template_tags($template_tags = '') {
169 169
 
170 170
 		// Process tags.
171 171
 		$result = preg_replace_callback(
172 172
 			$this->get_regex(),
173
-			array( $this, 'process_event_content' ),
173
+			array($this, 'process_event_content'),
174 174
 			$template_tags
175 175
 		);
176 176
 
177 177
 		// Removes extra consecutive <br> tags.
178 178
 		// TODO: Doesn't seem to work but going to remove it to allow multiple <br> tags in the editor
179 179
 		/*return preg_replace( '#(<br *//*?>\s*)+#i', '<br />', trim( $result ) );*/
180
-		return trim( $result );
180
+		return trim($result);
181 181
 	}
182 182
 
183 183
 	/**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @return string
191 191
 	 */
192
-	public function process_event_content( $match ) {
192
+	public function process_event_content($match) {
193 193
 
194
-		if ( $match[1] == '[' && $match[6] == ']' ) {
195
-			return substr( $match[0], 1, - 1 );
194
+		if ($match[1] == '[' && $match[6] == ']') {
195
+			return substr($match[0], 1, - 1);
196 196
 		}
197 197
 
198 198
 		$tag     = $match[2]; // Tag name without square brackets.
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 		$calendar = $this->calendar;
205 205
 		$event    = $this->event;
206 206
 
207
-		if ( ( $calendar instanceof Calendar ) && ( $event instanceof Event ) ) {
207
+		if (($calendar instanceof Calendar) && ($event instanceof Event)) {
208 208
 
209
-			switch ( $tag ) {
209
+			switch ($tag) {
210 210
 
211 211
 				/* ============ *
212 212
 				 * Content Tags *
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 
215 215
 				case 'title' :
216 216
 				case 'event-title' :
217
-					return $this->get_title( $event->title, $attr );
217
+					return $this->get_title($event->title, $attr);
218 218
 
219 219
 				case 'description' :
220
-					return $this->get_description( $event->description, $attr );
220
+					return $this->get_description($event->description, $attr);
221 221
 
222 222
 				case 'when' :
223
-					return $this->get_when( $event );
223
+					return $this->get_when($event);
224 224
 
225 225
 				case 'end-date' :
226 226
 				case 'end-custom' :
@@ -230,40 +230,40 @@  discard block
 block discarded – undo
230 230
 				case 'start-date' :
231 231
 				case 'start-human' :
232 232
 				case 'start-time' :
233
-					return $this->get_dt( $tag, $event, $attr );
233
+					return $this->get_dt($tag, $event, $attr);
234 234
 
235 235
 				case 'length' :
236 236
 				case 'duration' :
237
-					if ( false !== $event->end ) {
237
+					if (false !== $event->end) {
238 238
 						$duration = $event->start - $event->end;
239
-						$value    = human_time_diff( $event->start, $event->end );
239
+						$value    = human_time_diff($event->start, $event->end);
240 240
 					} else {
241 241
 						$duration = '-1';
242
-						$value    = __( 'No end time', 'google-calendar-events' );
242
+						$value    = __('No end time', 'google-calendar-events');
243 243
 					}
244
-					return ' <span class="simcal-event-duration" data-event-duration="' . $duration . '">' . $value . '</span>';
244
+					return ' <span class="simcal-event-duration" data-event-duration="'.$duration.'">'.$value.'</span>';
245 245
 
246 246
 				case 'location' :
247 247
 				case 'start-location' :
248 248
 				case 'end-location' :
249 249
 					$location = $tag == 'end-location' ? $event->end_location['address'] : $event->start_location['address'];
250 250
 					$location_class = $tag == 'end-location' ? 'end' : 'start';
251
-					return ' <span class="simcal-event-address simcal-event-' . $location_class . '-location" itemprop="location" itemscope itemtype="http://schema.org/Place">' . wp_strip_all_tags( $location ) . '</span>';
251
+					return ' <span class="simcal-event-address simcal-event-'.$location_class.'-location" itemprop="location" itemscope itemtype="http://schema.org/Place">'.wp_strip_all_tags($location).'</span>';
252 252
 
253 253
 				case 'start-location-link':
254 254
 				case 'end-location-link' :
255 255
 				case 'maps-link' :
256 256
 					$location = $tag == 'end-location-link' ? $event->end_location['address'] : $event->start_location['address'];
257
-					if ( ! empty( $location ) ) {
258
-						$url = '//maps.google.com?q=' . urlencode( $location );
259
-						return $this->make_link( $tag, $url, $calendar->get_event_html( $event, $partial ), $attr );
257
+					if ( ! empty($location)) {
258
+						$url = '//maps.google.com?q='.urlencode($location);
259
+						return $this->make_link($tag, $url, $calendar->get_event_html($event, $partial), $attr);
260 260
 					}
261 261
 					break;
262 262
 
263 263
 				case 'link' :
264 264
 				case 'url' :
265
-					$content = 'link' == $tag ? $calendar->get_event_html( $event, $partial ) : '';
266
-					return $this->make_link( $tag, $event->link, $content , $attr );
265
+					$content = 'link' == $tag ? $calendar->get_event_html($event, $partial) : '';
266
+					return $this->make_link($tag, $event->link, $content, $attr);
267 267
 
268 268
 				case 'calendar' :
269 269
 				case 'feed-title' :
@@ -285,22 +285,22 @@  discard block
 block discarded – undo
285 285
 
286 286
 				case 'attachments' :
287 287
 					$attachments = $event->get_attachments();
288
-					if ( ! empty( $attachments ) ) {
289
-						return $this->get_attachments( $attachments );
288
+					if ( ! empty($attachments)) {
289
+						return $this->get_attachments($attachments);
290 290
 					}
291 291
 					break;
292 292
 
293 293
 				case 'attendees' :
294 294
 					$attendees = $event->get_attendees();
295
-					if ( ! empty( $attendees ) ) {
296
-						return $this->get_attendees( $attendees, $attr );
295
+					if ( ! empty($attendees)) {
296
+						return $this->get_attendees($attendees, $attr);
297 297
 					}
298 298
 					break;
299 299
 
300 300
 				case 'organizer' :
301 301
 					$organizer = $event->get_organizer();
302
-					if ( ! empty( $organizer ) ) {
303
-						return $this->get_organizer( $organizer, $attr );
302
+					if ( ! empty($organizer)) {
303
+						return $this->get_organizer($organizer, $attr);
304 304
 					}
305 305
 					break;
306 306
 
@@ -309,35 +309,35 @@  discard block
 block discarded – undo
309 309
 				 * ================ */
310 310
 
311 311
 				case 'if-title':
312
-					if ( ! empty( $event->title ) ) {
313
-						return $calendar->get_event_html( $event, $partial );
312
+					if ( ! empty($event->title)) {
313
+						return $calendar->get_event_html($event, $partial);
314 314
 					}
315 315
 					break;
316 316
 
317 317
 				case 'if-description':
318
-					if ( ! empty( $event->description ) ) {
319
-						return $calendar->get_event_html( $event, $partial );
318
+					if ( ! empty($event->description)) {
319
+						return $calendar->get_event_html($event, $partial);
320 320
 					}
321 321
 					break;
322 322
 
323 323
 				case 'if-now' :
324 324
 				case 'if-not-now' :
325 325
 
326
-					$start_dt = $event->start_dt->setTimezone( $calendar->timezone );
326
+					$start_dt = $event->start_dt->setTimezone($calendar->timezone);
327 327
 					$start = $start_dt->getTimestamp();
328 328
 
329
-					if ( $event->end_dt instanceof Carbon ) {
330
-						$end = $event->end_dt->setTimezone( $calendar->timezone )->getTimestamp();
329
+					if ($event->end_dt instanceof Carbon) {
330
+						$end = $event->end_dt->setTimezone($calendar->timezone)->getTimestamp();
331 331
 					} else {
332 332
 						return '';
333 333
 					}
334 334
 
335
-					$now = ( $start <= $calendar->now ) && ( $end >= $calendar->now );
335
+					$now = ($start <= $calendar->now) && ($end >= $calendar->now);
336 336
 
337
-					if ( ( 'if-now' == $tag ) && $now ) {
338
-						return $calendar->get_event_html( $event, $partial );
339
-					} elseif ( ( 'if-not-now' == $tag ) && ( false == $now ) ) {
340
-						return $calendar->get_event_html( $event, $partial );
337
+					if (('if-now' == $tag) && $now) {
338
+						return $calendar->get_event_html($event, $partial);
339
+					} elseif (('if-not-now' == $tag) && (false == $now)) {
340
+						return $calendar->get_event_html($event, $partial);
341 341
 					}
342 342
 
343 343
 					break;
@@ -345,15 +345,15 @@  discard block
 block discarded – undo
345 345
 				case 'if-started' :
346 346
 				case 'if-not-started' :
347 347
 
348
-					$start = $event->start_dt->setTimezone( $calendar->timezone )->getTimestamp();
348
+					$start = $event->start_dt->setTimezone($calendar->timezone)->getTimestamp();
349 349
 
350
-					if ( 'if-started' == $tag ) {
351
-						if ( $start < $calendar->now ) {
352
-							return $calendar->get_event_html( $event, $partial );
350
+					if ('if-started' == $tag) {
351
+						if ($start < $calendar->now) {
352
+							return $calendar->get_event_html($event, $partial);
353 353
 						}
354
-					} elseif ( 'if-not-started' == $tag ) {
355
-						if ( $start > $calendar->now ) {
356
-							return $calendar->get_event_html( $event, $partial );
354
+					} elseif ('if-not-started' == $tag) {
355
+						if ($start > $calendar->now) {
356
+							return $calendar->get_event_html($event, $partial);
357 357
 						}
358 358
 					}
359 359
 
@@ -362,17 +362,17 @@  discard block
 block discarded – undo
362 362
 				case 'if-ended' :
363 363
 				case 'if-not-ended' :
364 364
 
365
-					if ( false !== $event->end ) {
365
+					if (false !== $event->end) {
366 366
 
367
-						$end = $event->end_dt->setTimezone( $calendar->timezone )->getTimestamp();
367
+						$end = $event->end_dt->setTimezone($calendar->timezone)->getTimestamp();
368 368
 
369
-						if ( 'if-ended' == $tag ) {
370
-							if ( $end < $calendar->now ) {
371
-								return $calendar->get_event_html( $event, $partial );
369
+						if ('if-ended' == $tag) {
370
+							if ($end < $calendar->now) {
371
+								return $calendar->get_event_html($event, $partial);
372 372
 							}
373
-						} elseif ( 'if-not-ended' == $tag ) {
374
-							if ( $end > $calendar->now ) {
375
-								return $calendar->get_event_html( $event, $partial );
373
+						} elseif ('if-not-ended' == $tag) {
374
+							if ($end > $calendar->now) {
375
+								return $calendar->get_event_html($event, $partial);
376 376
 							}
377 377
 						}
378 378
 
@@ -381,14 +381,14 @@  discard block
 block discarded – undo
381 381
 					break;
382 382
 
383 383
 				case 'if-end-time' :
384
-					if ( false !== $event->end ) {
385
-						return $calendar->get_event_html( $event, $partial );
384
+					if (false !== $event->end) {
385
+						return $calendar->get_event_html($event, $partial);
386 386
 					}
387 387
 					break;
388 388
 
389 389
 				case 'if-no-end-time' :
390
-					if ( false === $event->end ) {
391
-						return $calendar->get_event_html( $event, $partial );
390
+					if (false === $event->end) {
391
+						return $calendar->get_event_html($event, $partial);
392 392
 					}
393 393
 					break;
394 394
 
@@ -396,59 +396,59 @@  discard block
 block discarded – undo
396 396
 				case 'if-whole-day' :
397 397
 				case 'if-not-all-day' :
398 398
 				case 'if-not-whole-day' :
399
-					$bool = strstr( $tag, 'not' ) ? false : true;
400
-					if ( $bool === $event->whole_day ) {
401
-						return $calendar->get_event_html( $event, $partial );
399
+					$bool = strstr($tag, 'not') ? false : true;
400
+					if ($bool === $event->whole_day) {
401
+						return $calendar->get_event_html($event, $partial);
402 402
 					}
403 403
 					break;
404 404
 
405 405
 				case 'if-recurring' :
406
-					if ( ! empty( $event->recurrence ) ) {
407
-						return $calendar->get_event_html( $event, $partial );
406
+					if ( ! empty($event->recurrence)) {
407
+						return $calendar->get_event_html($event, $partial);
408 408
 					}
409 409
 					break;
410 410
 
411 411
 				case 'if-not-recurring' :
412
-					if ( false === $event->recurrence ) {
413
-						return $calendar->get_event_html( $event, $partial );
412
+					if (false === $event->recurrence) {
413
+						return $calendar->get_event_html($event, $partial);
414 414
 					}
415 415
 					break;
416 416
 
417 417
 				case 'if-multi-day' :
418
-					if ( false !== $event->multiple_days ) {
419
-						return $calendar->get_event_html( $event, $partial );
418
+					if (false !== $event->multiple_days) {
419
+						return $calendar->get_event_html($event, $partial);
420 420
 					}
421 421
 					break;
422 422
 
423 423
 				case 'if-single-day' :
424
-					if ( false === $event->multiple_days ) {
425
-						return $calendar->get_event_html( $event, $partial );
424
+					if (false === $event->multiple_days) {
425
+						return $calendar->get_event_html($event, $partial);
426 426
 					}
427 427
 					break;
428 428
 
429 429
 				case 'if-location' :
430 430
 				case 'if-start-location' :
431
-					if ( ! empty( $event->start_location['address'] ) ) {
432
-						return $calendar->get_event_html( $event, $partial );
431
+					if ( ! empty($event->start_location['address'])) {
432
+						return $calendar->get_event_html($event, $partial);
433 433
 					}
434 434
 					return false;
435 435
 
436 436
 				case 'if-not-location' :
437 437
 				case 'if-not-start-location' :
438
-					if ( empty( $event->start_location['address'] ) ) {
439
-						return $calendar->get_event_html( $event, $partial );
438
+					if (empty($event->start_location['address'])) {
439
+						return $calendar->get_event_html($event, $partial);
440 440
 					}
441 441
 					return '';
442 442
 
443 443
 				case 'if-not-end-location' :
444
-					if ( empty( $event->end_location['address'] ) ) {
445
-						return $calendar->get_event_html( $event, $partial );
444
+					if (empty($event->end_location['address'])) {
445
+						return $calendar->get_event_html($event, $partial);
446 446
 					}
447 447
 					return '';
448 448
 
449 449
 				case 'if-end-location' :
450
-					if ( ! empty( $event->end_location['address'] ) ) {
451
-						return $calendar->get_event_html( $event, $partial );
450
+					if ( ! empty($event->end_location['address'])) {
451
+						return $calendar->get_event_html($event, $partial);
452 452
 					}
453 453
 					return '';
454 454
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 				 * ======= */
458 458
 
459 459
 				default :
460
-					return wp_kses_post( $before . $partial . $after );
460
+					return wp_kses_post($before.$partial.$after);
461 461
 			}
462 462
 		}
463 463
 
@@ -475,14 +475,14 @@  discard block
 block discarded – undo
475 475
 	 *
476 476
 	 * @return string
477 477
 	 */
478
-	private function limit_words( $text, $limit ) {
478
+	private function limit_words($text, $limit) {
479 479
 
480
-		$limit = max( absint( $limit ), 0 );
480
+		$limit = max(absint($limit), 0);
481 481
 
482
-		if ( $limit > 0 && ( str_word_count( $text, 0 ) > $limit ) ) {
483
-			$words  = str_word_count( $text, 2 );
484
-			$pos    = array_keys( $words );
485
-			$text   = trim( substr( $text, 0, $pos[ $limit ] ) ) . '&hellip;';
482
+		if ($limit > 0 && (str_word_count($text, 0) > $limit)) {
483
+			$words  = str_word_count($text, 2);
484
+			$pos    = array_keys($words);
485
+			$text   = trim(substr($text, 0, $pos[$limit])).'&hellip;';
486 486
 		}
487 487
 
488 488
 		return $text;
@@ -499,26 +499,26 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @return string
501 501
 	 */
502
-	private function get_title( $title, $attr ) {
502
+	private function get_title($title, $attr) {
503 503
 
504
-		if ( empty( $title ) ) {
504
+		if (empty($title)) {
505 505
 			return '';
506 506
 		}
507 507
 
508
-		$attr = array_merge( array(
509
-			'html'  => '',  // Parse HTML
510
-			'limit' => 0,   // Trim length to amount of words
511
-		), (array) shortcode_parse_atts( $attr ) );
508
+		$attr = array_merge(array(
509
+			'html'  => '', // Parse HTML
510
+			'limit' => 0, // Trim length to amount of words
511
+		), (array) shortcode_parse_atts($attr));
512 512
 
513
-		if ( ! empty( $attr['html'] ) ) {
514
-			$title = wp_kses_post( $title );
513
+		if ( ! empty($attr['html'])) {
514
+			$title = wp_kses_post($title);
515 515
 			$tag = 'div';
516 516
 		} else {
517
-			$title = $this->limit_words( $title, $attr['limit'] );
517
+			$title = $this->limit_words($title, $attr['limit']);
518 518
 			$tag = 'span';
519 519
 		}
520 520
 
521
-		return '<' . $tag . ' class="simcal-event-title" itemprop="name">' . $title . '</' . $tag . '>';
521
+		return '<'.$tag.' class="simcal-event-title" itemprop="name">'.$title.'</'.$tag.'>';
522 522
 	}
523 523
 
524 524
 	/**
@@ -532,42 +532,42 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return string
534 534
 	 */
535
-	private function get_description( $description, $attr ) {
535
+	private function get_description($description, $attr) {
536 536
 
537
-		if ( empty( $description ) ) {
537
+		if (empty($description)) {
538 538
 			return '';
539 539
 		}
540 540
 
541
-		$attr = array_merge( array(
542
-			'limit'     => 0,       // Trim length to number of words
543
-			'html'      => 'no',    // Parse HTML content
544
-			'markdown'  => 'no',    // Parse Markdown content
545
-			'autolink'  => 'no',    // Automatically convert plaintext URIs to anchors
546
-		), (array) shortcode_parse_atts( $attr ) );
541
+		$attr = array_merge(array(
542
+			'limit'     => 0, // Trim length to number of words
543
+			'html'      => 'no', // Parse HTML content
544
+			'markdown'  => 'no', // Parse Markdown content
545
+			'autolink'  => 'no', // Automatically convert plaintext URIs to anchors
546
+		), (array) shortcode_parse_atts($attr));
547 547
 
548
-		$allow_html = 'no' != $attr['html']     ? true : false;
548
+		$allow_html = 'no' != $attr['html'] ? true : false;
549 549
 		$allow_md   = 'no' != $attr['markdown'] ? true : false;
550 550
 
551 551
 		$html = '<div class="simcal-event-description" itemprop="description">';
552 552
 
553 553
 		// Markdown and HTML don't play well together, use one or the other in the same tag.
554
-		if ( $allow_html || $allow_md ) {
555
-			if ( $allow_html ) {
556
-				$description = wp_kses_post( $description );
557
-			} elseif ( $allow_md ) {
554
+		if ($allow_html || $allow_md) {
555
+			if ($allow_html) {
556
+				$description = wp_kses_post($description);
557
+			} elseif ($allow_md) {
558 558
 				$markdown = new \Parsedown();
559
-				$description = $markdown->text( wp_strip_all_tags( $description ) );
559
+				$description = $markdown->text(wp_strip_all_tags($description));
560 560
 			}
561 561
 		} else {
562
-			$description = wpautop( $description );
562
+			$description = wpautop($description);
563 563
 		}
564 564
 
565
-		$description = $this->limit_words( $description, $attr['limit'] );
565
+		$description = $this->limit_words($description, $attr['limit']);
566 566
 
567
-		$html .= $description . '</div>';
567
+		$html .= $description.'</div>';
568 568
 
569
-		if ( 'no' != $attr['autolink'] ) {
570
-			$html = ' ' . make_clickable( $html );
569
+		if ('no' != $attr['autolink']) {
570
+			$html = ' '.make_clickable($html);
571 571
 		}
572 572
 
573 573
 		return $html;
@@ -583,74 +583,74 @@  discard block
 block discarded – undo
583 583
 	 *
584 584
 	 * @return string
585 585
 	 */
586
-	private function get_when( Event $event ) {
586
+	private function get_when(Event $event) {
587 587
 
588
-		$start = $event->start_dt->setTimezone( $event->timezone );
589
-		$end = ! is_null( $event->end_dt ) ? $event->end_dt->setTimezone( $event->timezone ) : null;
588
+		$start = $event->start_dt->setTimezone($event->timezone);
589
+		$end = ! is_null($event->end_dt) ? $event->end_dt->setTimezone($event->timezone) : null;
590 590
 
591 591
 		$time_start = '';
592 592
 		$time_end = '';
593 593
 
594
-		if ( ! $event->whole_day ) {
594
+		if ( ! $event->whole_day) {
595 595
 
596
-			$time_start = $this->calendar->datetime_separator .
597
-			              ' <span class="simcal-event-start simcal-event-start-time" ' .
598
-			              'data-event-start="' . $start->getTimestamp() . '" ' .
599
-			              'data-event-format="' . $this->calendar->time_format . '" ' .
600
-			              'itemprop="startDate" content="' . $start->toIso8601String() . '">' .
601
-			              date_i18n( $this->calendar->time_format, $start->getTimestamp() ) .
596
+			$time_start = $this->calendar->datetime_separator.
597
+			              ' <span class="simcal-event-start simcal-event-start-time" '.
598
+			              'data-event-start="'.$start->getTimestamp().'" '.
599
+			              'data-event-format="'.$this->calendar->time_format.'" '.
600
+			              'itemprop="startDate" content="'.$start->toIso8601String().'">'.
601
+			              date_i18n($this->calendar->time_format, $start->getTimestamp()).
602 602
 			              '</span> ';
603 603
 
604
-			if ( $end instanceof Carbon ) {
604
+			if ($end instanceof Carbon) {
605 605
 
606
-				$time_end = ' <span class="simcal-event-end simcal-event-end-time" ' .
607
-				            'data-event-end="' . $end->getTimestamp() . '" ' .
608
-				            'data-event-format="' . $this->calendar->time_format . '" ' .
609
-				            'itemprop="endDate" content="' . $end->toIso8601String() . '">' .
610
-				            date_i18n( $this->calendar->time_format, $end->getTimestamp() ) .
606
+				$time_end = ' <span class="simcal-event-end simcal-event-end-time" '.
607
+				            'data-event-end="'.$end->getTimestamp().'" '.
608
+				            'data-event-format="'.$this->calendar->time_format.'" '.
609
+				            'itemprop="endDate" content="'.$end->toIso8601String().'">'.
610
+				            date_i18n($this->calendar->time_format, $end->getTimestamp()).
611 611
 				            '</span> ';
612 612
 
613 613
 			}
614 614
 
615 615
 		}
616 616
 
617
-		if ( $event->multiple_days ) {
617
+		if ($event->multiple_days) {
618 618
 
619
-			$output = ' <span class="simcal-event-start simcal-event-start-date" ' .
620
-			          'data-event-start="' . $start->getTimestamp() . '" ' .
621
-			          'data-event-format="' . $this->calendar->date_format . '" ' .
622
-			          'itemprop="startDate" content="' . $start->toIso8601String() . '">' .
623
-			          date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
624
-			          '</span> ' .
619
+			$output = ' <span class="simcal-event-start simcal-event-start-date" '.
620
+			          'data-event-start="'.$start->getTimestamp().'" '.
621
+			          'data-event-format="'.$this->calendar->date_format.'" '.
622
+			          'itemprop="startDate" content="'.$start->toIso8601String().'">'.
623
+			          date_i18n($this->calendar->date_format, $start->getTimestamp()).
624
+			          '</span> '.
625 625
 			          $time_start;
626 626
 
627
-			if ( $end instanceof Carbon ) {
627
+			if ($end instanceof Carbon) {
628 628
 
629
-				$output .= '-' .
630
-				           ' <span class="simcal-event-start simcal-event-end-date" ' .
631
-				           'data-event-start="' . $end->getTimestamp() . '" ' .
632
-				           'data-event-format="' . $this->calendar->date_format . '" ' .
633
-				           'itemprop="endDate" content="' . $end->toIso8601String() . '">' .
634
-				           date_i18n( $this->calendar->date_format, $end->getTimestamp() ) .
635
-				           '</span> ' .
629
+				$output .= '-'.
630
+				           ' <span class="simcal-event-start simcal-event-end-date" '.
631
+				           'data-event-start="'.$end->getTimestamp().'" '.
632
+				           'data-event-format="'.$this->calendar->date_format.'" '.
633
+				           'itemprop="endDate" content="'.$end->toIso8601String().'">'.
634
+				           date_i18n($this->calendar->date_format, $end->getTimestamp()).
635
+				           '</span> '.
636 636
 				           $time_end;
637 637
 			}
638 638
 
639 639
 		} else {
640 640
 
641
-			$time_end = ! empty( $time_start ) && ! empty( $time_end ) ? ' - ' . $time_end : '';
641
+			$time_end = ! empty($time_start) && ! empty($time_end) ? ' - '.$time_end : '';
642 642
 
643
-			$output = ' <span class="simcal-event-start simcal-event-start-date" ' .
644
-			          'data-event-start="' . $start->getTimestamp() . '" ' .
645
-			          'data-event-format="' . $this->calendar->date_format . '">' .
646
-			          date_i18n( $this->calendar->date_format, $start->getTimestamp() ) .
647
-			          '</span> ' .
648
-			          $time_start .
643
+			$output = ' <span class="simcal-event-start simcal-event-start-date" '.
644
+			          'data-event-start="'.$start->getTimestamp().'" '.
645
+			          'data-event-format="'.$this->calendar->date_format.'">'.
646
+			          date_i18n($this->calendar->date_format, $start->getTimestamp()).
647
+			          '</span> '.
648
+			          $time_start.
649 649
 			          $time_end;
650 650
 
651 651
 		}
652 652
 
653
-		return trim( $output );
653
+		return trim($output);
654 654
 	}
655 655
 
656 656
 	/**
@@ -665,50 +665,50 @@  discard block
 block discarded – undo
665 665
 	 *
666 666
 	 * @return string
667 667
 	 */
668
-	private function get_dt( $tag, Event $event, $attr ) {
668
+	private function get_dt($tag, Event $event, $attr) {
669 669
 
670
-		$bound = 0 === strpos( $tag, 'end' ) ? 'end' : 'start';
671
-		if ( ( 'end' == $bound ) && ( false === $event->end ) ) {
670
+		$bound = 0 === strpos($tag, 'end') ? 'end' : 'start';
671
+		if (('end' == $bound) && (false === $event->end)) {
672 672
 			return '';
673 673
 		}
674 674
 
675
-		$dt = $bound . '_dt';
676
-		if ( ! $event->$dt instanceof Carbon ) {
675
+		$dt = $bound.'_dt';
676
+		if ( ! $event->$dt instanceof Carbon) {
677 677
 			return '';
678 678
 		}
679
-		$event_dt = $event->$dt->setTimezone( $event->timezone );
679
+		$event_dt = $event->$dt->setTimezone($event->timezone);
680 680
 
681
-		$attr = array_merge( array(
681
+		$attr = array_merge(array(
682 682
 			'format'    => '',
683
-		), (array) shortcode_parse_atts( $attr ) );
683
+		), (array) shortcode_parse_atts($attr));
684 684
 
685
-		$format = ltrim( strstr( $tag, '-' ), '-' );
685
+		$format = ltrim(strstr($tag, '-'), '-');
686 686
 		$dt_format = '';
687
-		if ( ! empty( $attr['format'] ) ) {
688
-			$dt_format = esc_attr( wp_strip_all_tags( $attr['format'] ) );
689
-		} elseif ( 'date' == $format ) {
687
+		if ( ! empty($attr['format'])) {
688
+			$dt_format = esc_attr(wp_strip_all_tags($attr['format']));
689
+		} elseif ('date' == $format) {
690 690
 			$dt_format = $this->calendar->date_format;
691
-		} elseif ( 'time' == $format ) {
691
+		} elseif ('time' == $format) {
692 692
 			$dt_format = $this->calendar->time_format;
693 693
 		}
694 694
 
695
-		if ( 'human' == $format ) {
696
-			$value = human_time_diff( $event_dt->getTimestamp(), Carbon::now( $event->timezone )->getTimestamp() );
695
+		if ('human' == $format) {
696
+			$value = human_time_diff($event_dt->getTimestamp(), Carbon::now($event->timezone)->getTimestamp());
697 697
 
698
-			if ( $event_dt->getTimestamp() < Carbon::now( $event->timezone )->getTimestamp() ) {
699
-				$value .= ' ' . _x( 'ago', 'human date event builder code modifier', 'google-calendar-events' );
698
+			if ($event_dt->getTimestamp() < Carbon::now($event->timezone)->getTimestamp()) {
699
+				$value .= ' '._x('ago', 'human date event builder code modifier', 'google-calendar-events');
700 700
 			} else {
701
-				$value .= ' ' . _x( 'from now', 'human date event builder code modifier', 'google-calendar-events' );
701
+				$value .= ' '._x('from now', 'human date event builder code modifier', 'google-calendar-events');
702 702
 			}
703 703
 		} else {
704
-			$value = date_i18n( $dt_format, $event_dt->getTimestamp() );
704
+			$value = date_i18n($dt_format, $event_dt->getTimestamp());
705 705
 		}
706 706
 
707
-		return '<span class="simcal-event-' . $bound . ' ' . 'simcal-event-' . $bound . '-' . $format . '" ' .
708
-		       'data-event-' . $bound . '="' . $event_dt->getTimestamp() . '" ' .
709
-		       'data-event-format="' . $dt_format . '" ' .
710
-		       'itemprop="' . $bound . 'Date" content="' . $event_dt->toIso8601String() . '">' .
711
-		       $value .
707
+		return '<span class="simcal-event-'.$bound.' '.'simcal-event-'.$bound.'-'.$format.'" '.
708
+		       'data-event-'.$bound.'="'.$event_dt->getTimestamp().'" '.
709
+		       'data-event-format="'.$dt_format.'" '.
710
+		       'itemprop="'.$bound.'Date" content="'.$event_dt->toIso8601String().'">'.
711
+		       $value.
712 712
 		       '</span>';
713 713
 	}
714 714
 
@@ -725,23 +725,23 @@  discard block
 block discarded – undo
725 725
 	 *
726 726
 	 * @return string
727 727
 	 */
728
-	private function make_link( $tag, $url, $content, $attr ) {
728
+	private function make_link($tag, $url, $content, $attr) {
729 729
 
730
-		if ( empty( $url ) ) {
730
+		if (empty($url)) {
731 731
 			return '';
732 732
 		}
733 733
 
734
-		$text = empty( $content ) ? $url : $content;
734
+		$text = empty($content) ? $url : $content;
735 735
 
736
-		$attr = array_merge( array(
737
-			'autolink'  => false,   // Convert url to link anchor
738
-			'newwindow' => false,   // If autolink attribute is true, open link in new window
739
-		), (array) shortcode_parse_atts( $attr ) );
736
+		$attr = array_merge(array(
737
+			'autolink'  => false, // Convert url to link anchor
738
+			'newwindow' => false, // If autolink attribute is true, open link in new window
739
+		), (array) shortcode_parse_atts($attr));
740 740
 
741 741
 		$anchor = $tag != 'url' ? 'yes' : $attr['autolink'];
742 742
 		$target = $attr['newwindow'] !== false ? 'target="_blank"' : '';
743 743
 
744
-		return $anchor !== false ? ' <a href="' . esc_url( $url ) . '" ' . $target . '>' . $text . '</a>' : ' ' . $text;
744
+		return $anchor !== false ? ' <a href="'.esc_url($url).'" '.$target.'>'.$text.'</a>' : ' '.$text;
745 745
 	}
746 746
 
747 747
 	/**
@@ -754,20 +754,20 @@  discard block
 block discarded – undo
754 754
 	 *
755 755
 	 * @return string
756 756
 	 */
757
-	private function get_attachments( $attachments ) {
757
+	private function get_attachments($attachments) {
758 758
 
759
-		$html = '<ul class="simcal-attachments">' . "\n\t";
759
+		$html = '<ul class="simcal-attachments">'."\n\t";
760 760
 
761
-		foreach ( $attachments as $attachment ) {
761
+		foreach ($attachments as $attachment) {
762 762
 			$html .= '<li class="simcal-attachment">';
763
-			$html .= '<a href="' . $attachment['url'] . '" target="_blank">';
764
-			$html .= ! empty( $attachment['icon'] ) ? '<img src="' . $attachment['icon'] . '" />' : '';
765
-			$html .= '<span>' . $attachment['name'] . '</span>';
763
+			$html .= '<a href="'.$attachment['url'].'" target="_blank">';
764
+			$html .= ! empty($attachment['icon']) ? '<img src="'.$attachment['icon'].'" />' : '';
765
+			$html .= '<span>'.$attachment['name'].'</span>';
766 766
 			$html .= '</a>';
767
-			$html .= '</li>' . "\n";
767
+			$html .= '</li>'."\n";
768 768
 		}
769 769
 
770
-		$html .= '</ul>' . "\n";
770
+		$html .= '</ul>'."\n";
771 771
 
772 772
 		return $html;
773 773
 	}
@@ -783,41 +783,41 @@  discard block
 block discarded – undo
783 783
 	 *
784 784
 	 * @return string
785 785
 	 */
786
-	private function get_attendees( $attendees, $attr ) {
786
+	private function get_attendees($attendees, $attr) {
787 787
 
788
-		$attr = array_merge( array(
789
-			'photo'     => 'show',  // show/hide attendee photo
790
-			'email'     => 'hide',  // show/hide attendee email address
791
-			'rsvp'      => 'hide',  // show/hide rsvp response status
792
-			'response'  => '',      // filter attendees by rsvp response (yes/no/maybe)
793
-		), (array) shortcode_parse_atts( $attr ) );
788
+		$attr = array_merge(array(
789
+			'photo'     => 'show', // show/hide attendee photo
790
+			'email'     => 'hide', // show/hide attendee email address
791
+			'rsvp'      => 'hide', // show/hide rsvp response status
792
+			'response'  => '', // filter attendees by rsvp response (yes/no/maybe)
793
+		), (array) shortcode_parse_atts($attr));
794 794
 
795
-		$html = '<ul class="simcal-attendees" itemprop="attendees">' . "\n\t";
795
+		$html = '<ul class="simcal-attendees" itemprop="attendees">'."\n\t";
796 796
 
797 797
 		$known = 0;
798 798
 		$unknown = 0;
799 799
 
800
-		foreach ( $attendees as $attendee ) {
800
+		foreach ($attendees as $attendee) {
801 801
 
802
-			if ( 'yes' == $attr['response'] && 'yes' != $attendee['response'] ) {
802
+			if ('yes' == $attr['response'] && 'yes' != $attendee['response']) {
803 803
 				continue;
804
-			} elseif ( 'no' == $attr['response'] && 'no' != $attendee['response'] ) {
804
+			} elseif ('no' == $attr['response'] && 'no' != $attendee['response']) {
805 805
 				continue;
806
-			} elseif ( 'maybe' == $attr['response'] && ! in_array( $attendee['response'], array( 'yes', 'maybe' ) ) ) {
806
+			} elseif ('maybe' == $attr['response'] && ! in_array($attendee['response'], array('yes', 'maybe'))) {
807 807
 				continue;
808 808
 			}
809 809
 
810
-			if ( ! empty( $attendee['name'] ) ) {
810
+			if ( ! empty($attendee['name'])) {
811 811
 
812
-				$photo      = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="' . $attendee['photo'] . '" itemprop="image" />' : '';
813
-				$response   = 'hide' != $attr['rsvp'] ? $this->get_rsvp_response( $attendee['response'] ) : '';
814
-				$guest      = $photo . '<span itemprop="name">' . $attendee['name'] . $response . '</span>';
812
+				$photo      = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="'.$attendee['photo'].'" itemprop="image" />' : '';
813
+				$response   = 'hide' != $attr['rsvp'] ? $this->get_rsvp_response($attendee['response']) : '';
814
+				$guest      = $photo.'<span itemprop="name">'.$attendee['name'].$response.'</span>';
815 815
 
816
-				if ( ! empty( $attendee['email'] ) && ( 'show' == $attr['email'] ) ) {
817
-					$guest = sprintf( '<a href="mailto:' . $attendee['email'] . '" itemprop="email">%s</a>', $guest );
816
+				if ( ! empty($attendee['email']) && ('show' == $attr['email'])) {
817
+					$guest = sprintf('<a href="mailto:'.$attendee['email'].'" itemprop="email">%s</a>', $guest);
818 818
 				}
819 819
 
820
-				$html .= '<li class="simcal-attendee" itemprop="attendee" itemscope itemtype="http://schema.org/Person">' . $guest . '</li>' . "\n";
820
+				$html .= '<li class="simcal-attendee" itemprop="attendee" itemscope itemtype="http://schema.org/Person">'.$guest.'</li>'."\n";
821 821
 
822 822
 				$known++;
823 823
 
@@ -828,21 +828,21 @@  discard block
 block discarded – undo
828 828
 			}
829 829
 		}
830 830
 
831
-		if ( $unknown > 0 ) {
832
-			if ( $known > 0 ) {
831
+		if ($unknown > 0) {
832
+			if ($known > 0) {
833 833
 				/* translators: One more person attending the event. */
834
-				$others = sprintf( _n( '1 more attendee', '%s more attendees', $unknown, 'google-calendar-events' ), $unknown );
834
+				$others = sprintf(_n('1 more attendee', '%s more attendees', $unknown, 'google-calendar-events'), $unknown);
835 835
 			} else {
836 836
 				/* translators: One or more persons attending the event whose name is unknown. */
837
-				$others = sprintf( _n( '1 anonymous attendee', '%s anonymous attendees', $unknown, 'google-calendar-events' ), $unknown );
837
+				$others = sprintf(_n('1 anonymous attendee', '%s anonymous attendees', $unknown, 'google-calendar-events'), $unknown);
838 838
 			}
839
-			$photo = $attr['photo'] !== 'hide' ? get_avatar( '', 128 ) : '';
840
-			$html .= '<li class="simcal-attendee simcal-attendee-anonymous">' . $photo . '<span>' . $others . '</span></li>' . "\n";
841
-		} elseif ( $known === 0 ) {
842
-			$html .= '<li class="simcal-attendee">' . _x( 'No one yet', 'No one yet rsvp to attend the event.', 'google-calendar-events' ) . '</li>' . "\n";
839
+			$photo = $attr['photo'] !== 'hide' ? get_avatar('', 128) : '';
840
+			$html .= '<li class="simcal-attendee simcal-attendee-anonymous">'.$photo.'<span>'.$others.'</span></li>'."\n";
841
+		} elseif ($known === 0) {
842
+			$html .= '<li class="simcal-attendee">'._x('No one yet', 'No one yet rsvp to attend the event.', 'google-calendar-events').'</li>'."\n";
843 843
 		}
844 844
 
845
-		$html .= '</ul>' . "\n";
845
+		$html .= '</ul>'."\n";
846 846
 
847 847
 		return $html;
848 848
 	}
@@ -856,23 +856,23 @@  discard block
 block discarded – undo
856 856
 	 *
857 857
 	 * @return string
858 858
 	 */
859
-	private function get_rsvp_response( $response ) {
859
+	private function get_rsvp_response($response) {
860 860
 
861
-		if ( 'yes' == $response ) {
861
+		if ('yes' == $response) {
862 862
 			/* translators: Someone replied with 'yes' to a rsvp request. */
863
-			$rsvp = __( 'Attending', 'google-calendar-events' );
864
-		} elseif ( 'no' == $response ) {
863
+			$rsvp = __('Attending', 'google-calendar-events');
864
+		} elseif ('no' == $response) {
865 865
 			/* translators: Someone replied with 'no' to a rsvp request. */
866
-			$rsvp = __( 'Not attending', 'google-calendar-events' );
867
-		} elseif ( 'maybe' == $response ) {
866
+			$rsvp = __('Not attending', 'google-calendar-events');
867
+		} elseif ('maybe' == $response) {
868 868
 			/* translators: Someone replied with 'maybe' to a rsvp request. */
869
-			$rsvp = __( 'Maybe attending', 'google-calendar-events' );
869
+			$rsvp = __('Maybe attending', 'google-calendar-events');
870 870
 		} else {
871 871
 			/* translators: Someone did not send yet a rsvp confirmation to join an event. */
872
-			$rsvp = __( 'Response pending', 'google-calendar-events' );
872
+			$rsvp = __('Response pending', 'google-calendar-events');
873 873
 		}
874 874
 
875
-		return ' <small>(' . $rsvp . ')</small>';
875
+		return ' <small>('.$rsvp.')</small>';
876 876
 	}
877 877
 
878 878
 	/**
@@ -886,21 +886,21 @@  discard block
 block discarded – undo
886 886
 	 *
887 887
 	 * @return string
888 888
 	 */
889
-	private function get_organizer( $organizer, $attr ) {
889
+	private function get_organizer($organizer, $attr) {
890 890
 
891
-		$attr = array_merge( array(
892
-			'photo' => 'show',  // show/hide attendee photo
893
-			'email' => 'hide',  // show/hide attendee email address
894
-		), (array) shortcode_parse_atts( $attr ) );
891
+		$attr = array_merge(array(
892
+			'photo' => 'show', // show/hide attendee photo
893
+			'email' => 'hide', // show/hide attendee email address
894
+		), (array) shortcode_parse_atts($attr));
895 895
 
896
-		$photo           = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="' . $organizer['photo'] . '" itemprop="image"  />' : '';
897
-		$organizer_html  = $photo . '<span itemprop="name">' . $organizer['name'] . '</span>';
896
+		$photo           = 'hide' != $attr['photo'] ? '<img class="avatar avatar-128 photo" src="'.$organizer['photo'].'" itemprop="image"  />' : '';
897
+		$organizer_html  = $photo.'<span itemprop="name">'.$organizer['name'].'</span>';
898 898
 
899
-		if ( ! empty( $organizer['email'] ) && ( 'show' == $attr['email'] ) ) {
900
-			$organizer_html = sprintf( '<a href="mailto:' . $organizer['email'] . '" itemprop="email">%s</a>', $organizer_html );
899
+		if ( ! empty($organizer['email']) && ('show' == $attr['email'])) {
900
+			$organizer_html = sprintf('<a href="mailto:'.$organizer['email'].'" itemprop="email">%s</a>', $organizer_html);
901 901
 		}
902 902
 
903
-		return '<div class="simcal-organizer" itemprop="organizer" itemscope itemtype="https://schema.org/Person">' . $organizer_html . '</div>';
903
+		return '<div class="simcal-organizer" itemprop="organizer" itemscope itemtype="https://schema.org/Person">'.$organizer_html.'</div>';
904 904
 	}
905 905
 
906 906
 	/**
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 		// This is largely borrowed on get_shortcode_regex() from WordPress Core.
926 926
 		// @see /wp-includes/shortcodes.php (with some modification)
927 927
 
928
-		$tagregexp = implode( '|', array_values( $this->tags ) );
928
+		$tagregexp = implode('|', array_values($this->tags));
929 929
 
930 930
 		return '/'
931 931
 		       . '\\['                              // Opening bracket
Please login to merge, or discard this patch.