Completed
Branch BUG-8698-ticket-sellouts (4c4ee4)
by
unknown
111:35 queued 95:47
created
core/admin/EE_Admin_Page_CPT.core.php 3 patches
Braces   +49 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * EE_Admin_Page_CPT class
4 6
  *
@@ -236,8 +238,9 @@  discard block
 block discarded – undo
236 238
 
237 239
 		$containers = array();
238 240
 
239
-		if ( empty( $wp_meta_boxes ) )
240
-			return;
241
+		if ( empty( $wp_meta_boxes ) ) {
242
+					return;
243
+		}
241 244
 
242 245
 		$current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array();
243 246
 
@@ -341,8 +344,9 @@  discard block
 block discarded – undo
341 344
 
342 345
 
343 346
 		//this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form
344
-		if ( method_exists( $this, 'extra_permalink_field_buttons' ) )
345
-			add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 );
347
+		if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) {
348
+					add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 );
349
+		}
346 350
 
347 351
 		//add preview button
348 352
 		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 );
@@ -352,12 +356,14 @@  discard block
 block discarded – undo
352 356
 		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 );
353 357
 
354 358
 		//This allows adding additional information to the publish post submitbox on the wp post edit form
355
-		if ( method_exists( $this, 'extra_misc_actions_publish_box' ) )
356
-			add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 );
359
+		if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) {
360
+					add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 );
361
+		}
357 362
 
358 363
 		//This allows for adding additional stuff after the title field on the wp post edit form.  This is also before the wp_editor for post description field.
359
-		if ( method_exists( $this, 'edit_form_after_title' ) )
360
-			add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 );
364
+		if ( method_exists( $this, 'edit_form_after_title' ) ) {
365
+					add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 );
366
+		}
361 367
 
362 368
 
363 369
 		/**
@@ -548,7 +554,9 @@  discard block
 block discarded – undo
548 554
 
549 555
 
550 556
 		//make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it)
551
-		if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true);
557
+		if ( !defined('DOING_AUTOSAVE') ) {
558
+			define('DOING_AUTOSAVE', true);
559
+		}
552 560
 
553 561
 		//if we made it here then the nonce checked out.  Let's run our methods and actions
554 562
 		if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) {
@@ -578,8 +586,9 @@  discard block
 block discarded – undo
578 586
 	protected function _extend_page_config_for_cpt() {
579 587
 
580 588
 		//before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug
581
-		if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) )
582
-			return;
589
+		if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) {
590
+					return;
591
+		}
583 592
 
584 593
 		//set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes
585 594
 		if ( !empty( $this->_cpt_object ) ) {
@@ -611,8 +620,9 @@  discard block
 block discarded – undo
611 620
 		}
612 621
 
613 622
 		//load the next section only if this is a matching cpt route as set in the cpt routes array.
614
-		if ( !isset( $this->_cpt_routes[$this->_req_action] ) )
615
-			return;
623
+		if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) {
624
+					return;
625
+		}
616 626
 
617 627
 
618 628
 		$this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE;
@@ -896,8 +906,10 @@  discard block
 block discarded – undo
896 906
 			}
897 907
 		}
898 908
 
899
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
900
-			return; //TODO we'll remove this after reimplementing autosave in 4.2
909
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
910
+					return;
911
+		}
912
+		//TODO we'll remove this after reimplementing autosave in 4.2
901 913
 		$this->_insert_update_cpt_item( $post_id, $post );
902 914
 	}
903 915
 
@@ -974,7 +986,9 @@  discard block
 block discarded – undo
974 986
 	 */
975 987
 	public function modify_current_screen() {
976 988
 		//ONLY do this if the current page_route IS a cpt route
977
-		if ( !$this->_cpt_route ) return;
989
+		if ( !$this->_cpt_route ) {
990
+			return;
991
+		}
978 992
 		//routing things REALLY early b/c this is a cpt admin page
979 993
 		set_current_screen( $this->_cpt_routes[$this->_req_action]);
980 994
 		$this->_current_screen = get_current_screen();
@@ -1014,8 +1028,9 @@  discard block
 block discarded – undo
1014 1028
 	public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) {
1015 1029
 		if ( !empty( $id ) && '' != get_option('permalink_structure') ) {
1016 1030
 			$post = get_post( $id );
1017
-			if ( isset($post->post_type) && $this->page_slug == $post->post_type )
1018
-			$shortlink = home_url('?p=' . $post->ID);
1031
+			if ( isset($post->post_type) && $this->page_slug == $post->post_type ) {
1032
+						$shortlink = home_url('?p=' . $post->ID);
1033
+			}
1019 1034
 		}
1020 1035
 		return $shortlink;
1021 1036
 	}
@@ -1028,7 +1043,9 @@  discard block
 block discarded – undo
1028 1043
 	 * @return void
1029 1044
 	 */
1030 1045
 	public function route_admin_request() {
1031
-		if ( $this->_cpt_route ) return;
1046
+		if ( $this->_cpt_route ) {
1047
+			return;
1048
+		}
1032 1049
 		try {
1033 1050
 			$this->_route_admin_request();
1034 1051
 		} catch ( EE_Error $e ) {
@@ -1067,8 +1084,9 @@  discard block
 block discarded – undo
1067 1084
 		$rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
1068 1085
 
1069 1086
 		//can't do anything without revision so let's get out if not present
1070
-		if ( empty( $rev_id ) )
1071
-			return $location;
1087
+		if ( empty( $rev_id ) ) {
1088
+					return $location;
1089
+		}
1072 1090
 
1073 1091
 		//get rev_post_data
1074 1092
 		$rev = get_post($rev_id);
@@ -1097,8 +1115,9 @@  discard block
 block discarded – undo
1097 1115
 	 */
1098 1116
 	public function modify_edit_post_link( $link, $id, $context ) {
1099 1117
 		$post = get_post( $id );
1100
-		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] )
1101
-			return $link;
1118
+		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) {
1119
+					return $link;
1120
+		}
1102 1121
 		$query_args = array(
1103 1122
 			'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit',
1104 1123
 			'post' => $id
@@ -1118,8 +1137,9 @@  discard block
 block discarded – undo
1118 1137
 	 */
1119 1138
 	public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) {
1120 1139
 		$post = get_post($post_id);
1121
-		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) )
1122
-			return $delete_link;
1140
+		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) {
1141
+					return $delete_link;
1142
+		}
1123 1143
 
1124 1144
 		return add_query_arg( array('current_route' => 'trash' ), $delete_link );
1125 1145
 	}
@@ -1133,8 +1153,9 @@  discard block
 block discarded – undo
1133 1153
 	 * @return string           url to redirect to
1134 1154
 	 */
1135 1155
 	public function cpt_trash_post_location_redirect( $location, $status ) {
1136
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) )
1137
-			return $location;
1156
+		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) {
1157
+					return $location;
1158
+		}
1138 1159
 
1139 1160
 		$post = get_post( $this->_req_data['post'] );
1140 1161
 		$query_args = array( 'action' => 'default' );
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	/**
81
-	* @var EE_CPT_Base
82
-	*/
81
+	 * @var EE_CPT_Base
82
+	 */
83 83
 	protected $_cpt_model_obj = FALSE;
84 84
 
85 85
 
@@ -659,12 +659,12 @@  discard block
 block discarded – undo
659 659
 		$model = null;
660 660
 		if (
661 661
 			empty( $this->_cpt_model_names )
662
-		    || (
663
-			     ! $ignore_route_check
664
-			     && ! isset( $this->_cpt_routes[ $this->_req_action ] )
665
-		    ) || (
666
-			     $this->_cpt_model_obj instanceof EE_CPT_Base
667
-			     && $this->_cpt_model_obj->ID() === $id
662
+			|| (
663
+				 ! $ignore_route_check
664
+				 && ! isset( $this->_cpt_routes[ $this->_req_action ] )
665
+			) || (
666
+				 $this->_cpt_model_obj instanceof EE_CPT_Base
667
+				 && $this->_cpt_model_obj->ID() === $id
668 668
 			)
669 669
 		) {
670 670
 			EE_Admin::debug_log( __METHOD__, array( '**RETURN**' => true ) );
@@ -906,9 +906,9 @@  discard block
 block discarded – undo
906 906
 		//if our cpt object is not instantiated and its NOT the same post_id as what is triggering this callback, then exit.
907 907
 		if ( $update
908 908
 			&& (
909
-			     ! $this->_cpt_model_obj instanceof EE_CPT_Base
910
-			     || $this->_cpt_model_obj->ID() !== $post_id
911
-		     )
909
+				 ! $this->_cpt_model_obj instanceof EE_CPT_Base
910
+				 || $this->_cpt_model_obj->ID() !== $post_id
911
+			 )
912 912
 		) {
913 913
 			return;
914 914
 		}
Please login to merge, or discard this patch.
Spacing   +250 added lines, -250 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param  object $post    The post object of the cpt that was saved.
114 114
 	 * @return void
115 115
 	 */
116
-	abstract protected function _insert_update_cpt_item( $post_id, $post );
116
+	abstract protected function _insert_update_cpt_item($post_id, $post);
117 117
 
118 118
 
119 119
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param  string $post_id The ID of the cpt that was trashed
127 127
 	 * @return void
128 128
 	 */
129
-	abstract public function trash_cpt_item( $post_id );
129
+	abstract public function trash_cpt_item($post_id);
130 130
 
131 131
 
132 132
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param  string $post_id theID of the cpt that was untrashed
138 138
 	 * @return void
139 139
 	 */
140
-	abstract public function restore_cpt_item( $post_id );
140
+	abstract public function restore_cpt_item($post_id);
141 141
 
142 142
 
143 143
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param  string $post_id the ID of the cpt that was deleted
149 149
 	 * @return void
150 150
 	 */
151
-	abstract public function delete_cpt_item( $post_id );
151
+	abstract public function delete_cpt_item($post_id);
152 152
 
153 153
 
154 154
 
@@ -161,32 +161,32 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function _before_page_setup() {
163 163
 
164
-		$page = isset( $this->_req_data['page'] ) ? $this->_req_data['page'] : $this->page_slug;
164
+		$page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug;
165 165
 
166
-		$this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes );
166
+		$this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes);
167 167
 
168 168
 		//let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page
169
-		$this->_cpt_object = isset($this->_req_data['action']) && isset( $this->_cpt_routes[$this->_req_data['action']] ) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object( $page );
169
+		$this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']]) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object($page);
170 170
 
171 171
 		//tweak pagenow for page loading.
172
-		if( ! $this->_pagenow_map ) {
172
+		if ( ! $this->_pagenow_map) {
173 173
 			$this->_pagenow_map = array(
174 174
 				'create_new' => 'post-new.php',
175 175
 				'edit' => 'post.php',
176 176
 				'trash' => 'post.php'
177 177
 				);
178 178
 		}
179
-		add_action( 'current_screen', array( $this, 'modify_pagenow') );
179
+		add_action('current_screen', array($this, 'modify_pagenow'));
180 180
 
181 181
 
182 182
 		//TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param.
183 183
 		//get current page from autosave
184
-		$current_page = isset( $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] ) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL;
185
-		$this->_current_page = isset( $this->_req_data['current_page'] ) ? $this->_req_data['current_page'] : $current_page;
184
+		$current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL;
185
+		$this->_current_page = isset($this->_req_data['current_page']) ? $this->_req_data['current_page'] : $current_page;
186 186
 
187 187
 
188 188
 		//autosave... make sure its only for the correct page
189
-		if ( !empty($this->_current_page ) && $this->_current_page == $this->page_slug ) {
189
+		if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) {
190 190
 			//setup autosave ajax hook
191 191
 			//add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented
192 192
 		}
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @return void
204 204
 	 */
205
-	public function modify_pagenow( $current_screen ) {
205
+	public function modify_pagenow($current_screen) {
206 206
 		global $pagenow;
207 207
 		//possibly reset pagenow.
208
-		if ( ! empty( $this->_req_data['page'] ) && $this->_req_data['page'] == $this->page_slug && !empty( $this->_req_data['action'] ) && isset( $this->_pagenow_map[$this->_req_data['action'] ] ) ) {
208
+		if ( ! empty($this->_req_data['page']) && $this->_req_data['page'] == $this->page_slug && ! empty($this->_req_data['action']) && isset($this->_pagenow_map[$this->_req_data['action']])) {
209 209
 			$pagenow = $this->_pagenow_map[$this->_req_data['action']];
210 210
 		}
211 211
 	}
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	 * @param  array $ids an array of ids for containers that hold form inputs we want autosave to pickup.  Typically you would send along the id of a metabox container.
221 221
 	 * @return void
222 222
 	 */
223
-	protected function _register_autosave_containers( $ids ) {
224
-		$this->_autosave_containers = array_merge( $this->_autosave_fields, (array) $ids );
223
+	protected function _register_autosave_containers($ids) {
224
+		$this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids);
225 225
 	}
226 226
 
227 227
 
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$containers = array();
238 238
 
239
-		if ( empty( $wp_meta_boxes ) )
239
+		if (empty($wp_meta_boxes))
240 240
 			return;
241 241
 
242
-		$current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array();
242
+		$current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array();
243 243
 
244
-		foreach ( $current_metaboxes as $box_context ) {
245
-			foreach ( $box_context as $box_details ) {
246
-				foreach ( $box_details as $box ) {
247
-					if ( is_array( $box['callback'] ) && ( $box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks ) ){
244
+		foreach ($current_metaboxes as $box_context) {
245
+			foreach ($box_context as $box_details) {
246
+				foreach ($box_details as $box) {
247
+					if (is_array($box['callback']) && ($box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks)) {
248 248
 						$containers[] = $box['id'];
249 249
 					}
250 250
 				}
251 251
 			}
252 252
 		}
253 253
 
254
-		$this->_autosave_containers = array_merge( $this->_autosave_containers, $containers );
254
+		$this->_autosave_containers = array_merge($this->_autosave_containers, $containers);
255 255
 
256 256
 		//add hidden inputs container
257 257
 		$this->_autosave_containers[] = 'ee-cpt-hidden-inputs';
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 		wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2
269 269
 
270 270
 		//filter _autosave_containers
271
-		$containers = apply_filters( 'FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this );
272
-		$containers = apply_filters( 'FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers', $containers, $this );
271
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this);
272
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers', $containers, $this);
273 273
 
274
-		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers ); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
274
+		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
275 275
 
276 276
 		$unsaved_data_msg = array(
277
-			'eventmsg' => sprintf( __("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name),
277
+			'eventmsg' => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name),
278 278
 			'inputChanged' => 0
279 279
 			);
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	public function load_page_dependencies() {
287 287
 		try {
288 288
 			$this->_load_page_dependencies();
289
-		} catch ( EE_Error $e ) {
289
+		} catch (EE_Error $e) {
290 290
 			$e->get_error();
291 291
 		}
292 292
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	protected function _load_page_dependencies() {
303 303
 
304 304
 		//we only add stuff if this is a cpt_route!
305
-		if ( !$this->_cpt_route ) {
305
+		if ( ! $this->_cpt_route) {
306 306
 			parent::_load_page_dependencies();
307 307
 			return;
308 308
 		}
@@ -312,72 +312,72 @@  discard block
 block discarded – undo
312 312
 
313 313
 		//the following filters are for setting all the redirects on DEFAULT WP custom post type actions
314 314
 		//let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects!  Otherwise the redirects will happen on ALL post saves which wouldn't be good of course!
315
-		add_action('edit_form_after_title', array( $this, 'cpt_post_form_hidden_input') );
315
+		add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input'));
316 316
 
317 317
 		//inject our Admin page nav tabs...
318 318
 		//let's make sure the nav tabs are set if they aren't already
319 319
 		//if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs();
320
-		add_action('post_edit_form_tag', array( $this, 'inject_nav_tabs' ) );
320
+		add_action('post_edit_form_tag', array($this, 'inject_nav_tabs'));
321 321
 
322 322
 		//modify the post_updated messages array
323
-		add_action('post_updated_messages', array( $this, 'post_update_messages' ), 10 );
323
+		add_action('post_updated_messages', array($this, 'post_update_messages'), 10);
324 324
 
325 325
 		//add shortlink button to cpt edit screens.  We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts!
326
-		add_filter( 'pre_get_shortlink', array( $this, 'add_shortlink_button_to_editor' ), 10, 4 );
326
+		add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4);
327 327
 
328 328
 		//This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class.
329
-		if ( !empty($this->_labels['publishbox'] ) ) {
329
+		if ( ! empty($this->_labels['publishbox'])) {
330 330
 
331
-			$box_label = is_array( $this->_labels['publishbox'] ) && isset( $this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
331
+			$box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
332 332
 
333
-			remove_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' );
334
-			add_meta_box( 'submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' );
333
+			remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
334
+			add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
335 335
 		}
336 336
 
337 337
 		//let's add page_templates metabox if this cpt added support for it.
338
-		if ( $this->_supports_page_templates($this->_cpt_object->name) ) {
339
-			add_meta_box( 'page_templates', __('Page Template', 'event_espresso' ), array( $this, 'page_template_meta_box' ), $this->_cpt_routes[$this->_req_action], 'side', 'default' );
338
+		if ($this->_supports_page_templates($this->_cpt_object->name)) {
339
+			add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default');
340 340
 		}/**/
341 341
 
342 342
 
343 343
 		//this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form
344
-		if ( method_exists( $this, 'extra_permalink_field_buttons' ) )
345
-			add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 );
344
+		if (method_exists($this, 'extra_permalink_field_buttons'))
345
+			add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4);
346 346
 
347 347
 		//add preview button
348
-		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 );
348
+		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4);
349 349
 
350 350
 
351 351
 		//insert our own post_stati dropdown
352
-		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 );
352
+		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10);
353 353
 
354 354
 		//This allows adding additional information to the publish post submitbox on the wp post edit form
355
-		if ( method_exists( $this, 'extra_misc_actions_publish_box' ) )
356
-			add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 );
355
+		if (method_exists($this, 'extra_misc_actions_publish_box'))
356
+			add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10);
357 357
 
358 358
 		//This allows for adding additional stuff after the title field on the wp post edit form.  This is also before the wp_editor for post description field.
359
-		if ( method_exists( $this, 'edit_form_after_title' ) )
360
-			add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 );
359
+		if (method_exists($this, 'edit_form_after_title'))
360
+			add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10);
361 361
 
362 362
 
363 363
 		/**
364 364
 		 * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route.
365 365
 		 */
366
-		add_filter( 'clean_url', array( $this, 'switch_core_wp_urls_with_ours' ), 10, 3 );
366
+		add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3);
367 367
 
368 368
 
369 369
 		parent::_load_page_dependencies();
370 370
 
371 371
 		//notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes.
372 372
 		global $pagenow;
373
-		do_action( 'load-' . $pagenow );
373
+		do_action('load-'.$pagenow);
374 374
 
375 375
 		$this->modify_current_screen();
376
-		add_action( 'admin_enqueue_scripts', array( $this, 'setup_autosave_hooks'), 30 );
376
+		add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30);
377 377
 		//we route REALLY early.
378 378
 		try {
379 379
 			$this->_route_admin_request();
380
-		} catch ( EE_Error $e ) {
380
+		} catch (EE_Error $e) {
381 381
 			$e->get_error();
382 382
 		}
383 383
 	}
@@ -396,21 +396,21 @@  discard block
 block discarded – undo
396 396
 	 *
397 397
 	 * @return string possibly a new url for our route.
398 398
 	 */
399
-	public function switch_core_wp_urls_with_ours( $good_protocol_url, $original_url, $_context ) {
399
+	public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context) {
400 400
 		$routes_to_match = array(
401 401
 			0 => array(
402 402
 				'edit.php?post_type=espresso_attendees',
403 403
 				'admin.php?page=espresso_registrations&action=contact_list'
404 404
 				),
405 405
 			 1 => array(
406
-			 	'edit.php?post_type=' . $this->_cpt_object->name,
407
-			 	'admin.php?page=' . $this->_cpt_object->name
406
+			 	'edit.php?post_type='.$this->_cpt_object->name,
407
+			 	'admin.php?page='.$this->_cpt_object->name
408 408
 				)
409 409
 			);
410 410
 
411
-		foreach( $routes_to_match as $route_matches ) {
412
-			if ( strpos( $good_protocol_url, $route_matches[0] ) !== false ) {
413
-				return str_replace( $route_matches[0], $route_matches[1], $good_protocol_url );
411
+		foreach ($routes_to_match as $route_matches) {
412
+			if (strpos($good_protocol_url, $route_matches[0]) !== false) {
413
+				return str_replace($route_matches[0], $route_matches[1], $good_protocol_url);
414 414
 
415 415
 			}
416 416
 		}
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	 * @param string $cpt_name The cpt slug we're checking on.
427 427
 	 * @return bool True supported, false not.
428 428
 	 */
429
-	private function _supports_page_templates( $cpt_name ) {
429
+	private function _supports_page_templates($cpt_name) {
430 430
 		$cpt_args = EE_Register_CPTs::get_CPTs();
431
-		$cpt_args = isset( $cpt_args[$cpt_name] ) ? $cpt_args[$cpt_name]['args'] : array();
432
-		return ! empty( $cpt_args['page_templates'] ) ? TRUE : FALSE;
431
+		$cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array();
432
+		return ! empty($cpt_args['page_templates']) ? TRUE : FALSE;
433 433
 	}
434 434
 
435 435
 
@@ -444,9 +444,9 @@  discard block
 block discarded – undo
444 444
 	public function page_template_meta_box() {
445 445
 		global $post;
446 446
 		$template = '';
447
-		if ( count( get_page_templates( $post ) ) != 0 ) {
448
-			$page_template = get_post_meta( $post->ID, '_wp_page_template', TRUE );
449
-			$template = !empty( $page_template ) ? $page_template : '';
447
+		if (count(get_page_templates($post)) != 0) {
448
+			$page_template = get_post_meta($post->ID, '_wp_page_template', TRUE);
449
+			$template = ! empty($page_template) ? $page_template : '';
450 450
 		}
451 451
 		?>
452 452
 		<p><strong><?php _e('Template') ?></strong></p>
@@ -470,10 +470,10 @@  discard block
 block discarded – undo
470 470
 	 * @param  string $new_slug  what the slug is
471 471
 	 * @return string            The new html string for the permalink area
472 472
 	 */
473
-	public function preview_button_html( $return, $id, $new_title, $new_slug ) {
474
-		$post = get_post( $id );
475
-		if ( 'publish' != get_post_status( $post ) ) {
476
-			$return .= '<span_id="view-post-btn"><a href="' . wp_get_shortlink($id, 'post') . '" class="button button-small">' . __('Preview', 'event_espresso') . '</a></span>' . "\n";
473
+	public function preview_button_html($return, $id, $new_title, $new_slug) {
474
+		$post = get_post($id);
475
+		if ('publish' != get_post_status($post)) {
476
+			$return .= '<span_id="view-post-btn"><a href="'.wp_get_shortlink($id, 'post').'" class="button button-small">'.__('Preview', 'event_espresso').'</a></span>'."\n";
477 477
 		}
478 478
 		return $return;
479 479
 	}
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 			'cur_status' =>  $this->_cpt_model_obj->status(),
494 494
 			'statuses' => $statuses,
495 495
 			'cur_status_label' => $cur_status_label,
496
-			'localized_status_save' => sprintf( __('Save %s', 'event_espresso'), $cur_status_label )
496
+			'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label)
497 497
 			);
498 498
 
499 499
 		//we'll add a trash post status (WP doesn't add one for some reason)
500
-		if ( $this->_cpt_model_obj->status() == 'trash' ) {
500
+		if ($this->_cpt_model_obj->status() == 'trash') {
501 501
 			$template_args['cur_status_label'] = __('Trashed', 'event_espresso');
502 502
 			$statuses['trash'] = __('Trashed', 'event_espresso');
503 503
 			$template_args['statuses'] = $statuses;
504 504
 		}
505 505
 
506
-		$template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php';
507
-		EEH_Template::display_template( $template, $template_args );
506
+		$template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php';
507
+		EEH_Template::display_template($template, $template_args);
508 508
 	}
509 509
 
510 510
 
@@ -543,22 +543,22 @@  discard block
 block discarded – undo
543 543
 	public function do_extra_autosave_stuff() {
544 544
 
545 545
 		//next let's check for the autosave nonce (we'll use _verify_nonce )
546
-		$nonce = isset( $this->_req_data['autosavenonce'] ) ? $this->_req_data['autosavenonce'] : NULL;
547
-		$this->_verify_nonce( $nonce, 'autosave' );
546
+		$nonce = isset($this->_req_data['autosavenonce']) ? $this->_req_data['autosavenonce'] : NULL;
547
+		$this->_verify_nonce($nonce, 'autosave');
548 548
 
549 549
 
550 550
 		//make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it)
551
-		if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true);
551
+		if ( ! defined('DOING_AUTOSAVE')) define('DOING_AUTOSAVE', true);
552 552
 
553 553
 		//if we made it here then the nonce checked out.  Let's run our methods and actions
554
-		if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) {
555
-			call_user_func( array( $this, '_ee_autosave_' . $this->_current_view ) );
554
+		if (method_exists($this, '_ee_autosave_'.$this->_current_view)) {
555
+			call_user_func(array($this, '_ee_autosave_'.$this->_current_view));
556 556
 		} else {
557 557
 			$this->_template_args['success'] = TRUE;
558 558
 		}
559 559
 
560
-		do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this );
561
-		do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class( $this ), $this );
560
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this);
561
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this);
562 562
 
563 563
 		//now let's return json
564 564
 		$this->_return_json();
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
 	protected function _extend_page_config_for_cpt() {
579 579
 
580 580
 		//before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug
581
-		if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) )
581
+		if ((isset($this->_req_data['page']) && $this->_req_data['page'] != $this->page_slug))
582 582
 			return;
583 583
 
584 584
 		//set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes
585
-		if ( !empty( $this->_cpt_object ) ) {
586
-			$this->_page_routes = array_merge( array(
585
+		if ( ! empty($this->_cpt_object)) {
586
+			$this->_page_routes = array_merge(array(
587 587
 				'create_new' => '_create_new_cpt_item',
588 588
 				'edit' => '_edit_cpt_item'
589
-				), $this->_page_routes );
589
+				), $this->_page_routes);
590 590
 
591 591
 
592
-			$this->_page_config = array_merge( array(
592
+			$this->_page_config = array_merge(array(
593 593
 				'create_new' => array(
594 594
 					'nav' => array(
595 595
 						'label' => $this->_cpt_object->labels->add_new_item,
@@ -611,23 +611,23 @@  discard block
 block discarded – undo
611 611
 		}
612 612
 
613 613
 		//load the next section only if this is a matching cpt route as set in the cpt routes array.
614
-		if ( !isset( $this->_cpt_routes[$this->_req_action] ) )
614
+		if ( ! isset($this->_cpt_routes[$this->_req_action]))
615 615
 			return;
616 616
 
617 617
 
618
-		$this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE;
618
+		$this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? TRUE : FALSE;
619 619
 		//add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') );
620 620
 
621 621
 
622
-		if ( empty( $this->_cpt_object ) ) {
623
-			$msg = sprintf( __('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this) );
624
-			throw new EE_Error( $msg );
622
+		if (empty($this->_cpt_object)) {
623
+			$msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this));
624
+			throw new EE_Error($msg);
625 625
 		}
626 626
 
627 627
 
628
-		if ( $this->_cpt_route ) {
629
-			$id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
630
-			$this->_set_model_object( $id );
628
+		if ($this->_cpt_route) {
629
+			$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
630
+			$this->_set_model_object($id);
631 631
 		}
632 632
 
633 633
 	}
@@ -641,13 +641,13 @@  discard block
 block discarded – undo
641 641
 	 * @param int  $id The id to retrieve the model object for. If empty we set a default object.
642 642
 	 * @param bool $ignore_route_check
643 643
 	 */
644
-	protected function _set_model_object( $id = NULL, $ignore_route_check = false ) {
644
+	protected function _set_model_object($id = NULL, $ignore_route_check = false) {
645 645
 		$model = null;
646 646
 		if (
647
-			empty( $this->_cpt_model_names )
647
+			empty($this->_cpt_model_names)
648 648
 		    || (
649 649
 			     ! $ignore_route_check
650
-			     && ! isset( $this->_cpt_routes[ $this->_req_action ] )
650
+			     && ! isset($this->_cpt_routes[$this->_req_action])
651 651
 		    ) || (
652 652
 			     $this->_cpt_model_obj instanceof EE_CPT_Base
653 653
 			     && $this->_cpt_model_obj->ID() === $id
@@ -657,21 +657,21 @@  discard block
 block discarded – undo
657 657
 			return;
658 658
 		}
659 659
 		//if ignore_route_check is true, then get the model name via EE_Register_CPTs
660
-		if ( $ignore_route_check ) {
660
+		if ($ignore_route_check) {
661 661
 			$model_names = EE_Register_CPTs::get_cpt_model_names();
662
-			$post_type = get_post_type( $id );
663
-			if ( isset( $model_names[ $post_type ] ) ) {
664
-				$model = EE_Registry::instance()->load_model( $model_names[ $post_type ] );
662
+			$post_type = get_post_type($id);
663
+			if (isset($model_names[$post_type])) {
664
+				$model = EE_Registry::instance()->load_model($model_names[$post_type]);
665 665
 			}
666 666
 		} else {
667
-			$model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] );
667
+			$model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]);
668 668
 		}
669 669
 
670
-		if ( $model instanceof EEM_Base ) {
671
-			$this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object();
670
+		if ($model instanceof EEM_Base) {
671
+			$this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object();
672 672
 		}
673 673
 
674
-		do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' );
674
+		do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object');
675 675
 	}
676 676
 
677 677
 
@@ -685,47 +685,47 @@  discard block
 block discarded – undo
685 685
 	 */
686 686
 	public function admin_init_global() {
687 687
 
688
-		$post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL;
688
+		$post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL;
689 689
 
690 690
 		//its possible this is a new save so let's catch that instead
691
-		$post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post;
691
+		$post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post;
692 692
 		$post_type = $post ? $post->post_type : false;
693 693
 
694 694
 		$current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork';
695 695
 
696
-		$route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';
696
+		$route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';
697 697
 
698
-		add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 );
699
-		add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 );
698
+		add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3);
699
+		add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
700 700
 
701 701
 
702
-		if ( $post_type === $route_to_check ) {
703
-			add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 );
702
+		if ($post_type === $route_to_check) {
703
+			add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2);
704 704
 			//catch trashed wp redirect
705
-			add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 );
705
+			add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2);
706 706
 		}
707 707
 
708 708
 		//now let's filter redirect if we're on a revision page and the revision is for an event CPT.
709
-		$revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL;
709
+		$revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
710 710
 
711 711
 		/**var_dump($this->_req_data);
712 712
 		exit();/**/
713 713
 
714
-		if ( !empty( $revision ) ) {
715
-			$action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL;
714
+		if ( ! empty($revision)) {
715
+			$action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL;
716 716
 
717 717
 			//doing a restore?
718
-			if ( !empty( $action ) && $action == 'restore' ) {
718
+			if ( ! empty($action) && $action == 'restore') {
719 719
 
720 720
 				//get post for revision
721
-				$rev_post = get_post( $revision );
722
-				$rev_parent = get_post( $rev_post->post_parent );
721
+				$rev_post = get_post($revision);
722
+				$rev_parent = get_post($rev_post->post_parent);
723 723
 
724 724
 				//only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts.
725
-				if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) {
726
-					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 );
725
+				if ($rev_parent && $rev_parent->post_type == $this->page_slug) {
726
+					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2);
727 727
 					//restores of revisions
728
-					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 );
728
+					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2);
729 729
 				}
730 730
 			}
731 731
 
@@ -734,15 +734,15 @@  discard block
 block discarded – undo
734 734
 		//NOTE we ONLY want to run these hooks if we're on the right class for the given post type.  Otherwise we could see some really freaky things happen!
735 735
 
736 736
 
737
-		if ( $post_type && $post_type === $route_to_check ) {
737
+		if ($post_type && $post_type === $route_to_check) {
738 738
 			//$post_id, $post
739
-			add_action('save_post', array( $this, 'insert_update'), 10, 3 );
739
+			add_action('save_post', array($this, 'insert_update'), 10, 3);
740 740
 
741 741
 			//$post_id
742
-			add_action('trashed_post', array( $this, 'before_trash_cpt_item' ), 10 );
743
-			add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 );
744
-			add_action('untrashed_post', array( $this, 'before_restore_cpt_item'), 10 );
745
-			add_action('after_delete_post', array( $this, 'before_delete_cpt_item'), 10 );
742
+			add_action('trashed_post', array($this, 'before_trash_cpt_item'), 10);
743
+			add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10);
744
+			add_action('untrashed_post', array($this, 'before_restore_cpt_item'), 10);
745
+			add_action('after_delete_post', array($this, 'before_delete_cpt_item'), 10);
746 746
 		}
747 747
 
748 748
 	}
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
 	 *
757 757
 	 * @param int $post_id
758 758
 	 */
759
-	public function before_trash_cpt_item( $post_id ) {
760
-		$this->_set_model_object( $post_id, true );
759
+	public function before_trash_cpt_item($post_id) {
760
+		$this->_set_model_object($post_id, true);
761 761
 		//if our cpt object isn't existent then get out immediately.
762
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) {
762
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
763 763
 			return;
764 764
 		}
765
-		$this->trash_cpt_item( $post_id );
765
+		$this->trash_cpt_item($post_id);
766 766
 	}
767 767
 
768 768
 
@@ -772,13 +772,13 @@  discard block
 block discarded – undo
772 772
 	 *
773 773
 	 * @param $post_id
774 774
 	 */
775
-	public function before_restore_cpt_item( $post_id ) {
776
-		$this->_set_model_object( $post_id, true );
775
+	public function before_restore_cpt_item($post_id) {
776
+		$this->_set_model_object($post_id, true);
777 777
 		//if our cpt object isn't existent then get out immediately.
778
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) {
778
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
779 779
 			return;
780 780
 		}
781
-		$this->restore_cpt_item( $post_id );
781
+		$this->restore_cpt_item($post_id);
782 782
 	}
783 783
 
784 784
 
@@ -787,13 +787,13 @@  discard block
 block discarded – undo
787 787
 	 * Execute some basic checks before calling the delete_cpt_item method in the child class.
788 788
 	 * @param $post_id
789 789
 	 */
790
-	public function before_delete_cpt_item( $post_id ) {
791
-		$this->_set_model_object( $post_id, true );
790
+	public function before_delete_cpt_item($post_id) {
791
+		$this->_set_model_object($post_id, true);
792 792
 		//if our cpt object isn't existent then get out immediately.
793
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) {
793
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
794 794
 			return;
795 795
 		}
796
-		$this->delete_cpt_item( $post_id );
796
+		$this->delete_cpt_item($post_id);
797 797
 	}
798 798
 
799 799
 
@@ -805,15 +805,15 @@  discard block
 block discarded – undo
805 805
 	 * @return void
806 806
 	 */
807 807
 	public function verify_cpt_object() {
808
-		$label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label;
808
+		$label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label;
809 809
 		// verify event object
810
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) {
811
-			throw new EE_Error( sprintf( __('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso' ), $label ) );
810
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
811
+			throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso'), $label));
812 812
 		}
813 813
 		//if auto-draft then throw an error
814
-		if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) {
814
+		if ($this->_cpt_model_obj->get('status') == 'auto-draft') {
815 815
 			EE_Error::overwrite_errors();
816
-			EE_Error::add_error( sprintf( __('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label ), __FILE__, __FUNCTION__, __LINE__ );
816
+			EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label), __FILE__, __FUNCTION__, __LINE__);
817 817
 		}
818 818
 	}
819 819
 
@@ -842,22 +842,22 @@  discard block
 block discarded – undo
842 842
 	public function load_global_scripts_styles() {
843 843
 		parent::load_global_scripts_styles();
844 844
 
845
-		if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) {
845
+		if ($this->_cpt_model_obj instanceof EE_CPT_Base) {
846 846
 			//setup custom post status object for localize script but only if we've got a cpt object
847 847
 			$statuses = $this->_cpt_model_obj->get_custom_post_statuses();
848 848
 
849
-			if ( !empty($statuses) ) {
849
+			if ( ! empty($statuses)) {
850 850
 				//get ALL statuses!
851 851
 				$statuses = $this->_cpt_model_obj->get_all_post_statuses();
852 852
 				//setup object
853 853
 				$ee_cpt_statuses = array();
854
-				foreach ( $statuses as $status => $label ) {
854
+				foreach ($statuses as $status => $label) {
855 855
 					$ee_cpt_statuses[$status] = array(
856 856
 						'label' => $label,
857
-						'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label )
857
+						'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label)
858 858
 						);
859 859
 				}
860
-				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses );
860
+				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses);
861 861
 			}
862 862
 		}
863 863
 	}
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 	 * @param  bool   $update  Whether this is an update or a new save.
873 873
 	 * @return void
874 874
 	 */
875
-	public function insert_update( $post_id, $post, $update ) {
875
+	public function insert_update($post_id, $post, $update) {
876 876
 
877 877
 		//make sure that if this is a revision OR trash action that we don't do any updates!
878 878
 		if (
879
-			isset( $this->_req_data['action'] )
879
+			isset($this->_req_data['action'])
880 880
 			&& (
881 881
 				$this->_req_data['action'] == 'restore'
882 882
 				|| $this->_req_data['action'] == 'trash'
@@ -885,10 +885,10 @@  discard block
 block discarded – undo
885 885
 			return;
886 886
 		}
887 887
 
888
-		$this->_set_model_object( $post_id, true );
888
+		$this->_set_model_object($post_id, true);
889 889
 
890 890
 		//if our cpt object is not instantiated and its NOT the same post_id as what is triggering this callback, then exit.
891
-		if ( $update
891
+		if ($update
892 892
 			&& (
893 893
 			     ! $this->_cpt_model_obj instanceof EE_CPT_Base
894 894
 			     || $this->_cpt_model_obj->ID() !== $post_id
@@ -909,19 +909,19 @@  discard block
 block discarded – undo
909 909
 		}/**/ //TODO reactivate after autosave is implemented in 4.2
910 910
 
911 911
 		//take care of updating any selected page_template IF this cpt supports it.
912
-		if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) {
912
+		if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) {
913 913
 			$post->page_template = $this->_req_data['page_template'];
914
-			$page_templates = wp_get_theme()->get_page_templates( $post );
915
-			if ( 'default' != $this->_req_data['page_template']  && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) {
916
-				EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
914
+			$page_templates = wp_get_theme()->get_page_templates($post);
915
+			if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) {
916
+				EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
917 917
 			} else {
918
-				update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] );
918
+				update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']);
919 919
 			}
920 920
 		}
921 921
 
922
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
922
+		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
923 923
 			return; //TODO we'll remove this after reimplementing autosave in 4.2
924
-		$this->_insert_update_cpt_item( $post_id, $post );
924
+		$this->_insert_update_cpt_item($post_id, $post);
925 925
 	}
926 926
 
927 927
 
@@ -934,15 +934,15 @@  discard block
 block discarded – undo
934 934
 	 * @param  int    $post_id ID of the post
935 935
 	 * @return void
936 936
 	 */
937
-	public function dont_permanently_delete_ee_cpts( $post_id ) {
937
+	public function dont_permanently_delete_ee_cpts($post_id) {
938 938
 		//only do this if we're actually processing one of our CPTs
939 939
 		//if our cpt object isn't existent then get out immediately.
940
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) {
940
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
941 941
 			return;
942 942
 		}
943 943
 
944
-		delete_post_meta( $post_id, '_wp_trash_meta_status' );
945
-		delete_post_meta( $post_id, '_wp_trash_meta_time');
944
+		delete_post_meta($post_id, '_wp_trash_meta_status');
945
+		delete_post_meta($post_id, '_wp_trash_meta_time');
946 946
 
947 947
 		//our cpts may have comments so let's take care of that too
948 948
 		delete_post_meta($post_id, '_wp_trash_meta_comments_status');
@@ -960,14 +960,14 @@  discard block
 block discarded – undo
960 960
 	 * @param  int    $revision_id ID of revision being restored
961 961
 	 * @return void
962 962
 	 */
963
-	public function restore_revision( $post_id, $revision_id ) {
964
-		$this->_restore_cpt_item( $post_id, $revision_id );
963
+	public function restore_revision($post_id, $revision_id) {
964
+		$this->_restore_cpt_item($post_id, $revision_id);
965 965
 
966 966
 		//global action
967
-		do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
967
+		do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
968 968
 
969 969
 		//class specific action so you can limit hooking into a specific page.
970
-		do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id );
970
+		do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id);
971 971
 	}
972 972
 
973 973
 
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 	 * @param  int $revision_id ID of revision for item
979 979
 	 * @return void
980 980
 	 */
981
-	abstract protected function _restore_cpt_item( $post_id, $revision_id );
981
+	abstract protected function _restore_cpt_item($post_id, $revision_id);
982 982
 
983 983
 
984 984
 
@@ -997,9 +997,9 @@  discard block
 block discarded – undo
997 997
 	 */
998 998
 	public function modify_current_screen() {
999 999
 		//ONLY do this if the current page_route IS a cpt route
1000
-		if ( !$this->_cpt_route ) return;
1000
+		if ( ! $this->_cpt_route) return;
1001 1001
 		//routing things REALLY early b/c this is a cpt admin page
1002
-		set_current_screen( $this->_cpt_routes[$this->_req_action]);
1002
+		set_current_screen($this->_cpt_routes[$this->_req_action]);
1003 1003
 		$this->_current_screen = get_current_screen();
1004 1004
 		$this->_current_screen->base = 'event-espresso';
1005 1005
 		$this->_add_help_tabs(); //we make sure we add any help tabs back in!
@@ -1020,8 +1020,8 @@  discard block
 block discarded – undo
1020 1020
 	 * @param string $title The new title (or existing if there is no editor_title defined)
1021 1021
 	 * @return string
1022 1022
 	 */
1023
-	public function add_custom_editor_default_title( $title ) {
1024
-		return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title;
1023
+	public function add_custom_editor_default_title($title) {
1024
+		return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title;
1025 1025
 	}
1026 1026
 
1027 1027
 
@@ -1034,11 +1034,11 @@  discard block
 block discarded – undo
1034 1034
 	 * @param bool   $allow_slugs Whether to allow post slugs in the shortlink.
1035 1035
 	 * @return string
1036 1036
 	 */
1037
-	public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) {
1038
-		if ( !empty( $id ) && '' != get_option('permalink_structure') ) {
1039
-			$post = get_post( $id );
1040
-			if ( isset($post->post_type) && $this->page_slug == $post->post_type )
1041
-			$shortlink = home_url('?p=' . $post->ID);
1037
+	public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) {
1038
+		if ( ! empty($id) && '' != get_option('permalink_structure')) {
1039
+			$post = get_post($id);
1040
+			if (isset($post->post_type) && $this->page_slug == $post->post_type)
1041
+			$shortlink = home_url('?p='.$post->ID);
1042 1042
 		}
1043 1043
 		return $shortlink;
1044 1044
 	}
@@ -1051,10 +1051,10 @@  discard block
 block discarded – undo
1051 1051
 	 * @return void
1052 1052
 	 */
1053 1053
 	public function route_admin_request() {
1054
-		if ( $this->_cpt_route ) return;
1054
+		if ($this->_cpt_route) return;
1055 1055
 		try {
1056 1056
 			$this->_route_admin_request();
1057
-		} catch ( EE_Error $e ) {
1057
+		} catch (EE_Error $e) {
1058 1058
 			$e->get_error();
1059 1059
 		}
1060 1060
 	}
@@ -1067,12 +1067,12 @@  discard block
 block discarded – undo
1067 1067
 	 * @return string html
1068 1068
 	 */
1069 1069
 	public function cpt_post_form_hidden_input() {
1070
-		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />';
1070
+		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />';
1071 1071
 
1072 1072
 		//we're also going to add the route value and the current page so we can direct autosave parsing correctly
1073 1073
 		echo '<div id="ee-cpt-hidden-inputs">';
1074
-		echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />';
1075
-		echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />';
1074
+		echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />';
1075
+		echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />';
1076 1076
 		echo '</div>';
1077 1077
 	}
1078 1078
 
@@ -1085,12 +1085,12 @@  discard block
 block discarded – undo
1085 1085
 	 * @param  int    $status   Status for http header
1086 1086
 	 * @return string           new (or original) url to redirect to.
1087 1087
 	 */
1088
-	public function revision_redirect( $location, $status ) {
1088
+	public function revision_redirect($location, $status) {
1089 1089
 		//get revision
1090 1090
 		$rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
1091 1091
 
1092 1092
 		//can't do anything without revision so let's get out if not present
1093
-		if ( empty( $rev_id ) )
1093
+		if (empty($rev_id))
1094 1094
 			return $location;
1095 1095
 
1096 1096
 		//get rev_post_data
@@ -1104,8 +1104,8 @@  discard block
 block discarded – undo
1104 1104
 				'message' => 5
1105 1105
 			);
1106 1106
 
1107
-		$this->_process_notices( $query_args, TRUE );
1108
-		return self::add_query_args_and_nonce( $query_args, $admin_url );
1107
+		$this->_process_notices($query_args, TRUE);
1108
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1109 1109
 	}
1110 1110
 
1111 1111
 
@@ -1118,16 +1118,16 @@  discard block
 block discarded – undo
1118 1118
 	 * @param  string $context optional, defaults to display.  How to write the '&'
1119 1119
 	 * @return string          the link
1120 1120
 	 */
1121
-	public function modify_edit_post_link( $link, $id, $context ) {
1122
-		$post = get_post( $id );
1123
-		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] )
1121
+	public function modify_edit_post_link($link, $id, $context) {
1122
+		$post = get_post($id);
1123
+		if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])
1124 1124
 			return $link;
1125 1125
 		$query_args = array(
1126 1126
 			'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit',
1127 1127
 			'post' => $id
1128 1128
 			);
1129 1129
 
1130
-		return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1130
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1131 1131
 	}
1132 1132
 
1133 1133
 
@@ -1139,12 +1139,12 @@  discard block
 block discarded – undo
1139 1139
 	 * @param  bool   $force_delete whether this is forcing a hard delete instead of trash
1140 1140
 	 * @return string               new delete link
1141 1141
 	 */
1142
-	public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) {
1142
+	public function modify_delete_post_link($delete_link, $post_id, $force_delete) {
1143 1143
 		$post = get_post($post_id);
1144
-		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) )
1144
+		if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]))
1145 1145
 			return $delete_link;
1146 1146
 
1147
-		return add_query_arg( array('current_route' => 'trash' ), $delete_link );
1147
+		return add_query_arg(array('current_route' => 'trash'), $delete_link);
1148 1148
 	}
1149 1149
 
1150 1150
 
@@ -1155,16 +1155,16 @@  discard block
 block discarded – undo
1155 1155
 	 * @param  string $status   status
1156 1156
 	 * @return string           url to redirect to
1157 1157
 	 */
1158
-	public function cpt_trash_post_location_redirect( $location, $status ) {
1159
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) )
1158
+	public function cpt_trash_post_location_redirect($location, $status) {
1159
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post']))
1160 1160
 			return $location;
1161 1161
 
1162
-		$post = get_post( $this->_req_data['post'] );
1163
-		$query_args = array( 'action' => 'default' );
1162
+		$post = get_post($this->_req_data['post']);
1163
+		$query_args = array('action' => 'default');
1164 1164
 		$this->_cpt_object = get_post_type_object($post->post_type);
1165
-		EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) );
1166
-		$this->_process_notices( $query_args, TRUE );
1167
-		return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1165
+		EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name));
1166
+		$this->_process_notices($query_args, TRUE);
1167
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1168 1168
 	}
1169 1169
 
1170 1170
 
@@ -1179,21 +1179,21 @@  discard block
 block discarded – undo
1179 1179
 	 * @param  string $post_id  This is the 'ID' value of the wp_posts table
1180 1180
 	 * @return string           the new location to redirect to
1181 1181
 	 */
1182
-	public function cpt_post_location_redirect( $location, $post_id ) {
1182
+	public function cpt_post_location_redirect($location, $post_id) {
1183 1183
 		//we DO have a match so let's setup the url
1184 1184
 		//we have to get the post to determine our route
1185 1185
 		$post = get_post($post_id);
1186 1186
 		$edit_route = $this->_cpt_edit_routes[$post->post_type];
1187 1187
 
1188 1188
 		//shared query_args
1189
-		$query_args = array( 'action' => $edit_route, 'post' => $post_id );
1189
+		$query_args = array('action' => $edit_route, 'post' => $post_id);
1190 1190
 		$admin_url = $this->_admin_base_url;
1191 1191
 //		$append = '';
1192 1192
 
1193
-		if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) {
1194
-			$status = get_post_status( $post_id );
1195
-			if ( isset( $this->_req_data['publish'] ) ) {
1196
-				switch ( $status ) {
1193
+		if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) {
1194
+			$status = get_post_status($post_id);
1195
+			if (isset($this->_req_data['publish'])) {
1196
+				switch ($status) {
1197 1197
 					case 'pending':
1198 1198
 						$message = 8;
1199 1199
 						break;
@@ -1206,13 +1206,13 @@  discard block
 block discarded – undo
1206 1206
 			} else {
1207 1207
 					$message = 'draft' == $status ? 10 : 1;
1208 1208
 			}
1209
-		} else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) {
1209
+		} else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) {
1210 1210
 			$message = 2;
1211 1211
 //			$append = '#postcustom';
1212
-		} else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) {
1212
+		} else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) {
1213 1213
 			$message = 3;
1214 1214
 //			$append = '#postcustom';
1215
-		} elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) {
1215
+		} elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') {
1216 1216
 			$message = 7;
1217 1217
 		} else {
1218 1218
 			$message = 4;
@@ -1220,11 +1220,11 @@  discard block
 block discarded – undo
1220 1220
 
1221 1221
 		//change the message if the post type is not viewable on the frontend
1222 1222
 		$this->_cpt_object = get_post_type_object($post->post_type);
1223
-		$message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message;
1223
+		$message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message;
1224 1224
 
1225
-		$query_args = array_merge( array( 'message' => $message ), $query_args );
1226
-		$this->_process_notices( $query_args, TRUE );
1227
-		return self::add_query_args_and_nonce( $query_args, $admin_url );
1225
+		$query_args = array_merge(array('message' => $message), $query_args);
1226
+		$this->_process_notices($query_args, TRUE);
1227
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1228 1228
 	}
1229 1229
 
1230 1230
 
@@ -1256,10 +1256,10 @@  discard block
 block discarded – undo
1256 1256
 	 * @param  array $messages the original messages array
1257 1257
 	 * @return array           the new messages array
1258 1258
 	 */
1259
-	public function post_update_messages( $messages ) {
1259
+	public function post_update_messages($messages) {
1260 1260
 		global $post;
1261
-		$id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
1262
-		$id = empty( $id ) && is_object( $post ) ? $post->ID : NULL;
1261
+		$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
1262
+		$id = empty($id) && is_object($post) ? $post->ID : NULL;
1263 1263
 
1264 1264
 //		$post_type = $post ? $post->post_type : false;
1265 1265
 
@@ -1272,9 +1272,9 @@  discard block
 block discarded – undo
1272 1272
 			0 => '', //Unused. Messages start at index 1.
1273 1273
 
1274 1274
 			1 => sprintf(
1275
-				__( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1275
+				__('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1276 1276
 				$this->_cpt_object->labels->singular_name,
1277
-				'<a href="' . esc_url( get_permalink( $id )) . '">',
1277
+				'<a href="'.esc_url(get_permalink($id)).'">',
1278 1278
 				'</a>'
1279 1279
 			),
1280 1280
 
@@ -1282,38 +1282,38 @@  discard block
 block discarded – undo
1282 1282
 
1283 1283
 			3 => __('Custom field deleted.'),
1284 1284
 
1285
-			4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ),
1285
+			4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1286 1286
 
1287
-			5 => isset( $_GET['revision'] ) ? sprintf( __('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], FALSE ) ) : FALSE,
1287
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], FALSE)) : FALSE,
1288 1288
 
1289 1289
 			6 => sprintf(
1290
-					__( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1290
+					__('%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1291 1291
 					$this->_cpt_object->labels->singular_name,
1292
-					'<a href="' . esc_url( get_permalink( $id )) . '">',
1292
+					'<a href="'.esc_url(get_permalink($id)).'">',
1293 1293
 					'</a>'
1294 1294
 				),
1295 1295
 
1296
-			7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ),
1296
+			7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1297 1297
 
1298 1298
 			8 => sprintf(
1299 1299
 				__('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'),
1300 1300
 				$this->_cpt_object->labels->singular_name,
1301
-				'<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">',
1301
+				'<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">',
1302 1302
 				'</a>'
1303 1303
 			),
1304 1304
 
1305 1305
 			9 => sprintf(
1306
-				__( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1306
+				__('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1307 1307
 				$this->_cpt_object->labels->singular_name,
1308
-				'<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>',
1309
-				'<a target="_blank" href="' . esc_url( get_permalink( $id )),
1308
+				'<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>',
1309
+				'<a target="_blank" href="'.esc_url(get_permalink($id)),
1310 1310
 				'</a>'
1311 1311
 			),
1312 1312
 
1313 1313
 			10 => sprintf(
1314 1314
 				__('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'),
1315 1315
 				$this->_cpt_object->labels->singular_name,
1316
-				'<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) ,
1316
+				'<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))),
1317 1317
 				'</a>'
1318 1318
 			)
1319 1319
 		);
@@ -1340,24 +1340,24 @@  discard block
 block discarded – undo
1340 1340
 		$post_type_object = $this->_cpt_object;
1341 1341
 		$title = $post_type_object->labels->add_new_item;
1342 1342
 		$editing = TRUE;
1343
-		wp_enqueue_script( 'autosave' );
1344
-		$post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE );
1343
+		wp_enqueue_script('autosave');
1344
+		$post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE);
1345 1345
 		$post_ID = $post->ID;
1346 1346
 		$is_IE = $is_IE;
1347 1347
 
1348
-		add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) );
1348
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1349 1349
 
1350 1350
 		//modify the default editor title field with default title.
1351
-		add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 );
1351
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1352 1352
 
1353
-		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1353
+		include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1354 1354
 	}
1355 1355
 
1356 1356
 
1357 1357
 
1358 1358
 
1359 1359
 	public function add_new_admin_page_global() {
1360
-		$admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php';
1360
+		$admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php';
1361 1361
 		?>
1362 1362
 		<script type="text/javascript">
1363 1363
 			adminpage = '<?php echo $admin_page; ?>';
@@ -1379,16 +1379,16 @@  discard block
 block discarded – undo
1379 1379
 	 */
1380 1380
 	protected function _edit_cpt_item() {
1381 1381
 		global $post, $title, $is_IE, $post_type, $post_type_object;
1382
-		$post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
1383
-		$post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL;
1382
+		$post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
1383
+		$post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL;
1384 1384
 
1385
-		if ( empty ( $post ) ) {
1386
-			wp_die( __('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?') );
1385
+		if (empty ($post)) {
1386
+			wp_die(__('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?'));
1387 1387
 		}
1388 1388
 
1389
-		if ( ! empty( $_GET['get-post-lock'] ) ) {
1390
-			wp_set_post_lock( $post_id );
1391
-			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
1389
+		if ( ! empty($_GET['get-post-lock'])) {
1390
+			wp_set_post_lock($post_id);
1391
+			wp_redirect(get_edit_post_link($post_id, 'url'));
1392 1392
 			exit();
1393 1393
 		}
1394 1394
 
@@ -1398,32 +1398,32 @@  discard block
 block discarded – undo
1398 1398
 		$post_type = $this->_cpt_routes[$this->_req_action];
1399 1399
 		$post_type_object = $this->_cpt_object;
1400 1400
 
1401
-		if ( ! wp_check_post_lock( $post->ID ) ) {
1402
-			$active_post_lock = wp_set_post_lock( $post->ID );
1401
+		if ( ! wp_check_post_lock($post->ID)) {
1402
+			$active_post_lock = wp_set_post_lock($post->ID);
1403 1403
 			//wp_enqueue_script('autosave');
1404 1404
 		}
1405 1405
 
1406 1406
 		$title = $this->_cpt_object->labels->edit_item;
1407 1407
 
1408
-		add_action('admin_footer', '_admin_notice_post_locked' );
1408
+		add_action('admin_footer', '_admin_notice_post_locked');
1409 1409
 
1410
-		if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) {
1411
-			$create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this );
1410
+		if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) {
1411
+			$create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this);
1412 1412
 
1413
-			$post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' );
1413
+			$post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php');
1414 1414
 		}
1415 1415
 
1416
-		if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) {
1416
+		if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) {
1417 1417
 			wp_enqueue_script('admin-comments');
1418 1418
 			enqueue_comment_hotkeys_js();
1419 1419
 		}
1420 1420
 
1421
-		add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) );
1421
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1422 1422
 
1423 1423
 		//modify the default editor title field with default title.
1424
-		add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 );
1424
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1425 1425
 
1426
-		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1426
+		include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1427 1427
 
1428 1428
 	}
1429 1429
 
Please login to merge, or discard this patch.
finalize_registration/EE_SPCO_Reg_Step_Finalize_Registration.class.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param    EE_Checkout $checkout
21 21
 	 * @return 	\EE_SPCO_Reg_Step_Finalize_Registration
22 22
 	 */
23
-	public function __construct( EE_Checkout $checkout ) {
23
+	public function __construct(EE_Checkout $checkout) {
24 24
 		$this->_slug = 'finalize_registration';
25 25
 		$this->_name = __('Finalize Registration', 'event_espresso');
26 26
 		$this->_submit_button_text = $this->_name;
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function initialize_reg_step() {
48 48
 		// there's actually no reg form to process if this is the final step
49
-		if ( $this->is_current_step() ) {
49
+		if ($this->is_current_step()) {
50 50
 			$this->checkout->step = $_REQUEST['step'] = $this->slug();
51
-			$this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step';
51
+			$this->checkout->action = $_REQUEST['action'] = 'process_reg_step';
52 52
 			$this->checkout->generate_reg_form = false;
53 53
 		}
54 54
 		return true;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function process_reg_step() {
73 73
 		// ensure all data gets refreshed from the db
74
-		$this->checkout->refresh_all_entities( true );
74
+		$this->checkout->refresh_all_entities(true);
75 75
 		// ensures that all details and statuses for transaction, registration, and payments are updated
76 76
 		$txn_update_params = $this->_finalize_transaction();
77 77
 		// DEBUG LOG
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
 		//	)
86 86
 		//);
87 87
 		// set a hook point
88
-		do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params );
88
+		do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params);
89 89
 		// check if transaction has a primary registrant and that it has a related Attendee object
90
-		if ( $this->checkout->transaction_has_primary_registrant() ) {
90
+		if ($this->checkout->transaction_has_primary_registrant()) {
91 91
 			// setup URL for redirect
92 92
 			$this->checkout->redirect_url = add_query_arg(
93
-				array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ),
93
+				array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()),
94 94
 				$this->checkout->thank_you_page_url
95 95
 			);
96 96
 		} else {
97
-			EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
97
+			EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
98 98
 			$this->checkout->redirect = false;
99 99
 			$this->checkout->continue_reg = false;
100 100
 			return false;
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		// you don't have to go home but you can't stay here !
103 103
 		$this->checkout->redirect = true;
104 104
 		$this->checkout->continue_reg = true;
105
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
106
-		if ( ! ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) ) {
105
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
106
+		if ( ! ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site())) {
107 107
 			// mark this reg step as completed
108 108
 			$this->set_completed();
109 109
 		}
@@ -120,24 +120,24 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function _finalize_transaction() {
122 122
 		/** @type EE_Transaction_Processor $transaction_processor */
123
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
123
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
124 124
 		//set revisit flag in txn processor
125
-		$transaction_processor->set_revisit( $this->checkout->revisit );
125
+		$transaction_processor->set_revisit($this->checkout->revisit);
126 126
 		// at this point we'll consider a TXN to not have been abandoned
127
-		$transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction );
128
-		if ( $this->checkout->cart instanceof EE_Cart ) {
127
+		$transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction);
128
+		if ($this->checkout->cart instanceof EE_Cart) {
129 129
 			// save TXN data to the cart
130
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
130
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
131 131
 		}
132 132
 		/** @type EE_Transaction_Payments $transaction_payments */
133
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
133
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
134 134
 		// maybe update status, but don't save transaction just yet
135
-		$transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false );
135
+		$transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false);
136 136
 		// If the selected method of payment used an off-site gateway...
137
-		if ( $this->checkout->payment_method instanceof EE_Payment_Method ) {
138
-			$is_revisit = filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN );
139
-			if ( $this->checkout->payment_method->is_off_site() ) {
140
-				$gateway= $this->checkout->payment_method->type_obj()->get_gateway();
137
+		if ($this->checkout->payment_method instanceof EE_Payment_Method) {
138
+			$is_revisit = filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN);
139
+			if ($this->checkout->payment_method->is_off_site()) {
140
+				$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
141 141
 				if (
142 142
 					! $is_revisit
143 143
 					&& $gateway instanceof EE_Offsite_Gateway
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 					)
148 148
 				) {
149 149
 					// first time through SPCO and we are processing the payment notification NOW
150
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
150
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
151 151
 				} else {
152 152
 					// do NOT trigger notifications because this is a revisit, OR it was already done during the IPN
153
-					remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' );
153
+					remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications');
154 154
 					add_filter(
155 155
 						'FHEE__EED_Messages___maybe_registration__deliver_notifications',
156 156
 						'__return_false',
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
 				}
160 160
 			} else if (
161 161
 				// if SPCO revisit and TXN status has changed due to a payment
162
-				$is_revisit && ( $this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated() )
162
+				$is_revisit && ($this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated())
163 163
 			) {
164 164
 				// send out notifications
165
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
166
-			} else if ( ! $is_revisit ) {
167
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
165
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
166
+			} else if ( ! $is_revisit) {
167
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
168 168
 			}
169 169
 		}
170 170
 		// this will result in the base session properties getting saved to the TXN_Session_data field
171
-		$this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true ));
171
+		$this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true));
172 172
 
173 173
 		// update the TXN if payment conditions have changed
174 174
 		return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment(
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * @return boolean
186 186
 	 */
187 187
 	public function update_reg_step() {
188
-		EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' );
188
+		EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0');
189 189
 	 }
190 190
 
191 191
 
Please login to merge, or discard this patch.
shortcodes/espresso_txn_page/EES_Espresso_Txn_Page.shortcode.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
 				$gateway = $payment_method->type_obj()->get_gateway();
97 97
 				if (
98 98
 					$gateway instanceof EE_Offsite_Gateway
99
-				    && $gateway->handle_IPN_in_this_request(
99
+					&& $gateway->handle_IPN_in_this_request(
100 100
 						\EE_Registry::instance()->REQ->params(),
101 101
 						true
102 102
 					)
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *  @return 	void
43 43
 	 */
44 44
 	public static function set_hooks() {
45
-		add_action( 'wp_loaded', array( 'EES_Espresso_Txn_Page', 'set_definitions' ), 2 );
45
+		add_action('wp_loaded', array('EES_Espresso_Txn_Page', 'set_definitions'), 2);
46 46
 	}
47 47
 
48 48
 	/**
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 *  @return 	void
64 64
 	 */
65 65
 	public static function set_definitions() {
66
-		define( 'TXN_PAGE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
67
-		define( 'TXN_PAGE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
66
+		define('TXN_PAGE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
67
+		define('TXN_PAGE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
68 68
 	}
69 69
 
70 70
 
@@ -77,22 +77,22 @@  discard block
 block discarded – undo
77 77
 	 *  @param 	 WP $WP
78 78
 	 *  @return 	void
79 79
 	 */
80
-	public function run( WP $WP ) {
81
-		if ( EE_Registry::instance()->REQ->is_set('e_reg_url_link' )){
82
-			$this->_current_txn = EE_Registry::instance()->load_model( 'Transaction' )->get_transaction_from_reg_url_link();
80
+	public function run(WP $WP) {
81
+		if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
82
+			$this->_current_txn = EE_Registry::instance()->load_model('Transaction')->get_transaction_from_reg_url_link();
83 83
 		} else {
84 84
 			$this->_current_txn = null;
85 85
 		}
86
-		if ( $this->_current_txn instanceof EE_Transaction ) {
86
+		if ($this->_current_txn instanceof EE_Transaction) {
87 87
 			//EE_Registry::instance()->load_helper( 'Debug_Tools' );
88 88
 			//EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $this->_current_txn ), true, 	'EE_Transaction: ' . $this->_current_txn->ID() );
89 89
 			$payment_method = null;
90
-			$payment_method_slug = EE_Registry::instance()->REQ->get( 'ee_payment_method', null );
91
-			if( $payment_method_slug ) {
92
-				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug( $payment_method_slug );
90
+			$payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null);
91
+			if ($payment_method_slug) {
92
+				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug);
93 93
 			}
94 94
 
95
-			if ( $payment_method instanceof EE_Payment_Method && $payment_method->is_off_site() ) {
95
+			if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) {
96 96
 				$gateway = $payment_method->type_obj()->get_gateway();
97 97
 				if (
98 98
 					$gateway instanceof EE_Offsite_Gateway
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 					)
103 103
 				) {
104 104
 					/** @type EE_Payment_Processor $payment_processor */
105
-					$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
106
-					$payment_processor->process_ipn( $_REQUEST, $this->_current_txn, $payment_method );
105
+					$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
106
+					$payment_processor->process_ipn($_REQUEST, $this->_current_txn, $payment_method);
107 107
 				}
108 108
 			}
109 109
 			//allow gateways to add a filter to stop rendering the page
110
-			if( apply_filters( 'FHEE__EES_Espresso_Txn_Page__run__exit', FALSE ) ){
110
+			if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', FALSE)) {
111 111
 				exit;
112 112
 			}
113 113
 		}
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 *  @param		array 	$attributes
125 125
 	 *  @return 	string
126 126
 	 */
127
-	public function process_shortcode( $attributes = array() ) {
128
-		return __( 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso' );
127
+	public function process_shortcode($attributes = array()) {
128
+		return __('This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso');
129 129
 	}
130 130
 
131 131
 
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 
184 184
 
185 185
 	/**
186
-	* init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
187
-	*
188
-	* @access public
189
-	* @return void
190
-	*/
186
+	 * init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
187
+	 *
188
+	 * @access public
189
+	 * @return void
190
+	 */
191 191
 	public function init() {
192 192
 		EE_Admin::debug_log( __METHOD__ );
193 193
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 
475 475
 
476 476
 	/**
477
-	* admin_init
478
-	*
479
-	* @access public
480
-	* @return void
481
-	*/
477
+	 * admin_init
478
+	 *
479
+	 * @access public
480
+	 * @return void
481
+	 */
482 482
 	public function admin_init() {
483 483
 
484 484
 		/**
@@ -631,11 +631,11 @@  discard block
 block discarded – undo
631 631
 
632 632
 
633 633
 	/**
634
-	* 	dismiss_persistent_admin_notice
635
-	*
636
-	*	@access 	public
637
-	* 	@return 		void
638
-	*/
634
+	 * 	dismiss_persistent_admin_notice
635
+	 *
636
+	 *	@access 	public
637
+	 * 	@return 		void
638
+	 */
639 639
 	public function dismiss_ee_nag_notice_callback() {
640 640
 		EE_Error::dismiss_persistent_admin_notice();
641 641
 	}
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function instance() {
42 42
 		// check if class object is instantiated
43
-		if (  ! self::$_instance instanceof EE_Admin ) {
43
+		if ( ! self::$_instance instanceof EE_Admin) {
44 44
 			self::$_instance = new self();
45 45
 		}
46 46
 		return self::$_instance;
@@ -57,30 +57,30 @@  discard block
 block discarded – undo
57 57
 		// define global EE_Admin constants
58 58
 		$this->_define_all_constants();
59 59
 		// set autoloaders for our admin page classes based on included path information
60
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
60
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
61 61
 		// admin hooks
62
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
62
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
63 63
 		// load EE_Request_Handler early
64
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
65
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
64
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
65
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
66 66
 		// post shortcode tracking
67 67
 		add_action(
68 68
 			'AHEE__EE_System__initialize_last',
69
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' )
69
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin')
70 70
 		);
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103 103
 	}
104 104
 
105 105
 
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
 	 * @param 	string 	$plugin
113 113
 	 * @return 	array
114 114
 	 */
115
-	public function filter_plugin_actions( $links, $plugin ) {
115
+	public function filter_plugin_actions($links, $plugin) {
116 116
 		// set $main_file in stone
117 117
 		static $main_file;
118 118
 		// if $main_file is not set yet
119
-		if ( ! $main_file ) {
120
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
119
+		if ( ! $main_file) {
120
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
121 121
 		}
122
-		 if ( $plugin === $main_file ) {
122
+		 if ($plugin === $main_file) {
123 123
 		 	// compare current plugin to this one
124
-			if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) {
125
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
126
-				array_unshift( $links, $maintenance_link );
124
+			if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) {
125
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
126
+				array_unshift($links, $maintenance_link);
127 127
 			} else {
128
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
129
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
128
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
129
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
130 130
 				// add before other links
131
-				array_unshift( $links, $org_settings_link, $events_link );
131
+				array_unshift($links, $org_settings_link, $events_link);
132 132
 			}
133 133
 		}
134 134
 		return $links;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *	@return void
144 144
 	 */
145 145
 	public function get_request() {
146
-		EE_Registry::instance()->load_core( 'Request_Handler' );
147
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
146
+		EE_Registry::instance()->load_core('Request_Handler');
147
+		EE_Registry::instance()->load_core('CPT_Strategy');
148 148
 	}
149 149
 
150 150
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param array $admin_page_folder_names
157 157
 	 * @return array
158 158
 	 */
159
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
159
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
160 160
 		return array(
161
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
162
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
163
-			'support' => EE_ADMIN_PAGES . 'support' . DS
161
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
162
+			'about' => EE_ADMIN_PAGES.'about'.DS,
163
+			'support' => EE_ADMIN_PAGES.'support'.DS
164 164
 		);
165 165
 	}
166 166
 
@@ -174,31 +174,31 @@  discard block
 block discarded – undo
174 174
 	*/
175 175
 	public function init() {
176 176
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
177
-		if ( EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance ){
177
+		if (EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) {
178 178
 			//ok so we want to enable the entire admin
179
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
180
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
181
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
179
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
180
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
181
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
182 182
 			//at a glance dashboard widget
183
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 );
183
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
184 184
 			//filter for get_edit_post_link used on comments for custom post types
185
-			add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 );
185
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2);
186 186
 		}
187 187
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
188
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
188
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
189 189
 			try {
190 190
 				//this loads the controller for the admin pages which will setup routing etc
191
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
192
-			} catch ( EE_Error $e ) {
191
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
192
+			} catch (EE_Error $e) {
193 193
 				$e->get_error();
194 194
 			}
195 195
 		}
196
-		add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
196
+		add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
197 197
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
198
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
199
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
198
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
199
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
200 200
 		//exclude EE critical pages from all nav menus and wp_list_pages
201
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
201
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
202 202
 	}
203 203
 
204 204
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	 * @param  object $post_type WP post type object
212 212
 	 * @return object            WP post type object
213 213
 	 */
214
-	public function remove_pages_from_nav_menu( $post_type ) {
214
+	public function remove_pages_from_nav_menu($post_type) {
215 215
 		//if this isn't the "pages" post type let's get out
216
-		if ( $post_type->name !== 'page' ) {
216
+		if ($post_type->name !== 'page') {
217 217
 			return $post_type;
218 218
 		}
219 219
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -233,28 +233,28 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function enable_hidden_ee_nav_menu_metaboxes() {
235 235
 		global $wp_meta_boxes, $pagenow;
236
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
236
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
237 237
 			return;
238 238
 		}
239 239
 		$user = wp_get_current_user();
240 240
 		//has this been done yet?
241
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
241
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
242 242
 			return;
243 243
 		}
244 244
 
245
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
246
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) );
245
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
246
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page'));
247 247
 
248
-		if ( is_array( $hidden_meta_boxes ) ) {
249
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
250
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
251
-					unset( $hidden_meta_boxes[ $key ] );
248
+		if (is_array($hidden_meta_boxes)) {
249
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
250
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
251
+					unset($hidden_meta_boxes[$key]);
252 252
 				}
253 253
 			}
254 254
 		}
255 255
 
256
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
257
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
256
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
257
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
258 258
 	}
259 259
 
260 260
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return void
274 274
 	 */
275 275
 	public function register_custom_nav_menu_boxes() {
276
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
276
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
277 277
 	}
278 278
 
279 279
 
@@ -289,17 +289,17 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string  the (maybe) modified link
291 291
 	 */
292
-	public function modify_edit_post_link( $link, $id ) {
293
-		if ( ! $post = get_post( $id ) ){
292
+	public function modify_edit_post_link($link, $id) {
293
+		if ( ! $post = get_post($id)) {
294 294
 			return $link;
295 295
 		}
296
-		if ( $post->post_type === 'espresso_attendees' ) {
296
+		if ($post->post_type === 'espresso_attendees') {
297 297
 			$query_args = array(
298 298
 				'action' => 'edit_attendee',
299 299
 				'post' => $id
300 300
 			);
301 301
 			EE_Registry::instance()->load_helper('URL');
302
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
302
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
303 303
 		}
304 304
 		return $link;
305 305
 	}
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		global $nav_menu_selected_id;
312 312
 
313 313
 		$db_fields = false;
314
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
314
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
315 315
 		$current_tab = 'event-archives';
316 316
 
317 317
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
 		?>
331 331
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
332 332
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
333
-				<li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>>
334
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
335
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
333
+				<li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>>
334
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
335
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
336 336
 					</a>
337 337
 				</li>
338 338
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -350,13 +350,13 @@  discard block
 block discarded – undo
350 350
  			<?php */ ?>
351 351
 
352 352
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
353
-			echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
353
+			echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
354 354
 			?>">
355 355
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
356 356
 					<?php
357 357
 					$pages = $this->_get_extra_nav_menu_pages_items();
358 358
 					$args['walker'] = $walker;
359
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
359
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
360 360
 					?>
361 361
 				</ul>
362 362
 			</div><!-- /.tabs-panel -->
@@ -364,18 +364,18 @@  discard block
 block discarded – undo
364 364
 			<p class="button-controls">
365 365
 				<span class="list-controls">
366 366
 					<a href="<?php
367
-						echo esc_url( add_query_arg(
367
+						echo esc_url(add_query_arg(
368 368
 							array(
369 369
 								'extra-nav-menu-pages-tab' => 'event-archives',
370 370
 								'selectall' => 1,
371 371
 							),
372
-							remove_query_arg( $removed_args )
372
+							remove_query_arg($removed_args)
373 373
 						));
374 374
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
375 375
 				</span>
376 376
 
377 377
 				<span class="add-to-menu">
378
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
378
+					<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" />
379 379
 					<span class="spinner"></span>
380 380
 				</span>
381 381
 			</p>
@@ -396,10 +396,10 @@  discard block
 block discarded – undo
396 396
 	private function _get_extra_nav_menu_pages_items() {
397 397
 		$menuitems[] = array(
398 398
 			'title' => __('Event List', 'event_espresso'),
399
-			'url' => get_post_type_archive_link( 'espresso_events' ),
399
+			'url' => get_post_type_archive_link('espresso_events'),
400 400
 			'description' => __('Archive page for all events.', 'event_espresso')
401 401
 		);
402
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
402
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
403 403
 	}
404 404
 
405 405
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 	 * @param $menu_item_values
412 412
 	 * @return stdClass
413 413
 	 */
414
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
414
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
415 415
 		$menu_item = new stdClass();
416 416
 		$keys = array(
417 417
 			'ID' => 0,
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
 			'xfn' => ''
432 432
 		);
433 433
 
434
-		foreach ( $keys as $key => $value) {
435
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
434
+		foreach ($keys as $key => $value) {
435
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
436 436
 		}
437 437
 		return $menu_item;
438 438
 	}
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 		 * - check if doing post processing of one of EE CPTs
472 472
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
473 473
 		 */
474
-		if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) {
475
-			EE_Registry::instance()->load_core( 'Register_CPTs' );
476
-			EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
474
+		if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') {
475
+			EE_Registry::instance()->load_core('Register_CPTs');
476
+			EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
477 477
 		}
478 478
 
479 479
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
483 483
 		 */
484 484
 		global $pagenow;
485
-		if ( $pagenow === 'options-reading.php' ) {
486
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
485
+		if ($pagenow === 'options-reading.php') {
486
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
487 487
 		}
488 488
 
489 489
 	}
@@ -495,25 +495,25 @@  discard block
 block discarded – undo
495 495
 	 * @param string $output  Current output.
496 496
 	 * @return string
497 497
 	 */
498
-	public function modify_dropdown_pages( $output ) {
498
+	public function modify_dropdown_pages($output) {
499 499
 		//get critical pages
500 500
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
501 501
 
502 502
 		//split current output by line break for easier parsing.
503
-		$split_output = explode( "\n", $output );
503
+		$split_output = explode("\n", $output);
504 504
 
505 505
 		//loop through to remove any critical pages from the array.
506
-		foreach ( $critical_pages as $page_id ) {
507
-			$needle = 'value="' . $page_id . '"';
508
-			foreach( $split_output as $key => $haystack ) {
509
-				if( strpos( $haystack, $needle ) !== false ) {
510
-					unset( $split_output[$key] );
506
+		foreach ($critical_pages as $page_id) {
507
+			$needle = 'value="'.$page_id.'"';
508
+			foreach ($split_output as $key => $haystack) {
509
+				if (strpos($haystack, $needle) !== false) {
510
+					unset($split_output[$key]);
511 511
 				}
512 512
 			}
513 513
 		}
514 514
 
515 515
 		//replace output with the new contents
516
-		return implode( "\n", $split_output );
516
+		return implode("\n", $split_output);
517 517
 	}
518 518
 
519 519
 
@@ -527,37 +527,37 @@  discard block
 block discarded – undo
527 527
 	public function enqueue_admin_scripts() {
528 528
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
529 529
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
530
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
530
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
531 531
 		// register cookie script for future dependencies
532
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
532
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
533 533
 		// jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
534
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
534
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
535 535
 			// register jQuery Validate
536
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
536
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
537 537
 		}
538 538
 		//joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' );
539
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
539
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
540 540
 			//joyride style
541
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
542
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
543
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
541
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
542
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
543
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
544 544
 			//joyride JS
545
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
545
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
546 546
 			// wanna go for a joyride?
547 547
 			wp_enqueue_style('ee-joyride-css');
548 548
 			wp_enqueue_script('jquery-joyride');
549 549
 		}
550 550
 		//qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' );
551
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
551
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
552 552
 			EE_Registry::instance()->load_helper('Qtip_Loader');
553 553
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
554 554
 		}
555 555
 		//accounting.js library
556 556
 		// @link http://josscrowcroft.github.io/accounting.js/
557
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
558
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
559
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
560
-			wp_enqueue_script( 'ee-accounting' );
557
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
558
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
559
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
560
+			wp_enqueue_script('ee-accounting');
561 561
 			// array of settings to get converted to JSON array via wp_localize_script
562 562
 			$currency_config = array(
563 563
 				'currency' => array(
@@ -604,11 +604,11 @@  discard block
 block discarded – undo
604 604
 	public function get_persistent_admin_notices() {
605 605
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
606 606
 		$args = array(
607
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
608
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
607
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
608
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
609 609
 		);
610
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
611
-		echo EE_Error::get_persistent_admin_notices( $return_url );
610
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
611
+		echo EE_Error::get_persistent_admin_notices($return_url);
612 612
 	}
613 613
 
614 614
 
@@ -629,26 +629,26 @@  discard block
 block discarded – undo
629 629
 	 * @param $elements
630 630
 	 * @return array
631 631
 	 */
632
-	public function dashboard_glance_items( $elements ) {
632
+	public function dashboard_glance_items($elements) {
633 633
 		$events = EEM_Event::instance()->count();
634
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
635
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
634
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
635
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
636 636
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
637 637
 		$registrations = EEM_Registration::instance()->count(
638 638
 			array(
639 639
 				array(
640
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
640
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
641 641
 				)
642 642
 			)
643 643
 		);
644
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
645
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
644
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
645
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
646 646
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
647 647
 
648
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
648
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
649 649
 
650
-		foreach ( $items as $type => $item_properties ) {
651
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
650
+		foreach ($items as $type => $item_properties) {
651
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
652 652
 		}
653 653
 		return $elements;
654 654
 	}
@@ -665,32 +665,32 @@  discard block
 block discarded – undo
665 665
 	 * @throws EE_Error
666 666
 	 * @return    string
667 667
 	 */
668
-	public function check_for_invalid_datetime_formats( $value, $option ) {
669
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
668
+	public function check_for_invalid_datetime_formats($value, $option) {
669
+		EE_Registry::instance()->load_helper('DTT_Helper');
670 670
 		// check for date_format or time_format
671
-		switch ( $option ) {
671
+		switch ($option) {
672 672
 			case 'date_format' :
673
-				$date_time_format = $value . ' ' . get_option('time_format');
673
+				$date_time_format = $value.' '.get_option('time_format');
674 674
 				break;
675 675
 			case 'time_format' :
676
-				$date_time_format = get_option('date_format') . ' ' . $value;
676
+				$date_time_format = get_option('date_format').' '.$value;
677 677
 				break;
678 678
 			default :
679 679
 				$date_time_format = FALSE;
680 680
 		}
681 681
 		// do we have a date_time format to check ?
682
-		if ( $date_time_format ) {
683
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
682
+		if ($date_time_format) {
683
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
684 684
 
685
-			if ( is_array( $error_msg ) ) {
686
-				$msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format  ) . '</p><p><ul>';
685
+			if (is_array($error_msg)) {
686
+				$msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>';
687 687
 
688 688
 
689
-				foreach ( $error_msg as $error ) {
690
-					$msg .= '<li>' . $error . '</li>';
689
+				foreach ($error_msg as $error) {
690
+					$msg .= '<li>'.$error.'</li>';
691 691
 				}
692 692
 
693
-				$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
693
+				$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
694 694
 
695 695
 				// trigger WP settings error
696 696
 				add_settings_error(
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 				);
701 701
 
702 702
 				// set format to something valid
703
-				switch ( $option ) {
703
+				switch ($option) {
704 704
 					case 'date_format' :
705 705
 						$value = 'F j, Y';
706 706
 						break;
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
 	 * @param $content
723 723
 	 * @return    string
724 724
 	 */
725
-	public function its_eSpresso( $content ) {
726
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
725
+	public function its_eSpresso($content) {
726
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
727 727
 	}
728 728
 
729 729
 
@@ -736,9 +736,9 @@  discard block
 block discarded – undo
736 736
 	 */
737 737
 	public function espresso_admin_footer() {
738 738
 		return sprintf(
739
-			__( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ),
739
+			__('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'),
740 740
 			'<a href="https://eventespresso.com/" title="',
741
-			'">' . EVENT_ESPRESSO_POWERED_BY . '</a>'
741
+			'">'.EVENT_ESPRESSO_POWERED_BY.'</a>'
742 742
 		);
743 743
 	}
744 744
 
@@ -758,12 +758,12 @@  discard block
 block discarded – undo
758 758
 	 * @param array $config
759 759
 	 * @return void
760 760
 	 */
761
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
762
-		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
763
-		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
761
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
762
+		EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3');
763
+		if (class_exists('EE_Register_Admin_Page')) {
764 764
 			$config['page_path'] = $page_path;
765 765
 		}
766
-		EE_Register_Admin_Page::register( $page_basename, $config );
766
+		EE_Register_Admin_Page::register($page_basename, $config);
767 767
 
768 768
 	}
769 769
 
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -606,9 +606,9 @@
 block discarded – undo
606 606
 		// first check if event is active.
607 607
 		if (
608 608
 			$orig_status === EEM_Event::cancelled
609
-		    || $orig_status === EEM_Event::postponed
610
-		    || $event->is_expired()
611
-		    || $event->is_inactive()
609
+			|| $orig_status === EEM_Event::postponed
610
+			|| $event->is_expired()
611
+			|| $event->is_inactive()
612 612
 		) {
613 613
 			return;
614 614
 		}
Please login to merge, or discard this patch.
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if (!defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -1484,10 +1485,11 @@  discard block
 block discarded – undo
1484 1485
 			//get the earliest datetime (if present);
1485 1486
 			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1486 1487
 
1487
-			if ( !empty( $earliest_dtt ) )
1488
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1489
-			else
1490
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1488
+			if ( !empty( $earliest_dtt ) ) {
1489
+							$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1490
+			} else {
1491
+							$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1492
+			}
1491 1493
 		}
1492 1494
 
1493 1495
 		$template_args = array_merge( $template_args, $price_args );
@@ -1725,8 +1727,9 @@  discard block
 block discarded – undo
1725 1727
 		}
1726 1728
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1727 1729
 
1728
-		if ( $redirect_after )
1729
-			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1730
+		if ( $redirect_after ) {
1731
+					$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1732
+		}
1730 1733
 	}
1731 1734
 
1732 1735
 	/**
@@ -1853,8 +1856,9 @@  discard block
 block discarded – undo
1853 1856
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1854 1857
 		}
1855 1858
 
1856
-		if ( $redirect_after )
1857
-			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1859
+		if ( $redirect_after ) {
1860
+					$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1861
+		}
1858 1862
 	}
1859 1863
 
1860 1864
 	/**
@@ -2091,8 +2095,10 @@  discard block
 block discarded – undo
2091 2095
 	 * @return void
2092 2096
 	 */
2093 2097
 	private function _set_category_object() {
2094
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2095
-			return; //already have the category object so get out.
2098
+		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) {
2099
+					return;
2100
+		}
2101
+		//already have the category object so get out.
2096 2102
 
2097 2103
 		//set default category object
2098 2104
 		$this->_set_empty_category_object();
Please login to merge, or discard this patch.
Spacing   +389 added lines, -389 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$this->_cpt_edit_routes = array(
67 67
 			'espresso_events' => 'edit'
68 68
 		);
69
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
69
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
70 70
 	}
71 71
 
72 72
 	protected function _ajax_hooks() {
@@ -92,20 +92,20 @@  discard block
 block discarded – undo
92 92
 				'edit' => __('Update Event', 'event_espresso'),
93 93
 				'add_category' => __('Save New Category', 'event_espresso'),
94 94
 				'edit_category' => __('Update Category', 'event_espresso'),
95
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
95
+				'template_settings' => __('Update Settings', 'event_espresso')
96 96
 				)
97 97
 		);
98 98
 	}
99 99
 
100 100
 	protected function _set_page_routes() {
101 101
 		//load formatter helper
102
-		EE_Registry::instance()->load_helper( 'Formatter' );
102
+		EE_Registry::instance()->load_helper('Formatter');
103 103
 		//load field generator helper
104
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
104
+		EE_Registry::instance()->load_helper('Form_Fields');
105 105
 
106 106
 		//is there a evt_id in the request?
107
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
108
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
107
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
108
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
109 109
 
110 110
 
111 111
 		$this->_page_routes = array(
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 				'help_tour' => array(
320 320
 					'Event_Editor_Help_Tour'
321 321
 					),
322
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
322
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
323 323
 				'require_nonce' => FALSE
324 324
 			),
325 325
 			'edit' => array(
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 				/*'help_tour' => array(
376 376
 					'Event_Edit_Help_Tour'
377 377
 				),*/
378
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
378
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
379 379
 				'require_nonce' => FALSE
380 380
 			),
381 381
 			'default_event_settings' => array(
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 						'filename' => 'events_default_settings_status'
398 398
 					)
399 399
 				),
400
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
400
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
401 401
 				'require_nonce' => FALSE
402 402
 			),
403 403
 			//template settings
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'general_settings_templates'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Templates_Help_Tour' ),
416
+				'help_tour' => array('Templates_Help_Tour'),
417 417
 				'require_nonce' => FALSE
418 418
 			),
419 419
 			//event category stuff
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 					'label' => __('Edit Category', 'event_espresso'),
438 438
 					'order' => 15,
439 439
 					'persistent' => FALSE,
440
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
440
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
441 441
 					),
442 442
 				'help_tabs' => array(
443 443
 					'edit_category_help_tab' => array(
@@ -507,14 +507,14 @@  discard block
 block discarded – undo
507 507
 
508 508
 	public function load_scripts_styles() {
509 509
 
510
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
511
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
510
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
511
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
512 512
 		wp_enqueue_style('events-admin-css');
513 513
 		wp_enqueue_style('ee-cat-admin');
514 514
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
515 515
 		//registers for all views
516 516
 		//scripts
517
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
517
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
518 518
 	}
519 519
 
520 520
 	/**
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
 	public function load_scripts_styles_edit() {
533 533
 		//styles
534 534
 		wp_enqueue_style('espresso-ui-theme');
535
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
535
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
536 536
 		wp_enqueue_style('event-editor-css');
537 537
 
538 538
 		//scripts
539
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
539
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
540 540
 		wp_enqueue_script('event-datetime-metabox');
541 541
 
542 542
 	}
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 
572 572
 
573 573
 	public function admin_init() {
574
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
574
+		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
575 575
 	}
576 576
 
577 577
 
@@ -592,12 +592,12 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	public function verify_event_edit($event = NULL) {
594 594
 		// no event?
595
-		if ( empty( $event )) {
595
+		if (empty($event)) {
596 596
 			// set event
597 597
 			$event = $this->_cpt_model_obj;
598 598
 		}
599 599
 		// STILL no event?
600
-		if ( empty ( $event )) {
600
+		if (empty ($event)) {
601 601
 			return;
602 602
 		}
603 603
 		$orig_status = $event->status();
@@ -611,27 +611,27 @@  discard block
 block discarded – undo
611 611
 			return;
612 612
 		}
613 613
 		//made it here so it IS active... next check that any of the tickets are sold.
614
-		if ( $event->is_sold_out( true ) ) {
615
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
614
+		if ($event->is_sold_out(true)) {
615
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
616 616
 				EE_Error::add_attention(
617 617
 					sprintf(
618
-						__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso' ),
619
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
618
+						__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso'),
619
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
620 620
 					)
621 621
 				);
622 622
 			}
623 623
 			return;
624
-		} else if ( $orig_status === EEM_Event::sold_out ) {
624
+		} else if ($orig_status === EEM_Event::sold_out) {
625 625
 			EE_Error::add_attention(
626 626
 				sprintf(
627
-					__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
628
-						'event_espresso' ),
629
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
627
+					__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
628
+						'event_espresso'),
629
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
630 630
 				)
631 631
 			);
632 632
 		}
633 633
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
634
-		if ( ! $event->tickets_on_sale() ) {
634
+		if ( ! $event->tickets_on_sale()) {
635 635
 			return;
636 636
 		}
637 637
 		//made it here so show warning
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 */
651 651
 	protected function _edit_event_warning() {
652 652
 		// we don't want to add warnings during these requests
653
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
653
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
654 654
 			return;
655 655
 		}
656 656
 		EE_Error::add_attention(
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 			),
682 682
 		);
683 683
 
684
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
684
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
685 685
 			$this->_views['trash'] = array(
686 686
 				'slug' => 'trash',
687 687
 				'label' => __('Trash', 'event_espresso'),
@@ -711,39 +711,39 @@  discard block
 block discarded – undo
711 711
 				'desc' => __('View Registrations for Event', 'event_espresso')
712 712
 			)
713 713
 		);
714
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
714
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
715 715
 		$statuses = array(
716 716
 			'sold_out_status' => array(
717
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
718
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
717
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
718
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
719 719
 			),
720 720
 			'active_status' => array(
721
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
722
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
721
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
722
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
723 723
 			),
724 724
 			'upcoming_status' => array(
725
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
726
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
725
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
726
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
727 727
 			),
728 728
 			'postponed_status' => array(
729
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
730
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
729
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
730
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
731 731
 			),
732 732
 			'cancelled_status' => array(
733
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
734
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
733
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
734
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
735 735
 			),
736 736
 			'expired_status' => array(
737
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
738
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
737
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
738
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
739 739
 			),
740 740
 			'inactive_status' => array(
741
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
742
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
741
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
742
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
743 743
 			)
744 744
 		);
745
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
746
-		return array_merge( $items, $statuses );
745
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
746
+		return array_merge($items, $statuses);
747 747
 	}
748 748
 
749 749
 
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 	 * @return EEM_Event
756 756
 	 */
757 757
 	private function _event_model() {
758
-		if ( ! $this->_event_model instanceof EEM_Event ) {
759
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
758
+		if ( ! $this->_event_model instanceof EEM_Event) {
759
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
760 760
 		}
761 761
 		return $this->_event_model;
762 762
 	}
@@ -775,12 +775,12 @@  discard block
 block discarded – undo
775 775
 	 * @param  string $new_slug  what the slug is
776 776
 	 * @return string            The new html string for the permalink area
777 777
 	 */
778
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
778
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
779 779
 		//make sure this is only when editing
780
-		if ( !empty( $id ) ) {
781
-			$post = get_post( $id );
782
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
783
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
780
+		if ( ! empty($id)) {
781
+			$post = get_post($id);
782
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
783
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
784 784
 		}
785 785
 		return $return;
786 786
 	}
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 	 * @return string html for generated table
797 797
 	 */
798 798
 	protected function _events_overview_list_table() {
799
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
800
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
799
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
800
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
801 801
 		$this->_display_legend($this->_event_legend_items());
802 802
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
803 803
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -815,51 +815,51 @@  discard block
 block discarded – undo
815 815
 
816 816
 
817 817
 
818
-	protected function _insert_update_cpt_item( $post_id, $post ) {
818
+	protected function _insert_update_cpt_item($post_id, $post) {
819 819
 
820
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
820
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
821 821
 			//getout we're not processing an event save.
822 822
 			return;
823 823
 		}
824 824
 
825 825
 		$event_values = array(
826
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
827
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
826
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
827
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
828 828
 			'EVT_additional_limit' => min(
829
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
830
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
831
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
832
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
833
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
834
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
835
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
836
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
829
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
830
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
831
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
832
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
833
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
834
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
835
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
836
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
837 837
 			);
838 838
 
839 839
 		//update event
840
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
840
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
841 841
 
842 842
 
843 843
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
844
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
845
-		$event = $this->_event_model()->get_one( array($get_one_where) );
844
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
845
+		$event = $this->_event_model()->get_one(array($get_one_where));
846 846
 
847 847
 
848 848
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
849
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
849
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
850 850
 
851 851
 		$att_success = TRUE;
852 852
 
853
-		foreach ( $event_update_callbacks as $e_callback ) {
854
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
855
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
853
+		foreach ($event_update_callbacks as $e_callback) {
854
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
855
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
856 856
 		}
857 857
 
858 858
 		//any errors?
859
-		if ( $success && FALSE === $att_success ) {
860
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
861
-		} else if ( $success === FALSE ) {
862
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
859
+		if ($success && FALSE === $att_success) {
860
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
861
+		} else if ($success === FALSE) {
862
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
863 863
 		}
864 864
 	}
865 865
 
@@ -869,14 +869,14 @@  discard block
 block discarded – undo
869 869
 	/**
870 870
 	 * @see parent::restore_item()
871 871
 	 */
872
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
872
+	protected function _restore_cpt_item($post_id, $revision_id) {
873 873
 		//copy existing event meta to new post
874 874
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
875
-		if ( $post_evt instanceof EE_Event ) {
875
+		if ($post_evt instanceof EE_Event) {
876 876
 			//meta revision restore
877
-			$post_evt->restore_revision( $revision_id );
877
+			$post_evt->restore_revision($revision_id);
878 878
 			//related objs restore
879
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
879
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
880 880
 		}
881 881
 	}
882 882
 
@@ -889,52 +889,52 @@  discard block
 block discarded – undo
889 889
 	 * @param  array  $data   The request data from the form
890 890
 	 * @return bool           Success or fail.
891 891
 	 */
892
-	protected function _default_venue_update( $evtobj, $data ) {
893
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
892
+	protected function _default_venue_update($evtobj, $data) {
893
+		require_once(EE_MODELS.'EEM_Venue.model.php');
894 894
 		$venue_model = EE_Registry::instance()->load_model('Venue');
895 895
 		$rows_affected = NULL;
896
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
896
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
897 897
 
898 898
 		// very important.  If we don't have a venue name...
899 899
 		// then we'll get out because not necessary to create empty venue
900
-		if ( empty( $data['venue_title'] ) ) {
900
+		if (empty($data['venue_title'])) {
901 901
 			return false;
902 902
 		}
903 903
 
904 904
 		$venue_array = array(
905 905
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
906
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
907
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
908
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
909
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
910
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
911
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
912
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
913
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
914
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
915
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
916
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
917
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
918
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
919
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
920
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
921
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
906
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
907
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
908
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
909
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
910
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
911
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
912
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
913
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
914
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
915
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
916
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
917
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
918
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
919
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
920
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
921
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
922 922
 				'status' => 'publish'
923 923
 			);
924 924
 
925 925
 
926 926
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
927
-		if ( !empty( $venue_id ) ) {
928
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
929
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
927
+		if ( ! empty($venue_id)) {
928
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
929
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
930 930
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
931
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
931
+			$evtobj->_add_relation_to($venue_id, 'Venue');
932 932
 			return $rows_affected > 0 ? TRUE : FALSE;
933 933
 		} else {
934 934
 			//we insert the venue
935
-			$venue_id = $venue_model->insert( $venue_array );
936
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
937
-			return !empty( $venue_id ) ? TRUE : FALSE;
935
+			$venue_id = $venue_model->insert($venue_array);
936
+			$evtobj->_add_relation_to($venue_id, 'Venue');
937
+			return ! empty($venue_id) ? TRUE : FALSE;
938 938
 		}
939 939
 		//when we have the ancestor come in it's already been handled by the revision save.
940 940
 	}
@@ -948,55 +948,55 @@  discard block
 block discarded – undo
948 948
 	 * @param  array    $data   The request data from the form
949 949
 	 * @return bool             success or fail
950 950
 	 */
951
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
951
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
952 952
 		$success = true;
953 953
 		$saved_dtt = null;
954 954
 		$saved_tickets = array();
955
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
955
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
956 956
 
957
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
957
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
958 958
 			//trim all values to ensure any excess whitespace is removed.
959
-			$dtt =  array_map( 'trim', $dtt );
960
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
959
+			$dtt = array_map('trim', $dtt);
960
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
961 961
 			$datetime_values = array(
962
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
962
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
963 963
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
964 964
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
965
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
965
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
966 966
 				'DTT_order' 	=> $row,
967 967
 			);
968 968
 
969 969
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
970 970
 
971
-			if ( !empty( $dtt['DTT_ID'] ) ) {
972
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
973
-				$DTM->set_date_format( $incoming_date_formats[0] );
974
-				$DTM->set_time_format( $incoming_date_formats[1] );
975
-				foreach ( $datetime_values as $field => $value ) {
976
-					$DTM->set( $field, $value );
971
+			if ( ! empty($dtt['DTT_ID'])) {
972
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
973
+				$DTM->set_date_format($incoming_date_formats[0]);
974
+				$DTM->set_time_format($incoming_date_formats[1]);
975
+				foreach ($datetime_values as $field => $value) {
976
+					$DTM->set($field, $value);
977 977
 				}
978 978
 
979 979
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
980 980
 				$saved_dtts[$DTM->ID()] = $DTM;
981 981
 			} else {
982
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
983
-				$DTM->set_date_format( $incoming_date_formats[0] );
984
-				$DTM->set_time_format( $incoming_date_formats[1] );
985
-				$DTM->set_timezone( $evtobj->get_timezone() );
986
-				foreach ( $datetime_values as $field => $value ) {
987
-					$DTM->set( $field, $value );
982
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
983
+				$DTM->set_date_format($incoming_date_formats[0]);
984
+				$DTM->set_time_format($incoming_date_formats[1]);
985
+				$DTM->set_timezone($evtobj->get_timezone());
986
+				foreach ($datetime_values as $field => $value) {
987
+					$DTM->set($field, $value);
988 988
 				}
989 989
 			}
990 990
 			$DTM->save();
991 991
 
992
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
992
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
993 993
 
994 994
 			//load DTT helper
995 995
 			EE_Registry::instance()->load_helper('DTT_Helper');
996 996
 
997 997
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
998
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
999
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
998
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
999
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
1000 1000
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
1001 1001
 				$DTT->save();
1002 1002
 			}
@@ -1004,45 +1004,45 @@  discard block
 block discarded – undo
1004 1004
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1005 1005
 			$saved_dtt = $DTT;
1006 1006
 
1007
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1007
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1008 1008
 		}
1009 1009
 
1010 1010
 		//no dtts get deleted so we don't do any of that logic here.
1011 1011
 		//update tickets next
1012
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1013
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1014
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1012
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1013
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1014
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1015 1015
 			$update_prices = false;
1016
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1016
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1017 1017
 
1018 1018
 			// trim inputs to ensure any excess whitespace is removed.
1019
-			$tkt = array_map( 'trim', $tkt );
1019
+			$tkt = array_map('trim', $tkt);
1020 1020
 
1021
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1021
+			if (empty($tkt['TKT_start_date'])) {
1022 1022
 				//let's use now in the set timezone.
1023
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1024
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1023
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1024
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1025 1025
 			}
1026 1026
 
1027
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1027
+			if (empty($tkt['TKT_end_date'])) {
1028 1028
 				//use the start date of the first datetime
1029 1029
 				$dtt = $evtobj->first_datetime();
1030
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1030
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1031 1031
 			}
1032 1032
 
1033 1033
 			$TKT_values = array(
1034
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1035
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1036
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1037
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1034
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1035
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1036
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1037
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1038 1038
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1039 1039
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1040
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1041
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1042
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1043
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1040
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1041
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1042
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1043
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1044 1044
 				'TKT_row' 			=> $row,
1045
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1045
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1046 1046
 				'TKT_price' 		=> $ticket_price
1047 1047
 			);
1048 1048
 
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 
1052 1052
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1053
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1053
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1054 1054
 				$TKT_values['TKT_ID'] = 0;
1055 1055
 				$TKT_values['TKT_is_default'] = 0;
1056 1056
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1061,58 +1061,58 @@  discard block
 block discarded – undo
1061 1061
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1062 1062
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1063 1063
 
1064
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1065
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1066
-				if ( $TKT instanceof EE_Ticket ) {
1067
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1064
+			if ( ! empty($tkt['TKT_ID'])) {
1065
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1066
+				if ($TKT instanceof EE_Ticket) {
1067
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1068 1068
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1069
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1070
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1071
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1069
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1070
+					$TKT->set_date_format($incoming_date_formats[0]);
1071
+					$TKT->set_time_format($incoming_date_formats[1]);
1072 1072
 					//set new values
1073
-					foreach ( $TKT_values as $field => $value ) {
1074
-						if ( $field == 'TKT_qty' ) {
1075
-							$TKT->set_qty( $value );
1073
+					foreach ($TKT_values as $field => $value) {
1074
+						if ($field == 'TKT_qty') {
1075
+							$TKT->set_qty($value);
1076 1076
 						} else {
1077
-							$TKT->set( $field, $value );
1077
+							$TKT->set($field, $value);
1078 1078
 						}
1079 1079
 					}
1080 1080
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1081
-					if ( $create_new_TKT ) {
1081
+					if ($create_new_TKT) {
1082 1082
 						//archive the old ticket first
1083
-						$TKT->set( 'TKT_deleted', 1 );
1083
+						$TKT->set('TKT_deleted', 1);
1084 1084
 						$TKT->save();
1085 1085
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1086
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1086
+						$saved_tickets[$TKT->ID()] = $TKT;
1087 1087
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1088 1088
 						$TKT = clone $TKT;
1089
-						$TKT->set( 'TKT_ID', 0 );
1090
-						$TKT->set( 'TKT_deleted', 0 );
1091
-						$TKT->set( 'TKT_price', $ticket_price );
1092
-						$TKT->set( 'TKT_sold', 0 );
1089
+						$TKT->set('TKT_ID', 0);
1090
+						$TKT->set('TKT_deleted', 0);
1091
+						$TKT->set('TKT_price', $ticket_price);
1092
+						$TKT->set('TKT_sold', 0);
1093 1093
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1094 1094
 						$update_prices = true;
1095 1095
 					}
1096 1096
 					//make sure price is set if it hasn't been already
1097
-					$TKT->set( 'TKT_price', $ticket_price );
1097
+					$TKT->set('TKT_price', $ticket_price);
1098 1098
 				}
1099 1099
 
1100 1100
 			} else {
1101 1101
 				//no TKT_id so a new TKT
1102 1102
 				$TKT_values['TKT_price'] = $ticket_price;
1103
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1104
-				if ( $TKT instanceof EE_Ticket ) {
1103
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1104
+				if ($TKT instanceof EE_Ticket) {
1105 1105
 					//need to reset values to properly account for the date formats
1106
-					$TKT->set_date_format( $incoming_date_formats[0] );
1107
-					$TKT->set_time_format( $incoming_date_formats[1] );
1108
-					$TKT->set_timezone( $evtobj->get_timezone() );
1106
+					$TKT->set_date_format($incoming_date_formats[0]);
1107
+					$TKT->set_time_format($incoming_date_formats[1]);
1108
+					$TKT->set_timezone($evtobj->get_timezone());
1109 1109
 
1110 1110
 					//set new values
1111
-					foreach ( $TKT_values as $field => $value ) {
1112
-						if ( $field == 'TKT_qty' ) {
1113
-							$TKT->set_qty( $value );
1111
+					foreach ($TKT_values as $field => $value) {
1112
+						if ($field == 'TKT_qty') {
1113
+							$TKT->set_qty($value);
1114 1114
 						} else {
1115
-							$TKT->set( $field, $value );
1115
+							$TKT->set($field, $value);
1116 1116
 						}
1117 1117
 					}
1118 1118
 
@@ -1120,32 +1120,32 @@  discard block
 block discarded – undo
1120 1120
 				}
1121 1121
 			}
1122 1122
 			// cap ticket qty by datetime reg limits
1123
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1123
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1124 1124
 			//update ticket.
1125 1125
 			$TKT->save();
1126 1126
 
1127 1127
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1128
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1129
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1128
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1129
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1130 1130
 				EE_Registry::instance()->load_helper('DTT_Helper');
1131 1131
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1132 1132
 				$TKT->save();
1133 1133
 			}
1134 1134
 
1135 1135
 			//initially let's add the ticket to the dtt
1136
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1136
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1137 1137
 
1138 1138
 			$saved_tickets[$TKT->ID()] = $TKT;
1139 1139
 
1140 1140
 			//add prices to ticket
1141
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1141
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1142 1142
 		}
1143 1143
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1144
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1145
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1144
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1145
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1146 1146
 
1147
-		foreach ( $tickets_removed as $id ) {
1148
-			$id = absint( $id );
1147
+		foreach ($tickets_removed as $id) {
1148
+			$id = absint($id);
1149 1149
 
1150 1150
 			//get the ticket for this id
1151 1151
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1154 1154
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1155 1155
 
1156
-			foreach( $dtts as $dtt ) {
1156
+			foreach ($dtts as $dtt) {
1157 1157
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1158 1158
 			}
1159 1159
 
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1165 1165
 			$tkt_to_remove->delete_permanently();
1166 1166
 		}
1167
-		return array( $saved_dtt, $saved_tickets );
1167
+		return array($saved_dtt, $saved_tickets);
1168 1168
 	}
1169 1169
 
1170 1170
 
@@ -1179,31 +1179,31 @@  discard block
 block discarded – undo
1179 1179
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1180 1180
 	 * @return  void
1181 1181
 	 */
1182
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1183
-		foreach ( $prices as $row => $prc ) {
1182
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1183
+		foreach ($prices as $row => $prc) {
1184 1184
 			$PRC_values = array(
1185
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1186
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1187
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1188
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1189
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1185
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1186
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1187
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1188
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1189
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1190 1190
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1191 1191
 				'PRC_order' => $row
1192 1192
 			);
1193 1193
 
1194
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1194
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1195 1195
 				$PRC_values['PRC_ID'] = 0;
1196
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1196
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1197 1197
 			} else {
1198
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1198
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1199 1199
 				//update this price with new values
1200
-				foreach ( $PRC_values as $field => $newprc ) {
1201
-					$PRC->set( $field, $newprc );
1200
+				foreach ($PRC_values as $field => $newprc) {
1201
+					$PRC->set($field, $newprc);
1202 1202
 				}
1203 1203
 				$PRC->save();
1204 1204
 			}
1205 1205
 
1206
-			$ticket->_add_relation_to( $PRC, 'Price' );
1206
+			$ticket->_add_relation_to($PRC, 'Price');
1207 1207
 		}
1208 1208
 	}
1209 1209
 
@@ -1239,12 +1239,12 @@  discard block
 block discarded – undo
1239 1239
 	private function _generate_publish_box_extra_content() {
1240 1240
 
1241 1241
 		//load formatter helper
1242
-  		EE_Registry::instance()->load_helper( 'Formatter' );
1242
+  		EE_Registry::instance()->load_helper('Formatter');
1243 1243
 
1244 1244
   		//args for getting related registrations
1245
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1246
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1247
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1245
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1246
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1247
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1248 1248
 
1249 1249
 
1250 1250
 		// publish box
@@ -1273,9 +1273,9 @@  discard block
 block discarded – undo
1273 1273
 				),
1274 1274
 				REG_ADMIN_URL
1275 1275
 			),
1276
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1277
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1278
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1276
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1277
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1278
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1279 1279
 			'misc_pub_section_class' => apply_filters(
1280 1280
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1281 1281
 				'misc-pub-section'
@@ -1294,9 +1294,9 @@  discard block
 block discarded – undo
1294 1294
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1295 1295
 			$this->_cpt_model_obj
1296 1296
 		);
1297
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1297
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1298 1298
 		// load template
1299
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1299
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1300 1300
 	}
1301 1301
 
1302 1302
 
@@ -1328,16 +1328,16 @@  discard block
 block discarded – undo
1328 1328
 		$this->verify_cpt_object();
1329 1329
 		add_meta_box(
1330 1330
 			'espresso_event_editor_tickets',
1331
-			__( 'Event Datetime & Ticket', 'event_espresso' ),
1332
-			array( $this, 'ticket_metabox' ),
1331
+			__('Event Datetime & Ticket', 'event_espresso'),
1332
+			array($this, 'ticket_metabox'),
1333 1333
 			$this->page_slug,
1334 1334
 			'normal',
1335 1335
 			'high'
1336 1336
 		);
1337 1337
 		add_meta_box(
1338 1338
 			'espresso_event_editor_event_options',
1339
-			__( 'Event Registration Options', 'event_espresso' ),
1340
-			array( $this, 'registration_options_meta_box' ),
1339
+			__('Event Registration Options', 'event_espresso'),
1340
+			array($this, 'registration_options_meta_box'),
1341 1341
 			$this->page_slug,
1342 1342
 			'side',
1343 1343
 			'default'
@@ -1367,37 +1367,37 @@  discard block
 block discarded – undo
1367 1367
 			'disabled' => ''
1368 1368
 			);
1369 1369
 
1370
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1370
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1371 1371
 
1372
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1372
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1373 1373
 
1374 1374
 		/**
1375 1375
 		 * 1. Start with retrieving Datetimes
1376 1376
 		 * 2. Fore each datetime get related tickets
1377 1377
 		 * 3. For each ticket get related prices
1378 1378
 		 */
1379
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1380
-		EE_Registry::instance()->load_helper('DTT_Helper' );
1379
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1380
+		EE_Registry::instance()->load_helper('DTT_Helper');
1381 1381
 		/** @type EE_Datetime $first_datetime */
1382
-		$first_datetime = reset( $times );
1382
+		$first_datetime = reset($times);
1383 1383
 		//do we get related tickets?
1384
-		if ( $first_datetime instanceof EE_Datetime
1385
-			&& $first_datetime->ID() !== 0 ) {
1384
+		if ($first_datetime instanceof EE_Datetime
1385
+			&& $first_datetime->ID() !== 0) {
1386 1386
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1387 1387
 			$template_args['time'] = $first_datetime;
1388 1388
 			$related_tickets = $first_datetime->tickets(
1389 1389
 				array(
1390
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1390
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1391 1391
 					'default_where_conditions' => 'none'
1392 1392
 				)
1393 1393
 			);
1394 1394
 
1395
-			if ( !empty($related_tickets) ) {
1395
+			if ( ! empty($related_tickets)) {
1396 1396
 				$template_args['total_ticket_rows'] = count($related_tickets);
1397 1397
 				$row = 0;
1398
-				foreach ( $related_tickets as $ticket ) {
1398
+				foreach ($related_tickets as $ticket) {
1399 1399
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1400
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1400
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1401 1401
 
1402 1402
 					$row++;
1403 1403
 				}
@@ -1405,13 +1405,13 @@  discard block
 block discarded – undo
1405 1405
 				$template_args['total_ticket_rows'] = 1;
1406 1406
 				/** @type EE_Ticket $ticket */
1407 1407
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1408
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1408
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1409 1409
 			}
1410 1410
 		} else {
1411 1411
 			$template_args['time'] = $times[0];
1412 1412
 			/** @type EE_Ticket $ticket */
1413 1413
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1414
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1414
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1415 1415
 			// NOTE: we're just sending the first default row
1416 1416
 			// (decaf can't manage default tickets so this should be sufficient);
1417 1417
 		}
@@ -1420,8 +1420,8 @@  discard block
 block discarded – undo
1420 1420
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1421 1421
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1422 1422
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1423
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1424
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1423
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1424
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1425 1425
 		EEH_Template::display_template($template, $template_args);
1426 1426
 	}
1427 1427
 
@@ -1436,21 +1436,21 @@  discard block
 block discarded – undo
1436 1436
 	 * @param int        $row
1437 1437
 	 * @return string generated html for the ticket row.
1438 1438
 	 */
1439
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1439
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1440 1440
 		$template_args = array(
1441
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1442
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1441
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1442
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1443 1443
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1444 1444
 			'TKT_ID' => $ticket->get('TKT_ID'),
1445 1445
 			'TKT_name' => $ticket->get('TKT_name'),
1446 1446
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1447 1447
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1448 1448
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1449
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1449
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1450 1450
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1451 1451
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1452
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1453
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1452
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1453
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1454 1454
 			);
1455 1455
 
1456 1456
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1466,23 +1466,23 @@  discard block
 block discarded – undo
1466 1466
 
1467 1467
 		//make sure we have default start and end dates if skeleton
1468 1468
 		//handle rows that should NOT be empty
1469
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1469
+		if (empty($template_args['TKT_start_date'])) {
1470 1470
 			//if empty then the start date will be now.
1471 1471
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1472 1472
 		}
1473 1473
 
1474
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1474
+		if (empty($template_args['TKT_end_date'])) {
1475 1475
 			//get the earliest datetime (if present);
1476
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1476
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1477 1477
 
1478
-			if ( !empty( $earliest_dtt ) )
1478
+			if ( ! empty($earliest_dtt))
1479 1479
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1480 1480
 			else
1481
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1481
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1482 1482
 		}
1483 1483
 
1484
-		$template_args = array_merge( $template_args, $price_args );
1485
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1484
+		$template_args = array_merge($template_args, $price_args);
1485
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1486 1486
 		return EEH_Template::display_template($template, $template_args, TRUE);
1487 1487
 	}
1488 1488
 
@@ -1511,8 +1511,8 @@  discard block
 block discarded – undo
1511 1511
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1512 1512
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1513 1513
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1514
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1515
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1514
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1515
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1516 1516
 		EEH_Template::display_template($templatepath, $template_args);
1517 1517
 	}
1518 1518
 
@@ -1540,21 +1540,21 @@  discard block
 block discarded – undo
1540 1540
 		$EEME = $this->_event_model();
1541 1541
 
1542 1542
 		$offset = ($current_page - 1) * $per_page;
1543
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1543
+		$limit = $count ? NULL : $offset.','.$per_page;
1544 1544
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1545 1545
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1546 1546
 
1547 1547
 		if (isset($this->_req_data['month_range'])) {
1548 1548
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1549
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1550
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1549
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1550
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1551 1551
 		}
1552 1552
 
1553 1553
 		$where = array();
1554 1554
 
1555
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1555
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1556 1556
 		//determine what post_status our condition will have for the query.
1557
-		switch ( $status ) {
1557
+		switch ($status) {
1558 1558
 			case 'month' :
1559 1559
 			case 'today' :
1560 1560
 			case NULL :
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 				break;
1563 1563
 
1564 1564
 			case 'draft' :
1565
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1565
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1566 1566
 				break;
1567 1567
 
1568 1568
 			default :
@@ -1570,43 +1570,43 @@  discard block
 block discarded – undo
1570 1570
 		}
1571 1571
 
1572 1572
 		//categories?
1573
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1573
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1574 1574
 
1575
-		if ( !empty ( $category ) ) {
1575
+		if ( ! empty ($category)) {
1576 1576
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1577 1577
 			$where['Term_Taxonomy.term_id'] = $category;
1578 1578
 		}
1579 1579
 
1580 1580
 		//date where conditions
1581
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1581
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1582 1582
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1583
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1584
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1585
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1586
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1583
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1584
+			$start = $DateTime->format(implode(' ', $start_formats));
1585
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1586
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1587 1587
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1588
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1589
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1590
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1591
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1592
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1593
-			$now = date( 'Y-m-01' );
1594
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1595
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1596
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1597
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1588
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1589
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1590
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1591
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1592
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1593
+			$now = date('Y-m-01');
1594
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1595
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1596
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1597
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1598 1598
 		}
1599 1599
 
1600 1600
 
1601
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1602
-			$where['EVT_wp_user'] =  get_current_user_id();
1601
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1602
+			$where['EVT_wp_user'] = get_current_user_id();
1603 1603
 		} else {
1604
-			if ( ! isset( $where['status'] ) ) {
1605
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1604
+			if ( ! isset($where['status'])) {
1605
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1606 1606
 					$where['OR'] = array(
1607
-						'status*restrict_private' => array( '!=', 'private' ),
1607
+						'status*restrict_private' => array('!=', 'private'),
1608 1608
 						'AND' => array(
1609
-							'status*inclusive' => array( '=', 'private' ),
1609
+							'status*inclusive' => array('=', 'private'),
1610 1610
 							'EVT_wp_user' => get_current_user_id()
1611 1611
 						)
1612 1612
 					);
@@ -1614,16 +1614,16 @@  discard block
 block discarded – undo
1614 1614
 			}
1615 1615
 		}
1616 1616
 
1617
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1618
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1617
+		if (isset($this->_req_data['EVT_wp_user'])) {
1618
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1619 1619
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1620 1620
 			}
1621 1621
 		}
1622 1622
 
1623 1623
 
1624 1624
 		//search query handling
1625
-		if ( isset( $this->_req_data['s'] ) ) {
1626
-			$search_string = '%' . $this->_req_data['s'] . '%';
1625
+		if (isset($this->_req_data['s'])) {
1626
+			$search_string = '%'.$this->_req_data['s'].'%';
1627 1627
 			$where['OR'] = array(
1628 1628
 				'EVT_name' => array('LIKE', $search_string),
1629 1629
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1632,32 +1632,32 @@  discard block
 block discarded – undo
1632 1632
 		}
1633 1633
 
1634 1634
 
1635
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1636
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1635
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1636
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1637 1637
 
1638 1638
 
1639 1639
 		//let's first check if we have special requests coming in.
1640
-		if ( isset( $this->_req_data['active_status'] ) ) {
1641
-			switch ( $this->_req_data['active_status'] ) {
1640
+		if (isset($this->_req_data['active_status'])) {
1641
+			switch ($this->_req_data['active_status']) {
1642 1642
 				case 'upcoming' :
1643
-					return $EEME->get_upcoming_events( $query_params, $count );
1643
+					return $EEME->get_upcoming_events($query_params, $count);
1644 1644
 					break;
1645 1645
 
1646 1646
 				case 'expired' :
1647
-					return $EEME->get_expired_events( $query_params, $count );
1647
+					return $EEME->get_expired_events($query_params, $count);
1648 1648
 					break;
1649 1649
 
1650 1650
 				case 'active' :
1651
-					return $EEME->get_active_events( $query_params, $count );
1651
+					return $EEME->get_active_events($query_params, $count);
1652 1652
 					break;
1653 1653
 
1654 1654
 				case 'inactive' :
1655
-					return $EEME->get_inactive_events( $query_params, $count );
1655
+					return $EEME->get_inactive_events($query_params, $count);
1656 1656
 					break;
1657 1657
 			}
1658 1658
 		}
1659 1659
 
1660
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1660
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1661 1661
 
1662 1662
 		return $events;
1663 1663
 	}
@@ -1666,23 +1666,23 @@  discard block
 block discarded – undo
1666 1666
 
1667 1667
 
1668 1668
 	//handling for WordPress CPT actions (trash, restore, delete)
1669
-	public function trash_cpt_item( $post_id ) {
1669
+	public function trash_cpt_item($post_id) {
1670 1670
 		$this->_req_data['EVT_ID'] = $post_id;
1671
-		$this->_trash_or_restore_event( 'trash', FALSE );
1671
+		$this->_trash_or_restore_event('trash', FALSE);
1672 1672
 	}
1673 1673
 
1674 1674
 
1675 1675
 
1676 1676
 
1677
-	public function restore_cpt_item( $post_id ) {
1677
+	public function restore_cpt_item($post_id) {
1678 1678
 		$this->_req_data['EVT_ID'] = $post_id;
1679
-		$this->_trash_or_restore_event( 'draft', FALSE );
1679
+		$this->_trash_or_restore_event('draft', FALSE);
1680 1680
 	}
1681 1681
 
1682 1682
 
1683
-	public function delete_cpt_item( $post_id ) {
1683
+	public function delete_cpt_item($post_id) {
1684 1684
 		$this->_req_data['EVT_ID'] = $post_id;
1685
-		$this->_delete_event( FALSE );
1685
+		$this->_delete_event(FALSE);
1686 1686
 	}
1687 1687
 
1688 1688
 
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 	 * @param  string $event_status
1695 1695
 	 * @return void
1696 1696
 	 */
1697
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1697
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1698 1698
 		//determine the event id and set to array.
1699 1699
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1700 1700
 		// loop thru events
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
 			// clean status
1703 1703
 			$event_status = sanitize_key($event_status);
1704 1704
 			// grab status
1705
-			if (!empty($event_status)) {
1705
+			if ( ! empty($event_status)) {
1706 1706
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1707 1707
 			} else {
1708 1708
 				$success = FALSE;
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
 		}
1717 1717
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1718 1718
 
1719
-		if ( $redirect_after )
1719
+		if ($redirect_after)
1720 1720
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1721 1721
 	}
1722 1722
 
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 		// clean status
1732 1732
 		$event_status = sanitize_key($event_status);
1733 1733
 		// grab status
1734
-		if (!empty($event_status)) {
1734
+		if ( ! empty($event_status)) {
1735 1735
 			$success = TRUE;
1736 1736
 			//determine the event id and set to array.
1737 1737
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1766,15 +1766,15 @@  discard block
 block discarded – undo
1766 1766
 	 * @param  string $event_status
1767 1767
 	 * @return bool
1768 1768
 	 */
1769
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1769
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1770 1770
 		// grab event id
1771
-		if (!$EVT_ID) {
1771
+		if ( ! $EVT_ID) {
1772 1772
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1773 1773
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1774 1774
 			return FALSE;
1775 1775
 		}
1776 1776
 
1777
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1777
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1778 1778
 
1779 1779
 		// clean status
1780 1780
 		$event_status = sanitize_key($event_status);
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 				$hook = FALSE;
1801 1801
 		}
1802 1802
 		//use class to change status
1803
-		$this->_cpt_model_obj->set_status( $event_status );
1803
+		$this->_cpt_model_obj->set_status($event_status);
1804 1804
 		$success = $this->_cpt_model_obj->save();
1805 1805
 
1806 1806
 		if ($success === FALSE) {
@@ -1822,15 +1822,15 @@  discard block
 block discarded – undo
1822 1822
 	 * @access protected
1823 1823
 	 * @param bool $redirect_after
1824 1824
 	 */
1825
-	protected function _delete_event( $redirect_after = TRUE ) {
1825
+	protected function _delete_event($redirect_after = TRUE) {
1826 1826
 		//determine the event id and set to array.
1827 1827
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1828
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1828
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1829 1829
 
1830 1830
 
1831 1831
 		// loop thru events
1832 1832
 		if ($EVT_ID) {
1833
-			$success = $this->_permanently_delete_event( $EVT_ID );
1833
+			$success = $this->_permanently_delete_event($EVT_ID);
1834 1834
 			// get list of events with no prices
1835 1835
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1836 1836
 			// remove this event from the list of events with no prices
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1845 1845
 		}
1846 1846
 
1847
-		if ( $redirect_after )
1847
+		if ($redirect_after)
1848 1848
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1849 1849
 	}
1850 1850
 
@@ -1862,12 +1862,12 @@  discard block
 block discarded – undo
1862 1862
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1863 1863
 		// loop thru events
1864 1864
 		foreach ($EVT_IDs as $EVT_ID) {
1865
-			$EVT_ID = absint( $EVT_ID );
1866
-			if ( $EVT_ID ) {
1867
-				$results = $this->_permanently_delete_event( $EVT_ID );
1865
+			$EVT_ID = absint($EVT_ID);
1866
+			if ($EVT_ID) {
1867
+				$results = $this->_permanently_delete_event($EVT_ID);
1868 1868
 				$success = $results !== FALSE ? $success : FALSE;
1869 1869
 				// remove this event from the list of events with no prices
1870
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1870
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1871 1871
 			} else {
1872 1872
 				$success = FALSE;
1873 1873
 				$msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1887,9 +1887,9 @@  discard block
 block discarded – undo
1887 1887
 	 * @param  int $EVT_ID
1888 1888
 	 * @return bool
1889 1889
 	 */
1890
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1890
+	private function _permanently_delete_event($EVT_ID = 0) {
1891 1891
 		// grab event id
1892
-		if ( ! $EVT_ID ) {
1892
+		if ( ! $EVT_ID) {
1893 1893
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1894 1894
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1895 1895
 			return FALSE;
@@ -1898,19 +1898,19 @@  discard block
 block discarded – undo
1898 1898
 			! $this->_cpt_model_obj instanceof EE_Event
1899 1899
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
1900 1900
 		) {
1901
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1901
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1902 1902
 		}
1903 1903
 
1904
-		if ( ! $this->_cpt_model instanceof EE_Event ) {
1904
+		if ( ! $this->_cpt_model instanceof EE_Event) {
1905 1905
 			return false;
1906 1906
 		}
1907 1907
 
1908 1908
 		//need to delete related tickets and prices first.
1909 1909
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1910
-		foreach ( $datetimes as $datetime ) {
1910
+		foreach ($datetimes as $datetime) {
1911 1911
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1912 1912
 			$tickets = $datetime->get_many_related('Ticket');
1913
-			foreach ( $tickets as $ticket ) {
1913
+			foreach ($tickets as $ticket) {
1914 1914
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1915 1915
 				$ticket->delete_related_permanently('Price');
1916 1916
 				$ticket->delete_permanently();
@@ -1920,14 +1920,14 @@  discard block
 block discarded – undo
1920 1920
 
1921 1921
 		//what about related venues or terms?
1922 1922
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1923
-		foreach ( $venues as $venue ) {
1923
+		foreach ($venues as $venue) {
1924 1924
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1925 1925
 		}
1926 1926
 
1927 1927
 		//any attached question groups?
1928 1928
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1929
-		if ( !empty( $question_groups ) ) {
1930
-			foreach ( $question_groups as $question_group ) {
1929
+		if ( ! empty($question_groups)) {
1930
+			foreach ($question_groups as $question_group) {
1931 1931
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1932 1932
 			}
1933 1933
 		}
@@ -1936,12 +1936,12 @@  discard block
 block discarded – undo
1936 1936
 
1937 1937
 
1938 1938
 		//Message Template Groups
1939
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1939
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1940 1940
 
1941 1941
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1942 1942
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1943 1943
 
1944
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1944
+		foreach ($term_taxonomies as $term_taxonomy) {
1945 1945
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1946 1946
 		}
1947 1947
 
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1956 1956
 			return FALSE;
1957 1957
 		}
1958
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1958
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1959 1959
 		return TRUE;
1960 1960
 	}
1961 1961
 
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 	 */
1973 1973
 	public function total_events() {
1974 1974
 
1975
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
1975
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
1976 1976
 		return $count;
1977 1977
 	}
1978 1978
 
@@ -1987,10 +1987,10 @@  discard block
 block discarded – undo
1987 1987
 	 */
1988 1988
 	public function total_events_draft() {
1989 1989
 		$where = array(
1990
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1990
+			'status' => array('IN', array('draft', 'auto-draft'))
1991 1991
 			);
1992 1992
 
1993
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1993
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1994 1994
 		return $count;
1995 1995
 	}
1996 1996
 
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
 			'status' => 'trash'
2010 2010
 			);
2011 2011
 
2012
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2012
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2013 2013
 		return $count;
2014 2014
 	}
2015 2015
 
@@ -2037,11 +2037,11 @@  discard block
 block discarded – undo
2037 2037
 			// translated
2038 2038
 			TRUE
2039 2039
 		);
2040
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2040
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2041 2041
 
2042 2042
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2043 2043
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2044
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2044
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2045 2045
 		$this->display_admin_page_with_sidebar();
2046 2046
 	}
2047 2047
 
@@ -2067,9 +2067,9 @@  discard block
 block discarded – undo
2067 2067
 
2068 2068
 	protected function _template_settings() {
2069 2069
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2070
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2071
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2072
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2070
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2071
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2072
+		$this->display_admin_caf_preview_page('template_settings_tab');
2073 2073
 	}
2074 2074
 
2075 2075
 
@@ -2082,22 +2082,22 @@  discard block
 block discarded – undo
2082 2082
 	 * @return void
2083 2083
 	 */
2084 2084
 	private function _set_category_object() {
2085
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2085
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2086 2086
 			return; //already have the category object so get out.
2087 2087
 
2088 2088
 		//set default category object
2089 2089
 		$this->_set_empty_category_object();
2090 2090
 
2091 2091
 		//only set if we've got an id
2092
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2092
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2093 2093
 			return;
2094 2094
 		}
2095 2095
 
2096 2096
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2097 2097
 
2098
-		$term = get_term( $category_id, 'espresso_event_categories' );
2098
+		$term = get_term($category_id, 'espresso_event_categories');
2099 2099
 
2100
-		if ( !empty( $term ) ) {
2100
+		if ( ! empty($term)) {
2101 2101
 			$this->_category->category_name = $term->name;
2102 2102
 			$this->_category->category_identifier = $term->slug;
2103 2103
 			$this->_category->category_desc = $term->description;
@@ -2111,13 +2111,13 @@  discard block
 block discarded – undo
2111 2111
 
2112 2112
 	private function _set_empty_category_object() {
2113 2113
 		$this->_category = new stdClass();
2114
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2114
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2115 2115
 		$this->_category->id = $this->_category->parent = 0;
2116 2116
 	}
2117 2117
 
2118 2118
 
2119 2119
 	protected function _category_list_table() {
2120
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2120
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2121 2121
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2122 2122
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2123 2123
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2127,22 +2127,22 @@  discard block
 block discarded – undo
2127 2127
 	protected function _category_details($view) {
2128 2128
 
2129 2129
 		//load formatter helper
2130
-		EE_Registry::instance()->load_helper( 'Formatter' );
2130
+		EE_Registry::instance()->load_helper('Formatter');
2131 2131
 		//load field generator helper
2132
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
2132
+		EE_Registry::instance()->load_helper('Form_Fields');
2133 2133
 
2134 2134
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
2135 2135
 		$this->_set_add_edit_form_tags($route);
2136 2136
 
2137 2137
 		$this->_set_category_object();
2138
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2138
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2139 2139
 
2140 2140
 		$delete_action = 'delete_category';
2141 2141
 
2142 2142
 		//custom redirect
2143
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2143
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2144 2144
 
2145
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2145
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2146 2146
 
2147 2147
 		//take care of contents
2148 2148
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2156,25 +2156,25 @@  discard block
 block discarded – undo
2156 2156
 			'type' => 'wp_editor',
2157 2157
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2158 2158
 			'class' => 'my_editor_custom',
2159
-			'wpeditor_args' => array('media_buttons' => FALSE )
2159
+			'wpeditor_args' => array('media_buttons' => FALSE)
2160 2160
 		);
2161
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2161
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2162 2162
 
2163
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2163
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2164 2164
 
2165 2165
 		//setup category select for term parents.
2166 2166
 		$category_select_values[] = array(
2167 2167
 			'text' => __('No Parent', 'event_espresso'),
2168 2168
 			'id' => 0
2169 2169
 			);
2170
-		foreach ( $all_terms as $term ) {
2170
+		foreach ($all_terms as $term) {
2171 2171
 			$category_select_values[] = array(
2172 2172
 				'text' => $term->name,
2173 2173
 				'id' => $term->term_id
2174 2174
 				);
2175 2175
 		}
2176 2176
 
2177
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2177
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2178 2178
 
2179 2179
 		$template_args = array(
2180 2180
 			'category' => $this->_category,
@@ -2184,15 +2184,15 @@  discard block
 block discarded – undo
2184 2184
 			'disable' => '',
2185 2185
 			'disabled_message' => FALSE
2186 2186
 			);
2187
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2188
-		return EEH_Template::display_template($template, $template_args, TRUE );
2187
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2188
+		return EEH_Template::display_template($template, $template_args, TRUE);
2189 2189
 	}
2190 2190
 
2191 2191
 
2192 2192
 	protected function _delete_categories() {
2193
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2193
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2194 2194
 
2195
-		foreach ( $cat_ids as $cat_id ) {
2195
+		foreach ($cat_ids as $cat_id) {
2196 2196
 			$this->_delete_category($cat_id);
2197 2197
 		}
2198 2198
 
@@ -2200,7 +2200,7 @@  discard block
 block discarded – undo
2200 2200
 		$query_args = array(
2201 2201
 			'action' => 'category_list'
2202 2202
 			);
2203
-		$this->_redirect_after_action(0,'','',$query_args);
2203
+		$this->_redirect_after_action(0, '', '', $query_args);
2204 2204
 
2205 2205
 	}
2206 2206
 
@@ -2210,61 +2210,61 @@  discard block
 block discarded – undo
2210 2210
 
2211 2211
 	protected function _delete_category($cat_id) {
2212 2212
 		global $wpdb;
2213
-		$cat_id = absint( $cat_id );
2214
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2213
+		$cat_id = absint($cat_id);
2214
+		wp_delete_term($cat_id, 'espresso_event_categories');
2215 2215
 	}
2216 2216
 
2217 2217
 
2218 2218
 
2219 2219
 	protected function _insert_or_update_category($new_category) {
2220 2220
 
2221
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2221
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2222 2222
 		$success = 0; //we already have a success message so lets not send another.
2223 2223
 
2224
-		if ( $cat_id ) {
2224
+		if ($cat_id) {
2225 2225
 			$query_args = array(
2226 2226
 				'action'     => 'edit_category',
2227 2227
 				'EVT_CAT_ID' => $cat_id
2228 2228
 			);
2229 2229
 		} else {
2230
-			$query_args = array( 'action' => 'add_category' );
2230
+			$query_args = array('action' => 'add_category');
2231 2231
 		}
2232
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2232
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2233 2233
 
2234 2234
 	}
2235 2235
 
2236 2236
 
2237 2237
 
2238
-	private function _insert_category( $update = FALSE ) {
2238
+	private function _insert_category($update = FALSE) {
2239 2239
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2240
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2241
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2242
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2240
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2241
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2242
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2243 2243
 
2244
-		if ( empty( $category_name ) ) {
2245
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2246
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2244
+		if (empty($category_name)) {
2245
+			$msg = __('You must add a name for the category.', 'event_espresso');
2246
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2247 2247
 			return false;
2248 2248
 		}
2249 2249
 
2250
-		$term_args=array(
2250
+		$term_args = array(
2251 2251
 			'name'=>$category_name,
2252 2252
 			'description'=>$category_desc,
2253 2253
 			'parent'=>$category_parent
2254 2254
 		);
2255 2255
 		//was the category_identifier input disabled?
2256
-		if(isset($this->_req_data['category_identifier'])){
2256
+		if (isset($this->_req_data['category_identifier'])) {
2257 2257
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2258 2258
 		}
2259
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2259
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2260 2260
 
2261
-		if ( !is_array( $insert_ids ) ) {
2262
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2263
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2261
+		if ( ! is_array($insert_ids)) {
2262
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2263
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2264 2264
 		} else {
2265 2265
 			$cat_id = $insert_ids['term_id'];
2266
-			$msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2267
-			EE_Error::add_success( $msg );
2266
+			$msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name);
2267
+			EE_Error::add_success($msg);
2268 2268
 		}
2269 2269
 
2270 2270
 		return $cat_id;
@@ -2273,32 +2273,32 @@  discard block
 block discarded – undo
2273 2273
 
2274 2274
 
2275 2275
 
2276
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2276
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2277 2277
 		global $wpdb;
2278 2278
 
2279 2279
 		//testing term stuff
2280
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2281
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2282
-		$limit = ($current_page-1)*$per_page;
2280
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2281
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2282
+		$limit = ($current_page - 1) * $per_page;
2283 2283
 
2284
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2284
+		$where = array('taxonomy' => 'espresso_event_categories');
2285 2285
 
2286
-		if ( isset( $this->_req_data['s'] ) ) {
2287
-			$sstr = '%' . $this->_req_data['s'] . '%';
2286
+		if (isset($this->_req_data['s'])) {
2287
+			$sstr = '%'.$this->_req_data['s'].'%';
2288 2288
 			$where['OR'] = array(
2289
-				'Term.name' => array( 'LIKE', $sstr),
2290
-				'description' => array( 'LIKE', $sstr )
2289
+				'Term.name' => array('LIKE', $sstr),
2290
+				'description' => array('LIKE', $sstr)
2291 2291
 				);
2292 2292
 		}
2293 2293
 
2294 2294
 		$query_params = array(
2295
-			$where ,
2296
-			'order_by' => array( $orderby => $order ),
2297
-			'limit' => $limit . ',' . $per_page,
2295
+			$where,
2296
+			'order_by' => array($orderby => $order),
2297
+			'limit' => $limit.','.$per_page,
2298 2298
 			'force_join' => array('Term')
2299 2299
 			);
2300 2300
 
2301
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2301
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2302 2302
 
2303 2303
 		return $categories;
2304 2304
 	}
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_CVV_Input.input.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 			! isset( $input_settings['include_whats_this_link'] )
34 34
 			|| (
35 35
 				isset( $input_settings['include_whats_this_link'] )
36
-			     && $input_settings['include_whats_this_link'] === true
36
+				 && $input_settings['include_whats_this_link'] === true
37 37
 			)
38 38
 		) {
39 39
 			$this->_html_label_text = sprintf(
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-class EE_CVV_Input extends EE_Text_Input{
11
+class EE_CVV_Input extends EE_Text_Input {
12 12
 
13 13
 	/**
14 14
 	 * @param array $input_settings {
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 		$this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal());
20 20
 		$this->_add_validation_strategy(
21 21
 			new EE_Text_Validation_Strategy(
22
-				isset( $input_settings[ 'validation_error_message' ] )
23
-					?  $input_settings[ 'validation_error_message' ]
22
+				isset($input_settings['validation_error_message'])
23
+					? $input_settings['validation_error_message']
24 24
 					: __(
25 25
 						'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front',
26 26
 						'event_espresso'
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 			)
30 30
 		);
31 31
 		parent::__construct($input_settings);
32
-		if(
33
-			! isset( $input_settings['include_whats_this_link'] )
32
+		if (
33
+			! isset($input_settings['include_whats_this_link'])
34 34
 			|| (
35
-				isset( $input_settings['include_whats_this_link'] )
35
+				isset($input_settings['include_whats_this_link'])
36 36
 			     && $input_settings['include_whats_this_link'] === true
37 37
 			)
38 38
 		) {
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 1 patch
Spacing   +605 added lines, -605 removed lines patch added patch discarded remove patch
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
155 155
 	 * 		@access public
156 156
 	 */
157
-	public function __construct( $routing = TRUE ) {
157
+	public function __construct($routing = TRUE) {
158 158
 
159
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
159
+		if (strpos($this->_get_dir(), 'caffeinated') !== false)
160 160
 			$this->_is_caf = TRUE;
161 161
 
162 162
 		$this->_yes_no_values = array(
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 
169 169
 		//set the _req_data property.
170
-		$this->_req_data = array_merge( $_GET, $_POST );
170
+		$this->_req_data = array_merge($_GET, $_POST);
171 171
 
172 172
 
173 173
 		//routing enabled?
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$this->_do_other_page_hooks();
189 189
 
190 190
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
191
-		if ( method_exists( $this, '_before_page_setup' ) )
191
+		if (method_exists($this, '_before_page_setup'))
192 192
 			$this->_before_page_setup();
193 193
 
194 194
 		//set up page dependencies
@@ -458,16 +458,16 @@  discard block
 block discarded – undo
458 458
 	 */
459 459
 	protected function _global_ajax_hooks() {
460 460
 		//for lazy loading of metabox content
461
-		add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 );
461
+		add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
462 462
 	}
463 463
 
464 464
 
465 465
 
466 466
 	public function ajax_metabox_content() {
467
-		$contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : '';
468
-		$url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : '';
467
+		$contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
468
+		$url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
469 469
 
470
-		self::cached_rss_display( $contentid, $url );
470
+		self::cached_rss_display($contentid, $url);
471 471
 		wp_die();
472 472
 	}
473 473
 
@@ -488,87 +488,87 @@  discard block
 block discarded – undo
488 488
 
489 489
 
490 490
 		//admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can.  But keep in mind, not everything is available from the EE_Admin Page object at this point.
491
-		add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 );
491
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
492 492
 
493 493
 
494 494
 		//next verify if we need to load anything...
495
-		$this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE;
496
-		$this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) );
495
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE;
496
+		$this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this))));
497 497
 
498 498
 		global $ee_menu_slugs;
499 499
 		$ee_menu_slugs = (array) $ee_menu_slugs;
500 500
 
501
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
501
+		if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE;
502 502
 
503 503
 
504 504
 		// becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first
505
-		if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) {
506
-			$this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
505
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) {
506
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
507 507
 		}
508 508
 		// then set blank or -1 action values to 'default'
509
-		$this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default';
509
+		$this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default';
510 510
 
511 511
 		//if action is 'default' after the above BUT we have  'route' var set, then let's use the route as the action.  This covers cases where we're coming in from a list table that isn't on the default route.
512
-		$this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action;
512
+		$this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
513 513
 
514 514
 		//however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
515 515
 		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
516 516
 
517 517
 		$this->_current_view = $this->_req_action;
518
-		$this->_req_nonce = $this->_req_action . '_nonce';
518
+		$this->_req_nonce = $this->_req_action.'_nonce';
519 519
 		$this->_define_page_props();
520 520
 
521
-		$this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ),  $this->_admin_base_url );
521
+		$this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url);
522 522
 
523 523
 		//default things
524
-		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' );
524
+		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box');
525 525
 
526 526
 		//set page configs
527 527
 		$this->_set_page_routes();
528 528
 		$this->_set_page_config();
529 529
 
530 530
 		//let's include any referrer data in our default_query_args for this route for "stickiness".
531
-		if ( isset( $this->_req_data['wp_referer'] ) ) {
531
+		if (isset($this->_req_data['wp_referer'])) {
532 532
 			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
533 533
 		}
534 534
 
535 535
 		//for caffeinated and other extended functionality.  If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays
536
-		if ( method_exists( $this, '_extend_page_config' ) )
536
+		if (method_exists($this, '_extend_page_config'))
537 537
 			$this->_extend_page_config();
538 538
 
539 539
 		//for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays.
540
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
540
+		if (method_exists($this, '_extend_page_config_for_cpt'))
541 541
 			$this->_extend_page_config_for_cpt();
542 542
 
543 543
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
544
-		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
545
-		$this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this );
544
+		$this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this);
545
+		$this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this);
546 546
 
547 547
 
548 548
 		//if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
549
-		if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) {
550
-			add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 );
549
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
550
+			add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2);
551 551
 		}
552 552
 
553 553
 
554 554
 		//next route only if routing enabled
555
-		if ( $this->_routing && !defined('DOING_AJAX') ) {
555
+		if ($this->_routing && ! defined('DOING_AJAX')) {
556 556
 
557 557
 			$this->_verify_routes();
558 558
 
559 559
 			//next let's just check user_access and kill if no access
560 560
 			$this->check_user_access();
561 561
 
562
-			if ( $this->_is_UI_request ) {
562
+			if ($this->_is_UI_request) {
563 563
 				//admin_init stuff - global, all views for this page class, specific view
564
-				add_action( 'admin_init', array( $this, 'admin_init' ), 10 );
565
-				if ( method_exists( $this, 'admin_init_' . $this->_current_view )) {
566
-					add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 );
564
+				add_action('admin_init', array($this, 'admin_init'), 10);
565
+				if (method_exists($this, 'admin_init_'.$this->_current_view)) {
566
+					add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
567 567
 				}
568 568
 
569 569
 			} else {
570 570
 				//hijack regular WP loading and route admin request immediately
571
-				@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
571
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
572 572
 				$this->route_admin_request();
573 573
 			}
574 574
 		}
@@ -585,18 +585,18 @@  discard block
 block discarded – undo
585 585
 	 * @return void
586 586
 	 */
587 587
 	private function _do_other_page_hooks() {
588
-		$registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() );
588
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
589 589
 
590
-		foreach ( $registered_pages as $page ) {
590
+		foreach ($registered_pages as $page) {
591 591
 
592 592
 			//now let's setup the file name and class that should be present
593 593
 			$classname = str_replace('.class.php', '', $page);
594 594
 
595 595
 			//autoloaders should take care of loading file
596
-			if ( !class_exists( $classname ) ) {
597
-				$error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page);
598
-				$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname );
599
-				throw new EE_Error( implode( '||', $error_msg ));
596
+			if ( ! class_exists($classname)) {
597
+				$error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page);
598
+				$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname);
599
+				throw new EE_Error(implode('||', $error_msg));
600 600
 			}
601 601
 
602 602
 			$a = new ReflectionClass($classname);
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 	public function load_page_dependencies() {
612 612
 		try {
613 613
 			$this->_load_page_dependencies();
614
-		} catch ( EE_Error $e ) {
614
+		} catch (EE_Error $e) {
615 615
 			$e->get_error();
616 616
 		}
617 617
 	}
@@ -629,16 +629,16 @@  discard block
 block discarded – undo
629 629
 		$this->_current_screen = get_current_screen();
630 630
 
631 631
 		//load admin_notices - global, page class, and view specific
632
-		add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 );
633
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
634
-		if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) {
635
-			add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 );
632
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
633
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
634
+		if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
635
+			add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
636 636
 		}
637 637
 
638 638
 		//load network admin_notices - global, page class, and view specific
639
-		add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 );
640
-		if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) {
641
-			add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) );
639
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
640
+		if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
641
+			add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
642 642
 		}
643 643
 
644 644
 		//this will save any per_page screen options if they are present
@@ -654,8 +654,8 @@  discard block
 block discarded – undo
654 654
 		//add screen options - global, page child class, and view specific
655 655
 		$this->_add_global_screen_options();
656 656
 		$this->_add_screen_options();
657
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
658
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
657
+		if (method_exists($this, '_add_screen_options_'.$this->_current_view))
658
+			call_user_func(array($this, '_add_screen_options_'.$this->_current_view));
659 659
 
660 660
 
661 661
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -666,33 +666,33 @@  discard block
 block discarded – undo
666 666
 		//add feature_pointers - global, page child class, and view specific
667 667
 		$this->_add_feature_pointers();
668 668
 		$this->_add_global_feature_pointers();
669
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
670
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
669
+		if (method_exists($this, '_add_feature_pointer_'.$this->_current_view))
670
+			call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view));
671 671
 
672 672
 		//enqueue scripts/styles - global, page class, and view specific
673
-		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
674
-		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
675
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
676
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
673
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
674
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
675
+		if (method_exists($this, 'load_scripts_styles_'.$this->_current_view))
676
+			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15);
677 677
 
678
-		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
678
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
679 679
 
680 680
 		//admin_print_footer_scripts - global, page child class, and view specific.  NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.  In most cases that's doing_it_wrong().  But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these
681
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
682
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
683
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
684
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
681
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
682
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
683
+		if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view))
684
+			add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101);
685 685
 
686 686
 		//admin footer scripts
687
-		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
688
-		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
689
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
690
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
687
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
688
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
689
+		if (method_exists($this, 'admin_footer_'.$this->_current_view))
690
+			add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101);
691 691
 
692 692
 
693
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
693
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
694 694
 		//targeted hook
695
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action );
695
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action);
696 696
 
697 697
 	}
698 698
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	private function _set_defaults() {
708 708
 		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL;
709 709
 
710
-		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config =  $this->_default_route_query_args = array();
710
+		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array();
711 711
 
712 712
 		$this->default_nav_tab_name = 'overview';
713 713
 
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 	public function route_admin_request() {
735 735
 		try {
736 736
 			$this->_route_admin_request();
737
-		} catch ( EE_Error $e ) {
737
+		} catch (EE_Error $e) {
738 738
 			$e->get_error();
739 739
 		}
740 740
 	}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 		$this->_wp_page_slug = $wp_page_slug;
746 746
 
747 747
 		//if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
748
-		if ( is_network_admin() ) {
748
+		if (is_network_admin()) {
749 749
 			$this->_wp_page_slug .= '-network';
750 750
 		}
751 751
 	}
@@ -758,53 +758,53 @@  discard block
 block discarded – undo
758 758
 	 * @return void
759 759
 	 */
760 760
 	protected function _verify_routes() {
761
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
761
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
762 762
 
763
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
763
+		if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE;
764 764
 
765 765
 		$this->_route = FALSE;
766 766
 		$func = FALSE;
767 767
 		$args = array();
768 768
 
769 769
 		// check that the page_routes array is not empty
770
-		if ( empty( $this->_page_routes )) {
770
+		if (empty($this->_page_routes)) {
771 771
 			// user error msg
772
-			$error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title );
772
+			$error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
773 773
 			// developer error msg
774
-			$error_msg .=  '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' );
775
-			throw new EE_Error( $error_msg );
774
+			$error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso');
775
+			throw new EE_Error($error_msg);
776 776
 		}
777 777
 
778 778
 		// and that the requested page route exists
779
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
780
-			$this->_route = $this->_page_routes[ $this->_req_action ];
779
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
780
+			$this->_route = $this->_page_routes[$this->_req_action];
781 781
 			$this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array();
782 782
 		} else {
783 783
 			// user error msg
784
-			$error_msg =  sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
784
+			$error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
785 785
 			// developer error msg
786
-			$error_msg .=  '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action );
787
-			throw new EE_Error( $error_msg );
786
+			$error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action);
787
+			throw new EE_Error($error_msg);
788 788
 		}
789 789
 
790 790
 		// and that a default route exists
791
-		if ( ! array_key_exists( 'default', $this->_page_routes )) {
791
+		if ( ! array_key_exists('default', $this->_page_routes)) {
792 792
 			// user error msg
793
-			$error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title );
793
+			$error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title);
794 794
 			// developer error msg
795
-			$error_msg .=  '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' );
796
-			throw new EE_Error( $error_msg );
795
+			$error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso');
796
+			throw new EE_Error($error_msg);
797 797
 		}
798 798
 
799 799
 
800 800
 		//first lets' catch if the UI request has EVER been set.
801
-		if ( $this->_is_UI_request === NULL ) {
801
+		if ($this->_is_UI_request === NULL) {
802 802
 			//lets set if this is a UI request or not.
803
-			$this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE;
803
+			$this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE;
804 804
 
805 805
 
806 806
 			//wait a minute... we might have a noheader in the route array
807
-			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
807
+			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
808 808
 		}
809 809
 
810 810
 		$this->_set_current_labels();
@@ -819,15 +819,15 @@  discard block
 block discarded – undo
819 819
 	 * @param  string $route the route name we're verifying
820 820
 	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
821 821
 	 */
822
-	protected function _verify_route( $route ) {
823
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
822
+	protected function _verify_route($route) {
823
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
824 824
 			return true;
825 825
 		} else {
826 826
 			// user error msg
827
-			$error_msg =  sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
827
+			$error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
828 828
 			// developer error msg
829
-			$error_msg .=  '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route );
830
-			throw new EE_Error( $error_msg );
829
+			$error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route);
830
+			throw new EE_Error($error_msg);
831 831
 		}
832 832
 	}
833 833
 
@@ -841,18 +841,18 @@  discard block
 block discarded – undo
841 841
 	 * @param  string $nonce_ref The nonce reference string (name0)
842 842
 	 * @return mixed (bool|die)
843 843
 	 */
844
-	protected function _verify_nonce( $nonce, $nonce_ref ) {
844
+	protected function _verify_nonce($nonce, $nonce_ref) {
845 845
 		// verify nonce against expected value
846
-		if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) {
846
+		if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
847 847
 			// these are not the droids you are looking for !!!
848
-			$msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' );
849
-			if ( WP_DEBUG ) {
850
-				$msg .= "\n  " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__  );
848
+			$msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>');
849
+			if (WP_DEBUG) {
850
+				$msg .= "\n  ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__);
851 851
 			}
852
-			if ( ! defined( 'DOING_AJAX' )) {
853
-				wp_die( $msg );
852
+			if ( ! defined('DOING_AJAX')) {
853
+				wp_die($msg);
854 854
 			} else {
855
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
855
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
856 856
 				$this->_return_json();
857 857
 			}
858 858
 		}
@@ -870,63 +870,63 @@  discard block
 block discarded – undo
870 870
 	 * @return void
871 871
 	 */
872 872
 	protected function _route_admin_request() {
873
-		if (  ! $this->_is_UI_request )
873
+		if ( ! $this->_is_UI_request)
874 874
 			$this->_verify_routes();
875 875
 
876
-		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
876
+		$nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE;
877 877
 
878
-		if ( $this->_req_action != 'default' && $nonce_check ) {
878
+		if ($this->_req_action != 'default' && $nonce_check) {
879 879
 			// set nonce from post data
880
-			$nonce = isset($this->_req_data[ $this->_req_nonce  ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce  ] ) : '';
881
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
880
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
881
+			$this->_verify_nonce($nonce, $this->_req_nonce);
882 882
 		}
883 883
 		//set the nav_tabs array but ONLY if this is  UI_request
884
-		if ( $this->_is_UI_request )
884
+		if ($this->_is_UI_request)
885 885
 			$this->_set_nav_tabs();
886 886
 
887 887
 		// grab callback function
888
-		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
888
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
889 889
 
890 890
 		// check if callback has args
891
-		$args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array();
891
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
892 892
 
893 893
 		$error_msg = '';
894 894
 
895 895
 		//action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
896
-		if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) {
897
-			do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this );
896
+		if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
897
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
898 898
 		}
899 899
 
900 900
 		//right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing).
901
-		$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
901
+		$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI']));
902 902
 
903
-		if ( ! empty( $func )) {
903
+		if ( ! empty($func)) {
904 904
 			$base_call = $addon_call = FALSE;
905 905
 			//try to access page route via this class
906
-			if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func  ), $args ) ) === FALSE ) {
906
+			if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) {
907 907
 				// user error msg
908
-				$error_msg =  __( 'An error occurred. The  requested page route could not be found.', 'event_espresso' );
908
+				$error_msg = __('An error occurred. The  requested page route could not be found.', 'event_espresso');
909 909
 				// developer error msg
910
-				$error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func );
910
+				$error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func);
911 911
 			}
912 912
 
913 913
 			//for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method)
914 914
 			$args['admin_page_object'] = $this; //send along this admin page object for access by addons.
915 915
 
916
-			if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) {
917
-				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' );
918
-				$error_msg .= '||' . sprintf( __('Page route "%s" could not be called.  Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func );
916
+			if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) {
917
+				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso');
918
+				$error_msg .= '||'.sprintf(__('Page route "%s" could not be called.  Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func);
919 919
 			}
920 920
 
921 921
 
922
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
923
-				throw new EE_Error( $error_msg );
922
+			if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE)
923
+				throw new EE_Error($error_msg);
924 924
 		}
925 925
 
926 926
 		//if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route.
927 927
 		//now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent.
928
-		if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) {
929
-			$this->_reset_routing_properties( $this->_route['headers_sent_route'] );
928
+		if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) {
929
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
930 930
 		}
931 931
 	}
932 932
 
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 	 * @param  string    $new_route   New (non header) route to redirect to.
943 943
 	 * @return   void
944 944
 	 */
945
-	protected function _reset_routing_properties( $new_route ) {
945
+	protected function _reset_routing_properties($new_route) {
946 946
 		$this->_is_UI_request = TRUE;
947 947
 		//now we set the current route to whatever the headers_sent_route is set at
948 948
 		$this->_req_data['action'] = $new_route;
@@ -988,24 +988,24 @@  discard block
 block discarded – undo
988 988
 	 * @param   bool    $exclude_nonce  If true, the the nonce will be excluded from the generated nonce.
989 989
 	 * 	@return string
990 990
 	 */
991
-	public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) {
991
+	public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) {
992 992
 		EE_Registry::instance()->load_helper('URL');
993 993
 
994 994
 		//if there is a _wp_http_referer include the values from the request but only if sticky = true
995
-		if ( $sticky ) {
995
+		if ($sticky) {
996 996
 			$request = $_REQUEST;
997
-			unset( $request['_wp_http_referer'] );
998
-			unset( $request['wp_referer'] );
999
-			foreach ( $request as $key => $value ) {
997
+			unset($request['_wp_http_referer']);
998
+			unset($request['wp_referer']);
999
+			foreach ($request as $key => $value) {
1000 1000
 				//do not add nonces
1001
-				if ( strpos( $key, 'nonce' ) !== false ) {
1001
+				if (strpos($key, 'nonce') !== false) {
1002 1002
 					continue;
1003 1003
 				}
1004
-				$args['wp_referer[' . $key . ']'] = $value;
1004
+				$args['wp_referer['.$key.']'] = $value;
1005 1005
 			}
1006 1006
 		}
1007 1007
 
1008
-		return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce );
1008
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1009 1009
 	}
1010 1010
 
1011 1011
 
@@ -1021,8 +1021,8 @@  discard block
 block discarded – undo
1021 1021
 	 * @uses EEH_Template::get_help_tab_link()
1022 1022
 	 * @return string              generated link
1023 1023
 	 */
1024
-	protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) {
1025
-		return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text );
1024
+	protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) {
1025
+		return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text);
1026 1026
 	}
1027 1027
 
1028 1028
 
@@ -1039,30 +1039,30 @@  discard block
 block discarded – undo
1039 1039
 	 */
1040 1040
 	protected function _add_help_tabs() {
1041 1041
 		$tour_buttons = '';
1042
-		if ( isset( $this->_page_config[$this->_req_action] ) ) {
1042
+		if (isset($this->_page_config[$this->_req_action])) {
1043 1043
 			$config = $this->_page_config[$this->_req_action];
1044 1044
 
1045 1045
 			//is there a help tour for the current route?  if there is let's setup the tour buttons
1046
-			if ( isset( $this->_help_tour[$this->_req_action]) ) {
1046
+			if (isset($this->_help_tour[$this->_req_action])) {
1047 1047
 				$tb = array();
1048 1048
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1049
-				foreach ( $this->_help_tour['tours'] as $tour ) {
1049
+				foreach ($this->_help_tour['tours'] as $tour) {
1050 1050
 					//if this is the end tour then we don't need to setup a button
1051
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1051
+					if ($tour instanceof EE_Help_Tour_final_stop)
1052 1052
 						continue;
1053
-					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1053
+					$tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>';
1054 1054
 				}
1055 1055
 				$tour_buttons .= implode('<br />', $tb);
1056 1056
 				$tour_buttons .= '</div></div>';
1057 1057
 			}
1058 1058
 
1059 1059
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1060
-			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1060
+			if (is_array($config) && isset($config['help_sidebar'])) {
1061 1061
 				//check that the callback given is valid
1062
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1063
-					throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) );
1062
+				if ( ! method_exists($this, $config['help_sidebar']))
1063
+					throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this)));
1064 1064
 
1065
-				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1065
+				$content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
1066 1066
 
1067 1067
 				$content .= $tour_buttons; //add help tour buttons.
1068 1068
 
@@ -1071,49 +1071,49 @@  discard block
 block discarded – undo
1071 1071
 			}
1072 1072
 
1073 1073
 			//if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
1074
-			if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) {
1074
+			if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1075 1075
 				$this->_current_screen->set_help_sidebar($tour_buttons);
1076 1076
 			}
1077 1077
 
1078 1078
 			//handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1079
-			if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) {
1079
+			if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1080 1080
 				$_ht['id'] = $this->page_slug;
1081 1081
 				$_ht['title'] = __('Help Tours', 'event_espresso');
1082
-				$_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
1082
+				$_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>';
1083 1083
 				$this->_current_screen->add_help_tab($_ht);
1084 1084
 				}/**/
1085 1085
 
1086 1086
 
1087
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1087
+			if ( ! isset($config['help_tabs'])) return; //no help tabs for this route
1088 1088
 
1089
-			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1089
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1090 1090
 				//we're here so there ARE help tabs!
1091 1091
 
1092 1092
 				//make sure we've got what we need
1093
-				if ( !isset( $cfg['title'] ) )
1094
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1093
+				if ( ! isset($cfg['title']))
1094
+					throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
1095 1095
 
1096 1096
 
1097
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1098
-					throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') );
1097
+				if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content']))
1098
+					throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso'));
1099 1099
 
1100 1100
 
1101 1101
 
1102 1102
 				//first priority goes to content.
1103
-				if ( !empty($cfg['content'] ) ) {
1104
-					$content = !empty($cfg['content']) ? $cfg['content'] : NULL;
1103
+				if ( ! empty($cfg['content'])) {
1104
+					$content = ! empty($cfg['content']) ? $cfg['content'] : NULL;
1105 1105
 
1106 1106
 				//second priority goes to filename
1107
-				} else if ( !empty($cfg['filename'] ) ) {
1108
-					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1107
+				} else if ( ! empty($cfg['filename'])) {
1108
+					$file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1109 1109
 
1110 1110
 
1111 1111
 					//it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1112
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
1112
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path;
1113 1113
 
1114 1114
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1115
-					if ( !is_readable($file_path) && !isset($cfg['callback']) ) {
1116
-						EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ );
1115
+					if ( ! is_readable($file_path) && ! isset($cfg['callback'])) {
1116
+						EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__);
1117 1117
 						return;
1118 1118
 					}
1119 1119
 					$template_args['admin_page_obj'] = $this;
@@ -1124,21 +1124,21 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
 
1126 1126
 				//check if callback is valid
1127
-				if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) {
1128
-					EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ );
1127
+				if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) {
1128
+					EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__);
1129 1129
 					return;
1130 1130
 				}
1131 1131
 
1132 1132
 				//setup config array for help tab method
1133
-				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1133
+				$id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1134 1134
 				$_ht = array(
1135 1135
 					'id' => $id,
1136 1136
 					'title' => $cfg['title'],
1137
-					'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL,
1137
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL,
1138 1138
 					'content' => $content
1139 1139
 					);
1140 1140
 
1141
-				$this->_current_screen->add_help_tab( $_ht );
1141
+				$this->_current_screen->add_help_tab($_ht);
1142 1142
 			}
1143 1143
 		}
1144 1144
 	}
@@ -1158,49 +1158,49 @@  discard block
 block discarded – undo
1158 1158
 		$this->_help_tour = array();
1159 1159
 
1160 1160
 		//exit early if help tours are turned off globally
1161
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1161
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS))
1162 1162
 			return;
1163 1163
 
1164 1164
 		//loop through _page_config to find any help_tour defined
1165
-		foreach ( $this->_page_config as $route => $config ) {
1165
+		foreach ($this->_page_config as $route => $config) {
1166 1166
 			//we're only going to set things up for this route
1167
-			if ( $route !== $this->_req_action )
1167
+			if ($route !== $this->_req_action)
1168 1168
 				continue;
1169 1169
 
1170
-			if ( isset( $config['help_tour'] ) ) {
1170
+			if (isset($config['help_tour'])) {
1171 1171
 
1172
-				foreach( $config['help_tour'] as $tour ) {
1173
-					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1172
+				foreach ($config['help_tour'] as $tour) {
1173
+					$file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1174 1174
 					//let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent
1175
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path;
1175
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path;
1176 1176
 
1177 1177
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1178
-					if ( !is_readable($file_path) ) {
1179
-						EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ );
1178
+					if ( ! is_readable($file_path)) {
1179
+						EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__);
1180 1180
 						return;
1181 1181
 					}
1182 1182
 
1183 1183
 					require_once $file_path;
1184
-					if ( !class_exists( $tour ) ) {
1185
-						$error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour);
1186
-						$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) );
1187
-						throw new EE_Error( implode( '||', $error_msg ));
1184
+					if ( ! class_exists($tour)) {
1185
+						$error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour);
1186
+						$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this));
1187
+						throw new EE_Error(implode('||', $error_msg));
1188 1188
 					}
1189 1189
 					$a = new ReflectionClass($tour);
1190 1190
 					$tour_obj = $a->newInstance($this->_is_caf);
1191 1191
 
1192 1192
 					$tours[] = $tour_obj;
1193
-					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj );
1193
+					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1194 1194
 				}
1195 1195
 
1196 1196
 				//let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1197 1197
 				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1198 1198
 				$tours[] = $end_stop_tour;
1199
-				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour );
1199
+				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1200 1200
 			}
1201 1201
 		}
1202 1202
 
1203
-		if ( !empty( $tours ) )
1203
+		if ( ! empty($tours))
1204 1204
 			$this->_help_tour['tours'] = $tours;
1205 1205
 
1206 1206
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
@@ -1216,13 +1216,13 @@  discard block
 block discarded – undo
1216 1216
 	 * @return void
1217 1217
 	 */
1218 1218
 	protected function _add_qtips() {
1219
-		if ( isset( $this->_route_config['qtips'] ) ) {
1219
+		if (isset($this->_route_config['qtips'])) {
1220 1220
 			$qtips = (array) $this->_route_config['qtips'];
1221 1221
 			//load qtip loader
1222 1222
 			EE_Registry::instance()->load_helper('Qtip_Loader', array(), TRUE);
1223 1223
 			$path = array(
1224
-				$this->_get_dir() . '/qtips/',
1225
-				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/'
1224
+				$this->_get_dir().'/qtips/',
1225
+				EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/'
1226 1226
 				);
1227 1227
 			EEH_Qtip_Loader::instance()->register($qtips, $path);
1228 1228
 		}
@@ -1239,41 +1239,41 @@  discard block
 block discarded – undo
1239 1239
 	 * @return void
1240 1240
 	 */
1241 1241
 	protected function _set_nav_tabs() {
1242
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1242
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1243 1243
 		$i = 0;
1244
-		foreach ( $this->_page_config as $slug => $config ) {
1245
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1244
+		foreach ($this->_page_config as $slug => $config) {
1245
+			if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav'])))
1246 1246
 				continue; //no nav tab for this config
1247 1247
 
1248 1248
 			//check for persistent flag
1249
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1249
+			if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action)
1250 1250
 				continue; //nav tab is only to appear when route requested.
1251 1251
 
1252
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1252
+			if ( ! $this->check_user_access($slug, TRUE))
1253 1253
 				continue; //no nav tab becasue current user does not have access.
1254 1254
 
1255
-			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1255
+			$css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1256 1256
 			$this->_nav_tabs[$slug] = array(
1257
-				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ),
1258
-				'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ),
1259
-				'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class,
1260
-				'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i
1257
+				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url),
1258
+				'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)),
1259
+				'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class,
1260
+				'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i
1261 1261
 				);
1262 1262
 			$i++;
1263 1263
 		}
1264 1264
 
1265 1265
 		//if $this->_nav_tabs is empty then lets set the default
1266
-		if ( empty( $this->_nav_tabs ) ) {
1266
+		if (empty($this->_nav_tabs)) {
1267 1267
 			$this->_nav_tabs[$this->default_nav_tab_name] = array(
1268 1268
 				'url' => $this->admin_base_url,
1269
-				'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ),
1269
+				'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)),
1270 1270
 				'css_class' => 'nav-tab-active',
1271 1271
 				'order' => 10
1272 1272
 				);
1273 1273
 		}
1274 1274
 
1275 1275
 		//now let's sort the tabs according to order
1276
-		usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' ));
1276
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1277 1277
 
1278 1278
 	}
1279 1279
 
@@ -1289,10 +1289,10 @@  discard block
 block discarded – undo
1289 1289
 	 * @return void
1290 1290
 	 */
1291 1291
 	private function _set_current_labels() {
1292
-		if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) {
1293
-			foreach ( $this->_route_config['labels'] as $label => $text ) {
1294
-				if ( is_array($text) ) {
1295
-					foreach ( $text as $sublabel => $subtext ) {
1292
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1293
+			foreach ($this->_route_config['labels'] as $label => $text) {
1294
+				if (is_array($text)) {
1295
+					foreach ($text as $sublabel => $subtext) {
1296 1296
 						$this->_labels[$label][$sublabel] = $subtext;
1297 1297
 					}
1298 1298
 				} else {
@@ -1313,24 +1313,24 @@  discard block
 block discarded – undo
1313 1313
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1314 1314
 	*		@return 		BOOL|wp_die()
1315 1315
 	*/
1316
-	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1317
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1318
-		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
1319
-		$capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1316
+	public function check_user_access($route_to_check = '', $verify_only = FALSE) {
1317
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1318
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1319
+		$capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1320 1320
 
1321
-		if ( empty( $capability ) && empty( $route_to_check )  ) {
1322
-			$capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability'];
1321
+		if (empty($capability) && empty($route_to_check)) {
1322
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability'];
1323 1323
 		} else {
1324
-			$capability = empty( $capability ) ? 'manage_options' : $capability;
1324
+			$capability = empty($capability) ? 'manage_options' : $capability;
1325 1325
 		}
1326 1326
 
1327
-		$id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0;
1327
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1328 1328
 
1329
-		if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) {
1330
-			if ( $verify_only ) {
1329
+		if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) {
1330
+			if ($verify_only) {
1331 1331
 				return FALSE;
1332 1332
 			} else {
1333
-				wp_die( __('You do not have access to this route.', 'event_espresso' ) );
1333
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1334 1334
 			}
1335 1335
 		}
1336 1336
 		return TRUE;
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 		$this->_add_admin_page_overlay();
1408 1408
 
1409 1409
 		//if metaboxes are present we need to add the nonce field
1410
-		if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) {
1410
+		if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) {
1411 1411
 			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1412 1412
 			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1413 1413
 		}
@@ -1426,20 +1426,20 @@  discard block
 block discarded – undo
1426 1426
 	 */
1427 1427
 	public function admin_footer_global() {
1428 1428
 		//dialog container for dialog helper
1429
-		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1429
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1430 1430
 		$d_cont .= '<div class="ee-notices"></div>';
1431 1431
 		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1432 1432
 		$d_cont .= '</div>';
1433 1433
 		echo $d_cont;
1434 1434
 
1435 1435
 		//help tour stuff?
1436
-		if ( isset( $this->_help_tour[$this->_req_action] ) ) {
1436
+		if (isset($this->_help_tour[$this->_req_action])) {
1437 1437
 			echo implode('<br />', $this->_help_tour[$this->_req_action]);
1438 1438
 		}
1439 1439
 
1440 1440
 		//current set timezone for timezone js
1441 1441
 		EE_Registry::instance()->load_helper('DTT_Helper');
1442
-		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1442
+		echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1443 1443
 	}
1444 1444
 
1445 1445
 
@@ -1463,18 +1463,18 @@  discard block
 block discarded – undo
1463 1463
 	 * @access protected
1464 1464
 	 * @return string content
1465 1465
 	 */
1466
-	protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) {
1466
+	protected function _set_help_popup_content($help_array = array(), $display = FALSE) {
1467 1467
 		$content = '';
1468 1468
 
1469
-		$help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array;
1470
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php';
1469
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1470
+		$template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php';
1471 1471
 
1472 1472
 
1473 1473
 		//loop through the array and setup content
1474
-		foreach ( $help_array as $trigger => $help ) {
1474
+		foreach ($help_array as $trigger => $help) {
1475 1475
 			//make sure the array is setup properly
1476
-			if ( !isset($help['title']) || !isset($help['content'] ) ) {
1477
-				throw new EE_Error( __('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') );
1476
+			if ( ! isset($help['title']) || ! isset($help['content'])) {
1477
+				throw new EE_Error(__('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso'));
1478 1478
 			}
1479 1479
 
1480 1480
 			//we're good so let'd setup the template vars and then assign parsed template content to our content.
@@ -1484,10 +1484,10 @@  discard block
 block discarded – undo
1484 1484
 				'help_popup_content' => $help['content']
1485 1485
 				);
1486 1486
 
1487
-			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1487
+			$content .= EEH_Template::display_template($template_path, $template_args, TRUE);
1488 1488
 		}
1489 1489
 
1490
-		if ( $display )
1490
+		if ($display)
1491 1491
 			echo $content;
1492 1492
 		else
1493 1493
 			return $content;
@@ -1504,18 +1504,18 @@  discard block
 block discarded – undo
1504 1504
 	 */
1505 1505
 	private function _get_help_content() {
1506 1506
 		//what is the method we're looking for?
1507
-		$method_name = '_help_popup_content_' . $this->_req_action;
1507
+		$method_name = '_help_popup_content_'.$this->_req_action;
1508 1508
 
1509 1509
 		//if method doesn't exist let's get out.
1510
-		if ( !method_exists( $this, $method_name ) )
1510
+		if ( ! method_exists($this, $method_name))
1511 1511
 			return array();
1512 1512
 
1513 1513
 		//k we're good to go let's retrieve the help array
1514
-		$help_array = call_user_func( array( $this, $method_name ) );
1514
+		$help_array = call_user_func(array($this, $method_name));
1515 1515
 
1516 1516
 		//make sure we've got an array!
1517
-		if ( !is_array($help_array) ) {
1518
-			throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) );
1517
+		if ( ! is_array($help_array)) {
1518
+			throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso'));
1519 1519
 		}
1520 1520
 
1521 1521
 		return $help_array;
@@ -1537,27 +1537,27 @@  discard block
 block discarded – undo
1537 1537
 	 * @param array $dimensions an array of dimensions for the box (array(h,w))
1538 1538
 	 * @return string
1539 1539
 	 */
1540
-	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1540
+	protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) {
1541 1541
 
1542
-		if ( defined('DOING_AJAX') ) return;
1542
+		if (defined('DOING_AJAX')) return;
1543 1543
 
1544 1544
 		//let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1545 1545
 		$help_array = $this->_get_help_content();
1546 1546
 		$help_content = '';
1547 1547
 
1548
-		if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) {
1548
+		if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1549 1549
 			$help_array[$trigger_id] = array(
1550 1550
 				'title' => __('Missing Content', 'event_espresso'),
1551 1551
 				'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso')
1552 1552
 				);
1553
-			$help_content = $this->_set_help_popup_content( $help_array, FALSE );
1553
+			$help_content = $this->_set_help_popup_content($help_array, FALSE);
1554 1554
 		}
1555 1555
 
1556 1556
 		//let's setup the trigger
1557
-		$content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1558
-		$content = $content . $help_content;
1557
+		$content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1558
+		$content = $content.$help_content;
1559 1559
 
1560
-		if ( $display )
1560
+		if ($display)
1561 1561
 			echo $content;
1562 1562
 		else
1563 1563
 			return $content;
@@ -1614,15 +1614,15 @@  discard block
 block discarded – undo
1614 1614
 	public function load_global_scripts_styles() {
1615 1615
 		/** STYLES **/
1616 1616
 		// add debugging styles
1617
-		if ( WP_DEBUG ) {
1618
-			add_action('admin_head', array( $this, 'add_xdebug_style' ));
1617
+		if (WP_DEBUG) {
1618
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1619 1619
 		}
1620 1620
 
1621 1621
 		//register all styles
1622
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION );
1623
-		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1622
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1623
+		wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1624 1624
 		//helpers styles
1625
-		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION );
1625
+		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION);
1626 1626
 		//enqueue global styles
1627 1627
 		wp_enqueue_style('ee-admin-css');
1628 1628
 
@@ -1630,66 +1630,66 @@  discard block
 block discarded – undo
1630 1630
 		/** SCRIPTS **/
1631 1631
 
1632 1632
 		//register all scripts
1633
-		wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1634
-		wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE );
1635
-		wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true );
1633
+		wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1634
+		wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE);
1635
+		wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1636 1636
 
1637
-		wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true );
1637
+		wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true);
1638 1638
 		// register jQuery Validate - see /includes/functions/wp_hooks.php
1639
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1639
+		add_filter('FHEE_load_jquery_validate', '__return_true');
1640 1640
 		add_filter('FHEE_load_joyride', '__return_true');
1641 1641
 
1642 1642
 		//script for sorting tables
1643
-		wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
1643
+		wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
1644 1644
 		//script for parsing uri's
1645
-		wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1645
+		wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1646 1646
 		//and parsing associative serialized form elements
1647
-		wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1647
+		wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1648 1648
 		//helpers scripts
1649
-		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1650
-		wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1651
-		wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE );
1652
-		wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE );
1649
+		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1650
+		wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1651
+		wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE);
1652
+		wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE);
1653 1653
 
1654 1654
 		//google charts
1655
-		wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false );
1655
+		wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false);
1656 1656
 
1657 1657
 		//enqueue global scripts
1658 1658
 
1659 1659
 		//taking care of metaboxes
1660
-		if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) {
1660
+		if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) {
1661 1661
 			wp_enqueue_script('dashboard');
1662 1662
 		}
1663 1663
 
1664 1664
 		//enqueue thickbox for ee help popups.  default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups
1665
-		if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) {
1665
+		if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) {
1666 1666
 			wp_enqueue_script('ee_admin_js');
1667 1667
 			wp_enqueue_style('ee-admin-css');
1668 1668
 		}
1669 1669
 
1670 1670
 
1671 1671
 		//localize script for ajax lazy loading
1672
-		$lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') );
1673
-		wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1672
+		$lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content'));
1673
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1674 1674
 
1675 1675
 
1676 1676
 		/**
1677 1677
 		 * help tour stuff
1678 1678
 		 */
1679
-		if ( !empty( $this->_help_tour ) ) {
1679
+		if ( ! empty($this->_help_tour)) {
1680 1680
 
1681 1681
 			//register the js for kicking things off
1682
-			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE );
1682
+			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE);
1683 1683
 
1684 1684
 			//setup tours for the js tour object
1685
-			foreach ( $this->_help_tour['tours'] as $tour ) {
1685
+			foreach ($this->_help_tour['tours'] as $tour) {
1686 1686
 				$tours[] = array(
1687 1687
 					'id' => $tour->get_slug(),
1688 1688
 					'options' => $tour->get_options()
1689 1689
 					);
1690 1690
 			}
1691 1691
 
1692
-			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) );
1692
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1693 1693
 
1694 1694
 			//admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1695 1695
 		}
@@ -1707,52 +1707,52 @@  discard block
 block discarded – undo
1707 1707
 	public function admin_footer_scripts_eei18n_js_strings() {
1708 1708
 
1709 1709
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1710
-		EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' );
1711
-
1712
-		EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' );
1713
-		EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' );
1714
-		EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' );
1715
-		EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' );
1716
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1717
-		EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' );
1718
-		EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' );
1719
-		EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' );
1720
-		EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' );
1721
-		EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' );
1722
-		EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' );
1723
-		EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' );
1724
-		EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' );
1725
-		EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' );
1726
-		EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' );
1727
-		EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' );
1728
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1729
-		EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' );
1730
-		EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' );
1731
-		EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' );
1732
-		EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' );
1733
-		EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' );
1734
-		EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' );
1735
-		EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' );
1736
-
1737
-		EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' );
1738
-		EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' );
1739
-		EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' );
1740
-		EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' );
1741
-		EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' );
1742
-		EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' );
1743
-		EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' );
1744
-		EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' );
1745
-		EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' );
1746
-		EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' );
1747
-		EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' );
1748
-		EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' );
1749
-		EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' );
1750
-		EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' );
1710
+		EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso');
1711
+
1712
+		EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso');
1713
+		EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso');
1714
+		EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso');
1715
+		EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso');
1716
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1717
+		EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso');
1718
+		EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso');
1719
+		EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso');
1720
+		EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso');
1721
+		EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso');
1722
+		EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso');
1723
+		EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso');
1724
+		EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso');
1725
+		EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso');
1726
+		EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso');
1727
+		EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso');
1728
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1729
+		EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso');
1730
+		EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso');
1731
+		EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso');
1732
+		EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso');
1733
+		EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso');
1734
+		EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso');
1735
+		EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso');
1736
+
1737
+		EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso');
1738
+		EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso');
1739
+		EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso');
1740
+		EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso');
1741
+		EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso');
1742
+		EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso');
1743
+		EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso');
1744
+		EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso');
1745
+		EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso');
1746
+		EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso');
1747
+		EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso');
1748
+		EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso');
1749
+		EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso');
1750
+		EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso');
1751 1751
 
1752 1752
 		//setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance
1753 1753
 		//admin page when in maintenance mode and ee_admin_js is not loaded then.  This works everywhere else because
1754 1754
 		//espresso_core is listed as a dependency of ee_admin_js.
1755
-		wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
1755
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
1756 1756
 
1757 1757
 	}
1758 1758
 
@@ -1786,23 +1786,23 @@  discard block
 block discarded – undo
1786 1786
 	protected function _set_list_table() {
1787 1787
 
1788 1788
 		//first is this a list_table view?
1789
-		if ( !isset($this->_route_config['list_table']) )
1789
+		if ( ! isset($this->_route_config['list_table']))
1790 1790
 			return; //not a list_table view so get out.
1791 1791
 
1792 1792
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1793 1793
 
1794
-		if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) {
1794
+		if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) {
1795 1795
 			//user error msg
1796
-			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' );
1796
+			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso');
1797 1797
 			//developer error msg
1798
-			$error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action );
1799
-			throw new EE_Error( $error_msg );
1798
+			$error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action);
1799
+			throw new EE_Error($error_msg);
1800 1800
 		}
1801 1801
 
1802 1802
 		//let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1803
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views );
1804
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views );
1805
-		$this->_views = apply_filters( 'FHEE_list_table_views', $this->_views );
1803
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views);
1804
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1805
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1806 1806
 
1807 1807
 		$this->_set_list_table_view();
1808 1808
 		$this->_set_list_table_object();
@@ -1824,14 +1824,14 @@  discard block
 block discarded – undo
1824 1824
 	*		@return array
1825 1825
 	*/
1826 1826
 	protected function _set_list_table_view() {
1827
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1827
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1828 1828
 
1829 1829
 
1830 1830
 		// looking at active items or dumpster diving ?
1831
-		if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) {
1832
-			$this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all';
1831
+		if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
1832
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1833 1833
 		} else {
1834
-			$this->_view = sanitize_key( $this->_req_data['status'] );
1834
+			$this->_view = sanitize_key($this->_req_data['status']);
1835 1835
 		}
1836 1836
 	}
1837 1837
 
@@ -1842,9 +1842,9 @@  discard block
 block discarded – undo
1842 1842
 	 * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
1843 1843
 	 */
1844 1844
 	protected function _set_list_table_object() {
1845
-		if ( isset($this->_route_config['list_table'] ) ) {
1846
-			if ( !class_exists( $this->_route_config['list_table'] ) )
1847
-				throw new EE_Error( sprintf( __('The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this) ) );
1845
+		if (isset($this->_route_config['list_table'])) {
1846
+			if ( ! class_exists($this->_route_config['list_table']))
1847
+				throw new EE_Error(sprintf(__('The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this)));
1848 1848
 			$a = new ReflectionClass($this->_route_config['list_table']);
1849 1849
 			$this->_list_table_object = $a->newInstance($this);
1850 1850
 		}
@@ -1863,27 +1863,27 @@  discard block
 block discarded – undo
1863 1863
 	 *
1864 1864
 	 * @return array
1865 1865
 	 */
1866
-	public function get_list_table_view_RLs( $extra_query_args = array() ) {
1866
+	public function get_list_table_view_RLs($extra_query_args = array()) {
1867 1867
 
1868
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1868
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1869 1869
 
1870
-		if ( empty( $this->_views )) {
1870
+		if (empty($this->_views)) {
1871 1871
 			$this->_views = array();
1872 1872
 		}
1873 1873
 
1874 1874
 		// cycle thru views
1875
-		foreach ( $this->_views as $key => $view ) {
1875
+		foreach ($this->_views as $key => $view) {
1876 1876
 			$query_args = array();
1877 1877
 			// check for current view
1878
-			$this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1878
+			$this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1879 1879
 			$query_args['action'] = $this->_req_action;
1880
-			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
1880
+			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
1881 1881
 			$query_args['status'] = $view['slug'];
1882 1882
 			//merge any other arguments sent in.
1883
-			if ( isset( $extra_query_args[$view['slug']] ) ) {
1884
-				$query_args = array_merge( $query_args, $extra_query_args[$view['slug']] );
1883
+			if (isset($extra_query_args[$view['slug']])) {
1884
+				$query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
1885 1885
 			}
1886
-			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1886
+			$this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1887 1887
 		}
1888 1888
 
1889 1889
 		return $this->_views;
@@ -1900,15 +1900,15 @@  discard block
 block discarded – undo
1900 1900
 	 * @param int $max_entries total number of rows in the table
1901 1901
 	 * @return string
1902 1902
 	*/
1903
-	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1903
+	protected function _entries_per_page_dropdown($max_entries = FALSE) {
1904 1904
 
1905
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1906
-		$values = array( 10, 25, 50, 100 );
1907
-		$per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10;
1905
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1906
+		$values = array(10, 25, 50, 100);
1907
+		$per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
1908 1908
 
1909
-		if ( $max_entries ) {
1909
+		if ($max_entries) {
1910 1910
 			$values[] = $max_entries;
1911
-			sort( $values );
1911
+			sort($values);
1912 1912
 		}
1913 1913
 
1914 1914
 		$entries_per_page_dropdown = '
@@ -1917,15 +1917,15 @@  discard block
 block discarded – undo
1917 1917
 					Show
1918 1918
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
1919 1919
 
1920
-		foreach ( $values as $value ) {
1921
-			if ( $value < $max_entries ) {
1922
-				$selected = $value == $per_page ?  ' selected="' . $per_page . '"' : '';
1920
+		foreach ($values as $value) {
1921
+			if ($value < $max_entries) {
1922
+				$selected = $value == $per_page ? ' selected="'.$per_page.'"' : '';
1923 1923
 				$entries_per_page_dropdown .= '
1924 1924
 						<option value="'.$value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
1925 1925
 			}
1926 1926
 		}
1927 1927
 
1928
-		$selected = $max_entries == $per_page ?  ' selected="' . $per_page . '"' : '';
1928
+		$selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : '';
1929 1929
 		$entries_per_page_dropdown .= '
1930 1930
 						<option value="'.$max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
1931 1931
 
@@ -1948,8 +1948,8 @@  discard block
 block discarded – undo
1948 1948
 	*		@return 		void
1949 1949
 	*/
1950 1950
 	public function _set_search_attributes() {
1951
-		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1952
-		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
1951
+		$this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label);
1952
+		$this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
1953 1953
 	}
1954 1954
 
1955 1955
 	/*** END LIST TABLE METHODS **/
@@ -1968,20 +1968,20 @@  discard block
 block discarded – undo
1968 1968
 	 * @return void
1969 1969
 	*/
1970 1970
 	private function _add_registered_meta_boxes() {
1971
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1971
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1972 1972
 
1973 1973
 		//we only add meta boxes if the page_route calls for it
1974
-		if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) {
1974
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) {
1975 1975
 
1976 1976
 
1977 1977
 			//this simply loops through the callbacks provided and checks if there is a corresponding callback registered by the child - if there is then we go ahead and process the metabox loader.
1978
-			foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) {
1979
-				if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) {
1978
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
1979
+				if (call_user_func(array($this, &$metabox_callback)) === FALSE) {
1980 1980
 					// user error msg
1981
-				$error_msg =  __( 'An error occurred. The  requested metabox could not be found.', 'event_espresso' );
1981
+				$error_msg = __('An error occurred. The  requested metabox could not be found.', 'event_espresso');
1982 1982
 				// developer error msg
1983
-				$error_msg .= '||' . sprintf( __( 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso' ), $metabox_callback );
1984
-				throw new EE_Error( $error_msg );
1983
+				$error_msg .= '||'.sprintf(__('The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso'), $metabox_callback);
1984
+				throw new EE_Error($error_msg);
1985 1985
 				}
1986 1986
 			}
1987 1987
 		}
@@ -1998,17 +1998,17 @@  discard block
 block discarded – undo
1998 1998
 	 * @return void
1999 1999
 	 */
2000 2000
 	private function _add_screen_columns() {
2001
-		if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) {
2001
+		if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) {
2002 2002
 
2003
-			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
2003
+			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1]));
2004 2004
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2005 2005
 			$screen_id = $this->_current_screen->id;
2006 2006
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
2007
-			$total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2008
-			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2007
+			$total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2008
+			$this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2009 2009
 			$this->_template_args['current_page'] = $this->_wp_page_slug;
2010 2010
 			$this->_template_args['screen'] = $this->_current_screen;
2011
-			$this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php';
2011
+			$this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php';
2012 2012
 
2013 2013
 			//finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2014 2014
 			$this->_route_config['has_metaboxes'] = TRUE;
@@ -2025,11 +2025,11 @@  discard block
 block discarded – undo
2025 2025
 	 */
2026 2026
 
2027 2027
 	private function _espresso_news_post_box() {
2028
-		$news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) );
2029
-		add_meta_box( 'espresso_news_post_box', $news_box_title, array(
2028
+		$news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso'));
2029
+		add_meta_box('espresso_news_post_box', $news_box_title, array(
2030 2030
 			$this,
2031 2031
 			'espresso_news_post_box'
2032
-		), $this->_wp_page_slug, 'side' );
2032
+		), $this->_wp_page_slug, 'side');
2033 2033
 	}
2034 2034
 
2035 2035
 
@@ -2037,14 +2037,14 @@  discard block
 block discarded – undo
2037 2037
 	 * Code for setting up espresso ratings request metabox.
2038 2038
 	 */
2039 2039
 	protected function _espresso_ratings_request() {
2040
-		if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) {
2040
+		if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2041 2041
 			return '';
2042 2042
 		}
2043
-		$ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') );
2044
-		add_meta_box( 'espresso_ratings_request', $ratings_box_title, array(
2043
+		$ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso'));
2044
+		add_meta_box('espresso_ratings_request', $ratings_box_title, array(
2045 2045
 			$this,
2046 2046
 			'espresso_ratings_request'
2047
-		), $this->_wp_page_slug, 'side' );
2047
+		), $this->_wp_page_slug, 'side');
2048 2048
 	}
2049 2049
 
2050 2050
 
@@ -2052,35 +2052,35 @@  discard block
 block discarded – undo
2052 2052
 	 * Code for setting up espresso ratings request metabox content.
2053 2053
 	 */
2054 2054
 	public function espresso_ratings_request() {
2055
-		$template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php';
2056
-		EE_Registry::instance()->load_helper( 'Template' );
2057
-		EEH_Template::display_template( $template_path, array() );
2055
+		$template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php';
2056
+		EE_Registry::instance()->load_helper('Template');
2057
+		EEH_Template::display_template($template_path, array());
2058 2058
 	}
2059 2059
 
2060 2060
 
2061 2061
 
2062 2062
 
2063
-	public static function cached_rss_display( $rss_id, $url ) {
2064
-		$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
2065
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
2066
-		$pre = '<div class="espresso-rss-display">' . "\n\t";
2067
-		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2068
-		$post = '</div>' . "\n";
2063
+	public static function cached_rss_display($rss_id, $url) {
2064
+		$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
2065
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
2066
+		$pre = '<div class="espresso-rss-display">'."\n\t";
2067
+		$pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2068
+		$post = '</div>'."\n";
2069 2069
 
2070
-		$cache_key = 'ee_rss_' . md5( $rss_id );
2071
-		if ( FALSE != ( $output = get_transient( $cache_key ) ) ) {
2072
-			echo $pre . $output . $post;
2070
+		$cache_key = 'ee_rss_'.md5($rss_id);
2071
+		if (FALSE != ($output = get_transient($cache_key))) {
2072
+			echo $pre.$output.$post;
2073 2073
 			return TRUE;
2074 2074
 		}
2075 2075
 
2076
-		if ( ! $doing_ajax ) {
2077
-			echo $pre . $loading . $post;
2076
+		if ( ! $doing_ajax) {
2077
+			echo $pre.$loading.$post;
2078 2078
 			return FALSE;
2079 2079
 		}
2080 2080
 
2081 2081
 		ob_start();
2082
-		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) );
2083
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
2082
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2083
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2084 2084
 		return TRUE;
2085 2085
 
2086 2086
 	}
@@ -2092,13 +2092,13 @@  discard block
 block discarded – undo
2092 2092
 	  	<div id="espresso_news_post_box_content" class="infolinks">
2093 2093
 	  		<?php
2094 2094
 	  		// Get RSS Feed(s)
2095
-	  		$feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' );
2095
+	  		$feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/');
2096 2096
 	  		$url = urlencode($feed_url);
2097
-	  		self::cached_rss_display( 'espresso_news_post_box_content', $url );
2097
+	  		self::cached_rss_display('espresso_news_post_box_content', $url);
2098 2098
 
2099 2099
 	  		?>
2100 2100
 	  	</div>
2101
-	  	<?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2101
+	  	<?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2102 2102
 	  </div>
2103 2103
 		<?php
2104 2104
 	}
@@ -2119,32 +2119,32 @@  discard block
 block discarded – undo
2119 2119
 
2120 2120
 	protected function _espresso_sponsors_post_box() {
2121 2121
 
2122
-		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2123
-		if ( $show_sponsors )
2124
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2122
+		$show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE);
2123
+		if ($show_sponsors)
2124
+			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2125 2125
 	}
2126 2126
 
2127 2127
 
2128 2128
 	public function espresso_sponsors_post_box() {
2129
-		$templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php';
2130
-		EEH_Template::display_template( $templatepath );
2129
+		$templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php';
2130
+		EEH_Template::display_template($templatepath);
2131 2131
 	}
2132 2132
 
2133 2133
 
2134 2134
 
2135 2135
 	private function _publish_post_box() {
2136
-		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2136
+		$meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2137 2137
 
2138 2138
 		//if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label.  Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2139
-		if ( !empty( $this->_labels['publishbox'] ) ) {
2140
-			$box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2139
+		if ( ! empty($this->_labels['publishbox'])) {
2140
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2141 2141
 		} else {
2142 2142
 			$box_label = __('Publish', 'event_espresso');
2143 2143
 		}
2144 2144
 
2145
-		$box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this );
2145
+		$box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this);
2146 2146
 
2147
-		add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' );
2147
+		add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high');
2148 2148
 
2149 2149
 	}
2150 2150
 
@@ -2152,9 +2152,9 @@  discard block
 block discarded – undo
2152 2152
 
2153 2153
 	public function editor_overview() {
2154 2154
 		//if we have extra content set let's add it in if not make sure its empty
2155
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2156
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php';
2157
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2155
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2156
+		$template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php';
2157
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2158 2158
 	}
2159 2159
 
2160 2160
 
@@ -2170,8 +2170,8 @@  discard block
 block discarded – undo
2170 2170
 	 * @see $this->_set_publish_post_box_vars for param details
2171 2171
 	 * @since 4.6.0
2172 2172
 	 */
2173
-	public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) {
2174
-		$this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns );
2173
+	public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) {
2174
+		$this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns);
2175 2175
 	}
2176 2176
 
2177 2177
 
@@ -2190,24 +2190,24 @@  discard block
 block discarded – undo
2190 2190
 	 * @param	string	$post_save_redirect_URL	custom URL to redirect to after Save & Close has been completed
2191 2191
 	 * @param	boolean	$both_btns	whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button
2192 2192
 	 */
2193
-	protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) {
2193
+	protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) {
2194 2194
 
2195 2195
 		// if Save & Close, use a custom redirect URL or default to the main page?
2196
-		$save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url;
2196
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url;
2197 2197
 		// create the Save & Close and Save buttons
2198
-		$this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL );
2198
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2199 2199
 		//if we have extra content set let's add it in if not make sure its empty
2200
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2200
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2201 2201
 
2202 2202
 
2203
-		if ( $delete && ! empty( $id )  ) {
2203
+		if ($delete && ! empty($id)) {
2204 2204
 			$delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent.
2205
-			$delete_link_args = array( $name => $id );
2206
-			$delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion');
2205
+			$delete_link_args = array($name => $id);
2206
+			$delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion');
2207 2207
 		}
2208 2208
 
2209
-		$this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : '';
2210
-		if ( ! empty( $name ) && ! empty( $id ) ) {
2209
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2210
+		if ( ! empty($name) && ! empty($id)) {
2211 2211
 			$hidden_field_arr[$name] = array(
2212 2212
 				'type' => 'hidden',
2213 2213
 				'value' => $id
@@ -2217,7 +2217,7 @@  discard block
 block discarded – undo
2217 2217
 			$hf = '';
2218 2218
 		}
2219 2219
 		// add hidden field
2220
-		$this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf;
2220
+		$this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf;
2221 2221
 
2222 2222
 	}
2223 2223
 
@@ -2234,8 +2234,8 @@  discard block
 block discarded – undo
2234 2234
 		<noscript>
2235 2235
 			<div id="no-js-message" class="error">
2236 2236
 				<p style="font-size:1.3em;">
2237
-					<span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span>
2238
-					<?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?>
2237
+					<span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span>
2238
+					<?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?>
2239 2239
 				</p>
2240 2240
 			</div>
2241 2241
 		</noscript>
@@ -2255,7 +2255,7 @@  discard block
 block discarded – undo
2255 2255
 	*		@return 		string
2256 2256
 	*/
2257 2257
 	private function _display_espresso_notices() {
2258
-		$notices = $this->_get_transient( TRUE );
2258
+		$notices = $this->_get_transient(TRUE);
2259 2259
 		echo stripslashes($notices);
2260 2260
 	}
2261 2261
 
@@ -2307,11 +2307,11 @@  discard block
 block discarded – undo
2307 2307
 	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2308 2308
 	 * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box.
2309 2309
 	 */
2310
-	public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) {
2311
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback );
2310
+	public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) {
2311
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2312 2312
 
2313 2313
 		//if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated.
2314
-		if ( empty( $callback_args ) && $create_func ) {
2314
+		if (empty($callback_args) && $create_func) {
2315 2315
 			$callback_args = array(
2316 2316
 				'template_path' => $this->_template_path,
2317 2317
 				'template_args' => $this->_template_args,
@@ -2321,7 +2321,7 @@  discard block
 block discarded – undo
2321 2321
 		//if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2322 2322
 		$call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback;
2323 2323
 
2324
-		add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args );
2324
+		add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args);
2325 2325
 	}
2326 2326
 
2327 2327
 
@@ -2334,7 +2334,7 @@  discard block
 block discarded – undo
2334 2334
 	 */
2335 2335
 	public function display_admin_page_with_metabox_columns() {
2336 2336
 		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2337
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE);
2337
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE);
2338 2338
 
2339 2339
 		//the final wrapper
2340 2340
 		$this->admin_page_wrapper();
@@ -2377,7 +2377,7 @@  discard block
 block discarded – undo
2377 2377
 	 * @return void
2378 2378
 	 */
2379 2379
 	public function display_about_admin_page() {
2380
-		$this->_display_admin_page( FALSE, TRUE );
2380
+		$this->_display_admin_page(FALSE, TRUE);
2381 2381
 	}
2382 2382
 
2383 2383
 
@@ -2393,26 +2393,26 @@  discard block
 block discarded – undo
2393 2393
 	 * @return html           admin_page
2394 2394
 	 */
2395 2395
 	private function _display_admin_page($sidebar = false, $about = FALSE) {
2396
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2396
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2397 2397
 
2398 2398
 		//custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2399
-		do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' );
2399
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2400 2400
 
2401 2401
 		// set current wp page slug - looks like: event-espresso_page_event_categories
2402 2402
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2403 2403
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2404 2404
 
2405
-		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2405
+		$template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2406 2406
 
2407
-		if ( defined('DOING_AJAX' ) )
2408
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2407
+		if (defined('DOING_AJAX'))
2408
+			$template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2409 2409
 
2410
-		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2410
+		$template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2411 2411
 
2412
-		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2412
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '';
2413 2413
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
2414 2414
 		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '';
2415
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2415
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2416 2416
 
2417 2417
 
2418 2418
 		// the final template wrapper
@@ -2432,7 +2432,7 @@  discard block
 block discarded – undo
2432 2432
 	 * @param bool   $display_sidebar whether to use the sidebar template or the full template for the page.  TRUE = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2433 2433
 	 * @return void
2434 2434
 	 */
2435
-	public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) {
2435
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) {
2436 2436
 		//let's generate a default preview action button if there isn't one already present.
2437 2437
 		$this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso');
2438 2438
 		$buy_now_url = add_query_arg(
@@ -2445,10 +2445,10 @@  discard block
 block discarded – undo
2445 2445
 			),
2446 2446
 		'http://eventespresso.com/pricing/'
2447 2447
 		);
2448
-		$this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) ? $this->get_action_link_or_button( '', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true ) : $this->_template_args['preview_action_button'];
2449
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php';
2450
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2451
-		$this->_display_admin_page( $display_sidebar );
2448
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) ? $this->get_action_link_or_button('', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true) : $this->_template_args['preview_action_button'];
2449
+		$template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php';
2450
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2451
+		$this->_display_admin_page($display_sidebar);
2452 2452
 	}
2453 2453
 
2454 2454
 
@@ -2482,41 +2482,41 @@  discard block
 block discarded – undo
2482 2482
 	 * @param boolean $sidebar whether to display with sidebar or not.
2483 2483
 	 * @return html
2484 2484
 	 */
2485
-	private function _display_admin_list_table_page( $sidebar = false ) {
2485
+	private function _display_admin_list_table_page($sidebar = false) {
2486 2486
 		//setup search attributes
2487 2487
 		$this->_set_search_attributes();
2488 2488
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2489
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2489
+		$template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2490 2490
 
2491
-		$this->_template_args['table_url'] = defined( 'DOING_AJAX') ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url);
2491
+		$this->_template_args['table_url'] = defined('DOING_AJAX') ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2492 2492
 		$this->_template_args['list_table'] = $this->_list_table_object;
2493 2493
 		$this->_template_args['current_route'] = $this->_req_action;
2494
-		$this->_template_args['list_table_class'] = get_class( $this->_list_table_object );
2494
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2495 2495
 
2496 2496
 		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2497
-		if( ! empty( $ajax_sorting_callback )) {
2498
-			$sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE );
2497
+		if ( ! empty($ajax_sorting_callback)) {
2498
+			$sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE);
2499 2499
 //			$reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce';
2500 2500
 //			$sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE );
2501
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />';
2502
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />';
2501
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />';
2502
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />';
2503 2503
 		} else {
2504 2504
 			$sortable_list_table_form_fields = '';
2505 2505
 		}
2506 2506
 
2507 2507
 		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2508
-		$hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : '';
2509
-		$nonce_ref = $this->_req_action . '_nonce';
2510
-		$hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">';
2508
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : '';
2509
+		$nonce_ref = $this->_req_action.'_nonce';
2510
+		$hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
2511 2511
 		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2512 2512
 
2513 2513
 		//display message about search results?
2514
-		$this->_template_args['before_list_table'] .= apply_filters( 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', !empty( $this->_req_data['s'] ) ? '<p class="ee-search-results">' . sprintf( __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%') ) . '</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action );
2514
+		$this->_template_args['before_list_table'] .= apply_filters('FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', ! empty($this->_req_data['s']) ? '<p class="ee-search-results">'.sprintf(__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%')).'</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action);
2515 2515
 
2516
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2516
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2517 2517
 
2518 2518
 		// the final template wrapper
2519
-		if ( $sidebar )
2519
+		if ($sidebar)
2520 2520
 			$this->display_admin_page_with_sidebar();
2521 2521
 		else
2522 2522
 			$this->display_admin_page_with_no_sidebar();
@@ -2539,9 +2539,9 @@  discard block
 block discarded – undo
2539 2539
 	 * @param  array $items  see above for format of array
2540 2540
 	 * @return string        html string of legend
2541 2541
 	 */
2542
-	protected function _display_legend( $items ) {
2543
-		$template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this );
2544
-		$legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php';
2542
+	protected function _display_legend($items) {
2543
+		$template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this);
2544
+		$legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php';
2545 2545
 		return EEH_Template::display_template($legend_template, $template_args, TRUE);
2546 2546
 	}
2547 2547
 
@@ -2566,33 +2566,33 @@  discard block
 block discarded – undo
2566 2566
 	 *
2567 2567
 	 * @return json object
2568 2568
 	 */
2569
-	protected function _return_json( $sticky_notices = false ) {
2569
+	protected function _return_json($sticky_notices = false) {
2570 2570
 
2571 2571
 		//make sure any EE_Error notices have been handled.
2572
-		$this->_process_notices( array(), true, $sticky_notices );
2572
+		$this->_process_notices(array(), true, $sticky_notices);
2573 2573
 
2574 2574
 
2575
-		$data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array();
2575
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
2576 2576
 		unset($this->_template_args['data']);
2577 2577
 		$json = array(
2578
-			'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false,
2579
-			'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false,
2580
-			'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false,
2581
-			'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false,
2578
+			'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
2579
+			'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
2580
+			'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
2581
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
2582 2582
 			'notices' => EE_Error::get_notices(),
2583
-			'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '',
2584
-			'data' => array_merge( $data, array('template_args' => $this->_template_args ) ),
2583
+			'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '',
2584
+			'data' => array_merge($data, array('template_args' => $this->_template_args)),
2585 2585
 			'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2586 2586
 			);
2587 2587
 
2588 2588
 
2589 2589
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2590
-		if ( NULL === error_get_last() || ! headers_sent() )
2590
+		if (NULL === error_get_last() || ! headers_sent())
2591 2591
 			header('Content-Type: application/json; charset=UTF-8');
2592
-                if( function_exists( 'wp_json_encode' ) ) {
2593
-                    echo wp_json_encode( $json );
2592
+                if (function_exists('wp_json_encode')) {
2593
+                    echo wp_json_encode($json);
2594 2594
                 } else {
2595
-                    echo json_encode( $json );
2595
+                    echo json_encode($json);
2596 2596
                 }
2597 2597
 		exit();
2598 2598
 	}
@@ -2604,11 +2604,11 @@  discard block
 block discarded – undo
2604 2604
 	 * @return json_obj|EE_Error
2605 2605
 	 */
2606 2606
 	public function return_json() {
2607
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2607
+		if (defined('DOING_AJAX') && DOING_AJAX)
2608 2608
 			$this->_return_json();
2609 2609
 
2610 2610
 		else {
2611
-			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2611
+			throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__));
2612 2612
 		}
2613 2613
 	}
2614 2614
 
@@ -2623,7 +2623,7 @@  discard block
 block discarded – undo
2623 2623
 	 * @access public
2624 2624
 	 * @return void
2625 2625
 	 */
2626
-	public function set_hook_object( EE_Admin_Hooks $hook_obj ) {
2626
+	public function set_hook_object(EE_Admin_Hooks $hook_obj) {
2627 2627
 		$this->_hook_obj = $hook_obj;
2628 2628
 	}
2629 2629
 
@@ -2639,33 +2639,33 @@  discard block
 block discarded – undo
2639 2639
 	*/
2640 2640
 	public function admin_page_wrapper($about = FALSE) {
2641 2641
 
2642
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2642
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2643 2643
 
2644 2644
 		$this->_nav_tabs = $this->_get_main_nav_tabs();
2645 2645
 
2646 2646
 		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
2647 2647
 		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
2648 2648
 
2649
-		$this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : '');
2650
-		$this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : '');
2649
+		$this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '');
2650
+		$this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '');
2651 2651
 
2652 2652
 		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
2653 2653
 
2654 2654
 
2655 2655
 
2656 2656
 		// load settings page wrapper template
2657
-		$template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php';
2657
+		$template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php';
2658 2658
 
2659 2659
 		//about page?
2660
-		$template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path;
2660
+		$template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path;
2661 2661
 
2662 2662
 
2663
-		if ( defined( 'DOING_AJAX' ) ) {
2664
-			$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2663
+		if (defined('DOING_AJAX')) {
2664
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2665 2665
 
2666 2666
 			$this->_return_json();
2667 2667
 		} else {
2668
-			EEH_Template::display_template( $template_path, $this->_template_args );
2668
+			EEH_Template::display_template($template_path, $this->_template_args);
2669 2669
 		}
2670 2670
 
2671 2671
 	}
@@ -2678,7 +2678,7 @@  discard block
 block discarded – undo
2678 2678
 	 */
2679 2679
 	protected function _get_main_nav_tabs() {
2680 2680
 		//let's generate the html using the EEH_Tabbed_Content helper.  We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute (rather than setting in the page_routes array)
2681
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2681
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2682 2682
 		return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
2683 2683
 	}
2684 2684
 
@@ -2694,7 +2694,7 @@  discard block
 block discarded – undo
2694 2694
 	*		@access public
2695 2695
 	*		@return void
2696 2696
 	*/
2697
-	private function _sort_nav_tabs( $a, $b ) {
2697
+	private function _sort_nav_tabs($a, $b) {
2698 2698
 		if ($a['order'] == $b['order']) {
2699 2699
 	        return 0;
2700 2700
 	    }
@@ -2715,8 +2715,8 @@  discard block
 block discarded – undo
2715 2715
 	 * 	@uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
2716 2716
 	 * 	@uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
2717 2717
 	 */
2718
-	protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) {
2719
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
2718
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) {
2719
+		EE_Registry::instance()->load_helper('Form_Fields');
2720 2720
 		$content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars);
2721 2721
 		return $content;
2722 2722
 	}
@@ -2738,25 +2738,25 @@  discard block
 block discarded – undo
2738 2738
 	 * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button).  We can also use this to just dump default actions by submitting some other value.
2739 2739
 	 * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling).
2740 2740
 	 */
2741
-	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) {
2741
+	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) {
2742 2742
 		//make sure $text and $actions are in an array
2743 2743
 		$text = (array) $text;
2744 2744
 		$actions = (array) $actions;
2745 2745
 		$referrer_url = empty($referrer) ? '' : $referrer;
2746
-		$referrer_url = !$referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />';
2746
+		$referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />';
2747 2747
 
2748
-		$button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') );
2749
-		$default_names = array( 'save', 'save_and_close' );
2748
+		$button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso'));
2749
+		$default_names = array('save', 'save_and_close');
2750 2750
 
2751 2751
 		//add in a hidden index for the current page (so save and close redirects properly)
2752 2752
 		$this->_template_args['save_buttons'] = $referrer_url;
2753 2753
 
2754
-		foreach ( $button_text as $key => $button ) {
2754
+		foreach ($button_text as $key => $button) {
2755 2755
 			$ref = $default_names[$key];
2756
-			$id = $this->_current_view . '_' . $ref;
2757
-			$name = !empty($actions) ? $actions[$key] : $ref;
2758
-			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2759
-			if ( !$both ) break;
2756
+			$id = $this->_current_view.'_'.$ref;
2757
+			$name = ! empty($actions) ? $actions[$key] : $ref;
2758
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />';
2759
+			if ( ! $both) break;
2760 2760
 		}
2761 2761
 
2762 2762
 	}
@@ -2769,8 +2769,8 @@  discard block
 block discarded – undo
2769 2769
 	 * @since 4.6.0
2770 2770
 	 *
2771 2771
 	 */
2772
-	public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2773
-		$this->_set_add_edit_form_tags( $route, $additional_hidden_fields );
2772
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2773
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
2774 2774
 	}
2775 2775
 
2776 2776
 
@@ -2783,30 +2783,30 @@  discard block
 block discarded – undo
2783 2783
 	 * @param array $additional_hidden_fields any additional hidden fields required in the form header
2784 2784
 	 * @return void
2785 2785
 	 */
2786
-	protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2786
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2787 2787
 
2788
-		if ( empty( $route )) {
2788
+		if (empty($route)) {
2789 2789
 			$user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso');
2790
-			$dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ );
2791
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
2790
+			$dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__);
2791
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
2792 2792
 		}
2793 2793
 		// open form
2794
-		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >';
2794
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >';
2795 2795
 		// add nonce
2796
-		$nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE );
2796
+		$nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE);
2797 2797
 //		$nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE );
2798
-		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
2798
+		$this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
2799 2799
 		// add REQUIRED form action
2800 2800
 		$hidden_fields = array(
2801
-				'action' => array( 'type' => 'hidden', 'value' => $route ),
2801
+				'action' => array('type' => 'hidden', 'value' => $route),
2802 2802
 			);
2803 2803
 		// merge arrays
2804
-		$hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields;
2804
+		$hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields;
2805 2805
 		// generate form fields
2806
-		$form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' );
2806
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
2807 2807
 		// add fields to form
2808
-		foreach ( $form_fields as $field_name => $form_field ) {
2809
-			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
2808
+		foreach ($form_fields as $field_name => $form_field) {
2809
+			$this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
2810 2810
 		}
2811 2811
 
2812 2812
 		// close form
@@ -2823,8 +2823,8 @@  discard block
 block discarded – undo
2823 2823
 	 * @see EE_Admin_Page::_redirect_after_action() for params.
2824 2824
 	 * @since 4.5.0
2825 2825
 	 */
2826
-	public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2827
-		$this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite );
2826
+	public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2827
+		$this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite);
2828 2828
 	}
2829 2829
 
2830 2830
 
@@ -2840,32 +2840,32 @@  discard block
 block discarded – undo
2840 2840
 	 *	@access protected
2841 2841
 	 *	@return void
2842 2842
 	 */
2843
-	protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2843
+	protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2844 2844
 
2845
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2845
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2846 2846
 
2847 2847
 		//class name for actions/filters.
2848 2848
 		$classname = get_class($this);
2849 2849
 
2850 2850
 		//set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url
2851
-		$redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url;
2852
-		$notices = EE_Error::get_notices( FALSE );
2851
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
2852
+		$notices = EE_Error::get_notices(FALSE);
2853 2853
 
2854 2854
 		// overwrite default success messages //BUT ONLY if overwrite not overridden
2855
-		if ( ! $override_overwrite || ! empty( $notices['errors'] )) {
2855
+		if ( ! $override_overwrite || ! empty($notices['errors'])) {
2856 2856
 			EE_Error::overwrite_success();
2857 2857
 		}
2858 2858
 		// how many records affected ? more than one record ? or just one ?
2859
-		if ( $success > 1 && empty( $notices['errors'] )) {
2859
+		if ($success > 1 && empty($notices['errors'])) {
2860 2860
 			// set plural msg
2861
-			EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__);
2862
-		} else if ( $success == 1 && empty( $notices['errors'] )) {
2861
+			EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2862
+		} else if ($success == 1 && empty($notices['errors'])) {
2863 2863
 			// set singular msg
2864
-			EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ );
2864
+			EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2865 2865
 		}
2866 2866
 
2867 2867
 		// check that $query_args isn't something crazy
2868
-		if ( ! is_array( $query_args )) {
2868
+		if ( ! is_array($query_args)) {
2869 2869
 			$query_args = array();
2870 2870
 		}
2871 2871
 
@@ -2878,36 +2878,36 @@  discard block
 block discarded – undo
2878 2878
 		 * @param array $query_args   The original query_args array coming into the
2879 2879
 		 *                          		method.
2880 2880
 		 */
2881
-		do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args );
2881
+		do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args);
2882 2882
 
2883 2883
 		//calculate where we're going (if we have a "save and close" button pushed)
2884
-		if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) {
2884
+		if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) {
2885 2885
 			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
2886
-			$parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] );
2886
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
2887 2887
 			// regenerate query args array from refferer URL
2888
-			parse_str( $parsed_url['query'], $query_args );
2888
+			parse_str($parsed_url['query'], $query_args);
2889 2889
 			// correct page and action will be in the query args now
2890
-			$redirect_url = admin_url( 'admin.php' );
2890
+			$redirect_url = admin_url('admin.php');
2891 2891
 		}
2892 2892
 
2893 2893
 		//merge any default query_args set in _default_route_query_args property
2894
-		if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) {
2894
+		if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
2895 2895
 			$args_to_merge = array();
2896
-			foreach ( $this->_default_route_query_args as $query_param => $query_value ) {
2896
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
2897 2897
 				//is there a wp_referer array in our _default_route_query_args property?
2898
-				if ( $query_param == 'wp_referer'  ) {
2898
+				if ($query_param == 'wp_referer') {
2899 2899
 					$query_value = (array) $query_value;
2900
-					foreach ( $query_value as $reference => $value ) {
2901
-						if ( strpos( $reference, 'nonce' ) !== false ) {
2900
+					foreach ($query_value as $reference => $value) {
2901
+						if (strpos($reference, 'nonce') !== false) {
2902 2902
 							continue;
2903 2903
 						}
2904 2904
 
2905 2905
 						//finally we will override any arguments in the referer with
2906 2906
 						//what might be set on the _default_route_query_args array.
2907
-						if ( isset( $this->_default_route_query_args[$reference] ) ) {
2908
-							$args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] );
2907
+						if (isset($this->_default_route_query_args[$reference])) {
2908
+							$args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
2909 2909
 						} else {
2910
-							$args_to_merge[$reference] = urlencode( $value );
2910
+							$args_to_merge[$reference] = urlencode($value);
2911 2911
 						}
2912 2912
 					}
2913 2913
 					continue;
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
 
2919 2919
 			//now let's merge these arguments but override with what was specifically sent in to the
2920 2920
 			//redirect.
2921
-			$query_args = array_merge( $args_to_merge, $query_args );
2921
+			$query_args = array_merge($args_to_merge, $query_args);
2922 2922
 		}
2923 2923
 
2924 2924
 		$this->_process_notices($query_args);
@@ -2927,19 +2927,19 @@  discard block
 block discarded – undo
2927 2927
 		// generate redirect url
2928 2928
 
2929 2929
 		// if redirecting to anything other than the main page, add a nonce
2930
-		if ( isset( $query_args['action'] )) {
2930
+		if (isset($query_args['action'])) {
2931 2931
 			// manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars
2932
-			$query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
2932
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
2933 2933
 		}
2934 2934
 
2935 2935
 		//we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that).
2936
-		do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args );
2936
+		do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
2937 2937
 
2938
-		$redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args );
2938
+		$redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args);
2939 2939
 
2940 2940
 
2941 2941
 		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
2942
-		if ( defined('DOING_AJAX' ) ) {
2942
+		if (defined('DOING_AJAX')) {
2943 2943
 			$default_data = array(
2944 2944
 				'close' => TRUE,
2945 2945
 				'redirect_url' => $redirect_url,
@@ -2948,11 +2948,11 @@  discard block
 block discarded – undo
2948 2948
 				);
2949 2949
 
2950 2950
 			$this->_template_args['success'] = $success;
2951
-			$this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data;
2951
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data;
2952 2952
 			$this->_return_json();
2953 2953
 		}
2954 2954
 
2955
-		wp_safe_redirect( $redirect_url );
2955
+		wp_safe_redirect($redirect_url);
2956 2956
 		exit();
2957 2957
 	}
2958 2958
 
@@ -2968,30 +2968,30 @@  discard block
 block discarded – undo
2968 2968
 	 * @param bool    $sticky_notices      This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice.
2969 2969
 	 * @return void
2970 2970
 	 */
2971
-	protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) {
2971
+	protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) {
2972 2972
 
2973 2973
 		//first let's set individual error properties if doing_ajax and the properties aren't already set.
2974
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
2975
-			$notices = EE_Error::get_notices( false );
2976
-			if ( empty( $this->_template_args['success'] ) ) {
2977
-				$this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false;
2974
+		if (defined('DOING_AJAX') && DOING_AJAX) {
2975
+			$notices = EE_Error::get_notices(false);
2976
+			if (empty($this->_template_args['success'])) {
2977
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
2978 2978
 			}
2979 2979
 
2980
-			if ( empty( $this->_template_args['errors'] ) ) {
2981
-				$this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false;
2980
+			if (empty($this->_template_args['errors'])) {
2981
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
2982 2982
 			}
2983 2983
 
2984
-			if ( empty( $this->_template_args['attention'] ) ) {
2985
-				$this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false;
2984
+			if (empty($this->_template_args['attention'])) {
2985
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
2986 2986
 			}
2987 2987
 		}
2988 2988
 
2989 2989
 		$this->_template_args['notices'] = EE_Error::get_notices();
2990 2990
 
2991 2991
 		//IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
2992
-		if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) {
2993
-			$route = isset( $query_args['action'] ) ? $query_args['action'] : 'default';
2994
-			$this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify );
2992
+		if ( ! defined('DOING_AJAX') || $sticky_notices) {
2993
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
2994
+			$this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify);
2995 2995
 		}
2996 2996
 	}
2997 2997
 
@@ -3013,32 +3013,32 @@  discard block
 block discarded – undo
3013 3013
 	 *
3014 3014
 	 * @return string html for button
3015 3015
 	 */
3016
-	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) {
3016
+	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) {
3017 3017
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3018
-		if ( !isset($this->_page_routes[$action]) && !$base_url )
3019
-			throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
3018
+		if ( ! isset($this->_page_routes[$action]) && ! $base_url)
3019
+			throw new EE_Error(sprintf(__('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action));
3020 3020
 
3021
-		if ( !isset( $this->_labels['buttons'][$type] ) )
3022
-			throw new EE_Error( sprintf( __('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type) );
3021
+		if ( ! isset($this->_labels['buttons'][$type]))
3022
+			throw new EE_Error(sprintf(__('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type));
3023 3023
 
3024 3024
 		//finally check user access for this button.
3025
-		$has_access = $this->check_user_access( $action, TRUE );
3026
-		if ( ! $has_access ) {
3025
+		$has_access = $this->check_user_access($action, TRUE);
3026
+		if ( ! $has_access) {
3027 3027
 			return '';
3028 3028
 		}
3029 3029
 
3030
-		$_base_url = !$base_url ? $this->_admin_base_url : $base_url;
3030
+		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
3031 3031
 
3032 3032
 		$query_args = array(
3033 3033
 			'action' => $action  );
3034 3034
 
3035 3035
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3036
-		if ( !empty($extra_request) )
3037
-			$query_args = array_merge( $extra_request, $query_args );
3036
+		if ( ! empty($extra_request))
3037
+			$query_args = array_merge($extra_request, $query_args);
3038 3038
 
3039
-		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3039
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3040 3040
 
3041
-		$button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class );
3041
+		$button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3042 3042
 
3043 3043
 		return $button;
3044 3044
 	}
@@ -3058,11 +3058,11 @@  discard block
 block discarded – undo
3058 3058
 		$args = array(
3059 3059
 			'label' => $this->_admin_page_title,
3060 3060
 			'default' => 10,
3061
-			'option' => $this->_current_page . '_' . $this->_current_view . '_per_page'
3061
+			'option' => $this->_current_page.'_'.$this->_current_view.'_per_page'
3062 3062
 			);
3063 3063
 		//ONLY add the screen option if the user has access to it.
3064
-		if ( $this->check_user_access( $this->_current_view, true ) ) {
3065
-			add_screen_option( $option, $args );
3064
+		if ($this->check_user_access($this->_current_view, true)) {
3065
+			add_screen_option($option, $args);
3066 3066
 		}
3067 3067
 	}
3068 3068
 
@@ -3078,36 +3078,36 @@  discard block
 block discarded – undo
3078 3078
 	 * @return void
3079 3079
 	 */
3080 3080
 	private function _set_per_page_screen_options() {
3081
-		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3082
-			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3081
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3082
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3083 3083
 
3084
-			if ( !$user = wp_get_current_user() )
3084
+			if ( ! $user = wp_get_current_user())
3085 3085
 			return;
3086 3086
 			$option = $_POST['wp_screen_options']['option'];
3087 3087
 			$value = $_POST['wp_screen_options']['value'];
3088 3088
 
3089
-			if ( $option != sanitize_key( $option ) )
3089
+			if ($option != sanitize_key($option))
3090 3090
 				return;
3091 3091
 
3092 3092
 			$map_option = $option;
3093 3093
 
3094 3094
 			$option = str_replace('-', '_', $option);
3095 3095
 
3096
-			switch ( $map_option ) {
3097
-				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3096
+			switch ($map_option) {
3097
+				case $this->_current_page.'_'.$this->_current_view.'_per_page':
3098 3098
 					$value = (int) $value;
3099
-					if ( $value < 1 || $value > 999 )
3099
+					if ($value < 1 || $value > 999)
3100 3100
 						return;
3101 3101
 					break;
3102 3102
 				default:
3103
-					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3104
-					if ( false === $value )
3103
+					$value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value);
3104
+					if (false === $value)
3105 3105
 						return;
3106 3106
 					break;
3107 3107
 			}
3108 3108
 
3109 3109
 			update_user_meta($user->ID, $option, $value);
3110
-			wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
3110
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3111 3111
 			exit;
3112 3112
 		}
3113 3113
 	}
@@ -3118,8 +3118,8 @@  discard block
 block discarded – undo
3118 3118
 	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3119 3119
 	 * @param array $data array that will be assigned to template args.
3120 3120
 	 */
3121
-	public function set_template_args( $data ) {
3122
-		$this->_template_args = array_merge( $this->_template_args, (array) $data );
3121
+	public function set_template_args($data) {
3122
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3123 3123
 	}
3124 3124
 
3125 3125
 
@@ -3135,26 +3135,26 @@  discard block
 block discarded – undo
3135 3135
 	 * @param bool $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used when we are adding a transient before page_routes have been defined.
3136 3136
 	 * @return void
3137 3137
 	 */
3138
-	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3138
+	protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) {
3139 3139
 		$user_id = get_current_user_id();
3140 3140
 
3141
-		if ( !$skip_route_verify )
3141
+		if ( ! $skip_route_verify)
3142 3142
 			$this->_verify_route($route);
3143 3143
 
3144 3144
 
3145 3145
 		//now let's set the string for what kind of transient we're setting
3146
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3147
-		$data = $notices ? array( 'notices' => $data ) : $data;
3146
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3147
+		$data = $notices ? array('notices' => $data) : $data;
3148 3148
 		//is there already a transient for this route?  If there is then let's ADD to that transient
3149
-		$existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3150
-		if ( $existing ) {
3151
-			$data = array_merge( (array) $data, (array) $existing );
3149
+		$existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3150
+		if ($existing) {
3151
+			$data = array_merge((array) $data, (array) $existing);
3152 3152
 		}
3153 3153
 
3154
-		if ( is_multisite() && is_network_admin() ) {
3155
-			set_site_transient( $transient, $data, 8 );
3154
+		if (is_multisite() && is_network_admin()) {
3155
+			set_site_transient($transient, $data, 8);
3156 3156
 		} else {
3157
-			set_transient( $transient, $data, 8 );
3157
+			set_transient($transient, $data, 8);
3158 3158
 		}
3159 3159
 	}
3160 3160
 
@@ -3166,18 +3166,18 @@  discard block
 block discarded – undo
3166 3166
 	 * @param bool $notices true we get notices transient. False we just return normal route transient
3167 3167
 	 * @return mixed data
3168 3168
 	 */
3169
-	protected function _get_transient( $notices = FALSE, $route = FALSE ) {
3169
+	protected function _get_transient($notices = FALSE, $route = FALSE) {
3170 3170
 		$user_id = get_current_user_id();
3171
-		$route = !$route ? $this->_req_action : $route;
3172
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3173
-		$data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3171
+		$route = ! $route ? $this->_req_action : $route;
3172
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3173
+		$data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3174 3174
 		//delete transient after retrieval (just in case it hasn't expired);
3175
-		if ( is_multisite() && is_network_admin() ) {
3176
-			delete_site_transient( $transient );
3175
+		if (is_multisite() && is_network_admin()) {
3176
+			delete_site_transient($transient);
3177 3177
 		} else {
3178
-			delete_transient( $transient );
3178
+			delete_transient($transient);
3179 3179
 		}
3180
-		return $notices && isset( $data['notices'] ) ? $data['notices'] : $data;
3180
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3181 3181
 	}
3182 3182
 
3183 3183
 
@@ -3194,12 +3194,12 @@  discard block
 block discarded – undo
3194 3194
 
3195 3195
 		//retrieve all existing transients
3196 3196
 		$query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3197
-		if ( $results = $wpdb->get_results( $query ) ) {
3198
-			foreach ( $results as $result ) {
3199
-				$transient = str_replace( '_transient_', '', $result->option_name );
3200
-				get_transient( $transient );
3201
-				if ( is_multisite() && is_network_admin() ) {
3202
-					get_site_transient( $transient );
3197
+		if ($results = $wpdb->get_results($query)) {
3198
+			foreach ($results as $result) {
3199
+				$transient = str_replace('_transient_', '', $result->option_name);
3200
+				get_transient($transient);
3201
+				if (is_multisite() && is_network_admin()) {
3202
+					get_site_transient($transient);
3203 3203
 				}
3204 3204
 			}
3205 3205
 		}
@@ -3323,23 +3323,23 @@  discard block
 block discarded – undo
3323 3323
 	 * @param string $line	line no where error occurred
3324 3324
 	 * @return boolean
3325 3325
 	 */
3326
-	protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) {
3326
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') {
3327 3327
 
3328 3328
 		//remove any options that are NOT going to be saved with the config settings.
3329
-		if ( isset( $config->core->ee_ueip_optin ) ) {
3329
+		if (isset($config->core->ee_ueip_optin)) {
3330 3330
 			$config->core->ee_ueip_has_notified = TRUE;
3331 3331
 			// TODO: remove the following two lines and make sure values are migrated from 3.1
3332
-			update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin);
3333
-			update_option( 'ee_ueip_has_notified', TRUE );
3332
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3333
+			update_option('ee_ueip_has_notified', TRUE);
3334 3334
 		}
3335 3335
 		// and save it (note we're also doing the network save here)
3336
-		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE;
3337
-		$config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE );
3338
-		if ( $config_saved && $net_saved ) {
3339
-			EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab ));
3336
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE;
3337
+		$config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE);
3338
+		if ($config_saved && $net_saved) {
3339
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3340 3340
 			return TRUE;
3341 3341
 		} else {
3342
-			EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line  );
3342
+			EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3343 3343
 			return FALSE;
3344 3344
 		}
3345 3345
 	}
@@ -3352,7 +3352,7 @@  discard block
 block discarded – undo
3352 3352
 	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3353 3353
 	 * @return array
3354 3354
 	 */
3355
-	public function get_yes_no_values(){
3355
+	public function get_yes_no_values() {
3356 3356
 		return $this->_yes_no_values;
3357 3357
 	}
3358 3358
 
@@ -3374,8 +3374,8 @@  discard block
 block discarded – undo
3374 3374
 	 *
3375 3375
 	 * @return string
3376 3376
 	 */
3377
-	protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) {
3378
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3377
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') {
3378
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3379 3379
 	}
3380 3380
 
3381 3381
 
@@ -3389,8 +3389,8 @@  discard block
 block discarded – undo
3389 3389
 	 *
3390 3390
 	 * @return string
3391 3391
 	 */
3392
-	protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) {
3393
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3392
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') {
3393
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3394 3394
 	}
3395 3395
 
3396 3396
 
@@ -3409,8 +3409,8 @@  discard block
 block discarded – undo
3409 3409
 	 * @return bool success/fail
3410 3410
 	 */
3411 3411
 	protected function _process_resend_registration() {
3412
-		$this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data );
3413
-		do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data );
3412
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3413
+		do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data);
3414 3414
 		return $this->_template_args['success'];
3415 3415
 	}
3416 3416
 
@@ -3423,9 +3423,9 @@  discard block
 block discarded – undo
3423 3423
 	 * @param \EE_Payment $payment
3424 3424
 	 * @return bool success/fail
3425 3425
 	 */
3426
-	protected function _process_payment_notification( EE_Payment $payment ) {
3427
-		add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' );
3428
-		$success = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment );
3426
+	protected function _process_payment_notification(EE_Payment $payment) {
3427
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3428
+		$success = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment);
3429 3429
 		$this->_template_args['success'] = $success;
3430 3430
 		return $success;
3431 3431
 	}
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 	 *
544 544
 	 * @access        public
545 545
 	 * @access        public
546
-	 * @return        string
546
+	 * @return        false|null
547 547
 	 */
548 548
 	public static function cancel_ticket_selections() {
549 549
 		// check nonce
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 	 *
611 611
 	 *	@access public
612 612
 	 * 	@access 		public
613
-	 * 	@return		bool
613
+	 * 	@return		boolean|null
614 614
 	 */
615 615
 	public function process_ticket_selections() {
616 616
 		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 	 *    validate_post_data
753 753
 	 *
754 754
 	 * @access        private
755
-	 * @return        array  or FALSE
755
+	 * @return        string  or FALSE
756 756
 	 */
757 757
 	private static function _validate_post_data() {
758 758
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Spacing   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
 	 * @return EED_Ticket_Selector
58 58
 	 */
59 59
 	public static function instance() {
60
-		return parent::get_instance( __CLASS__ );
60
+		return parent::get_instance(__CLASS__);
61 61
 	}
62 62
 
63 63
 
64 64
 
65
-	protected function set_config(){
66
-		$this->set_config_section( 'template_settings' );
67
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
68
-		$this->set_config_name( 'EED_Ticket_Selector' );
65
+	protected function set_config() {
66
+		$this->set_config_section('template_settings');
67
+		$this->set_config_class('EE_Ticket_Selector_Config');
68
+		$this->set_config_name('EED_Ticket_Selector');
69 69
 	}
70 70
 
71 71
 
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public static function set_hooks() {
82 82
 		// routing
83
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
84
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
85
-		EE_Config::register_route( 'cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections' );
86
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
83
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
84
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
85
+		EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections');
86
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
87 87
 		//add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
88
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
88
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
89 89
 		//add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
90 90
 		//add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
91
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
91
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
92 92
 	}
93 93
 
94 94
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 *  @return 	void
101 101
 	 */
102 102
 	public static function set_hooks_admin() {
103
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
103
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
104 104
 		//add button for iframe code to event editor.
105
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
106
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
105
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
106
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
107 107
 	}
108 108
 
109 109
 
@@ -115,15 +115,15 @@  discard block
 block discarded – undo
115 115
 	 *  @return 	void
116 116
 	 */
117 117
 	public static function set_definitions() {
118
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
119
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
118
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
119
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
120 120
 
121 121
 		//if config is not set, initialize
122 122
 		//If config is not set, set it.
123
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
123
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
124 124
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
125 125
 		}
126
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
126
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
127 127
 	}
128 128
 
129 129
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * 	@param	object 			$WP
135 135
 	 * 	@return 	void
136 136
 	 */
137
-	public function run( $WP ) {}
137
+	public function run($WP) {}
138 138
 
139 139
 
140 140
 	/**
@@ -146,23 +146,23 @@  discard block
 block discarded – undo
146 146
 	public function ticket_selector_iframe() {
147 147
 		self::$_in_iframe = true;
148 148
 		/** @type EEM_Event $EEM_Event */
149
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
149
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
150 150
 		$event = $EEM_Event->get_one_by_ID(
151
-			EE_Registry::instance()->REQ->get( 'event', 0 )
151
+			EE_Registry::instance()->REQ->get('event', 0)
152 152
 		);
153
-		EE_Registry::instance()->REQ->set_espresso_page( true );
154
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
153
+		EE_Registry::instance()->REQ->set_espresso_page(true);
154
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
155 155
 		$template_args['css'] = apply_filters(
156 156
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
157 157
 			array(
158
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
159
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
160
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
161
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
158
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
159
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
160
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
161
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
162 162
 			)
163 163
 		);
164
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
165
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' );
164
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
165
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso');
166 166
 		$template_args['eei18n'] = apply_filters(
167 167
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
168 168
 			EE_Registry::localize_i18n_js_strings()
@@ -170,19 +170,19 @@  discard block
 block discarded – undo
170 170
 		$template_args['js'] = apply_filters(
171 171
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
172 172
 			array(
173
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
174
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
175
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
173
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
174
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
175
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
176 176
 			)
177 177
 		);
178 178
 		EE_Registry::instance()->load_helper('Template');
179
-		$template_args[ 'notices' ] = EEH_Template::display_template(
180
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
179
+		$template_args['notices'] = EEH_Template::display_template(
180
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
181 181
 			array(),
182 182
 			true
183 183
 		);
184 184
 		EEH_Template::display_template(
185
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
185
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
186 186
 			$template_args
187 187
 		);
188 188
 		exit;
@@ -201,23 +201,23 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return string The new html string for the permalink area.
203 203
 	 */
204
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
204
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
205 205
 		//make sure this is ONLY when editing and the event id has been set.
206
-		if ( ! empty( $id ) )  {
207
-			$post = get_post( $id );
206
+		if ( ! empty($id)) {
207
+			$post = get_post($id);
208 208
 
209 209
 			//if NOT event then let's get out.
210
-			if ( $post->post_type !== 'espresso_events' ) {
210
+			if ($post->post_type !== 'espresso_events') {
211 211
 				return $permalink_string;
212 212
 			}
213 213
 
214
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
214
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
215 215
 
216
-			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">' . __('Embed', 'event_espresso') . '</a> ';
216
+			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'.__('Embed', 'event_espresso').'</a> ';
217 217
 			$permalink_string .= '
218 218
 <div id="js-ts-iframe" style="display:none">
219 219
 	<div style="width:100%; height: 500px;">
220
-		<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>
220
+		<iframe src="' . $ticket_selector_url.'" width="100%" height="100%"></iframe>
221 221
 	</div>
222 222
 </div>';
223 223
 		}
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 	 * @param 	mixed $event
237 237
 	 * @return 	bool
238 238
 	 */
239
-	protected static function set_event( $event = null ) {
240
-		if( $event === null ) {
239
+	protected static function set_event($event = null) {
240
+		if ($event === null) {
241 241
 			global $post;
242 242
 			$event = $post;
243 243
 		}
244
-		if ( $event instanceof EE_Event ) {
244
+		if ($event instanceof EE_Event) {
245 245
 			self::$_event = $event;
246
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
246
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
247 247
 			self::$_event = $event->EE_Event;
248
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
249
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
248
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
249
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
250 250
 			self::$_event = $event->EE_Event;
251 251
 		} else {
252
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
253
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
254
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
252
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
253
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
254
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
255 255
 			return false;
256 256
 		}
257 257
 		return true;
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	 * @param 	bool 	$view_details
271 271
 	 * @return 	string
272 272
 	 */
273
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
273
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
274 274
 		// reset filter for displaying submit button
275
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
275
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
276 276
 		// poke and prod incoming event till it tells us what it is
277
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
277
+		if ( ! EED_Ticket_Selector::set_event($event)) {
278 278
 			return false;
279 279
 		}
280 280
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			&& (
286 286
 				! self::$_event->display_ticket_selector()
287 287
 				|| $view_details
288
-				|| post_password_required( $event_post )
288
+				|| post_password_required($event_post)
289 289
 				|| (
290 290
 					$_event_active_status != EE_Datetime::active
291 291
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -303,70 +303,70 @@  discard block
 block discarded – undo
303 303
 		$template_args = array();
304 304
 		$template_args['event_status'] = $_event_active_status;
305 305
 
306
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
307
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
306
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
307
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
308 308
 
309 309
 		$template_args['EVT_ID'] = self::$_event->ID();
310 310
 		$template_args['event'] = self::$_event;
311 311
 
312 312
 		// is the event expired ?
313 313
 		$template_args['event_is_expired'] = self::$_event->is_expired();
314
-		if ( $template_args['event_is_expired'] ) {
315
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
314
+		if ($template_args['event_is_expired']) {
315
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
316 316
 		}
317 317
 
318 318
 		$ticket_query_args = array(
319
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
320
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
319
+			array('Datetime.EVT_ID' => self::$_event->ID()),
320
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
321 321
 		);
322 322
 
323
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
323
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
324 324
 			//use the correct applicable time query depending on what version of core is being run.
325
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
326
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
325
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
326
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
327 327
 		}
328 328
 
329 329
 		// get all tickets for this event ordered by the datetime
330
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
330
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
331 331
 
332
-		if ( count( $template_args['tickets'] ) < 1 ) {
333
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
332
+		if (count($template_args['tickets']) < 1) {
333
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
334 334
 		}
335 335
 
336 336
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
337
-		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() );
338
-		if ( $template_args['max_atndz'] < 1 ) {
339
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
340
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
341
-				$sales_closed_msg .=  sprintf(
342
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
337
+		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit());
338
+		if ($template_args['max_atndz'] < 1) {
339
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
340
+			if (current_user_can('edit_post', self::$_event->ID())) {
341
+				$sales_closed_msg .= sprintf(
342
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
343 343
 					'<div class="ee-attention" style="text-align: left;"><b>',
344 344
 					'</b><br />',
345
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
345
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
346 346
 					'</a></span></div>'
347 347
 				);
348 348
 			}
349
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
349
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
350 350
 		}
351 351
 
352
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
353
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
352
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
353
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
354 354
 
355 355
 		// redirecting to another site for registration ??
356 356
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
357 357
 		// set up the form (but not for the admin)
358
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
358
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
359 359
 		// if not redirecting to another site for registration
360
-		if ( ! $external_url ) {
361
-			EE_Registry::instance()->load_helper( 'Template' );
362
-			EE_Registry::instance()->load_helper( 'URL' );
360
+		if ( ! $external_url) {
361
+			EE_Registry::instance()->load_helper('Template');
362
+			EE_Registry::instance()->load_helper('URL');
363 363
 			// then display the ticket selector
364
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
364
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
365 365
 		} else {
366 366
 			// if not we still need to trigger the display of the submit button
367
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
367
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
368 368
 			//display notice to admin that registration is external
369
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
369
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
370 370
 		}
371 371
 		// submit button and form close tag
372 372
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -386,27 +386,27 @@  discard block
 block discarded – undo
386 386
 	 * @param 		string $external_url
387 387
 	 * @return 		string
388 388
 	 */
389
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
389
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
390 390
 		// if redirecting, we don't need any anything else
391
-		if ( $external_url ) {
392
-			EE_Registry::instance()->load_helper( 'URL' );
393
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
394
-			$query_args = EEH_URL::get_query_string( $external_url );
395
-			foreach ( $query_args as $query_arg => $value ) {
396
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
391
+		if ($external_url) {
392
+			EE_Registry::instance()->load_helper('URL');
393
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
394
+			$query_args = EEH_URL::get_query_string($external_url);
395
+			foreach ($query_args as $query_arg => $value) {
396
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
397 397
 			}
398 398
 			return $html;
399 399
 		}
400
-		EE_Registry::instance()->load_helper( 'Event_View' );
401
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
402
-		if ( ! $checkout_url ) {
403
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
400
+		EE_Registry::instance()->load_helper('Event_View');
401
+		$checkout_url = EEH_Event_View::event_link_url($ID);
402
+		if ( ! $checkout_url) {
403
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
404 404
 		}
405 405
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
406
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
407
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
406
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
407
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
408 408
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
409
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
409
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
410 410
 		return $html;
411 411
 	}
412 412
 
@@ -421,25 +421,25 @@  discard block
 block discarded – undo
421 421
 	 * 	@return		string
422 422
 	 */
423 423
 	public static function display_ticket_selector_submit() {
424
-		if ( ! is_admin() ) {
425
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
424
+		if ( ! is_admin()) {
425
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
426 426
 				$btn_text = apply_filters(
427 427
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
428
-					__('Register Now', 'event_espresso' ),
428
+					__('Register Now', 'event_espresso'),
429 429
 					self::$_event
430 430
 				);
431 431
 				$external_url = self::$_event->external_url();
432
-				$html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"';
432
+				$html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"';
433 433
 				$html .= ' class="ticket-selector-submit-btn ';
434
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
435
-				$html .= ' type="submit" value="' . $btn_text . '" />';
436
-				$html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event );
434
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
435
+				$html .= ' type="submit" value="'.$btn_text.'" />';
436
+				$html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event);
437 437
 				$html .= '<div class="clear"><br/></div></form>';
438 438
 				return $html;
439
-			} else if ( is_archive() ) {
440
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
441
-			} else if ( EE_Registry::instance()->SSN->cart() instanceof EE_Cart ) {
442
-				if ( ! EE_Registry::instance()->SSN->cart()->all_ticket_quantity_count() ) {
439
+			} else if (is_archive()) {
440
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
441
+			} else if (EE_Registry::instance()->SSN->cart() instanceof EE_Cart) {
442
+				if ( ! EE_Registry::instance()->SSN->cart()->all_ticket_quantity_count()) {
443 443
 					return '';
444 444
 				}
445 445
 				return EED_Ticket_Selector::display_proceed_btn_when_tickets_in_cart();
@@ -467,12 +467,12 @@  discard block
 block discarded – undo
467 467
 		$html .= '">';
468 468
 		$html .= apply_filters(
469 469
 			'FHEE__EED_Ticket_Selector__proceed_to_registration_btn_txt',
470
-			__( 'Proceed to Registration', 'event_espresso' )
470
+			__('Proceed to Registration', 'event_espresso')
471 471
 		);
472 472
 		$html .= ' <span class="dashicons dashicons-arrow-right-alt2"></span>';
473 473
 		$html .= '</a>';
474 474
 		$html .= '<div class="clear"></div>';
475
-		$cancel_url = EEH_Event_View::event_link_url( self::$_event->ID() );
475
+		$cancel_url = EEH_Event_View::event_link_url(self::$_event->ID());
476 476
 		$cancel_url = add_query_arg(
477 477
 			array(
478 478
 				'ee'       => 'cancel_ticket_selections',
@@ -481,11 +481,11 @@  discard block
 block discarded – undo
481 481
 			),
482 482
 			$cancel_url
483 483
 		);
484
-		$cancel_url = wp_nonce_url( $cancel_url, 'cancel_ticket_selections', 'cancel_ticket_selections_nonce' );
485
-		$html .= '<a class="ticket-selector-submit-btn small-text" href="' . $cancel_url . '">';
484
+		$cancel_url = wp_nonce_url($cancel_url, 'cancel_ticket_selections', 'cancel_ticket_selections_nonce');
485
+		$html .= '<a class="ticket-selector-submit-btn small-text" href="'.$cancel_url.'">';
486 486
 		$html .= apply_filters(
487 487
 			'FHEE__EED_Ticket_Selector__cancel_ticket_selections_txt',
488
-			__( 'cancel ticket selection', 'event_espresso' )
488
+			__('cancel ticket selection', 'event_espresso')
489 489
 		);
490 490
 		$html .= '</a>';
491 491
 		$html .= '<div class="clear"><br/></div>';
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 	 * 	@return		string
519 519
 	 */
520 520
 	public static function display_view_details_btn() {
521
-		if ( ! self::$_event->get_permalink() ) {
522
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
521
+		if ( ! self::$_event->get_permalink()) {
522
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
523 523
 		}
524 524
 		$view_details_btn = '<form method="POST" action="';
525 525
 		$view_details_btn .= apply_filters(
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
 			self::$_event
529 529
 		);
530 530
 		$view_details_btn .= '">';
531
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
532
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
533
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
531
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
532
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
533
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
534 534
 		$view_details_btn .= '<div class="clear"><br/></div>';
535 535
 		$view_details_btn .= '</form>';
536 536
 		return $view_details_btn;
@@ -547,19 +547,19 @@  discard block
 block discarded – undo
547 547
 	 */
548 548
 	public static function cancel_ticket_selections() {
549 549
 		// check nonce
550
-		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'cancel_ticket_selections_nonce' ) ) {
550
+		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce('cancel_ticket_selections_nonce')) {
551 551
 			return false;
552 552
 		}
553
-		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__ );
554
-		if ( EE_Registry::instance()->REQ->is_set( 'event_id' ) ) {
553
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
554
+		if (EE_Registry::instance()->REQ->is_set('event_id')) {
555 555
 			wp_safe_redirect(
556 556
 				EEH_Event_View::event_link_url(
557
-					EE_Registry::instance()->REQ->get( 'event_id' )
557
+					EE_Registry::instance()->REQ->get('event_id')
558 558
 				)
559 559
 			);
560 560
 		} else {
561 561
 			wp_safe_redirect(
562
-				site_url( '/' . EE_Registry::instance()->CFG->core->event_cpt_slug . '/' )
562
+				site_url('/'.EE_Registry::instance()->CFG->core->event_cpt_slug.'/')
563 563
 			);
564 564
 		}
565 565
 		die();
@@ -574,15 +574,15 @@  discard block
 block discarded – undo
574 574
 	 * @param  string $nonce_name
575 575
 	 * @return bool
576 576
 	 */
577
-	public static function process_ticket_selector_nonce( $nonce_name ) {
577
+	public static function process_ticket_selector_nonce($nonce_name) {
578 578
 		if (
579 579
 			! is_admin()
580 580
 			&& (
581
-				! EE_Registry::instance()->REQ->is_set( $nonce_name )
581
+				! EE_Registry::instance()->REQ->is_set($nonce_name)
582 582
 				||
583 583
 				! wp_verify_nonce(
584
-					EE_Registry::instance()->REQ->get( $nonce_name ),
585
-					str_replace( '_nonce', '', $nonce_name )
584
+					EE_Registry::instance()->REQ->get($nonce_name),
585
+					str_replace('_nonce', '', $nonce_name)
586 586
 				)
587 587
 			)
588 588
 		) {
@@ -613,10 +613,10 @@  discard block
 block discarded – undo
613 613
 	 * 	@return		bool
614 614
 	 */
615 615
 	public function process_ticket_selections() {
616
-		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
616
+		do_action('EED_Ticket_Selector__process_ticket_selections__before');
617 617
 		//echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() \n";
618 618
 		// check nonce
619
-		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'process_ticket_selections_nonce' ) ) {
619
+		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce('process_ticket_selections_nonce')) {
620 620
 			return false;
621 621
 		}
622 622
 
@@ -626,109 +626,109 @@  discard block
 block discarded – undo
626 626
 		);
627 627
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
628 628
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
629
-		EE_Registry::instance()->load_core( 'Session' );
629
+		EE_Registry::instance()->load_core('Session');
630 630
 		// unless otherwise requested, clear the session
631
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
632
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
631
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
632
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
633 633
 		}
634 634
 		//d( EE_Registry::instance()->SSN );
635 635
 
636
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
636
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
637 637
 		// do we have an event id?
638
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
638
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
639 639
 			// validate/sanitize data
640 640
 			$valid = self::_validate_post_data();
641 641
 			//check total tickets ordered vs max number of attendees that can register
642
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
642
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
643 643
 
644 644
 				// ordering too many tickets !!!
645 645
 				$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
646
-				$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
646
+				$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
647 647
 				// dev only message
648 648
 				$max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso');
649
-				$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
650
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
649
+				$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
650
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
651 651
 			} else {
652 652
 
653 653
 				// all data appears to be valid
654 654
 				$tckts_slctd = false;
655 655
 				$tickets_added = 0;
656 656
 				// validate/sanitize data
657
-				$valid = apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', $valid );
658
-				if ( $valid[ 'total_tickets' ] >0 ) {
657
+				$valid = apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', $valid);
658
+				if ($valid['total_tickets'] > 0) {
659 659
 					// load cart
660
-					EE_Registry::instance()->load_core( 'Cart' );
660
+					EE_Registry::instance()->load_core('Cart');
661 661
 
662 662
 					// cycle thru the number of data rows sent from the event listing
663
-					for ( $x = 0; $x < $valid['rows']; $x++ ) {
663
+					for ($x = 0; $x < $valid['rows']; $x++) {
664 664
 						// does this row actually contain a ticket quantity?
665
-						if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
665
+						if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
666 666
 							// YES we have a ticket quantity
667 667
 							$tckts_slctd = TRUE;
668 668
 							// d( $valid['ticket_obj'][$x] );
669
-							if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
669
+							if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
670 670
 								// then add ticket to cart
671
-								$tickets_added += self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
671
+								$tickets_added += self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
672 672
 								//echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
673 673
 								//echo "\n . ticket_added: " . $ticket_added . '<br />';
674
-								if ( EE_Error::has_error() ) {
674
+								if (EE_Error::has_error()) {
675 675
 									break;
676 676
 								}
677 677
 							} else {
678 678
 								// nothing added to cart retrieved
679 679
 								EE_Error::add_error(
680
-									sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
680
+									sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
681 681
 									__FILE__, __FUNCTION__, __LINE__
682 682
 								);
683 683
 							}
684 684
 						}
685 685
 					}
686 686
 				}
687
-				do_action( 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', EE_Registry::instance()->CART, $this );
687
+				do_action('AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', EE_Registry::instance()->CART, $this);
688 688
 				//d( EE_Registry::instance()->CART );
689 689
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
690 690
 
691
-				if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd ) ) {
692
-					if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added ) ) {
693
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
691
+				if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd)) {
692
+					if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) {
693
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
694 694
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
695
-						EE_Registry::instance()->CART->save_cart( FALSE );
695
+						EE_Registry::instance()->CART->save_cart(FALSE);
696 696
 						EE_Registry::instance()->SSN->update();
697 697
 						//d( EE_Registry::instance()->CART );
698 698
 						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
699 699
 						// just return TRUE for registrations being made from admin
700
-						if ( is_admin() ) {
700
+						if (is_admin()) {
701 701
 							return TRUE;
702 702
 						}
703 703
 
704
-						EE_Error::get_notices( false, true );
705
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
704
+						EE_Error::get_notices(false, true);
705
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
706 706
 						exit();
707 707
 
708 708
 					} else {
709
-						if ( ! EE_Error::has_error() ) {
709
+						if ( ! EE_Error::has_error()) {
710 710
 							// nothing added to cart
711
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
711
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
712 712
 						}
713 713
 					}
714 714
 
715 715
 				} else {
716 716
 					// no ticket quantities were selected
717
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
717
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
718 718
 				}
719 719
 			}
720 720
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
721 721
 			// at this point, just return if registration is being made from admin
722
-			if ( is_admin() ) {
722
+			if (is_admin()) {
723 723
 				return FALSE;
724 724
 			}
725
-			if ( $valid['return_url'] ) {
726
-				EE_Error::get_notices( FALSE, TRUE );
727
-				wp_safe_redirect( $valid['return_url'] );
725
+			if ($valid['return_url']) {
726
+				EE_Error::get_notices(FALSE, TRUE);
727
+				wp_safe_redirect($valid['return_url']);
728 728
 				exit();
729
-			} elseif ( isset( $event_to_add['id'] )) {
730
-				EE_Error::get_notices( FALSE, TRUE );
731
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
729
+			} elseif (isset($event_to_add['id'])) {
730
+				EE_Error::get_notices(FALSE, TRUE);
731
+				wp_safe_redirect(get_permalink($event_to_add['id']));
732 732
 				exit();
733 733
 			} else {
734 734
 				echo EE_Error::get_notices();
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 		} else {
738 738
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
739 739
 			EE_Error::add_error(
740
-				sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
740
+				sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
741 741
 				__FILE__, __FUNCTION__, __LINE__
742 742
 			);
743 743
 		}
@@ -755,18 +755,18 @@  discard block
 block discarded – undo
755 755
 	 * @return        array  or FALSE
756 756
 	 */
757 757
 	private static function _validate_post_data() {
758
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
758
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
759 759
 
760 760
 		// start with an empty array()
761 761
 		$valid_data = array();
762 762
 		//		d( $_POST );
763 763
 		//if event id is valid
764
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
765
-		if ( $id ) {
764
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
765
+		if ($id) {
766 766
 			// grab valid id
767 767
 			$valid_data['id'] = $id;
768 768
 			// grab and sanitize return-url
769
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
769
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
770 770
 			// array of other form names
771 771
 			$inputs_to_clean = array(
772 772
 				'event_id' => 'tkt-slctr-event-id',
@@ -779,22 +779,22 @@  discard block
 block discarded – undo
779 779
 			// let's track the total number of tickets ordered.'
780 780
 			$valid_data['total_tickets'] = 0;
781 781
 			// cycle through $inputs_to_clean array
782
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
782
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
783 783
 				// check for POST data
784
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
784
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
785 785
 					// grab value
786
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
786
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
787 787
 					switch ($what) {
788 788
 
789 789
 						// integers
790 790
 						case 'event_id':
791
-							$valid_data[$what] = absint( $input_value );
791
+							$valid_data[$what] = absint($input_value);
792 792
 							// get event via the event id we put in the form
793
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
793
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
794 794
 							break;
795 795
 						case 'rows':
796 796
 						case 'max_atndz':
797
-							$valid_data[$what] = absint( $input_value );
797
+							$valid_data[$what] = absint($input_value);
798 798
 							break;
799 799
 
800 800
 						// arrays of integers
@@ -802,27 +802,27 @@  discard block
 block discarded – undo
802 802
 							//							d( $input_value );
803 803
 							$row_qty = $input_value;
804 804
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
805
-							if( ! is_array( $row_qty )) {
805
+							if ( ! is_array($row_qty)) {
806 806
 								// get number of rows
807
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
807
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
808 808
 								//								d( $rows );
809 809
 								// explode ints by the dash
810
-								$row_qty = explode( '-', $row_qty );
811
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
812
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
813
-								$row_qty = array( $row => $qty );
810
+								$row_qty = explode('-', $row_qty);
811
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
812
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
813
+								$row_qty = array($row => $qty);
814 814
 								//								 d( $row_qty );
815
-								for( $x = 1; $x <= $rows; $x++ ) {
816
-									if ( ! isset( $row_qty[$x] )) {
815
+								for ($x = 1; $x <= $rows; $x++) {
816
+									if ( ! isset($row_qty[$x])) {
817 817
 										$row_qty[$x] = 0;
818 818
 									}
819 819
 								}
820 820
 							}
821
-							ksort( $row_qty );
821
+							ksort($row_qty);
822 822
 							//							 d( $row_qty );
823 823
 							// cycle thru values
824
-							foreach ( $row_qty as $qty ) {
825
-								$qty = absint( $qty );
824
+							foreach ($row_qty as $qty) {
825
+								$qty = absint($qty);
826 826
 								// sanitize as integers
827 827
 								$valid_data[$what][] = $qty;
828 828
 								$valid_data['total_tickets'] += $qty;
@@ -833,19 +833,19 @@  discard block
 block discarded – undo
833 833
 						case 'ticket_id':
834 834
 							$value_array = array();
835 835
 							// cycle thru values
836
-							foreach ( $input_value as $key=>$value ) {
836
+							foreach ($input_value as $key=>$value) {
837 837
 								// allow only numbers, letters,  spaces, commas and dashes
838
-								$value_array[ $key ] = wp_strip_all_tags( $value );
838
+								$value_array[$key] = wp_strip_all_tags($value);
839 839
 								// get ticket via the ticket id we put in the form
840
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
841
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
840
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
841
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
842 842
 							}
843
-							$valid_data[ $what ] = $value_array;
843
+							$valid_data[$what] = $value_array;
844 844
 							break;
845 845
 
846 846
 						case 'return_url' :
847 847
 							// grab and sanitize return-url
848
-							$valid_data[$what] = esc_url_raw( $input_value );
848
+							$valid_data[$what] = esc_url_raw($input_value);
849 849
 							break;
850 850
 
851 851
 					} 	// end switch $what
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 			} 	// end foreach $inputs_to_clean
854 854
 
855 855
 		} else {
856
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
856
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
857 857
 			return FALSE;
858 858
 		}
859 859
 
@@ -871,12 +871,12 @@  discard block
 block discarded – undo
871 871
 	 * @param int       $qty
872 872
 	 * @return int quantity of tickets added
873 873
 	 */
874
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
875
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
874
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
875
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
876 876
 		// get the number of spaces left for this datetime ticket
877
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
877
+		$available_spaces = self::_ticket_datetime_availability($ticket);
878 878
 		// compare available spaces against the number of tickets being purchased
879
-		if ( $available_spaces >= $qty ) {
879
+		if ($available_spaces >= $qty) {
880 880
 			// allow addons to prevent a ticket from being added to cart
881 881
 			if (
882 882
 				! apply_filters(
@@ -889,10 +889,10 @@  discard block
 block discarded – undo
889 889
 			) {
890 890
 				return 0;
891 891
 			}
892
-			$qty = apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket );
892
+			$qty = apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket);
893 893
 			// add event to cart
894
-			if( $qty && EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
895
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
894
+			if ($qty && EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
895
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
896 896
 				return $qty;
897 897
 			} else {
898 898
 				return 0;
@@ -900,9 +900,9 @@  discard block
 block discarded – undo
900 900
 		} else {
901 901
 			// tickets can not be purchased but let's find the exact number left
902 902
 			// for the last ticket selected PRIOR to subtracting tickets
903
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
903
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
904 904
 			// greedy greedy greedy eh?
905
-			if ( $available_spaces > 0 ) {
905
+			if ($available_spaces > 0) {
906 906
 				if (
907 907
 					apply_filters(
908 908
 						'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_display_availability_error',
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 						$available_spaces
913 913
 					)
914 914
 				) {
915
-					EED_Ticket_Selector::_display_availability_error( $available_spaces );
915
+					EED_Ticket_Selector::_display_availability_error($available_spaces);
916 916
 				}
917 917
 			} else {
918 918
 				EE_Error::add_error(
@@ -937,10 +937,10 @@  discard block
 block discarded – undo
937 937
 	 * @access    private
938 938
 	 * @param int $available_spaces
939 939
 	 */
940
-	private static function _display_availability_error( $available_spaces = 1 ) {
940
+	private static function _display_availability_error($available_spaces = 1) {
941 941
 		// add error messaging - we're using the _n function that will generate
942 942
 		// the appropriate singular or plural message based on the number of $available_spaces
943
-		if ( EE_Registry::instance()->CART->all_ticket_quantity_count() ) {
943
+		if (EE_Registry::instance()->CART->all_ticket_quantity_count()) {
944 944
 			$msg = sprintf(
945 945
 				_n(
946 946
 					'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.',
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 				'<br />'
964 964
 			);
965 965
 		}
966
-		EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
966
+		EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
967 967
 	}
968 968
 
969 969
 
@@ -978,22 +978,22 @@  discard block
 block discarded – undo
978 978
 	 * @param 	bool         $get_original_ticket_spaces
979 979
 	 * @return 	int
980 980
 	 */
981
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
981
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
982 982
 		// if the $_available_spaces array has not been set up yet...
983
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
984
-				self::_set_initial_ticket_datetime_availability( $ticket );
983
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
984
+				self::_set_initial_ticket_datetime_availability($ticket);
985 985
 		}
986 986
 		$available_spaces = $ticket->qty() - $ticket->sold();
987
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
987
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
988 988
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
989
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
989
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
990 990
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
991
-				if ( $get_original_ticket_spaces ) {
991
+				if ($get_original_ticket_spaces) {
992 992
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
993
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
993
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
994 994
 				} else {
995 995
 					// we want the updated ticket availability as stored in the "datetimes" array
996
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
996
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
997 997
 				}
998 998
 			}
999 999
 		}
@@ -1009,23 +1009,23 @@  discard block
 block discarded – undo
1009 1009
 	 * @param 	EE_Ticket $ticket
1010 1010
 	 * @return 	int
1011 1011
 	 */
1012
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
1012
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
1013 1013
 		// first, get all of the datetimes that are available to this ticket
1014 1014
 		$datetimes = $ticket->get_many_related(
1015 1015
 			'Datetime',
1016
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
1016
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
1017 1017
 		);
1018
-		if ( ! empty( $datetimes )) {
1018
+		if ( ! empty($datetimes)) {
1019 1019
 			// now loop thru all of the datetimes
1020
-			foreach ( $datetimes as $datetime  ) {
1021
-				if ( $datetime instanceof EE_Datetime ) {
1020
+			foreach ($datetimes as $datetime) {
1021
+				if ($datetime instanceof EE_Datetime) {
1022 1022
 					// the number of spaces available for the datetime without considering individual ticket quantities
1023 1023
 					$spaces_remaining = $datetime->spaces_remaining();
1024 1024
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
1025
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
1025
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
1026 1026
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
1027 1027
 					// else just take the datetime spaces remaining, and assign to the datetimes array
1028
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
1028
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
1029 1029
 				}
1030 1030
 			}
1031 1031
 		}
@@ -1041,12 +1041,12 @@  discard block
 block discarded – undo
1041 1041
 	 * @param 	int   $qty
1042 1042
 	 * @return 	int
1043 1043
 	 */
1044
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
1045
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
1044
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
1045
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
1046 1046
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
1047
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
1047
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
1048 1048
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
1049
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
1049
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
1050 1050
 			}
1051 1051
 		}
1052 1052
 	}
@@ -1063,8 +1063,8 @@  discard block
 block discarded – undo
1063 1063
 	*/
1064 1064
 	public static function load_tckt_slctr_assets() {
1065 1065
 		// add some style
1066
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
1067
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
1066
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
1067
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
1068 1068
 			wp_enqueue_style('ticket_selector');
1069 1069
 			// make it dance
1070 1070
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -1078,9 +1078,9 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
 	public static function load_tckt_slctr_assets_admin() {
1080 1080
 		//iframe button js on admin event editor page
1081
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
1082
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
1083
-			wp_enqueue_script( 'ticket_selector_embed' );
1081
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
1082
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1083
+			wp_enqueue_script('ticket_selector_embed');
1084 1084
 		}
1085 1085
 	}
1086 1086
 
Please login to merge, or discard this patch.
admin/new/pricing/templates/event_tickets_datetime_ticket_row.template.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 	<td class="ee-tkt-order-field"><span class="ee-status-strip-td ee-status-strip<?php echo $tkt_status_class; ?>"></span><input type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_order]" class="edit-ticket-TKT_order" value ="<?php echo $TKT_order; ?>"></td>
4 4
 	<td><input maxlength="245" type="text" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_name]" class="edit-ticket-TKT_name ee-large-text-inp" placeholder="Ticket Title" value="<?php echo $TKT_name; ?>"></td>
5 5
 	<td>
6
-		<?php if ( $disabled ) : ?>
6
+		<?php if ($disabled) : ?>
7 7
 			<input type="hidden" id="edit-ticket-TKT_start_date-<?php echo $tkt_row; ?>"  name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_start_date]" class="edit-ticket-TKT_start_date ee-text-inp" value="<?php echo $TKT_start_date; ?>" >
8 8
 			<input type="text" name="archived_ticket[TKT_start_date]" class="edit-ticket-TKT_start_date ee-text-inp" value="<?php echo $TKT_start_date; ?>" disabled>
9 9
 		<?php else : ?>
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 		<?php endif; ?>
12 12
 	</td>
13 13
 	<td>
14
-		<?php if ( $disabled ) : ?>
14
+		<?php if ($disabled) : ?>
15 15
 			<input type="hidden" id="edit-ticket-TKT_end_date-<?php echo $tkt_row; ?>"  name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_end_date]" class="edit-ticket-TKT_end_date ee-text-inp" value="<?php echo $TKT_end_date; ?>" >
16 16
 			<input type="text" name="archived_ticket[TKT_end_date]" class="edit-ticket-TKT_end_date ee-text-inp" value="<?php echo $TKT_end_date; ?>" disabled>
17 17
 		<?php else : ?>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 		<?php endif; ?>
20 20
 	</td>
21 21
 	<td>
22
-		<?php if ( $disabled ) : ?>
22
+		<?php if ($disabled) : ?>
23 23
 			<input id="edit-ticket-TKT_base_price-<?php echo $tkt_row; ?>" type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_base_price]" class="edit-ticket-TKT_base_price ee-small-text-inp edit-price-PRC_amount ee-numeric" value="<?php echo $TKT_base_price; ?>">
24 24
 			<input type="text" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_base_price]" class="edit-ticket-TKT_base_price ee-small-text-inp edit-price-PRC_amount ee-numeric" value="<?php echo $TKT_base_price; ?>" disabled>
25 25
 		<?php else : ?>
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		<input type="hidden" id="edit-ticket-TKT_base_price_ID-<?php echo $tkt_row; ?>" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_base_price_ID]" value="<?php echo $TKT_base_price_ID; ?>">
29 29
 	</td>
30 30
 	<td>
31
-		<?php if ( $disabled ) : ?>
31
+		<?php if ($disabled) : ?>
32 32
 			<input type="hidden" class="edit-ticket-TKT_qty ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_qty]" value="<?php echo $TKT_qty_for_input; ?>">
33 33
 			<input type="text" class="edit-ticket-TKT_qty ee-small-text-inp ee-numeric" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_qty]" value="<?php echo $TKT_qty_for_input; ?>" disabled>
34 34
 		<?php else : ?>
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	</td>
38 38
 	<!--<td><span class="ticket-display-row-TKT_price"><?php echo $TKT_price; ?></span></td>-->
39 39
 	<td><span class="ticket-display-row-TKT_sold"><?php echo $TKT_sold; ?></span></td>
40
-	<?php if ( WP_DEBUG ) { ?>
40
+	<?php if (WP_DEBUG) { ?>
41 41
 	<td><span class="ticket-display-row-TKT_reserved"><?php echo $TKT_reserved; ?></span></td>
42 42
 	<?php } ?>
43 43
 	<td><span class="ticket-display-row-TKT_registrations"><?php echo $TKT_registrations; ?></span></td>
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 			<input type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_ID]" class="edit-ticket-TKT_ID" value="<?php echo $TKT_ID; ?>">
53 53
 			<input type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_row]" class="edit-ticket-TKT_row" value="<?php echo $tkt_row; ?>">
54 54
 
55
-			<!--<div class="total-price-container"><?php printf( __('Total Final Price: %s', 'event_espresso'), '<span class="ticket-price-amount">' . $TKT_price . '</span>'); ?> </div>-->
55
+			<!--<div class="total-price-container"><?php printf(__('Total Final Price: %s', 'event_espresso'), '<span class="ticket-price-amount">'.$TKT_price.'</span>'); ?> </div>-->
56 56
 			<textarea name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_description]" class="edit-ticket-TKT_description ee-full-textarea-inp" placeholder="Ticket Description"><?php echo $TKT_description; ?></textarea>
57 57
 
58
-			<?php do_action( 'AHEE__event_tickets_datetime_ticket_row_template_after_desc', $tkt_row, $TKT_ID ); ?>
58
+			<?php do_action('AHEE__event_tickets_datetime_ticket_row_template_after_desc', $tkt_row, $TKT_ID); ?>
59 59
 
60 60
 			<div class="basic-ticket-container">
61 61
 				<h4 class="tickets-heading"><?php _e('Ticket Details', 'event_espresso'); ?></h4>
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 					<tbody>
72 72
 						<tr>
73 73
 							<td>
74
-								<?php if ( $disabled ) : ?>
74
+								<?php if ($disabled) : ?>
75 75
 									<input type="hidden" class="edit-ticket-TKT_uses ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_uses]" value="<?php echo $TKT_uses; ?>">
76 76
 									<input type="text" class="edit-ticket-TKT_uses ee-small-text-inp ee-numeric" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_uses]" value="<?php echo $TKT_uses; ?>" disabled>
77 77
 								<?php else : ?>
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 								<?php endif; ?>
80 80
 							</td>
81 81
 							<td>
82
-								<?php if ( $disabled ) : ?>
82
+								<?php if ($disabled) : ?>
83 83
 									<input type="hidden" class="edit-ticket-TKT_min ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_min]" value="<?php echo $TKT_min; ?>">
84 84
 									<input type="text" class="edit-ticket-TKT_min ee-small-text-inp ee-numeric" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_min]" value="<?php echo $TKT_min; ?>" disabled>
85 85
 								<?php else: ?>
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 								<?php endif; ?>
88 88
 							</td>
89 89
 							<td>
90
-								<?php if ( $disabled ) : ?>
90
+								<?php if ($disabled) : ?>
91 91
 									<input type="hidden" class="edit-ticket-TKT_max ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_max]" value="<?php echo $TKT_max; ?>">
92 92
 									<input type="text" class="edit-ticket-TKT_max ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_max]" value="<?php echo $TKT_max; ?>" disabled>
93 93
 								<?php else : ?>
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
 					<label for="edit-ticket-TKT_required"><?php _e('This ticket is required (will appear first in frontend ticket lists).', 'event_espresso'); ?></label>
106 106
 				</div>
107 107
 				<div class="ticket-is-taxable-container">
108
-					<?php if ( !empty($tax_rows) ) { ?>
109
-						<?php if ( $disabled ) : ?>
108
+					<?php if ( ! empty($tax_rows)) { ?>
109
+						<?php if ($disabled) : ?>
110 110
 							<?php
111
-								$tax_value = !empty( $TKT_taxable ) ? 1 : 0;
111
+								$tax_value = ! empty($TKT_taxable) ? 1 : 0;
112 112
 							?>
113
-							<input class="TKT-taxable-checkbox" type="hidden" name="<?php echo $edit_tickets_name;?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="<?php echo $tax_value; ?>">
113
+							<input class="TKT-taxable-checkbox" type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="<?php echo $tax_value; ?>">
114 114
 							<input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>" type="checkbox" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_taxable]" value="1"<?php echo $TKT_taxable; ?> disabled>
115 115
 						<?php else : ?>
116
-							<input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>" type="checkbox" name="<?php echo $edit_tickets_name;?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="1"<?php echo $TKT_taxable; ?>>
116
+							<input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>" type="checkbox" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="1"<?php echo $TKT_taxable; ?>>
117 117
 						<?php endif; ?>
118 118
 						<label for="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>"> <?php _e('This ticket is taxable.', 'event_espresso'); ?>
119 119
 					<?php } //end tax_rows check ?>
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 				<?php echo $ticket_datetimes_list; ?>
171 171
 			</ul>
172 172
 
173
-			<?php do_action( 'AHEE__event_tickets_datetime_ticket_row_template__advanced_details_end', $tkt_row, $TKT_ID ); ?>
173
+			<?php do_action('AHEE__event_tickets_datetime_ticket_row_template__advanced_details_end', $tkt_row, $TKT_ID); ?>
174 174
 			<div class="ee-editor-footer-container">
175 175
 				<div class="ee-editor-id-container">
176
-					<span class="ee-item-id"><?php echo $TKT_ID ? 'Ticket ID: ' . $TKT_ID : ''; ?></span>
176
+					<span class="ee-item-id"><?php echo $TKT_ID ? 'Ticket ID: '.$TKT_ID : ''; ?></span>
177 177
 				</div>
178 178
 				<div class="save-cancel-button-container">
179 179
 					<label for="edit-ticket-TKT_is_default_selector"><?php _e('use this new ticket as a default ticket for any new events', 'event_espresso'); ?></label>
Please login to merge, or discard this patch.