Completed
Branch BUG-8698-ticket-sellouts (330ec2)
by
unknown
34:27 queued 16:21
created
core/services/progress_steps/ProgressStepsConfigInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Class EE_Line_Item_Filter_Collection
Please login to merge, or discard this patch.
admin/new/pricing/templates/event_tickets_datetime_edit_row.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@
 block discarded – undo
41 41
 		</div>
42 42
 		<span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="<?php echo $clone_icon; ?> clickable"></span>
43 43
 		<span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="<?php echo $trash_icon; ?> clickable"<?php echo $show_trash; ?>></span>
44
-		<?php if ( $reg_list_url !== '' ) : ?>
45
-		<a href="<?php echo $reg_list_url; ?>" title="<?php _e( 'View registrations for this datetime.', 'event_espresso' );?>" style="text-decoration: none;">
44
+		<?php if ($reg_list_url !== '') : ?>
45
+		<a href="<?php echo $reg_list_url; ?>" title="<?php _e('View registrations for this datetime.', 'event_espresso'); ?>" style="text-decoration: none;">
46 46
 			<span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="dashicons dashicons-groups clickable"></span>
47 47
 		</a>
48 48
 		<?php endif; ?>
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -963,7 +963,7 @@
 block discarded – undo
963 963
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
964 964
 			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
965 965
 			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
966
-		    'reg_list_url' => $default ? '' : EE_Admin_Page::add_query_args_and_nonce(
966
+			'reg_list_url' => $default ? '' : EE_Admin_Page::add_query_args_and_nonce(
967 967
 				array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ),
968 968
 				REG_ADMIN_URL
969 969
 			)
Please login to merge, or discard this patch.
Spacing   +382 added lines, -382 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
 /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$this->_name = 'pricing';
55 55
 
56 56
 		//capability check
57
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
57
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
58 58
 			return;
59 59
 		}
60 60
 
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 		//if we were going to add our own metaboxes we'd use the below.
63 63
 		$this->_metaboxes = array(
64 64
 			0 => array(
65
-				'page_route' => array('edit','create_new'),
65
+				'page_route' => array('edit', 'create_new'),
66 66
 				'func' => 'pricing_metabox',
67 67
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
68 68
 				'priority' => 'high',
69 69
 				'context' => 'normal'
70 70
 				),
71 71
 
72
-			);/**/
72
+			); /**/
73 73
 
74 74
 		$this->_remove_metaboxes = array(
75 75
 			0 => array(
@@ -88,24 +88,24 @@  discard block
 block discarded – undo
88 88
 		 *
89 89
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
90 90
 		 */
91
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
91
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92 92
 				'date' => 'Y-m-d',
93 93
 				'time' => 'h:i a'
94 94
 			));
95 95
 
96 96
 		//validate
97
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
98
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
97
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
98
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
99 99
 
100 100
 		//validate format strings
101
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
102
-		if ( is_array( $format_validation ) ) {
103
-			$msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>';
104
-			foreach ( $format_validation as $error ) {
105
-				$msg .= '<li>' . $error . '</li>';
101
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
102
+		if (is_array($format_validation)) {
103
+			$msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
104
+			foreach ($format_validation as $error) {
105
+				$msg .= '<li>'.$error.'</li>';
106 106
 			}
107
-			$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
108
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
107
+			$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
108
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
109 109
 			$this->_date_format_strings = array(
110 110
 				'date' => 'Y-m-d',
111 111
 				'time' => 'h:i a'
@@ -116,60 +116,60 @@  discard block
 block discarded – undo
116 116
 		$this->_scripts_styles = array(
117 117
 			'registers' => array(
118 118
 				'ee-tickets-datetimes-css' => array(
119
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
119
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
120 120
 					'type' => 'css'
121 121
 					),
122 122
 				'ee-dtt-ticket-metabox' => array(
123
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
123
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
124 124
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
125 125
 					)
126 126
 				),
127 127
 			'deregisters' => array(
128
-				'event-editor-css' => array('type' => 'css' ),
128
+				'event-editor-css' => array('type' => 'css'),
129 129
 				'event-datetime-metabox' => array('type' => 'js')
130 130
 				),
131 131
 			'enqueues' => array(
132
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
133
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
132
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
133
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
134 134
 				),
135 135
 			'localize' => array(
136 136
 				'ee-dtt-ticket-metabox' => array(
137 137
 					'DTT_TRASH_BLOCK' => array(
138 138
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
139 139
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
140
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
140
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
141 141
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
142 142
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
143
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
143
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
144 144
 						),
145 145
 					'DTT_ERROR_MSG' => array(
146 146
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
147
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
147
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
148 148
 						),
149 149
 					'DTT_OVERSELL_WARNING' => array(
150 150
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
151 151
 						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')
152 152
 						),
153
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
154
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
153
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
154
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
155 155
 					)
156 156
 				)
157 157
 			);
158 158
 
159 159
 
160
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
161
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
160
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
161
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
162 162
 	}
163 163
 
164 164
 
165 165
 
166
-	public function caf_updates( $update_callbacks ) {
167
-		foreach ( $update_callbacks as $key => $callback ) {
168
-			if ( $callback[1] == '_default_tickets_update' )
169
-				unset( $update_callbacks[$key] );
166
+	public function caf_updates($update_callbacks) {
167
+		foreach ($update_callbacks as $key => $callback) {
168
+			if ($callback[1] == '_default_tickets_update')
169
+				unset($update_callbacks[$key]);
170 170
 		}
171 171
 
172
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
172
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
173 173
 		return $update_callbacks;
174 174
 	}
175 175
 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param  array    $data   The request data from the form
183 183
 	 * @return bool             success or fail
184 184
 	 */
185
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
185
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
186 186
 		//first we need to start with datetimes cause they are the "root" items attached to events.
187
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
187
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
188 188
 		//next tackle the tickets (and prices?)
189
-		$this->_update_tkts( $evtobj, $saved_dtts, $data );
189
+		$this->_update_tkts($evtobj, $saved_dtts, $data);
190 190
 	}
191 191
 
192 192
 
@@ -197,41 +197,41 @@  discard block
 block discarded – undo
197 197
 	 * @param  array    	$data    the request data from the form
198 198
 	 * @return EE_Datetime[]
199 199
 	 */
200
-	protected function _update_dtts( $evt_obj, $data ) {
201
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
200
+	protected function _update_dtts($evt_obj, $data) {
201
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
202 202
 		$saved_dtt_ids = array();
203 203
 		$saved_dtt_objs = array();
204 204
 
205
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
205
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
206 206
 			//trim all values to ensure any excess whitespace is removed.
207 207
 			$dtt = array_map(
208
-				function( $datetime_data ) {
209
-					return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data );
208
+				function($datetime_data) {
209
+					return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
210 210
 				},
211 211
 				$dtt
212 212
 			);
213
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
213
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
214 214
 			$datetime_values = array(
215
-				'DTT_ID' 			=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
216
-				'DTT_name' 			=> ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
217
-				'DTT_description' 	=> ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
215
+				'DTT_ID' 			=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
216
+				'DTT_name' 			=> ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
217
+				'DTT_description' 	=> ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
218 218
 				'DTT_EVT_start' 	=> $dtt['DTT_EVT_start'],
219 219
 				'DTT_EVT_end' 		=> $dtt['DTT_EVT_end'],
220
-				'DTT_reg_limit' 	=> empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ],
221
-				'DTT_order' 		=> ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
220
+				'DTT_reg_limit' 	=> empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
221
+				'DTT_order' 		=> ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
222 222
 			);
223 223
 
224 224
 			//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.
225 225
 
226
-			if ( !empty( $dtt['DTT_ID'] ) ) {
227
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
226
+			if ( ! empty($dtt['DTT_ID'])) {
227
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
228 228
 
229 229
 				//set date and time format according to what is set in this class.
230
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
231
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
230
+				$DTM->set_date_format($this->_date_format_strings['date']);
231
+				$DTM->set_time_format($this->_date_format_strings['time']);
232 232
 
233
-				foreach ( $datetime_values as $field => $value ) {
234
-					$DTM->set( $field, $value );
233
+				foreach ($datetime_values as $field => $value) {
234
+					$DTM->set($field, $value);
235 235
 				}
236 236
 
237 237
 				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
@@ -239,24 +239,24 @@  discard block
 block discarded – undo
239 239
 				$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
240 240
 
241 241
 			} else {
242
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
242
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
243 243
 
244 244
 				//reset date and times to match the format
245
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
246
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
247
-				foreach( $datetime_values as $field => $value ) {
248
-					$DTM->set( $field, $value );
245
+				$DTM->set_date_format($this->_date_format_strings['date']);
246
+				$DTM->set_time_format($this->_date_format_strings['time']);
247
+				foreach ($datetime_values as $field => $value) {
248
+					$DTM->set($field, $value);
249 249
 				}
250 250
 			}
251 251
 
252 252
 
253 253
 			$DTM->save();
254
-			$DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
254
+			$DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
255 255
 			$evt_obj->save();
256 256
 
257 257
 			//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.
258
-			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
259
-				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
258
+			if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
259
+				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
260 260
 				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
261 261
 				$DTM->save();
262 262
 			}
@@ -271,25 +271,25 @@  discard block
 block discarded – undo
271 271
 		}
272 272
 
273 273
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
274
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
274
+		$old_datetimes = explode(',', $data['datetime_IDs']);
275 275
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
276 276
 
277
-		if ( is_array( $old_datetimes ) ) {
278
-			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
279
-			foreach ( $dtts_to_delete as $id ) {
280
-				$id = absint( $id );
281
-				if ( empty( $id ) )
277
+		if (is_array($old_datetimes)) {
278
+			$dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
279
+			foreach ($dtts_to_delete as $id) {
280
+				$id = absint($id);
281
+				if (empty($id))
282 282
 					continue;
283 283
 
284 284
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
285 285
 
286 286
 				//remove tkt relationships.
287 287
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
288
-				foreach ( $related_tickets as $tkt ) {
288
+				foreach ($related_tickets as $tkt) {
289 289
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
290 290
 				}
291 291
 
292
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
292
+				$evt_obj->_remove_relation_to($id, 'Datetime');
293 293
 				$dtt_to_remove->refresh_cache_of_related_objects();
294 294
 
295 295
 			}
@@ -310,85 +310,85 @@  discard block
 block discarded – undo
310 310
 	 * @param  array            $data       incoming request data
311 311
 	 * @return EE_Ticket[]
312 312
 	 */
313
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
313
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
314 314
 
315 315
 		$new_tkt = null;
316 316
 		$new_default = null;
317 317
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
318 318
 		$data = stripslashes_deep($data);
319
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
319
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
320 320
 		$saved_tickets = $dtts_on_existing = array();
321
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
321
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
322 322
 
323 323
 		//load money helper
324 324
 
325
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
325
+		foreach ($data['edit_tickets'] as $row => $tkt) {
326 326
 
327 327
 			$update_prices = $create_new_TKT = FALSE;
328 328
 
329 329
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
330 330
 
331
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
332
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
331
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
332
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
333 333
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
334 334
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
335 335
 
336 336
 			// trim inputs to ensure any excess whitespace is removed.
337 337
 			$tkt = array_map(
338
-				function( $ticket_data ) {
339
-					return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data );
338
+				function($ticket_data) {
339
+					return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
340 340
 				},
341 341
 				$tkt
342 342
 			);
343 343
 
344 344
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
345 345
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
346
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
346
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
347 347
 
348 348
 			//note incoming base price needs converted from localized value.
349
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
349
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
350 350
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
351 351
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
352
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
352
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
353 353
 
354 354
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
355 355
 
356 356
 			$now = null;
357
-			if ( empty( $tkt['TKT_start_date'] ) ) {
357
+			if (empty($tkt['TKT_start_date'])) {
358 358
 				//lets' use now in the set timezone.
359
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
360
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
359
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
360
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
361 361
 			}
362 362
 
363
-			if ( empty( $tkt['TKT_end_date'] ) ) {
363
+			if (empty($tkt['TKT_end_date'])) {
364 364
 				/**
365 365
 				 * set the TKT_end_date to the first datetime attached to the ticket.
366 366
 				 */
367
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
368
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
367
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
368
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
369 369
 			}
370 370
 
371 371
 			$TKT_values = array(
372
-				'TKT_ID' 			=> ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
373
-				'TTM_ID' 			=> ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
374
-				'TKT_name' 			=> ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
375
-				'TKT_description' 	=> ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
372
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
373
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
374
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
375
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
376 376
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
377 377
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
378
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ],
379
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'],
380
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
381
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
378
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
379
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
380
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
381
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
382 382
 				'TKT_row' 			=> $row,
383
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
384
-				'TKT_taxable' 		=> ! empty( $tkt['TKT_taxable'] ) ? 1 : 0,
385
-				'TKT_required' 		=> ! empty( $tkt['TKT_required'] ) ? 1 : 0,
383
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
384
+				'TKT_taxable' 		=> ! empty($tkt['TKT_taxable']) ? 1 : 0,
385
+				'TKT_required' 		=> ! empty($tkt['TKT_required']) ? 1 : 0,
386 386
 				'TKT_price' 		=> $ticket_price
387 387
 			);
388 388
 
389 389
 
390 390
 			//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.
391
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
391
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
392 392
 				$TKT_values['TKT_ID'] = 0;
393 393
 				$TKT_values['TKT_is_default'] = 0;
394 394
 				$update_prices = TRUE;
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
 			// but DID have it's items modified.
401 401
 			// keep in mind that if the TKT has been sold (and we have changed pricing information),
402 402
 			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
403
-			if ( absint( $TKT_values['TKT_ID'] ) ) {
404
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
405
-				if ( $TKT instanceof EE_Ticket ) {
403
+			if (absint($TKT_values['TKT_ID'])) {
404
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
405
+				if ($TKT instanceof EE_Ticket) {
406 406
 
407
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
407
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
408 408
 					// are there any registrations using this ticket ?
409 409
 					$tickets_sold = $TKT->count_related(
410 410
 						'Registration',
411
-						array( array(
412
-								'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) )
413
-						) )
411
+						array(array(
412
+								'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
413
+						))
414 414
 					);
415 415
 					//set ticket formats
416
-					$TKT->set_date_format( $this->_date_format_strings['date'] );
417
-					$TKT->set_time_format( $this->_date_format_strings['time'] );
416
+					$TKT->set_date_format($this->_date_format_strings['date']);
417
+					$TKT->set_time_format($this->_date_format_strings['time']);
418 418
 
419 419
 					// let's just check the total price for the existing ticket
420 420
 					// and determine if it matches the new total price.
@@ -424,17 +424,17 @@  discard block
 block discarded – undo
424 424
 							? TRUE : FALSE;
425 425
 
426 426
 					//set new values
427
-					foreach ( $TKT_values as $field => $value ) {
428
-						if ( $field === 'TKT_qty' ) {
429
-							$TKT->set_qty( $value );
427
+					foreach ($TKT_values as $field => $value) {
428
+						if ($field === 'TKT_qty') {
429
+							$TKT->set_qty($value);
430 430
 						} else {
431
-							$TKT->set( $field, $value );
431
+							$TKT->set($field, $value);
432 432
 						}
433 433
 					}
434 434
 
435 435
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
436
-					if ( $create_new_TKT ) {
437
-						$new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id );
436
+					if ($create_new_TKT) {
437
+						$new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id);
438 438
 					}
439 439
 				}
440 440
 
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
 				$TKT = EE_Ticket::new_instance(
444 444
 					$TKT_values,
445 445
 					$timezone,
446
-					array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ]  )
446
+					array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
447 447
 				);
448
-				if ( $TKT instanceof EE_Ticket ) {
448
+				if ($TKT instanceof EE_Ticket) {
449 449
 					// make sure ticket has an ID of setting relations won't work
450 450
 					$TKT->save();
451
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
451
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
452 452
 					$update_prices = TRUE;
453 453
 				}
454 454
 			}
@@ -456,37 +456,37 @@  discard block
 block discarded – undo
456 456
 			//$TKT->save();
457 457
 
458 458
 			//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.
459
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
460
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
459
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
460
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
461 461
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
462 462
 			}
463 463
 
464 464
 			//let's make sure the base price is handled
465
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
465
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
466 466
 
467 467
 			//add/update price_modifiers
468
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
468
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
469 469
 
470 470
 			//need to make sue that the TKT_price is accurate after saving the prices.
471 471
 			$TKT->ensure_TKT_Price_correct();
472 472
 
473 473
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
474
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
475
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
474
+			if ( ! defined('DOING_AUTOSAVE')) {
475
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
476 476
 					$update_prices = TRUE;
477 477
 					$new_default = clone $TKT;
478
-					$new_default->set( 'TKT_ID', 0 );
479
-					$new_default->set( 'TKT_is_default', 1 );
480
-					$new_default->set( 'TKT_row', 1 );
481
-					$new_default->set( 'TKT_price', $ticket_price );
478
+					$new_default->set('TKT_ID', 0);
479
+					$new_default->set('TKT_is_default', 1);
480
+					$new_default->set('TKT_row', 1);
481
+					$new_default->set('TKT_price', $ticket_price);
482 482
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
483 483
 					$new_default->_remove_relations('Datetime');
484 484
 					//todo we need to add the current attached prices as new prices to the new default ticket.
485
-					$new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices );
485
+					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
486 486
 					//don't forget the base price!
487
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
487
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
488 488
 					$new_default->save();
489
-					do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data );
489
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data);
490 490
 				}
491 491
 			}
492 492
 
@@ -497,19 +497,19 @@  discard block
 block discarded – undo
497 497
 			//let's assign any tickets that have been setup to the saved_tickets tracker
498 498
 			//save existing TKT
499 499
 			$TKT->save();
500
-			if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) {
500
+			if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
501 501
 				//save new TKT
502 502
 				$new_tkt->save();
503 503
 				//add new ticket to array
504
-				$saved_tickets[ $new_tkt->ID() ] = $new_tkt;
504
+				$saved_tickets[$new_tkt->ID()] = $new_tkt;
505 505
 
506
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
506
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
507 507
 
508 508
 			} else {
509 509
 				//add tkt to saved tkts
510
-				$saved_tickets[ $TKT->ID() ] = $TKT;
510
+				$saved_tickets[$TKT->ID()] = $TKT;
511 511
 
512
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
512
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
513 513
 			}
514 514
 
515 515
 		}
@@ -519,22 +519,22 @@  discard block
 block discarded – undo
519 519
 		// (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
520 520
 		// Or a draft event was saved and in the process of editing a ticket is trashed.
521 521
 		// No sense in keeping all the related data in the db!
522
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
523
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
522
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
523
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
524 524
 
525
-		foreach ( $tickets_removed as $id ) {
526
-			$id = absint( $id );
525
+		foreach ($tickets_removed as $id) {
526
+			$id = absint($id);
527 527
 
528 528
 			//get the ticket for this id
529 529
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
530 530
 
531 531
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
532
-			if ( $tkt_to_remove->get('TKT_is_default') )
532
+			if ($tkt_to_remove->get('TKT_is_default'))
533 533
 				continue;
534 534
 
535 535
 			// if this tkt has any registrations attached so then we just ARCHIVE
536 536
 			// because we don't actually permanently delete these tickets.
537
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
537
+			if ($tkt_to_remove->count_related('Registration') > 0) {
538 538
 				$tkt_to_remove->delete();
539 539
 				continue;
540 540
 			}
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 			// (remember this process can ONLY kick off if there are NO tkts_sold)
544 544
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
545 545
 
546
-			foreach( $dtts as $dtt ) {
546
+			foreach ($dtts as $dtt) {
547 547
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
548 548
 			}
549 549
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
552 552
 			$tkt_to_remove->delete_related_permanently('Price');
553 553
 
554
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
554
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
555 555
 
556 556
 			// finally let's delete this ticket
557 557
 			// (which should not be blocked at this point b/c we've removed all our relationships)
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
 		// and removing the ticket from datetimes it got removed from.
584 584
 
585 585
 		// first let's add datetimes
586
-		if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) {
587
-			foreach ( $added_datetimes as $row_id ) {
586
+		if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
587
+			foreach ($added_datetimes as $row_id) {
588 588
 				$row_id = (int) $row_id;
589
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
590
-					$ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
589
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
590
+					$ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
591 591
 					// Is this an existing ticket (has an ID) and does it have any sold?
592 592
 					// If so, then we need to add that to the DTT sold because this DTT is getting added.
593
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
594
-						$saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() );
595
-						$saved_datetimes[ $row_id ]->save();
593
+					if ($ticket->ID() && $ticket->sold() > 0) {
594
+						$saved_datetimes[$row_id]->increase_sold($ticket->sold());
595
+						$saved_datetimes[$row_id]->save();
596 596
 					}
597 597
 				}
598 598
 			}
599 599
 		}
600 600
 		// then remove datetimes
601
-		if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) {
602
-			foreach ( $removed_datetimes as $row_id ) {
603
-				$row_id = (int)$row_id;
601
+		if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
602
+			foreach ($removed_datetimes as $row_id) {
603
+				$row_id = (int) $row_id;
604 604
 				// its entirely possible that a datetime got deleted (instead of just removed from relationship.
605 605
 				// So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
606
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
607
-					$ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
606
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
607
+					$ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
608 608
 					// Is this an existing ticket (has an ID) and does it have any sold?
609 609
 					// If so, then we need to remove it's sold from the DTT_sold.
610
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
611
-						$saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() );
612
-						$saved_datetimes[ $row_id ]->save();
610
+					if ($ticket->ID() && $ticket->sold() > 0) {
611
+						$saved_datetimes[$row_id]->decrease_sold($ticket->sold());
612
+						$saved_datetimes[$row_id]->save();
613 613
 					}
614 614
 				}
615 615
 			}
616 616
 		}
617 617
 		// cap ticket qty by datetime reg limits
618
-		$ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) );
618
+		$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
619 619
 		return $ticket;
620 620
 	}
621 621
 
@@ -636,39 +636,39 @@  discard block
 block discarded – undo
636 636
 		EE_Ticket $ticket,
637 637
 		$price_rows = array(),
638 638
 		$ticket_price = 0,
639
-		$base_price = 0 ,
639
+		$base_price = 0,
640 640
 		$base_price_id = 0
641 641
 	) {
642 642
 
643 643
 		// create new ticket that's a copy of the existing
644 644
 		// except a new id of course (and not archived)
645 645
 		// AND has the new TKT_price associated with it.
646
-		$new_ticket = clone( $ticket );
647
-		$new_ticket->set( 'TKT_ID', 0 );
648
-		$new_ticket->set( 'TKT_deleted', 0 );
649
-		$new_ticket->set( 'TKT_price', $ticket_price );
650
-		$new_ticket->set( 'TKT_sold', 0 );
646
+		$new_ticket = clone($ticket);
647
+		$new_ticket->set('TKT_ID', 0);
648
+		$new_ticket->set('TKT_deleted', 0);
649
+		$new_ticket->set('TKT_price', $ticket_price);
650
+		$new_ticket->set('TKT_sold', 0);
651 651
 		// let's get a new ID for this ticket
652 652
 		$new_ticket->save();
653 653
 		// we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
654
-		$datetimes_on_existing = $ticket->get_many_related( 'Datetime' );
654
+		$datetimes_on_existing = $ticket->get_many_related('Datetime');
655 655
 		$new_ticket = $this->_update_ticket_datetimes(
656 656
 			$new_ticket,
657 657
 			$datetimes_on_existing,
658
-			array_keys( $datetimes_on_existing )
658
+			array_keys($datetimes_on_existing)
659 659
 		);
660 660
 
661 661
 		// $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
662 662
 		// if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
663 663
 		// available.
664
-		if ( $ticket->sold() > 0 ) {
664
+		if ($ticket->sold() > 0) {
665 665
 			$new_qty = $ticket->qty() - $ticket->sold();
666
-			$new_ticket->set_qty( $new_qty );
666
+			$new_ticket->set_qty($new_qty);
667 667
 		}
668 668
 		//now we update the prices just for this ticket
669
-		$new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true );
669
+		$new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
670 670
 		//and we update the base price
671
-		$new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id );
671
+		$new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
672 672
 		return $new_ticket;
673 673
 	}
674 674
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
689 689
 	 * @return EE_Ticket
690 690
 	 */
691
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
691
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
692 692
 
693 693
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
694 694
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 		$updated_prices = array();
697 697
 
698 698
 		// if $base_price ! FALSE then updating a base price.
699
-		if ( $base_price !== FALSE ) {
699
+		if ($base_price !== FALSE) {
700 700
 			$prices[1] = array(
701 701
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
702 702
 				'PRT_ID' => 1,
@@ -707,47 +707,47 @@  discard block
 block discarded – undo
707 707
 		}
708 708
 
709 709
 		//possibly need to save tkt
710
-		if ( ! $ticket->ID() )
710
+		if ( ! $ticket->ID())
711 711
 			$ticket->save();
712 712
 
713
-		foreach ( $prices as $row => $prc ) {
714
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
715
-			if ( empty($prt_id) )
713
+		foreach ($prices as $row => $prc) {
714
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
715
+			if (empty($prt_id))
716 716
 				continue; //prices MUST have a price type id.
717 717
 			$PRC_values = array(
718
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
718
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
719 719
 				'PRT_ID' => $prt_id,
720
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
721
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
722
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
720
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
721
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
722
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
723 723
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
724 724
 				'PRC_order' => $row
725 725
 				);
726
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
726
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
727 727
 				$PRC_values['PRC_ID'] = 0;
728
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
728
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
729 729
 			} else {
730
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
730
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
731 731
 				//update this price with new values
732
-				foreach ( $PRC_values as $field => $newprc ) {
733
-					$PRC->set( $field, $newprc );
732
+				foreach ($PRC_values as $field => $newprc) {
733
+					$PRC->set($field, $newprc);
734 734
 				}
735 735
 			}
736 736
 			$PRC->save();
737 737
 			$prcid = $PRC->ID();
738 738
 			$updated_prices[$prcid] = $PRC;
739
-			$ticket->_add_relation_to( $PRC, 'Price' );
739
+			$ticket->_add_relation_to($PRC, 'Price');
740 740
 		}
741 741
 
742 742
 		//now let's remove any prices that got removed from the ticket
743
-		if ( !empty ( $current_prices_on_ticket ) ) {
743
+		if ( ! empty ($current_prices_on_ticket)) {
744 744
 			$current = array_keys($current_prices_on_ticket);
745 745
 			$updated = array_keys($updated_prices);
746 746
 			$prices_to_remove = array_diff($current, $updated);
747
-			if ( !empty( $prices_to_remove ) ) {
748
-				foreach ( $prices_to_remove as $prc_id ) {
747
+			if ( ! empty($prices_to_remove)) {
748
+				foreach ($prices_to_remove as $prc_id) {
749 749
 					$p = $current_prices_on_ticket[$prc_id];
750
-					$ticket->_remove_relation_to( $p, 'Price' );
750
+					$ticket->_remove_relation_to($p, 'Price');
751 751
 
752 752
 					//delete permanently the price
753 753
 					$p->delete_permanently();
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 
761 761
 
762 762
 
763
-	public function autosave_handling( $event_admin_obj ) {
763
+	public function autosave_handling($event_admin_obj) {
764 764
 		return $event_admin_obj; //doing nothing for the moment.
765 765
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
766 766
 
@@ -794,12 +794,12 @@  discard block
 block discarded – undo
794 794
 
795 795
 		//default main template args
796 796
 		$main_template_args = array(
797
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
797
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
798 798
 			'existing_datetime_ids' => '',
799 799
 			'total_dtt_rows' => 1,
800
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
800
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
801 801
 			'datetime_rows' => '',
802
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
802
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
803 803
 			'ticket_rows' => '',
804 804
 			'existing_ticket_ids' => '',
805 805
 			'total_ticket_rows' => 1,
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 
810 810
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
811 811
 
812
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
812
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
813 813
 
814 814
 		/**
815 815
 		 * 1. Start with retrieving Datetimes
@@ -817,8 +817,8 @@  discard block
 block discarded – undo
817 817
 		 * 3. For each ticket get related prices
818 818
 		 */
819 819
 
820
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
821
-		$times = $DTM->get_all_event_dates( $evtID );
820
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
821
+		$times = $DTM->get_all_event_dates($evtID);
822 822
 
823 823
 
824 824
 
@@ -826,31 +826,31 @@  discard block
 block discarded – undo
826 826
 
827 827
 		/** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */
828 828
 		$dttrow = 1;
829
-		foreach ( $times as $time ) {
829
+		foreach ($times as $time) {
830 830
 			$dttid = $time->get('DTT_ID');
831
-			$time->set( 'DTT_order', $dttrow );
831
+			$time->set('DTT_order', $dttrow);
832 832
 			$existing_datetime_ids[] = $dttid;
833 833
 
834 834
 			//tickets attached
835
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
835
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
836 836
 
837 837
 			//if there are no related tickets this is likely a new event OR autodraft
838 838
 			// event so we need to generate the default tickets because dtts
839 839
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
840 840
 			// datetime on the event.
841
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
841
+			if (empty ($related_tickets) && count($times) < 2) {
842 842
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
843 843
 
844 844
 				//this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save).
845 845
 				$default_prices = EEM_Price::instance()->get_all_default_prices();
846 846
 
847
-				$main_default_ticket = reset( $related_tickets );
848
-				if ( $main_default_ticket instanceof EE_Ticket ) {
849
-					foreach ( $default_prices as $default_price ) {
850
-						if ( $default_price->is_base_price() ) {
847
+				$main_default_ticket = reset($related_tickets);
848
+				if ($main_default_ticket instanceof EE_Ticket) {
849
+					foreach ($default_prices as $default_price) {
850
+						if ($default_price->is_base_price()) {
851 851
 							continue;
852 852
 						}
853
-						$main_default_ticket->cache( 'Price', $default_price );
853
+						$main_default_ticket->cache('Price', $default_price);
854 854
 					}
855 855
 				}
856 856
 			}
@@ -859,11 +859,11 @@  discard block
 block discarded – undo
859 859
 			//we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information.
860 860
 
861 861
 			//loop through and setup the ticket rows and make sure the order is set.
862
-			foreach ( $related_tickets as $ticket ) {
862
+			foreach ($related_tickets as $ticket) {
863 863
 				$tktid = $ticket->get('TKT_ID');
864 864
 				$tktrow = $ticket->get('TKT_row');
865 865
 				//we only want unique tickets in our final display!!
866
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
866
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
867 867
 					$existing_ticket_ids[] = $tktid;
868 868
 					$all_tickets[] = $ticket;
869 869
 				}
@@ -872,57 +872,57 @@  discard block
 block discarded – undo
872 872
 				$datetime_tickets[$dttid][] = $tktrow;
873 873
 
874 874
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
875
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
875
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
876 876
 					$ticket_datetimes[$tktid][] = $dttrow;
877 877
 			}
878 878
 			$dttrow++;
879 879
 		}
880 880
 
881
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
882
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
883
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
881
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
882
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
883
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
884 884
 
885 885
 		//sort $all_tickets by order
886
-		usort( $all_tickets, function( $a, $b ) {
886
+		usort($all_tickets, function($a, $b) {
887 887
 			$a_order = (int) $a->get('TKT_order');
888 888
 			$b_order = (int) $b->get('TKT_order');
889
-			if ( $a_order == $b_order ) {
889
+			if ($a_order == $b_order) {
890 890
 				return 0;
891 891
 			}
892
-			return ( $a_order < $b_order ) ? -1 : 1;
892
+			return ($a_order < $b_order) ? -1 : 1;
893 893
 		});
894 894
 
895 895
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
896 896
 		$dttrow = 1;
897
-		foreach ( $times as $time ) {
898
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
897
+		foreach ($times as $time) {
898
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
899 899
 			$dttrow++;
900 900
 		}
901 901
 
902 902
 		//then loop through all tickets for the ticket rows.
903 903
 		$tktrow = 1;
904
-		foreach ( $all_tickets as $ticket ) {
905
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
904
+		foreach ($all_tickets as $ticket) {
905
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
906 906
 			$tktrow++;
907 907
 		}
908 908
 
909 909
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
910
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
911
-		EEH_Template::display_template( $template, $main_template_args );
910
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
911
+		EEH_Template::display_template($template, $main_template_args);
912 912
 		return;
913 913
 	}
914 914
 
915 915
 
916 916
 
917
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
917
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
918 918
 
919 919
 		$dtt_display_template_args = array(
920
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
921
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
920
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
921
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
922 922
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
923 923
 			);
924
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
925
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
924
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
925
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
926 926
 	}
927 927
 
928 928
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 	 *
941 941
 	 * @return string Generated edit row.
942 942
 	 */
943
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
943
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
944 944
 
945 945
 		// if the incoming $dtt object is NOT an instance of EE_Datetime then force default to true.
946 946
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -948,34 +948,34 @@  discard block
 block discarded – undo
948 948
 		$template_args = array(
949 949
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
950 950
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
951
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
951
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
952 952
 			'DTT_ID' => $default ? '' : $dtt->ID(),
953 953
 			'DTT_name' => $default ? '' : $dtt->name(),
954 954
 			'DTT_description' => $default ? '' : $dtt->description(),
955
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
956
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
957
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
955
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
956
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
957
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
958 958
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
959 959
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
960
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
960
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
962 962
 		    'reg_list_url' => $default ? '' : EE_Admin_Page::add_query_args_and_nonce(
963
-				array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ),
963
+				array('event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID()),
964 964
 				REG_ADMIN_URL
965 965
 			)
966 966
 		);
967 967
 
968
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
968
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
969 969
 
970 970
 		//allow filtering of template args at this point.
971
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
971
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
972 972
 
973
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
974
-		return EEH_Template::display_template( $template, $template_args, TRUE );
973
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
974
+		return EEH_Template::display_template($template, $template_args, TRUE);
975 975
 	}
976 976
 
977 977
 
978
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
978
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
979 979
 
980 980
 		$template_args = array(
981 981
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -983,47 +983,47 @@  discard block
 block discarded – undo
983 983
 			'DTT_description' => $default ? '' : $dtt->description(),
984 984
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
985 985
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
986
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
986
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
987 987
 			'DTT_ID' => $default ? '' : $dtt->ID()
988 988
 			);
989 989
 
990 990
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
991
-		if ( !$default ) {
991
+		if ( ! $default) {
992 992
 			$tktrow = 1;
993
-			foreach ( $all_tickets as $ticket ) {
994
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
993
+			foreach ($all_tickets as $ticket) {
994
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
995 995
 				$tktrow++;
996 996
 			}
997 997
 		}
998 998
 
999 999
 		//filter template args at this point
1000
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
1000
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
1001 1001
 
1002
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
1003
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1002
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
1003
+		return EEH_Template::display_template($template, $template_args, TRUE);
1004 1004
 	}
1005 1005
 
1006 1006
 
1007 1007
 
1008
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
1009
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
1010
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
1008
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
1009
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
1010
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
1011 1011
 
1012
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
1012
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
1013 1013
 		$template_args = array(
1014 1014
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
1015
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
1015
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1016 1016
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1017 1017
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1018
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
1019
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1018
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1019
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
1020 1020
 			);
1021 1021
 
1022 1022
 		//filter template args
1023
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
1023
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
1024 1024
 
1025
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1026
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1025
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
1026
+		return EEH_Template::display_template($template, $template_args, TRUE);
1027 1027
 	}
1028 1028
 
1029 1029
 
@@ -1045,37 +1045,37 @@  discard block
 block discarded – undo
1045 1045
 	 *
1046 1046
 	 * @return [type] [description]
1047 1047
 	 */
1048
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
1048
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
1049 1049
 
1050 1050
 		//if $ticket is not an instance of EE_Ticket then force default to true.
1051
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
1051
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
1052 1052
 
1053
-		$prices = ! empty( $ticket ) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
1053
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1054 1054
 
1055 1055
 		//if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on
1056 1056
 		//the object.  This is done by not including any query_params.
1057
-		if ( $ticket instanceof EE_Ticket && $ticket->is_default() && ( count( $prices ) === 1  || empty( $prices ) ) ) {
1058
-			$prices = $ticket->get_many_related( 'Price' );
1057
+		if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) {
1058
+			$prices = $ticket->get_many_related('Price');
1059 1059
 		}
1060 1060
 
1061 1061
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
1062
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
1062
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
1063 1063
 
1064
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1064
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1065 1065
 
1066 1066
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
1067
-		$base_price = $default ? NULL :  $ticket->base_price();
1067
+		$base_price = $default ? NULL : $ticket->base_price();
1068 1068
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
1069 1069
 
1070 1070
 		//breaking out complicated condition for ticket_status
1071
-		if ( $default ) {
1072
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1071
+		if ($default) {
1072
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
1073 1073
 		} else {
1074
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1074
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
1075 1075
 		}
1076 1076
 
1077 1077
 		//breaking out complicated condition for TKT_taxable
1078
-		if ( $default ) {
1078
+		if ($default) {
1079 1079
 			$TKT_taxable = '';
1080 1080
 		} else {
1081 1081
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -1090,19 +1090,19 @@  discard block
 block discarded – undo
1090 1090
 			'edit_tkt_expanded' => '',
1091 1091
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1092 1092
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
1093
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
1094
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
1095
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1093
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1094
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1095
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1096 1096
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
1097 1097
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1098 1098
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1099
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1100
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1101
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1102
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1103
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1099
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1100
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1101
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1102
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1103
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1104 1104
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1105
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1105
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1106 1106
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1107 1107
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1108 1108
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1111,99 +1111,99 @@  discard block
 block discarded – undo
1111 1111
 			'ticket_price_rows' => '',
1112 1112
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1113 1113
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1114
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1115
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1114
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1115
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1116 1116
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1117 1117
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1118 1118
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1119 1119
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1120
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1120
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1121 1121
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1122 1122
 			'TKT_taxable' => $TKT_taxable,
1123 1123
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1124 1124
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1125
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1125
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1126 1126
 			'TKT_subtotal_amount' => $ticket_subtotal,
1127
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1128
-			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1127
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1128
+			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE,
1129 1129
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1130 1130
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1131 1131
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1132 1132
 			);
1133 1133
 
1134
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1134
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1135 1135
 
1136 1136
 		//handle rows that should NOT be empty
1137
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1137
+		if (empty($template_args['TKT_start_date'])) {
1138 1138
 			//if empty then the start date will be now.
1139
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1140
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1139
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1140
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1141 1141
 		}
1142 1142
 
1143
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1143
+		if (empty($template_args['TKT_end_date'])) {
1144 1144
 
1145 1145
 			//get the earliest datetime (if present);
1146
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1146
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1147 1147
 
1148
-			if ( !empty( $earliest_dtt ) ) {
1149
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1148
+			if ( ! empty($earliest_dtt)) {
1149
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1150 1150
 			} else {
1151 1151
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1152
-				$template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
1152
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1153 1153
 			}
1154
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1154
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1155 1155
 		}
1156 1156
 
1157 1157
 		//generate ticket_datetime items
1158
-		if ( ! $default ) {
1158
+		if ( ! $default) {
1159 1159
 			$dttrow = 1;
1160
-			foreach ( $all_dtts as $dtt ) {
1161
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1160
+			foreach ($all_dtts as $dtt) {
1161
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1162 1162
 				$dttrow++;
1163 1163
 			}
1164 1164
 		}
1165 1165
 
1166 1166
 		$prcrow = 1;
1167
-		foreach ( $prices as $price ) {
1168
-			if ( $price->is_base_price() ) {
1167
+		foreach ($prices as $price) {
1168
+			if ($price->is_base_price()) {
1169 1169
 				$prcrow++;
1170 1170
 				continue;
1171 1171
 			}
1172
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1173
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1174
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1172
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1173
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1174
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1175 1175
 			$prcrow++;
1176 1176
 		}
1177 1177
 
1178 1178
 		//filter $template_args
1179
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
1179
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
1180 1180
 
1181
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1182
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1181
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1182
+		return EEH_Template::display_template($template, $template_args, TRUE);
1183 1183
 	}
1184 1184
 
1185 1185
 
1186 1186
 
1187 1187
 
1188 1188
 
1189
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1189
+	protected function _get_tax_rows($tktrow, $ticket) {
1190 1190
 		$tax_rows = '';
1191
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1191
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1192 1192
 		$template_args = array();
1193
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1194
-		foreach ( $taxes as $tax ) {
1195
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1193
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1194
+		foreach ($taxes as $tax) {
1195
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1196 1196
 			$template_args = array(
1197
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1197
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1198 1198
 				'tax_id' => $tax->ID(),
1199 1199
 				'tkt_row' => $tktrow,
1200 1200
 				'tax_label' => $tax->get('PRC_name'),
1201 1201
 				'tax_added' => $tax_added,
1202
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1202
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1203 1203
 				'tax_amount' => $tax->get('PRC_amount')
1204 1204
 				);
1205
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1206
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1205
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1206
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1207 1207
 		}
1208 1208
 
1209 1209
 
@@ -1211,81 +1211,81 @@  discard block
 block discarded – undo
1211 1211
 	}
1212 1212
 
1213 1213
 
1214
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1215
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1214
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1215
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1216 1216
 		return $subtotal * $tax->get('PRC_amount') / 100;
1217 1217
 	}
1218 1218
 
1219 1219
 
1220 1220
 
1221 1221
 
1222
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1223
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1222
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1223
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1224 1224
 		$template_args = array(
1225 1225
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1226 1226
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1227 1227
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1228
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
1228
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1229 1229
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1230 1230
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1231 1231
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1232 1232
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1233 1233
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1234
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1235
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1236
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1237
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1238
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1234
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1235
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1236
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1237
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1238
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1239 1239
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1240 1240
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1241
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1242
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1241
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1242
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1243 1243
 			);
1244 1244
 
1245
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
1245
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
1246 1246
 
1247
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1248
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1247
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1248
+		return EEH_Template::display_template($template, $template_args, TRUE);
1249 1249
 	}
1250 1250
 
1251 1251
 
1252
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1253
-		if ( $price->is_base_price() ) {
1254
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1252
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1253
+		if ($price->is_base_price()) {
1254
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1255 1255
 		} else {
1256
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1256
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1257 1257
 		}
1258 1258
 
1259 1259
 	}
1260 1260
 
1261 1261
 
1262
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1262
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1263 1263
 		$template_args = array(
1264 1264
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1265
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1266
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1265
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1266
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1267 1267
 				'PRT_name' => __('Price', 'event_espresso'),
1268 1268
 				'price_selected_operator' => '+',
1269 1269
 				'price_selected_is_percent' => 0
1270 1270
 			);
1271
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1271
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1272 1272
 
1273
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1273
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1274 1274
 
1275
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1275
+		return EEH_Template::display_template($template, $template_args, TRUE);
1276 1276
 	}
1277 1277
 
1278 1278
 
1279 1279
 
1280
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1281
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1282
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1283
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1284
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1285
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1280
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1281
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1282
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1283
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1284
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1285
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1286 1286
 		$price_option_spans = '';
1287 1287
 		//setup pricetypes for selector
1288
-		foreach ( $price_types as $price_type ) {
1288
+		foreach ($price_types as $price_type) {
1289 1289
 			$all_price_types[] = array(
1290 1290
 				'id' => $price_type->ID(),
1291 1291
 				'text' => $price_type->get('PRT_name'),
@@ -1297,50 +1297,50 @@  discard block
 block discarded – undo
1297 1297
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1298 1298
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1299 1299
 				);
1300
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1300
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1301 1301
 		}
1302 1302
 
1303
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1303
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1304 1304
 		$main_name = $select_name;
1305
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1305
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1306 1306
 
1307 1307
 		$template_args = array(
1308 1308
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1309
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1310
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1309
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1310
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1311 1311
 			'main_name' => $main_name,
1312 1312
 			'selected_price_type_id' => $selected_price_type_id,
1313 1313
 			'price_option_spans' => $price_option_spans,
1314
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1315
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1314
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1315
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1316 1316
 			'disabled' => $disabled
1317 1317
 			);
1318 1318
 
1319
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1319
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1320 1320
 
1321
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1321
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1322 1322
 
1323
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1323
+		return EEH_Template::display_template($template, $template_args, TRUE);
1324 1324
 	}
1325 1325
 
1326 1326
 
1327 1327
 
1328
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1329
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1330
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1331
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1328
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1329
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1330
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1331
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1332 1332
 		$template_args = array(
1333
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1333
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1334 1334
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1335
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1336
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1337
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1335
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1336
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1337
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1338 1338
 			'tkt_status_class' => '',
1339 1339
 			);
1340 1340
 
1341
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1342
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1343
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1341
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1342
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1343
+		return EEH_Template::display_template($template, $template_args, TRUE);
1344 1344
 	}
1345 1345
 
1346 1346
 
@@ -1348,53 +1348,53 @@  discard block
 block discarded – undo
1348 1348
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1349 1349
 		$template_args = array(
1350 1350
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1351
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1352
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1351
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1352
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1353 1353
 			'default_price_rows' => '',
1354 1354
 			'default_base_price_amount' => 0,
1355 1355
 			'default_base_price_name' => '',
1356 1356
 			'default_base_price_description' => '',
1357
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1358
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1357
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1358
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1359 1359
 			'existing_available_datetime_tickets_list' => '',
1360 1360
 			'existing_available_ticket_datetimes_list' => '',
1361
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1362
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1361
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1362
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1363 1363
 			);
1364 1364
 
1365 1365
 		$tktrow = 1;
1366
-		foreach ( $all_tickets as $ticket ) {
1367
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1366
+		foreach ($all_tickets as $ticket) {
1367
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1368 1368
 			$tktrow++;
1369 1369
 		}
1370 1370
 
1371 1371
 
1372 1372
 		$dttrow = 1;
1373
-		foreach ( $all_dtts as $dtt ) {
1374
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1373
+		foreach ($all_dtts as $dtt) {
1374
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1375 1375
 			$dttrow++;
1376 1376
 		}
1377 1377
 
1378 1378
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1379 1379
 		$prcrow = 1;
1380
-		foreach ( $default_prices as $price ) {
1381
-			if ( $price->is_base_price() ) {
1380
+		foreach ($default_prices as $price) {
1381
+			if ($price->is_base_price()) {
1382 1382
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1383 1383
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1384 1384
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1385 1385
 				$prcrow++;
1386 1386
 				continue;
1387 1387
 			}
1388
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1389
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1390
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1388
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1389
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1390
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1391 1391
 			$prcrow++;
1392 1392
 		}
1393 1393
 
1394
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1394
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1395 1395
 
1396
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1397
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1396
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1397
+		return EEH_Template::display_template($template, $template_args, TRUE);
1398 1398
 	}
1399 1399
 
1400 1400
 
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_EE_Registrations_List_Table.class.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 	/**
32 32
 	 * 		REG_date
33
-	*/
33
+	 */
34 34
 	function column_REG_date(EE_Registration $item){
35 35
 
36 36
 		//Build row actions
@@ -60,60 +60,60 @@  discard block
 block discarded – undo
60 60
 		$remove_defaults = array('default_where_conditions' => 'none');
61 61
 		$ticket = $item->ticket();
62 62
 		$datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array();
63
-	    $EVT_ID = $item->event_ID();
64
-	    $datetime_string = '';
65
-	    foreach( $datetimes as $datetime ){
66
-		    if (
67
-			    EE_Registry::instance()->CAP->current_user_can(
68
-				    'ee_read_checkin',
69
-				    'espresso_registrations_registration_checkins',
70
-				    $item->ID()
71
-			    )
72
-		    ) {
73
-			    // open "a" tag and "href"
74
-			    $datetime_string .= '<a href="';
75
-			    // checkin URL
76
-			    $datetime_string .= EE_Admin_Page::add_query_args_and_nonce(
77
-				    array(
78
-					    'action'   => 'event_registrations',
79
-					    'event_id' => $EVT_ID,
80
-					    'DTT_ID'   => $datetime->ID(),
81
-				    ),
82
-				    REG_ADMIN_URL
83
-			    );
84
-			    // close "href"
85
-			    $datetime_string .= '"';
86
-			    // open "title" tag
87
-			    $datetime_string .= ' title="';
88
-			    // link title text
89
-			    $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' );
90
-			    // close "title" tag and end of "a" tag opening
91
-			    $datetime_string .= '">';
92
-			    // link text
93
-			    $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
94
-			    // close "a" tag
95
-			    $datetime_string .= '</a>';
96
-		    } else {
97
-			    $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
98
-		    }
99
-		    // add a "View Registrations" link that filters list by event AND datetime
100
-		    $datetime_string .= $this->row_actions(
101
-			    array(
102
-				    'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce(
103
-						    array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ),
104
-						    REG_ADMIN_URL
105
-					    ) . '" title="' . sprintf(
106
-						    esc_attr__(
107
-							    'Filter this list to only show registrations for this datetime %s',
108
-							    'event_espresso'
109
-						    ),
110
-						    $datetime->name()
111
-					    ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>'
112
-			    )
113
-		    );
63
+		$EVT_ID = $item->event_ID();
64
+		$datetime_string = '';
65
+		foreach( $datetimes as $datetime ){
66
+			if (
67
+				EE_Registry::instance()->CAP->current_user_can(
68
+					'ee_read_checkin',
69
+					'espresso_registrations_registration_checkins',
70
+					$item->ID()
71
+				)
72
+			) {
73
+				// open "a" tag and "href"
74
+				$datetime_string .= '<a href="';
75
+				// checkin URL
76
+				$datetime_string .= EE_Admin_Page::add_query_args_and_nonce(
77
+					array(
78
+						'action'   => 'event_registrations',
79
+						'event_id' => $EVT_ID,
80
+						'DTT_ID'   => $datetime->ID(),
81
+					),
82
+					REG_ADMIN_URL
83
+				);
84
+				// close "href"
85
+				$datetime_string .= '"';
86
+				// open "title" tag
87
+				$datetime_string .= ' title="';
88
+				// link title text
89
+				$datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' );
90
+				// close "title" tag and end of "a" tag opening
91
+				$datetime_string .= '">';
92
+				// link text
93
+				$datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
94
+				// close "a" tag
95
+				$datetime_string .= '</a>';
96
+			} else {
97
+				$datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
98
+			}
99
+			// add a "View Registrations" link that filters list by event AND datetime
100
+			$datetime_string .= $this->row_actions(
101
+				array(
102
+					'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce(
103
+							array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ),
104
+							REG_ADMIN_URL
105
+						) . '" title="' . sprintf(
106
+							esc_attr__(
107
+								'Filter this list to only show registrations for this datetime %s',
108
+								'event_espresso'
109
+							),
110
+							$datetime->name()
111
+						) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>'
112
+				)
113
+			);
114 114
 		}
115 115
 		return $datetime_string;
116
-    }
116
+	}
117 117
 
118 118
 
119 119
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
 	/**
32 32
 	 * 		REG_date
33 33
 	*/
34
-	function column_REG_date(EE_Registration $item){
34
+	function column_REG_date(EE_Registration $item) {
35 35
 
36 36
 		//Build row actions
37 37
 		$actions = array();
38 38
 
39 39
 		//Build row actions
40
-		$check_in_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$item->event_ID() ), REG_ADMIN_URL );
41
-		$actions['check_in'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID() ) ? '
42
-			<a href="'.$check_in_url.'" title="' . esc_attr__( 'The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso' ) . '">' . __( 'View Check-ins', 'event_espresso' ) . '</a>' : __( 'View Check-ins', 'event_espresso' );
40
+		$check_in_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$item->event_ID()), REG_ADMIN_URL);
41
+		$actions['check_in'] = EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID()) ? '
42
+			<a href="'.$check_in_url.'" title="'.esc_attr__('The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso').'">'.__('View Check-ins', 'event_espresso').'</a>' : __('View Check-ins', 'event_espresso');
43 43
 
44
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID() ), TXN_ADMIN_URL );
45
-		$REG_date = EE_Regisry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
44
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID()), TXN_ADMIN_URL);
45
+		$REG_date = EE_Regisry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date');
46 46
 
47
-		return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions) );
47
+		return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions));
48 48
 
49 49
 	}
50 50
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 * @param \EE_Registration $item
57 57
 	 * @return string
58 58
 	 */
59
-   	public function column_DTT_EVT_start(EE_Registration $item){
59
+   	public function column_DTT_EVT_start(EE_Registration $item) {
60 60
 		$remove_defaults = array('default_where_conditions' => 'none');
61 61
 		$ticket = $item->ticket();
62 62
 		$datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array();
63 63
 	    $EVT_ID = $item->event_ID();
64 64
 	    $datetime_string = '';
65
-	    foreach( $datetimes as $datetime ){
65
+	    foreach ($datetimes as $datetime) {
66 66
 		    if (
67 67
 			    EE_Registry::instance()->CAP->current_user_can(
68 68
 				    'ee_read_checkin',
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
 			    // open "title" tag
87 87
 			    $datetime_string .= ' title="';
88 88
 			    // link title text
89
-			    $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' );
89
+			    $datetime_string .= esc_attr__('View Checkins for this Event', 'event_espresso');
90 90
 			    // close "title" tag and end of "a" tag opening
91 91
 			    $datetime_string .= '">';
92 92
 			    // link text
93
-			    $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
93
+			    $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start');
94 94
 			    // close "a" tag
95 95
 			    $datetime_string .= '</a>';
96 96
 		    } else {
97
-			    $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
97
+			    $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start');
98 98
 		    }
99 99
 		    // add a "View Registrations" link that filters list by event AND datetime
100 100
 		    $datetime_string .= $this->row_actions(
101 101
 			    array(
102
-				    'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce(
103
-						    array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ),
102
+				    'event_datetime_filter' => '<a href="'.EE_Admin_Page::add_query_args_and_nonce(
103
+						    array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()),
104 104
 						    REG_ADMIN_URL
105
-					    ) . '" title="' . sprintf(
105
+					    ).'" title="'.sprintf(
106 106
 						    esc_attr__(
107 107
 							    'Filter this list to only show registrations for this datetime %s',
108 108
 							    'event_espresso'
109 109
 						    ),
110 110
 						    $datetime->name()
111
-					    ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>'
111
+					    ).'">'.__('View Registrations', 'event_espresso').'</a>'
112 112
 			    )
113 113
 		    );
114 114
 		}
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 3 patches
Braces   +146 added lines, -92 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
  * Event Espresso
4 6
  *
@@ -149,8 +151,9 @@  discard block
 block discarded – undo
149 151
 	 */
150 152
 	public function __construct( $routing = TRUE ) {
151 153
 
152
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
153
-			$this->_is_caf = TRUE;
154
+		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) {
155
+					$this->_is_caf = TRUE;
156
+		}
154 157
 
155 158
 		$this->_yes_no_values = array(
156 159
 			array('id' => TRUE, 'text' => __('Yes', 'event_espresso')),
@@ -181,8 +184,9 @@  discard block
 block discarded – undo
181 184
 		$this->_do_other_page_hooks();
182 185
 
183 186
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
184
-		if ( method_exists( $this, '_before_page_setup' ) )
185
-			$this->_before_page_setup();
187
+		if ( method_exists( $this, '_before_page_setup' ) ) {
188
+					$this->_before_page_setup();
189
+		}
186 190
 
187 191
 		//set up page dependencies
188 192
 		$this->_page_setup();
@@ -491,7 +495,9 @@  discard block
 block discarded – undo
491 495
 		global $ee_menu_slugs;
492 496
 		$ee_menu_slugs = (array) $ee_menu_slugs;
493 497
 
494
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
498
+		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) {
499
+			return FALSE;
500
+		}
495 501
 
496 502
 
497 503
 		// 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
@@ -526,12 +532,14 @@  discard block
 block discarded – undo
526 532
 		}
527 533
 
528 534
 		//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
529
-		if ( method_exists( $this, '_extend_page_config' ) )
530
-			$this->_extend_page_config();
535
+		if ( method_exists( $this, '_extend_page_config' ) ) {
536
+					$this->_extend_page_config();
537
+		}
531 538
 
532 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.
533
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
534
-			$this->_extend_page_config_for_cpt();
540
+		if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) {
541
+					$this->_extend_page_config_for_cpt();
542
+		}
535 543
 
536 544
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
537 545
 		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
@@ -647,8 +655,9 @@  discard block
 block discarded – undo
647 655
 		//add screen options - global, page child class, and view specific
648 656
 		$this->_add_global_screen_options();
649 657
 		$this->_add_screen_options();
650
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
651
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
658
+		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) {
659
+					call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
660
+		}
652 661
 
653 662
 
654 663
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -659,28 +668,32 @@  discard block
 block discarded – undo
659 668
 		//add feature_pointers - global, page child class, and view specific
660 669
 		$this->_add_feature_pointers();
661 670
 		$this->_add_global_feature_pointers();
662
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
663
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
671
+		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) {
672
+					call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
673
+		}
664 674
 
665 675
 		//enqueue scripts/styles - global, page class, and view specific
666 676
 		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
667 677
 		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
668
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
669
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
678
+		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) {
679
+					add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
680
+		}
670 681
 
671 682
 		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
672 683
 
673 684
 		//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
674 685
 		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
675 686
 		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
676
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
677
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
687
+		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) {
688
+					add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
689
+		}
678 690
 
679 691
 		//admin footer scripts
680 692
 		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
681 693
 		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
682
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
683
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
694
+		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) {
695
+					add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
696
+		}
684 697
 
685 698
 
686 699
 		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
@@ -753,7 +766,9 @@  discard block
 block discarded – undo
753 766
 	protected function _verify_routes() {
754 767
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
755 768
 
756
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
769
+		if ( !$this->_current_page && !defined( 'DOING_AJAX')) {
770
+			return FALSE;
771
+		}
757 772
 
758 773
 		$this->_route = FALSE;
759 774
 		$func = FALSE;
@@ -863,8 +878,9 @@  discard block
 block discarded – undo
863 878
 	 * @return void
864 879
 	 */
865 880
 	protected function _route_admin_request() {
866
-		if (  ! $this->_is_UI_request )
867
-			$this->_verify_routes();
881
+		if (  ! $this->_is_UI_request ) {
882
+					$this->_verify_routes();
883
+		}
868 884
 
869 885
 		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
870 886
 
@@ -874,8 +890,9 @@  discard block
 block discarded – undo
874 890
 			$this->_verify_nonce( $nonce, $this->_req_nonce );
875 891
 		}
876 892
 		//set the nav_tabs array but ONLY if this is  UI_request
877
-		if ( $this->_is_UI_request )
878
-			$this->_set_nav_tabs();
893
+		if ( $this->_is_UI_request ) {
894
+					$this->_set_nav_tabs();
895
+		}
879 896
 
880 897
 		// grab callback function
881 898
 		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
@@ -912,8 +929,9 @@  discard block
 block discarded – undo
912 929
 			}
913 930
 
914 931
 
915
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
916
-				throw new EE_Error( $error_msg );
932
+			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) {
933
+							throw new EE_Error( $error_msg );
934
+			}
917 935
 		}
918 936
 
919 937
 		//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.
@@ -1041,8 +1059,9 @@  discard block
 block discarded – undo
1041 1059
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1042 1060
 				foreach ( $this->_help_tour['tours'] as $tour ) {
1043 1061
 					//if this is the end tour then we don't need to setup a button
1044
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1045
-						continue;
1062
+					if ( $tour instanceof EE_Help_Tour_final_stop ) {
1063
+											continue;
1064
+					}
1046 1065
 					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1047 1066
 				}
1048 1067
 				$tour_buttons .= implode('<br />', $tb);
@@ -1052,8 +1071,9 @@  discard block
 block discarded – undo
1052 1071
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1053 1072
 			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1054 1073
 				//check that the callback given is valid
1055
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1056
-					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) ) );
1074
+				if ( !method_exists($this, $config['help_sidebar'] ) ) {
1075
+									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) ) );
1076
+				}
1057 1077
 
1058 1078
 				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1059 1079
 
@@ -1077,18 +1097,23 @@  discard block
 block discarded – undo
1077 1097
 				}/**/
1078 1098
 
1079 1099
 
1080
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1100
+			if ( !isset( $config['help_tabs'] ) ) {
1101
+				return;
1102
+			}
1103
+			//no help tabs for this route
1081 1104
 
1082 1105
 			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1083 1106
 				//we're here so there ARE help tabs!
1084 1107
 
1085 1108
 				//make sure we've got what we need
1086
-				if ( !isset( $cfg['title'] ) )
1087
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1109
+				if ( !isset( $cfg['title'] ) ) {
1110
+									throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1111
+				}
1088 1112
 
1089 1113
 
1090
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1091
-					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') );
1114
+				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) {
1115
+									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') );
1116
+				}
1092 1117
 
1093 1118
 
1094 1119
 
@@ -1151,14 +1176,16 @@  discard block
 block discarded – undo
1151 1176
 		$this->_help_tour = array();
1152 1177
 
1153 1178
 		//exit early if help tours are turned off globally
1154
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1155
-			return;
1179
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) {
1180
+					return;
1181
+		}
1156 1182
 
1157 1183
 		//loop through _page_config to find any help_tour defined
1158 1184
 		foreach ( $this->_page_config as $route => $config ) {
1159 1185
 			//we're only going to set things up for this route
1160
-			if ( $route !== $this->_req_action )
1161
-				continue;
1186
+			if ( $route !== $this->_req_action ) {
1187
+							continue;
1188
+			}
1162 1189
 
1163 1190
 			if ( isset( $config['help_tour'] ) ) {
1164 1191
 
@@ -1193,8 +1220,9 @@  discard block
 block discarded – undo
1193 1220
 			}
1194 1221
 		}
1195 1222
 
1196
-		if ( !empty( $tours ) )
1197
-			$this->_help_tour['tours'] = $tours;
1223
+		if ( !empty( $tours ) ) {
1224
+					$this->_help_tour['tours'] = $tours;
1225
+		}
1198 1226
 
1199 1227
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
1200 1228
 	}
@@ -1235,15 +1263,21 @@  discard block
 block discarded – undo
1235 1263
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1236 1264
 		$i = 0;
1237 1265
 		foreach ( $this->_page_config as $slug => $config ) {
1238
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1239
-				continue; //no nav tab for this config
1266
+			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) {
1267
+							continue;
1268
+			}
1269
+			//no nav tab for this config
1240 1270
 
1241 1271
 			//check for persistent flag
1242
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1243
-				continue; //nav tab is only to appear when route requested.
1272
+			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) {
1273
+							continue;
1274
+			}
1275
+			//nav tab is only to appear when route requested.
1244 1276
 
1245
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1246
-				continue; //no nav tab becasue current user does not have access.
1277
+			if ( ! $this->check_user_access( $slug, TRUE ) ) {
1278
+							continue;
1279
+			}
1280
+			//no nav tab becasue current user does not have access.
1247 1281
 
1248 1282
 			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1249 1283
 			$this->_nav_tabs[$slug] = array(
@@ -1480,10 +1514,11 @@  discard block
 block discarded – undo
1480 1514
 			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1481 1515
 		}
1482 1516
 
1483
-		if ( $display )
1484
-			echo $content;
1485
-		else
1486
-			return $content;
1517
+		if ( $display ) {
1518
+					echo $content;
1519
+		} else {
1520
+					return $content;
1521
+		}
1487 1522
 	}
1488 1523
 
1489 1524
 
@@ -1500,8 +1535,9 @@  discard block
 block discarded – undo
1500 1535
 		$method_name = '_help_popup_content_' . $this->_req_action;
1501 1536
 
1502 1537
 		//if method doesn't exist let's get out.
1503
-		if ( !method_exists( $this, $method_name ) )
1504
-			return array();
1538
+		if ( !method_exists( $this, $method_name ) ) {
1539
+					return array();
1540
+		}
1505 1541
 
1506 1542
 		//k we're good to go let's retrieve the help array
1507 1543
 		$help_array = call_user_func( array( $this, $method_name ) );
@@ -1532,7 +1568,9 @@  discard block
 block discarded – undo
1532 1568
 	 */
1533 1569
 	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1534 1570
 
1535
-		if ( defined('DOING_AJAX') ) return;
1571
+		if ( defined('DOING_AJAX') ) {
1572
+			return;
1573
+		}
1536 1574
 
1537 1575
 		//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
1538 1576
 		$help_array = $this->_get_help_content();
@@ -1550,10 +1588,11 @@  discard block
 block discarded – undo
1550 1588
 		$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>';
1551 1589
 		$content = $content . $help_content;
1552 1590
 
1553
-		if ( $display )
1554
-			echo $content;
1555
-		else
1556
-			return $content;
1591
+		if ( $display ) {
1592
+					echo $content;
1593
+		} else {
1594
+					return $content;
1595
+		}
1557 1596
 	}
1558 1597
 
1559 1598
 
@@ -1779,8 +1818,10 @@  discard block
 block discarded – undo
1779 1818
 	protected function _set_list_table() {
1780 1819
 
1781 1820
 		//first is this a list_table view?
1782
-		if ( !isset($this->_route_config['list_table']) )
1783
-			return; //not a list_table view so get out.
1821
+		if ( !isset($this->_route_config['list_table']) ) {
1822
+					return;
1823
+		}
1824
+		//not a list_table view so get out.
1784 1825
 
1785 1826
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1786 1827
 
@@ -2125,8 +2166,9 @@  discard block
 block discarded – undo
2125 2166
 	protected function _espresso_sponsors_post_box() {
2126 2167
 
2127 2168
 		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2128
-		if ( $show_sponsors )
2129
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2169
+		if ( $show_sponsors ) {
2170
+					add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2171
+		}
2130 2172
 	}
2131 2173
 
2132 2174
 
@@ -2409,8 +2451,9 @@  discard block
 block discarded – undo
2409 2451
 
2410 2452
 		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2411 2453
 
2412
-		if ( defined('DOING_AJAX' ) )
2413
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2454
+		if ( defined('DOING_AJAX' ) ) {
2455
+					$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2456
+		}
2414 2457
 
2415 2458
 		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2416 2459
 
@@ -2541,10 +2584,11 @@  discard block
 block discarded – undo
2541 2584
 			true
2542 2585
 		);
2543 2586
 		// the final template wrapper
2544
-		if ( $sidebar )
2545
-			$this->display_admin_page_with_sidebar();
2546
-		else
2547
-			$this->display_admin_page_with_no_sidebar();
2587
+		if ( $sidebar ) {
2588
+					$this->display_admin_page_with_sidebar();
2589
+		} else {
2590
+					$this->display_admin_page_with_no_sidebar();
2591
+		}
2548 2592
 	}
2549 2593
 
2550 2594
 
@@ -2610,8 +2654,9 @@  discard block
 block discarded – undo
2610 2654
 
2611 2655
 
2612 2656
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2613
-		if ( NULL === error_get_last() || ! headers_sent() )
2614
-			header('Content-Type: application/json; charset=UTF-8');
2657
+		if ( NULL === error_get_last() || ! headers_sent() ) {
2658
+					header('Content-Type: application/json; charset=UTF-8');
2659
+		}
2615 2660
                 if( function_exists( 'wp_json_encode' ) ) {
2616 2661
                     echo wp_json_encode( $json );
2617 2662
                 } else {
@@ -2627,10 +2672,9 @@  discard block
 block discarded – undo
2627 2672
 	 * @return json_obj|EE_Error
2628 2673
 	 */
2629 2674
 	public function return_json() {
2630
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2631
-			$this->_return_json();
2632
-
2633
-		else {
2675
+		if ( defined('DOING_AJAX') && DOING_AJAX ) {
2676
+					$this->_return_json();
2677
+		} else {
2634 2678
 			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2635 2679
 		}
2636 2680
 	}
@@ -2779,7 +2823,9 @@  discard block
 block discarded – undo
2779 2823
 			$id = $this->_current_view . '_' . $ref;
2780 2824
 			$name = !empty($actions) ? $actions[$key] : $ref;
2781 2825
 			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2782
-			if ( !$both ) break;
2826
+			if ( !$both ) {
2827
+				break;
2828
+			}
2783 2829
 		}
2784 2830
 
2785 2831
 	}
@@ -3022,11 +3068,13 @@  discard block
 block discarded – undo
3022 3068
 	 */
3023 3069
 	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) {
3024 3070
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3025
-		if ( !isset($this->_page_routes[$action]) && !$base_url )
3026
-			throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
3071
+		if ( !isset($this->_page_routes[$action]) && !$base_url ) {
3072
+					throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
3073
+		}
3027 3074
 
3028
-		if ( !isset( $this->_labels['buttons'][$type] ) )
3029
-			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) );
3075
+		if ( !isset( $this->_labels['buttons'][$type] ) ) {
3076
+					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) );
3077
+		}
3030 3078
 
3031 3079
 		//finally check user access for this button.
3032 3080
 		$has_access = $this->check_user_access( $action, TRUE );
@@ -3040,8 +3088,9 @@  discard block
 block discarded – undo
3040 3088
 			'action' => $action  );
3041 3089
 
3042 3090
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3043
-		if ( !empty($extra_request) )
3044
-			$query_args = array_merge( $extra_request, $query_args );
3091
+		if ( !empty($extra_request) ) {
3092
+					$query_args = array_merge( $extra_request, $query_args );
3093
+		}
3045 3094
 
3046 3095
 		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3047 3096
 
@@ -3088,13 +3137,15 @@  discard block
 block discarded – undo
3088 3137
 		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3089 3138
 			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3090 3139
 
3091
-			if ( !$user = wp_get_current_user() )
3092
-			return;
3140
+			if ( !$user = wp_get_current_user() ) {
3141
+						return;
3142
+			}
3093 3143
 			$option = $_POST['wp_screen_options']['option'];
3094 3144
 			$value = $_POST['wp_screen_options']['value'];
3095 3145
 
3096
-			if ( $option != sanitize_key( $option ) )
3097
-				return;
3146
+			if ( $option != sanitize_key( $option ) ) {
3147
+							return;
3148
+			}
3098 3149
 
3099 3150
 			$map_option = $option;
3100 3151
 
@@ -3103,13 +3154,15 @@  discard block
 block discarded – undo
3103 3154
 			switch ( $map_option ) {
3104 3155
 				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3105 3156
 					$value = (int) $value;
3106
-					if ( $value < 1 || $value > 999 )
3107
-						return;
3157
+					if ( $value < 1 || $value > 999 ) {
3158
+											return;
3159
+					}
3108 3160
 					break;
3109 3161
 				default:
3110 3162
 					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3111
-					if ( false === $value )
3112
-						return;
3163
+					if ( false === $value ) {
3164
+											return;
3165
+					}
3113 3166
 					break;
3114 3167
 			}
3115 3168
 
@@ -3145,8 +3198,9 @@  discard block
 block discarded – undo
3145 3198
 	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3146 3199
 		$user_id = get_current_user_id();
3147 3200
 
3148
-		if ( !$skip_route_verify )
3149
-			$this->_verify_route($route);
3201
+		if ( !$skip_route_verify ) {
3202
+					$this->_verify_route($route);
3203
+		}
3150 3204
 
3151 3205
 
3152 3206
 		//now let's set the string for what kind of transient we're setting
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 *
480 480
 	 * @final
481 481
 	 * @access protected
482
-	 * @return void
482
+	 * @return false|null
483 483
 	 */
484 484
 	final protected function _page_setup() {
485 485
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 	 * All this method does is verify the incoming request and make sure that routes exist for it.  We do this early so we know if we need to drop out.
754 754
 	 *
755 755
 	 * @access protected
756
-	 * @return void
756
+	 * @return false|null
757 757
 	 */
758 758
 	protected function _verify_routes() {
759 759
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 	/**
816 816
 	 * this method simply verifies a given route and makes sure its an actual route available for the loaded page
817 817
 	 * @param  string $route the route name we're verifying
818
-	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
818
+	 * @return boolean  (bool|Exception)      we'll throw an exception if this isn't a valid route.
819 819
 	 */
820 820
 	protected function _verify_route( $route ) {
821 821
 		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
@@ -2186,7 +2186,7 @@  discard block
 block discarded – undo
2186 2186
 	 * @param	string	$name		key used for the action ID (i.e. event_id)
2187 2187
 	 * @param	int		$id	id attached to the item published
2188 2188
 	 * @param	string	$delete	page route callback for the delete action
2189
-	 * @param	string	$post_save_redirect_URL	custom URL to redirect to after Save & Close has been completed
2189
+	 * @param	string	$save_close_redirect_URL	custom URL to redirect to after Save & Close has been completed
2190 2190
 	 * @param	boolean	$both_btns	whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button
2191 2191
 	 */
2192 2192
 	protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) {
@@ -2690,7 +2690,7 @@  discard block
 block discarded – undo
2690 2690
 	/**
2691 2691
 	*		sort nav tabs
2692 2692
 	*		@access public
2693
-	*		@return void
2693
+	*		@return integer
2694 2694
 	*/
2695 2695
 	private function _sort_nav_tabs( $a, $b ) {
2696 2696
 		if ($a['order'] == $b['order']) {
@@ -3309,7 +3309,7 @@  discard block
 block discarded – undo
3309 3309
 
3310 3310
 
3311 3311
 	/**
3312
-	 * @return mixed
3312
+	 * @return string[]
3313 3313
 	 */
3314 3314
 	public function default_espresso_metaboxes() {
3315 3315
 		return $this->_default_espresso_metaboxes;
@@ -3327,7 +3327,7 @@  discard block
 block discarded – undo
3327 3327
 
3328 3328
 
3329 3329
 	/**
3330
-	 * @return mixed
3330
+	 * @return string
3331 3331
 	 */
3332 3332
 	public function wp_page_slug() {
3333 3333
 		return $this->_wp_page_slug;
@@ -3340,7 +3340,6 @@  discard block
 block discarded – undo
3340 3340
 	 *
3341 3341
 	 * @access 	protected
3342 3342
 	 * @param string $tab
3343
-	 * @param array $data
3344 3343
 	 * @param string $file	file where error occurred
3345 3344
 	 * @param string $func function  where error occurred
3346 3345
 	 * @param string $line	line no where error occurred
Please login to merge, or discard this patch.
Spacing   +615 added lines, -615 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
 
@@ -486,87 +486,87 @@  discard block
 block discarded – undo
486 486
 		//requires?
487 487
 
488 488
 		//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.
489
-		add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 );
489
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
490 490
 
491 491
 
492 492
 		//next verify if we need to load anything...
493
-		$this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : '';
494
-		$this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) );
493
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : '';
494
+		$this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this))));
495 495
 
496 496
 		global $ee_menu_slugs;
497 497
 		$ee_menu_slugs = (array) $ee_menu_slugs;
498 498
 
499
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
499
+		if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE;
500 500
 
501 501
 
502 502
 		// 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
503
-		if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) {
504
-			$this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
503
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) {
504
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
505 505
 		}
506 506
 		// then set blank or -1 action values to 'default'
507
-		$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';
507
+		$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';
508 508
 
509 509
 		//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.
510
-		$this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action;
510
+		$this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
511 511
 
512 512
 		//however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
513 513
 		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
514 514
 
515 515
 		$this->_current_view = $this->_req_action;
516
-		$this->_req_nonce = $this->_req_action . '_nonce';
516
+		$this->_req_nonce = $this->_req_action.'_nonce';
517 517
 		$this->_define_page_props();
518 518
 
519
-		$this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ),  $this->_admin_base_url );
519
+		$this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url);
520 520
 
521 521
 		//default things
522
-		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' );
522
+		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box');
523 523
 
524 524
 		//set page configs
525 525
 		$this->_set_page_routes();
526 526
 		$this->_set_page_config();
527 527
 
528 528
 		//let's include any referrer data in our default_query_args for this route for "stickiness".
529
-		if ( isset( $this->_req_data['wp_referer'] ) ) {
529
+		if (isset($this->_req_data['wp_referer'])) {
530 530
 			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
531 531
 		}
532 532
 
533 533
 		//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
534
-		if ( method_exists( $this, '_extend_page_config' ) )
534
+		if (method_exists($this, '_extend_page_config'))
535 535
 			$this->_extend_page_config();
536 536
 
537 537
 		//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.
538
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
538
+		if (method_exists($this, '_extend_page_config_for_cpt'))
539 539
 			$this->_extend_page_config_for_cpt();
540 540
 
541 541
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
542
-		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
543
-		$this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this );
542
+		$this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this);
543
+		$this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this);
544 544
 
545 545
 
546 546
 		//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
547
-		if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) {
548
-			add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 );
547
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
548
+			add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2);
549 549
 		}
550 550
 
551 551
 
552 552
 		//next route only if routing enabled
553
-		if ( $this->_routing && !defined('DOING_AJAX') ) {
553
+		if ($this->_routing && ! defined('DOING_AJAX')) {
554 554
 
555 555
 			$this->_verify_routes();
556 556
 
557 557
 			//next let's just check user_access and kill if no access
558 558
 			$this->check_user_access();
559 559
 
560
-			if ( $this->_is_UI_request ) {
560
+			if ($this->_is_UI_request) {
561 561
 				//admin_init stuff - global, all views for this page class, specific view
562
-				add_action( 'admin_init', array( $this, 'admin_init' ), 10 );
563
-				if ( method_exists( $this, 'admin_init_' . $this->_current_view )) {
564
-					add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 );
562
+				add_action('admin_init', array($this, 'admin_init'), 10);
563
+				if (method_exists($this, 'admin_init_'.$this->_current_view)) {
564
+					add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
565 565
 				}
566 566
 
567 567
 			} else {
568 568
 				//hijack regular WP loading and route admin request immediately
569
-				@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
569
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
570 570
 				$this->route_admin_request();
571 571
 			}
572 572
 		}
@@ -583,18 +583,18 @@  discard block
 block discarded – undo
583 583
 	 * @return void
584 584
 	 */
585 585
 	private function _do_other_page_hooks() {
586
-		$registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() );
586
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
587 587
 
588
-		foreach ( $registered_pages as $page ) {
588
+		foreach ($registered_pages as $page) {
589 589
 
590 590
 			//now let's setup the file name and class that should be present
591 591
 			$classname = str_replace('.class.php', '', $page);
592 592
 
593 593
 			//autoloaders should take care of loading file
594
-			if ( !class_exists( $classname ) ) {
595
-				$error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page);
596
-				$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 );
597
-				throw new EE_Error( implode( '||', $error_msg ));
594
+			if ( ! class_exists($classname)) {
595
+				$error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page);
596
+				$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);
597
+				throw new EE_Error(implode('||', $error_msg));
598 598
 			}
599 599
 
600 600
 			$a = new ReflectionClass($classname);
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 	public function load_page_dependencies() {
610 610
 		try {
611 611
 			$this->_load_page_dependencies();
612
-		} catch ( EE_Error $e ) {
612
+		} catch (EE_Error $e) {
613 613
 			$e->get_error();
614 614
 		}
615 615
 	}
@@ -627,16 +627,16 @@  discard block
 block discarded – undo
627 627
 		$this->_current_screen = get_current_screen();
628 628
 
629 629
 		//load admin_notices - global, page class, and view specific
630
-		add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 );
631
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
632
-		if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) {
633
-			add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 );
630
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
631
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
632
+		if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
633
+			add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
634 634
 		}
635 635
 
636 636
 		//load network admin_notices - global, page class, and view specific
637
-		add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 );
638
-		if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) {
639
-			add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) );
637
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
638
+		if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
639
+			add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
640 640
 		}
641 641
 
642 642
 		//this will save any per_page screen options if they are present
@@ -652,8 +652,8 @@  discard block
 block discarded – undo
652 652
 		//add screen options - global, page child class, and view specific
653 653
 		$this->_add_global_screen_options();
654 654
 		$this->_add_screen_options();
655
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
656
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
655
+		if (method_exists($this, '_add_screen_options_'.$this->_current_view))
656
+			call_user_func(array($this, '_add_screen_options_'.$this->_current_view));
657 657
 
658 658
 
659 659
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -664,33 +664,33 @@  discard block
 block discarded – undo
664 664
 		//add feature_pointers - global, page child class, and view specific
665 665
 		$this->_add_feature_pointers();
666 666
 		$this->_add_global_feature_pointers();
667
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
668
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
667
+		if (method_exists($this, '_add_feature_pointer_'.$this->_current_view))
668
+			call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view));
669 669
 
670 670
 		//enqueue scripts/styles - global, page class, and view specific
671
-		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
672
-		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
673
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
674
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
671
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
672
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
673
+		if (method_exists($this, 'load_scripts_styles_'.$this->_current_view))
674
+			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15);
675 675
 
676
-		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
676
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
677 677
 
678 678
 		//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
679
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
680
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
681
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
682
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
679
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
680
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
681
+		if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view))
682
+			add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101);
683 683
 
684 684
 		//admin footer scripts
685
-		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
686
-		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
687
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
688
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
685
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
686
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
687
+		if (method_exists($this, 'admin_footer_'.$this->_current_view))
688
+			add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101);
689 689
 
690 690
 
691
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
691
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
692 692
 		//targeted hook
693
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action );
693
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action);
694 694
 
695 695
 	}
696 696
 
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	private function _set_defaults() {
706 706
 		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL;
707 707
 
708
-		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config =  $this->_default_route_query_args = array();
708
+		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array();
709 709
 
710 710
 		$this->default_nav_tab_name = 'overview';
711 711
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 	public function route_admin_request() {
733 733
 		try {
734 734
 			$this->_route_admin_request();
735
-		} catch ( EE_Error $e ) {
735
+		} catch (EE_Error $e) {
736 736
 			$e->get_error();
737 737
 		}
738 738
 	}
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 		$this->_wp_page_slug = $wp_page_slug;
744 744
 
745 745
 		//if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
746
-		if ( is_network_admin() ) {
746
+		if (is_network_admin()) {
747 747
 			$this->_wp_page_slug .= '-network';
748 748
 		}
749 749
 	}
@@ -756,53 +756,53 @@  discard block
 block discarded – undo
756 756
 	 * @return void
757 757
 	 */
758 758
 	protected function _verify_routes() {
759
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
759
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
760 760
 
761
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
761
+		if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE;
762 762
 
763 763
 		$this->_route = FALSE;
764 764
 		$func = FALSE;
765 765
 		$args = array();
766 766
 
767 767
 		// check that the page_routes array is not empty
768
-		if ( empty( $this->_page_routes )) {
768
+		if (empty($this->_page_routes)) {
769 769
 			// user error msg
770
-			$error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title );
770
+			$error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
771 771
 			// developer error msg
772
-			$error_msg .=  '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' );
773
-			throw new EE_Error( $error_msg );
772
+			$error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso');
773
+			throw new EE_Error($error_msg);
774 774
 		}
775 775
 
776 776
 		// and that the requested page route exists
777
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
778
-			$this->_route = $this->_page_routes[ $this->_req_action ];
777
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
778
+			$this->_route = $this->_page_routes[$this->_req_action];
779 779
 			$this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array();
780 780
 		} else {
781 781
 			// user error msg
782
-			$error_msg =  sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
782
+			$error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
783 783
 			// developer error msg
784
-			$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 );
785
-			throw new EE_Error( $error_msg );
784
+			$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);
785
+			throw new EE_Error($error_msg);
786 786
 		}
787 787
 
788 788
 		// and that a default route exists
789
-		if ( ! array_key_exists( 'default', $this->_page_routes )) {
789
+		if ( ! array_key_exists('default', $this->_page_routes)) {
790 790
 			// user error msg
791
-			$error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title );
791
+			$error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title);
792 792
 			// developer error msg
793
-			$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' );
794
-			throw new EE_Error( $error_msg );
793
+			$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');
794
+			throw new EE_Error($error_msg);
795 795
 		}
796 796
 
797 797
 
798 798
 		//first lets' catch if the UI request has EVER been set.
799
-		if ( $this->_is_UI_request === NULL ) {
799
+		if ($this->_is_UI_request === NULL) {
800 800
 			//lets set if this is a UI request or not.
801
-			$this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE;
801
+			$this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE;
802 802
 
803 803
 
804 804
 			//wait a minute... we might have a noheader in the route array
805
-			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
805
+			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
806 806
 		}
807 807
 
808 808
 		$this->_set_current_labels();
@@ -817,15 +817,15 @@  discard block
 block discarded – undo
817 817
 	 * @param  string $route the route name we're verifying
818 818
 	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
819 819
 	 */
820
-	protected function _verify_route( $route ) {
821
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
820
+	protected function _verify_route($route) {
821
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
822 822
 			return true;
823 823
 		} else {
824 824
 			// user error msg
825
-			$error_msg =  sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
825
+			$error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
826 826
 			// developer error msg
827
-			$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 );
828
-			throw new EE_Error( $error_msg );
827
+			$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);
828
+			throw new EE_Error($error_msg);
829 829
 		}
830 830
 	}
831 831
 
@@ -839,18 +839,18 @@  discard block
 block discarded – undo
839 839
 	 * @param  string $nonce_ref The nonce reference string (name0)
840 840
 	 * @return mixed (bool|die)
841 841
 	 */
842
-	protected function _verify_nonce( $nonce, $nonce_ref ) {
842
+	protected function _verify_nonce($nonce, $nonce_ref) {
843 843
 		// verify nonce against expected value
844
-		if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) {
844
+		if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
845 845
 			// these are not the droids you are looking for !!!
846
-			$msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' );
847
-			if ( WP_DEBUG ) {
848
-				$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__  );
846
+			$msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>');
847
+			if (WP_DEBUG) {
848
+				$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__);
849 849
 			}
850
-			if ( ! defined( 'DOING_AJAX' )) {
851
-				wp_die( $msg );
850
+			if ( ! defined('DOING_AJAX')) {
851
+				wp_die($msg);
852 852
 			} else {
853
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
853
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
854 854
 				$this->_return_json();
855 855
 			}
856 856
 		}
@@ -868,63 +868,63 @@  discard block
 block discarded – undo
868 868
 	 * @return void
869 869
 	 */
870 870
 	protected function _route_admin_request() {
871
-		if (  ! $this->_is_UI_request )
871
+		if ( ! $this->_is_UI_request)
872 872
 			$this->_verify_routes();
873 873
 
874
-		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
874
+		$nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE;
875 875
 
876
-		if ( $this->_req_action != 'default' && $nonce_check ) {
876
+		if ($this->_req_action != 'default' && $nonce_check) {
877 877
 			// set nonce from post data
878
-			$nonce = isset($this->_req_data[ $this->_req_nonce  ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce  ] ) : '';
879
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
878
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
879
+			$this->_verify_nonce($nonce, $this->_req_nonce);
880 880
 		}
881 881
 		//set the nav_tabs array but ONLY if this is  UI_request
882
-		if ( $this->_is_UI_request )
882
+		if ($this->_is_UI_request)
883 883
 			$this->_set_nav_tabs();
884 884
 
885 885
 		// grab callback function
886
-		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
886
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
887 887
 
888 888
 		// check if callback has args
889
-		$args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array();
889
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
890 890
 
891 891
 		$error_msg = '';
892 892
 
893 893
 		//action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
894
-		if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) {
895
-			do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this );
894
+		if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
895
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
896 896
 		}
897 897
 
898 898
 		//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).
899
-		$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
899
+		$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI']));
900 900
 
901
-		if ( ! empty( $func )) {
901
+		if ( ! empty($func)) {
902 902
 			$base_call = $addon_call = FALSE;
903 903
 			//try to access page route via this class
904
-			if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func  ), $args ) ) === FALSE ) {
904
+			if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) {
905 905
 				// user error msg
906
-				$error_msg =  __( 'An error occurred. The  requested page route could not be found.', 'event_espresso' );
906
+				$error_msg = __('An error occurred. The  requested page route could not be found.', 'event_espresso');
907 907
 				// developer error msg
908
-				$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 );
908
+				$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);
909 909
 			}
910 910
 
911 911
 			//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)
912 912
 			$args['admin_page_object'] = $this; //send along this admin page object for access by addons.
913 913
 
914
-			if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) {
915
-				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' );
916
-				$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 );
914
+			if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) {
915
+				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso');
916
+				$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);
917 917
 			}
918 918
 
919 919
 
920
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
921
-				throw new EE_Error( $error_msg );
920
+			if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE)
921
+				throw new EE_Error($error_msg);
922 922
 		}
923 923
 
924 924
 		//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.
925 925
 		//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.
926
-		if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) {
927
-			$this->_reset_routing_properties( $this->_route['headers_sent_route'] );
926
+		if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) {
927
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
928 928
 		}
929 929
 	}
930 930
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 	 * @param  string    $new_route   New (non header) route to redirect to.
941 941
 	 * @return   void
942 942
 	 */
943
-	protected function _reset_routing_properties( $new_route ) {
943
+	protected function _reset_routing_properties($new_route) {
944 944
 		$this->_is_UI_request = TRUE;
945 945
 		//now we set the current route to whatever the headers_sent_route is set at
946 946
 		$this->_req_data['action'] = $new_route;
@@ -986,23 +986,23 @@  discard block
 block discarded – undo
986 986
 	 * @param   bool    $exclude_nonce  If true, the the nonce will be excluded from the generated nonce.
987 987
 	 * 	@return string
988 988
 	 */
989
-	public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) {
989
+	public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) {
990 990
 
991 991
 		//if there is a _wp_http_referer include the values from the request but only if sticky = true
992
-		if ( $sticky ) {
992
+		if ($sticky) {
993 993
 			$request = $_REQUEST;
994
-			unset( $request['_wp_http_referer'] );
995
-			unset( $request['wp_referer'] );
996
-			foreach ( $request as $key => $value ) {
994
+			unset($request['_wp_http_referer']);
995
+			unset($request['wp_referer']);
996
+			foreach ($request as $key => $value) {
997 997
 				//do not add nonces
998
-				if ( strpos( $key, 'nonce' ) !== false ) {
998
+				if (strpos($key, 'nonce') !== false) {
999 999
 					continue;
1000 1000
 				}
1001
-				$args['wp_referer[' . $key . ']'] = $value;
1001
+				$args['wp_referer['.$key.']'] = $value;
1002 1002
 			}
1003 1003
 		}
1004 1004
 
1005
-		return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce );
1005
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1006 1006
 	}
1007 1007
 
1008 1008
 
@@ -1018,8 +1018,8 @@  discard block
 block discarded – undo
1018 1018
 	 * @uses EEH_Template::get_help_tab_link()
1019 1019
 	 * @return string              generated link
1020 1020
 	 */
1021
-	protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) {
1022
-		return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text );
1021
+	protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) {
1022
+		return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text);
1023 1023
 	}
1024 1024
 
1025 1025
 
@@ -1036,30 +1036,30 @@  discard block
 block discarded – undo
1036 1036
 	 */
1037 1037
 	protected function _add_help_tabs() {
1038 1038
 		$tour_buttons = '';
1039
-		if ( isset( $this->_page_config[$this->_req_action] ) ) {
1039
+		if (isset($this->_page_config[$this->_req_action])) {
1040 1040
 			$config = $this->_page_config[$this->_req_action];
1041 1041
 
1042 1042
 			//is there a help tour for the current route?  if there is let's setup the tour buttons
1043
-			if ( isset( $this->_help_tour[$this->_req_action]) ) {
1043
+			if (isset($this->_help_tour[$this->_req_action])) {
1044 1044
 				$tb = array();
1045 1045
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1046
-				foreach ( $this->_help_tour['tours'] as $tour ) {
1046
+				foreach ($this->_help_tour['tours'] as $tour) {
1047 1047
 					//if this is the end tour then we don't need to setup a button
1048
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1048
+					if ($tour instanceof EE_Help_Tour_final_stop)
1049 1049
 						continue;
1050
-					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1050
+					$tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>';
1051 1051
 				}
1052 1052
 				$tour_buttons .= implode('<br />', $tb);
1053 1053
 				$tour_buttons .= '</div></div>';
1054 1054
 			}
1055 1055
 
1056 1056
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1057
-			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1057
+			if (is_array($config) && isset($config['help_sidebar'])) {
1058 1058
 				//check that the callback given is valid
1059
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1060
-					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) ) );
1059
+				if ( ! method_exists($this, $config['help_sidebar']))
1060
+					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)));
1061 1061
 
1062
-				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1062
+				$content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
1063 1063
 
1064 1064
 				$content .= $tour_buttons; //add help tour buttons.
1065 1065
 
@@ -1068,49 +1068,49 @@  discard block
 block discarded – undo
1068 1068
 			}
1069 1069
 
1070 1070
 			//if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
1071
-			if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) {
1071
+			if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1072 1072
 				$this->_current_screen->set_help_sidebar($tour_buttons);
1073 1073
 			}
1074 1074
 
1075 1075
 			//handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1076
-			if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) {
1076
+			if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1077 1077
 				$_ht['id'] = $this->page_slug;
1078 1078
 				$_ht['title'] = __('Help Tours', 'event_espresso');
1079
-				$_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
1079
+				$_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>';
1080 1080
 				$this->_current_screen->add_help_tab($_ht);
1081 1081
 				}/**/
1082 1082
 
1083 1083
 
1084
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1084
+			if ( ! isset($config['help_tabs'])) return; //no help tabs for this route
1085 1085
 
1086
-			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1086
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1087 1087
 				//we're here so there ARE help tabs!
1088 1088
 
1089 1089
 				//make sure we've got what we need
1090
-				if ( !isset( $cfg['title'] ) )
1091
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1090
+				if ( ! isset($cfg['title']))
1091
+					throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
1092 1092
 
1093 1093
 
1094
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1095
-					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') );
1094
+				if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content']))
1095
+					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'));
1096 1096
 
1097 1097
 
1098 1098
 
1099 1099
 				//first priority goes to content.
1100
-				if ( !empty($cfg['content'] ) ) {
1101
-					$content = !empty($cfg['content']) ? $cfg['content'] : NULL;
1100
+				if ( ! empty($cfg['content'])) {
1101
+					$content = ! empty($cfg['content']) ? $cfg['content'] : NULL;
1102 1102
 
1103 1103
 				//second priority goes to filename
1104
-				} else if ( !empty($cfg['filename'] ) ) {
1105
-					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1104
+				} else if ( ! empty($cfg['filename'])) {
1105
+					$file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1106 1106
 
1107 1107
 
1108 1108
 					//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)
1109
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
1109
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path;
1110 1110
 
1111 1111
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1112
-					if ( !is_readable($file_path) && !isset($cfg['callback']) ) {
1113
-						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__ );
1112
+					if ( ! is_readable($file_path) && ! isset($cfg['callback'])) {
1113
+						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__);
1114 1114
 						return;
1115 1115
 					}
1116 1116
 					$template_args['admin_page_obj'] = $this;
@@ -1121,21 +1121,21 @@  discard block
 block discarded – undo
1121 1121
 
1122 1122
 
1123 1123
 				//check if callback is valid
1124
-				if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) {
1125
-					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__ );
1124
+				if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) {
1125
+					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__);
1126 1126
 					return;
1127 1127
 				}
1128 1128
 
1129 1129
 				//setup config array for help tab method
1130
-				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1130
+				$id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1131 1131
 				$_ht = array(
1132 1132
 					'id' => $id,
1133 1133
 					'title' => $cfg['title'],
1134
-					'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL,
1134
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL,
1135 1135
 					'content' => $content
1136 1136
 					);
1137 1137
 
1138
-				$this->_current_screen->add_help_tab( $_ht );
1138
+				$this->_current_screen->add_help_tab($_ht);
1139 1139
 			}
1140 1140
 		}
1141 1141
 	}
@@ -1155,49 +1155,49 @@  discard block
 block discarded – undo
1155 1155
 		$this->_help_tour = array();
1156 1156
 
1157 1157
 		//exit early if help tours are turned off globally
1158
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1158
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS))
1159 1159
 			return;
1160 1160
 
1161 1161
 		//loop through _page_config to find any help_tour defined
1162
-		foreach ( $this->_page_config as $route => $config ) {
1162
+		foreach ($this->_page_config as $route => $config) {
1163 1163
 			//we're only going to set things up for this route
1164
-			if ( $route !== $this->_req_action )
1164
+			if ($route !== $this->_req_action)
1165 1165
 				continue;
1166 1166
 
1167
-			if ( isset( $config['help_tour'] ) ) {
1167
+			if (isset($config['help_tour'])) {
1168 1168
 
1169
-				foreach( $config['help_tour'] as $tour ) {
1170
-					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1169
+				foreach ($config['help_tour'] as $tour) {
1170
+					$file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1171 1171
 					//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
1172
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path;
1172
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path;
1173 1173
 
1174 1174
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1175
-					if ( !is_readable($file_path) ) {
1176
-						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__ );
1175
+					if ( ! is_readable($file_path)) {
1176
+						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__);
1177 1177
 						return;
1178 1178
 					}
1179 1179
 
1180 1180
 					require_once $file_path;
1181
-					if ( !class_exists( $tour ) ) {
1182
-						$error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour);
1183
-						$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) );
1184
-						throw new EE_Error( implode( '||', $error_msg ));
1181
+					if ( ! class_exists($tour)) {
1182
+						$error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour);
1183
+						$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));
1184
+						throw new EE_Error(implode('||', $error_msg));
1185 1185
 					}
1186 1186
 					$a = new ReflectionClass($tour);
1187 1187
 					$tour_obj = $a->newInstance($this->_is_caf);
1188 1188
 
1189 1189
 					$tours[] = $tour_obj;
1190
-					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj );
1190
+					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1191 1191
 				}
1192 1192
 
1193 1193
 				//let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1194 1194
 				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1195 1195
 				$tours[] = $end_stop_tour;
1196
-				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour );
1196
+				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1197 1197
 			}
1198 1198
 		}
1199 1199
 
1200
-		if ( !empty( $tours ) )
1200
+		if ( ! empty($tours))
1201 1201
 			$this->_help_tour['tours'] = $tours;
1202 1202
 
1203 1203
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
@@ -1213,12 +1213,12 @@  discard block
 block discarded – undo
1213 1213
 	 * @return void
1214 1214
 	 */
1215 1215
 	protected function _add_qtips() {
1216
-		if ( isset( $this->_route_config['qtips'] ) ) {
1216
+		if (isset($this->_route_config['qtips'])) {
1217 1217
 			$qtips = (array) $this->_route_config['qtips'];
1218 1218
 			//load qtip loader
1219 1219
 			$path = array(
1220
-				$this->_get_dir() . '/qtips/',
1221
-				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/'
1220
+				$this->_get_dir().'/qtips/',
1221
+				EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/'
1222 1222
 				);
1223 1223
 			EEH_Qtip_Loader::instance()->register($qtips, $path);
1224 1224
 		}
@@ -1235,41 +1235,41 @@  discard block
 block discarded – undo
1235 1235
 	 * @return void
1236 1236
 	 */
1237 1237
 	protected function _set_nav_tabs() {
1238
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1238
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1239 1239
 		$i = 0;
1240
-		foreach ( $this->_page_config as $slug => $config ) {
1241
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1240
+		foreach ($this->_page_config as $slug => $config) {
1241
+			if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav'])))
1242 1242
 				continue; //no nav tab for this config
1243 1243
 
1244 1244
 			//check for persistent flag
1245
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1245
+			if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action)
1246 1246
 				continue; //nav tab is only to appear when route requested.
1247 1247
 
1248
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1248
+			if ( ! $this->check_user_access($slug, TRUE))
1249 1249
 				continue; //no nav tab becasue current user does not have access.
1250 1250
 
1251
-			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1251
+			$css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1252 1252
 			$this->_nav_tabs[$slug] = array(
1253
-				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ),
1254
-				'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ),
1255
-				'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class,
1256
-				'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i
1253
+				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url),
1254
+				'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)),
1255
+				'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class,
1256
+				'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i
1257 1257
 				);
1258 1258
 			$i++;
1259 1259
 		}
1260 1260
 
1261 1261
 		//if $this->_nav_tabs is empty then lets set the default
1262
-		if ( empty( $this->_nav_tabs ) ) {
1262
+		if (empty($this->_nav_tabs)) {
1263 1263
 			$this->_nav_tabs[$this->default_nav_tab_name] = array(
1264 1264
 				'url' => $this->admin_base_url,
1265
-				'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ),
1265
+				'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)),
1266 1266
 				'css_class' => 'nav-tab-active',
1267 1267
 				'order' => 10
1268 1268
 				);
1269 1269
 		}
1270 1270
 
1271 1271
 		//now let's sort the tabs according to order
1272
-		usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' ));
1272
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1273 1273
 
1274 1274
 	}
1275 1275
 
@@ -1285,10 +1285,10 @@  discard block
 block discarded – undo
1285 1285
 	 * @return void
1286 1286
 	 */
1287 1287
 	private function _set_current_labels() {
1288
-		if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) {
1289
-			foreach ( $this->_route_config['labels'] as $label => $text ) {
1290
-				if ( is_array($text) ) {
1291
-					foreach ( $text as $sublabel => $subtext ) {
1288
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1289
+			foreach ($this->_route_config['labels'] as $label => $text) {
1290
+				if (is_array($text)) {
1291
+					foreach ($text as $sublabel => $subtext) {
1292 1292
 						$this->_labels[$label][$sublabel] = $subtext;
1293 1293
 					}
1294 1294
 				} else {
@@ -1309,24 +1309,24 @@  discard block
 block discarded – undo
1309 1309
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1310 1310
 	*		@return 		BOOL|wp_die()
1311 1311
 	*/
1312
-	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1313
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1314
-		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
1315
-		$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;
1312
+	public function check_user_access($route_to_check = '', $verify_only = FALSE) {
1313
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1314
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1315
+		$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 1316
 
1317
-		if ( empty( $capability ) && empty( $route_to_check )  ) {
1318
-			$capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability'];
1317
+		if (empty($capability) && empty($route_to_check)) {
1318
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability'];
1319 1319
 		} else {
1320
-			$capability = empty( $capability ) ? 'manage_options' : $capability;
1320
+			$capability = empty($capability) ? 'manage_options' : $capability;
1321 1321
 		}
1322 1322
 
1323
-		$id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0;
1323
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1324 1324
 
1325
-		if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) {
1326
-			if ( $verify_only ) {
1325
+		if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) {
1326
+			if ($verify_only) {
1327 1327
 				return FALSE;
1328 1328
 			} else {
1329
-				wp_die( __('You do not have access to this route.', 'event_espresso' ) );
1329
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1330 1330
 			}
1331 1331
 		}
1332 1332
 		return TRUE;
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 		$this->_add_admin_page_overlay();
1404 1404
 
1405 1405
 		//if metaboxes are present we need to add the nonce field
1406
-		if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) {
1406
+		if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) {
1407 1407
 			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1408 1408
 			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1409 1409
 		}
@@ -1422,19 +1422,19 @@  discard block
 block discarded – undo
1422 1422
 	 */
1423 1423
 	public function admin_footer_global() {
1424 1424
 		//dialog container for dialog helper
1425
-		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1425
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1426 1426
 		$d_cont .= '<div class="ee-notices"></div>';
1427 1427
 		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1428 1428
 		$d_cont .= '</div>';
1429 1429
 		echo $d_cont;
1430 1430
 
1431 1431
 		//help tour stuff?
1432
-		if ( isset( $this->_help_tour[$this->_req_action] ) ) {
1432
+		if (isset($this->_help_tour[$this->_req_action])) {
1433 1433
 			echo implode('<br />', $this->_help_tour[$this->_req_action]);
1434 1434
 		}
1435 1435
 
1436 1436
 		//current set timezone for timezone js
1437
-		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1437
+		echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1438 1438
 	}
1439 1439
 
1440 1440
 
@@ -1458,18 +1458,18 @@  discard block
 block discarded – undo
1458 1458
 	 * @access protected
1459 1459
 	 * @return string content
1460 1460
 	 */
1461
-	protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) {
1461
+	protected function _set_help_popup_content($help_array = array(), $display = FALSE) {
1462 1462
 		$content = '';
1463 1463
 
1464
-		$help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array;
1465
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php';
1464
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1465
+		$template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php';
1466 1466
 
1467 1467
 
1468 1468
 		//loop through the array and setup content
1469
-		foreach ( $help_array as $trigger => $help ) {
1469
+		foreach ($help_array as $trigger => $help) {
1470 1470
 			//make sure the array is setup properly
1471
-			if ( !isset($help['title']) || !isset($help['content'] ) ) {
1472
-				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') );
1471
+			if ( ! isset($help['title']) || ! isset($help['content'])) {
1472
+				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'));
1473 1473
 			}
1474 1474
 
1475 1475
 			//we're good so let'd setup the template vars and then assign parsed template content to our content.
@@ -1479,10 +1479,10 @@  discard block
 block discarded – undo
1479 1479
 				'help_popup_content' => $help['content']
1480 1480
 				);
1481 1481
 
1482
-			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1482
+			$content .= EEH_Template::display_template($template_path, $template_args, TRUE);
1483 1483
 		}
1484 1484
 
1485
-		if ( $display )
1485
+		if ($display)
1486 1486
 			echo $content;
1487 1487
 		else
1488 1488
 			return $content;
@@ -1499,18 +1499,18 @@  discard block
 block discarded – undo
1499 1499
 	 */
1500 1500
 	private function _get_help_content() {
1501 1501
 		//what is the method we're looking for?
1502
-		$method_name = '_help_popup_content_' . $this->_req_action;
1502
+		$method_name = '_help_popup_content_'.$this->_req_action;
1503 1503
 
1504 1504
 		//if method doesn't exist let's get out.
1505
-		if ( !method_exists( $this, $method_name ) )
1505
+		if ( ! method_exists($this, $method_name))
1506 1506
 			return array();
1507 1507
 
1508 1508
 		//k we're good to go let's retrieve the help array
1509
-		$help_array = call_user_func( array( $this, $method_name ) );
1509
+		$help_array = call_user_func(array($this, $method_name));
1510 1510
 
1511 1511
 		//make sure we've got an array!
1512
-		if ( !is_array($help_array) ) {
1513
-			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' ) );
1512
+		if ( ! is_array($help_array)) {
1513
+			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'));
1514 1514
 		}
1515 1515
 
1516 1516
 		return $help_array;
@@ -1532,27 +1532,27 @@  discard block
 block discarded – undo
1532 1532
 	 * @param array $dimensions an array of dimensions for the box (array(h,w))
1533 1533
 	 * @return string
1534 1534
 	 */
1535
-	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1535
+	protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) {
1536 1536
 
1537
-		if ( defined('DOING_AJAX') ) return;
1537
+		if (defined('DOING_AJAX')) return;
1538 1538
 
1539 1539
 		//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
1540 1540
 		$help_array = $this->_get_help_content();
1541 1541
 		$help_content = '';
1542 1542
 
1543
-		if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) {
1543
+		if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1544 1544
 			$help_array[$trigger_id] = array(
1545 1545
 				'title' => __('Missing Content', 'event_espresso'),
1546 1546
 				'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')
1547 1547
 				);
1548
-			$help_content = $this->_set_help_popup_content( $help_array, FALSE );
1548
+			$help_content = $this->_set_help_popup_content($help_array, FALSE);
1549 1549
 		}
1550 1550
 
1551 1551
 		//let's setup the trigger
1552
-		$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>';
1553
-		$content = $content . $help_content;
1552
+		$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>';
1553
+		$content = $content.$help_content;
1554 1554
 
1555
-		if ( $display )
1555
+		if ($display)
1556 1556
 			echo $content;
1557 1557
 		else
1558 1558
 			return $content;
@@ -1609,15 +1609,15 @@  discard block
 block discarded – undo
1609 1609
 	public function load_global_scripts_styles() {
1610 1610
 		/** STYLES **/
1611 1611
 		// add debugging styles
1612
-		if ( WP_DEBUG ) {
1613
-			add_action('admin_head', array( $this, 'add_xdebug_style' ));
1612
+		if (WP_DEBUG) {
1613
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1614 1614
 		}
1615 1615
 
1616 1616
 		//register all styles
1617
-		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 );
1618
-		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1617
+		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);
1618
+		wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1619 1619
 		//helpers styles
1620
-		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION );
1620
+		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION);
1621 1621
 		//enqueue global styles
1622 1622
 		wp_enqueue_style('ee-admin-css');
1623 1623
 
@@ -1625,66 +1625,66 @@  discard block
 block discarded – undo
1625 1625
 		/** SCRIPTS **/
1626 1626
 
1627 1627
 		//register all scripts
1628
-		wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1629
-		wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE );
1630
-		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 );
1628
+		wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1629
+		wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE);
1630
+		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);
1631 1631
 
1632
-		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 );
1632
+		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);
1633 1633
 		// register jQuery Validate - see /includes/functions/wp_hooks.php
1634
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1634
+		add_filter('FHEE_load_jquery_validate', '__return_true');
1635 1635
 		add_filter('FHEE_load_joyride', '__return_true');
1636 1636
 
1637 1637
 		//script for sorting tables
1638
-		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);
1638
+		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);
1639 1639
 		//script for parsing uri's
1640
-		wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1640
+		wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1641 1641
 		//and parsing associative serialized form elements
1642
-		wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1642
+		wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1643 1643
 		//helpers scripts
1644
-		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1645
-		wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1646
-		wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE );
1647
-		wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE );
1644
+		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1645
+		wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1646
+		wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE);
1647
+		wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE);
1648 1648
 
1649 1649
 		//google charts
1650
-		wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false );
1650
+		wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false);
1651 1651
 
1652 1652
 		//enqueue global scripts
1653 1653
 
1654 1654
 		//taking care of metaboxes
1655
-		if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) {
1655
+		if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) {
1656 1656
 			wp_enqueue_script('dashboard');
1657 1657
 		}
1658 1658
 
1659 1659
 		//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
1660
-		if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) {
1660
+		if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) {
1661 1661
 			wp_enqueue_script('ee_admin_js');
1662 1662
 			wp_enqueue_style('ee-admin-css');
1663 1663
 		}
1664 1664
 
1665 1665
 
1666 1666
 		//localize script for ajax lazy loading
1667
-		$lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') );
1668
-		wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1667
+		$lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content'));
1668
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1669 1669
 
1670 1670
 
1671 1671
 		/**
1672 1672
 		 * help tour stuff
1673 1673
 		 */
1674
-		if ( !empty( $this->_help_tour ) ) {
1674
+		if ( ! empty($this->_help_tour)) {
1675 1675
 
1676 1676
 			//register the js for kicking things off
1677
-			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE );
1677
+			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE);
1678 1678
 
1679 1679
 			//setup tours for the js tour object
1680
-			foreach ( $this->_help_tour['tours'] as $tour ) {
1680
+			foreach ($this->_help_tour['tours'] as $tour) {
1681 1681
 				$tours[] = array(
1682 1682
 					'id' => $tour->get_slug(),
1683 1683
 					'options' => $tour->get_options()
1684 1684
 					);
1685 1685
 			}
1686 1686
 
1687
-			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) );
1687
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1688 1688
 
1689 1689
 			//admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1690 1690
 		}
@@ -1702,52 +1702,52 @@  discard block
 block discarded – undo
1702 1702
 	public function admin_footer_scripts_eei18n_js_strings() {
1703 1703
 
1704 1704
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1705
-		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' );
1706
-
1707
-		EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' );
1708
-		EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' );
1709
-		EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' );
1710
-		EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' );
1711
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1712
-		EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' );
1713
-		EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' );
1714
-		EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' );
1715
-		EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' );
1716
-		EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' );
1717
-		EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' );
1718
-		EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' );
1719
-		EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' );
1720
-		EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' );
1721
-		EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' );
1722
-		EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' );
1723
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1724
-		EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' );
1725
-		EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' );
1726
-		EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' );
1727
-		EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' );
1728
-		EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' );
1729
-		EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' );
1730
-		EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' );
1731
-
1732
-		EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' );
1733
-		EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' );
1734
-		EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' );
1735
-		EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' );
1736
-		EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' );
1737
-		EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' );
1738
-		EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' );
1739
-		EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' );
1740
-		EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' );
1741
-		EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' );
1742
-		EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' );
1743
-		EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' );
1744
-		EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' );
1745
-		EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' );
1705
+		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');
1706
+
1707
+		EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso');
1708
+		EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso');
1709
+		EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso');
1710
+		EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso');
1711
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1712
+		EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso');
1713
+		EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso');
1714
+		EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso');
1715
+		EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso');
1716
+		EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso');
1717
+		EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso');
1718
+		EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso');
1719
+		EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso');
1720
+		EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso');
1721
+		EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso');
1722
+		EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso');
1723
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1724
+		EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso');
1725
+		EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso');
1726
+		EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso');
1727
+		EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso');
1728
+		EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso');
1729
+		EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso');
1730
+		EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso');
1731
+
1732
+		EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso');
1733
+		EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso');
1734
+		EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso');
1735
+		EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso');
1736
+		EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso');
1737
+		EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso');
1738
+		EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso');
1739
+		EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso');
1740
+		EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso');
1741
+		EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso');
1742
+		EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso');
1743
+		EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso');
1744
+		EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso');
1745
+		EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso');
1746 1746
 
1747 1747
 		//setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance
1748 1748
 		//admin page when in maintenance mode and ee_admin_js is not loaded then.  This works everywhere else because
1749 1749
 		//espresso_core is listed as a dependency of ee_admin_js.
1750
-		wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
1750
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
1751 1751
 
1752 1752
 	}
1753 1753
 
@@ -1781,23 +1781,23 @@  discard block
 block discarded – undo
1781 1781
 	protected function _set_list_table() {
1782 1782
 
1783 1783
 		//first is this a list_table view?
1784
-		if ( !isset($this->_route_config['list_table']) )
1784
+		if ( ! isset($this->_route_config['list_table']))
1785 1785
 			return; //not a list_table view so get out.
1786 1786
 
1787 1787
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1788 1788
 
1789
-		if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) {
1789
+		if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) {
1790 1790
 			//user error msg
1791
-			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' );
1791
+			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso');
1792 1792
 			//developer error msg
1793
-			$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 );
1794
-			throw new EE_Error( $error_msg );
1793
+			$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);
1794
+			throw new EE_Error($error_msg);
1795 1795
 		}
1796 1796
 
1797 1797
 		//let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1798
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views );
1799
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views );
1800
-		$this->_views = apply_filters( 'FHEE_list_table_views', $this->_views );
1798
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views);
1799
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1800
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1801 1801
 
1802 1802
 		$this->_set_list_table_view();
1803 1803
 		$this->_set_list_table_object();
@@ -1819,14 +1819,14 @@  discard block
 block discarded – undo
1819 1819
 	*		@return array
1820 1820
 	*/
1821 1821
 	protected function _set_list_table_view() {
1822
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1822
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1823 1823
 
1824 1824
 
1825 1825
 		// looking at active items or dumpster diving ?
1826
-		if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) {
1827
-			$this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all';
1826
+		if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
1827
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1828 1828
 		} else {
1829
-			$this->_view = sanitize_key( $this->_req_data['status'] );
1829
+			$this->_view = sanitize_key($this->_req_data['status']);
1830 1830
 		}
1831 1831
 	}
1832 1832
 
@@ -1839,8 +1839,8 @@  discard block
 block discarded – undo
1839 1839
 	 * @throws \EE_Error
1840 1840
 	 */
1841 1841
 	protected function _set_list_table_object() {
1842
-		if ( isset( $this->_route_config['list_table'] ) ) {
1843
-			if ( ! class_exists( $this->_route_config['list_table'] ) ) {
1842
+		if (isset($this->_route_config['list_table'])) {
1843
+			if ( ! class_exists($this->_route_config['list_table'])) {
1844 1844
 				throw new EE_Error(
1845 1845
 					sprintf(
1846 1846
 						__(
@@ -1848,12 +1848,12 @@  discard block
 block discarded – undo
1848 1848
 							'event_espresso'
1849 1849
 						),
1850 1850
 						$this->_route_config['list_table'],
1851
-						get_class( $this )
1851
+						get_class($this)
1852 1852
 					)
1853 1853
 				);
1854 1854
 			}
1855 1855
 			$list_table = $this->_route_config['list_table'];
1856
-			$this->_list_table_object = new $list_table( $this );
1856
+			$this->_list_table_object = new $list_table($this);
1857 1857
 		}
1858 1858
 	}
1859 1859
 
@@ -1870,27 +1870,27 @@  discard block
 block discarded – undo
1870 1870
 	 *
1871 1871
 	 * @return array
1872 1872
 	 */
1873
-	public function get_list_table_view_RLs( $extra_query_args = array() ) {
1873
+	public function get_list_table_view_RLs($extra_query_args = array()) {
1874 1874
 
1875
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1875
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1876 1876
 
1877
-		if ( empty( $this->_views )) {
1877
+		if (empty($this->_views)) {
1878 1878
 			$this->_views = array();
1879 1879
 		}
1880 1880
 
1881 1881
 		// cycle thru views
1882
-		foreach ( $this->_views as $key => $view ) {
1882
+		foreach ($this->_views as $key => $view) {
1883 1883
 			$query_args = array();
1884 1884
 			// check for current view
1885
-			$this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1885
+			$this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1886 1886
 			$query_args['action'] = $this->_req_action;
1887
-			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
1887
+			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
1888 1888
 			$query_args['status'] = $view['slug'];
1889 1889
 			//merge any other arguments sent in.
1890
-			if ( isset( $extra_query_args[$view['slug']] ) ) {
1891
-				$query_args = array_merge( $query_args, $extra_query_args[$view['slug']] );
1890
+			if (isset($extra_query_args[$view['slug']])) {
1891
+				$query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
1892 1892
 			}
1893
-			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1893
+			$this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1894 1894
 		}
1895 1895
 
1896 1896
 		return $this->_views;
@@ -1907,15 +1907,15 @@  discard block
 block discarded – undo
1907 1907
 	 * @param int $max_entries total number of rows in the table
1908 1908
 	 * @return string
1909 1909
 	*/
1910
-	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1910
+	protected function _entries_per_page_dropdown($max_entries = FALSE) {
1911 1911
 
1912
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1913
-		$values = array( 10, 25, 50, 100 );
1914
-		$per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10;
1912
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1913
+		$values = array(10, 25, 50, 100);
1914
+		$per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
1915 1915
 
1916
-		if ( $max_entries ) {
1916
+		if ($max_entries) {
1917 1917
 			$values[] = $max_entries;
1918
-			sort( $values );
1918
+			sort($values);
1919 1919
 		}
1920 1920
 
1921 1921
 		$entries_per_page_dropdown = '
@@ -1924,15 +1924,15 @@  discard block
 block discarded – undo
1924 1924
 					Show
1925 1925
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
1926 1926
 
1927
-		foreach ( $values as $value ) {
1928
-			if ( $value < $max_entries ) {
1929
-				$selected = $value == $per_page ?  ' selected="' . $per_page . '"' : '';
1927
+		foreach ($values as $value) {
1928
+			if ($value < $max_entries) {
1929
+				$selected = $value == $per_page ? ' selected="'.$per_page.'"' : '';
1930 1930
 				$entries_per_page_dropdown .= '
1931 1931
 						<option value="'.$value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
1932 1932
 			}
1933 1933
 		}
1934 1934
 
1935
-		$selected = $max_entries == $per_page ?  ' selected="' . $per_page . '"' : '';
1935
+		$selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : '';
1936 1936
 		$entries_per_page_dropdown .= '
1937 1937
 						<option value="'.$max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
1938 1938
 
@@ -1955,8 +1955,8 @@  discard block
 block discarded – undo
1955 1955
 	*		@return 		void
1956 1956
 	*/
1957 1957
 	public function _set_search_attributes() {
1958
-		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1959
-		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
1958
+		$this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label);
1959
+		$this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
1960 1960
 	}
1961 1961
 
1962 1962
 	/*** END LIST TABLE METHODS **/
@@ -1975,10 +1975,10 @@  discard block
 block discarded – undo
1975 1975
 	 * @return void
1976 1976
 	*/
1977 1977
 	private function _add_registered_meta_boxes() {
1978
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1978
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1979 1979
 
1980 1980
 		//we only add meta boxes if the page_route calls for it
1981
-		if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] )
1981
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
1982 1982
 			 && is_array(
1983 1983
 			 $this->_route_config['metaboxes']
1984 1984
 			 )
@@ -1986,27 +1986,27 @@  discard block
 block discarded – undo
1986 1986
 			// this simply loops through the callbacks provided
1987 1987
 			// and checks if there is a corresponding callback registered by the child
1988 1988
 			// if there is then we go ahead and process the metabox loader.
1989
-			foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) {
1989
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
1990 1990
 				// first check for Closures
1991
-				if ( is_callable( $metabox_callback ) ) {
1991
+				if (is_callable($metabox_callback)) {
1992 1992
 					$result = $metabox_callback();
1993
-				} else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) {
1994
-					$result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) );
1993
+				} else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
1994
+					$result = call_user_func(array($metabox_callback[0], $metabox_callback[1]));
1995 1995
 				} else {
1996
-					$result = call_user_func( array( $this, &$metabox_callback ) );
1996
+					$result = call_user_func(array($this, &$metabox_callback));
1997 1997
 				}
1998
-				if ( $result === FALSE ) {
1998
+				if ($result === FALSE) {
1999 1999
 					// user error msg
2000
-					$error_msg =  __( 'An error occurred. The  requested metabox could not be found.', 'event_espresso' );
2000
+					$error_msg = __('An error occurred. The  requested metabox could not be found.', 'event_espresso');
2001 2001
 					// developer error msg
2002
-					$error_msg .= '||' . sprintf(
2002
+					$error_msg .= '||'.sprintf(
2003 2003
 						__(
2004 2004
 							'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.',
2005 2005
 							'event_espresso'
2006 2006
 						),
2007 2007
 						$metabox_callback
2008 2008
 					);
2009
-					throw new EE_Error( $error_msg );
2009
+					throw new EE_Error($error_msg);
2010 2010
 				}
2011 2011
 			}
2012 2012
 		}
@@ -2023,17 +2023,17 @@  discard block
 block discarded – undo
2023 2023
 	 * @return void
2024 2024
 	 */
2025 2025
 	private function _add_screen_columns() {
2026
-		if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) {
2026
+		if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) {
2027 2027
 
2028
-			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
2028
+			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1]));
2029 2029
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2030 2030
 			$screen_id = $this->_current_screen->id;
2031 2031
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
2032
-			$total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2033
-			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2032
+			$total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2033
+			$this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2034 2034
 			$this->_template_args['current_page'] = $this->_wp_page_slug;
2035 2035
 			$this->_template_args['screen'] = $this->_current_screen;
2036
-			$this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php';
2036
+			$this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php';
2037 2037
 
2038 2038
 			//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.
2039 2039
 			$this->_route_config['has_metaboxes'] = TRUE;
@@ -2050,11 +2050,11 @@  discard block
 block discarded – undo
2050 2050
 	 */
2051 2051
 
2052 2052
 	private function _espresso_news_post_box() {
2053
-		$news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) );
2054
-		add_meta_box( 'espresso_news_post_box', $news_box_title, array(
2053
+		$news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso'));
2054
+		add_meta_box('espresso_news_post_box', $news_box_title, array(
2055 2055
 			$this,
2056 2056
 			'espresso_news_post_box'
2057
-		), $this->_wp_page_slug, 'side' );
2057
+		), $this->_wp_page_slug, 'side');
2058 2058
 	}
2059 2059
 
2060 2060
 
@@ -2062,14 +2062,14 @@  discard block
 block discarded – undo
2062 2062
 	 * Code for setting up espresso ratings request metabox.
2063 2063
 	 */
2064 2064
 	protected function _espresso_ratings_request() {
2065
-		if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) {
2065
+		if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2066 2066
 			return '';
2067 2067
 		}
2068
-		$ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') );
2069
-		add_meta_box( 'espresso_ratings_request', $ratings_box_title, array(
2068
+		$ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso'));
2069
+		add_meta_box('espresso_ratings_request', $ratings_box_title, array(
2070 2070
 			$this,
2071 2071
 			'espresso_ratings_request'
2072
-		), $this->_wp_page_slug, 'side' );
2072
+		), $this->_wp_page_slug, 'side');
2073 2073
 	}
2074 2074
 
2075 2075
 
@@ -2077,34 +2077,34 @@  discard block
 block discarded – undo
2077 2077
 	 * Code for setting up espresso ratings request metabox content.
2078 2078
 	 */
2079 2079
 	public function espresso_ratings_request() {
2080
-		$template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php';
2081
-		EEH_Template::display_template( $template_path, array() );
2080
+		$template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php';
2081
+		EEH_Template::display_template($template_path, array());
2082 2082
 	}
2083 2083
 
2084 2084
 
2085 2085
 
2086 2086
 
2087
-	public static function cached_rss_display( $rss_id, $url ) {
2088
-		$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
2089
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
2090
-		$pre = '<div class="espresso-rss-display">' . "\n\t";
2091
-		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2092
-		$post = '</div>' . "\n";
2087
+	public static function cached_rss_display($rss_id, $url) {
2088
+		$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
2089
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
2090
+		$pre = '<div class="espresso-rss-display">'."\n\t";
2091
+		$pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2092
+		$post = '</div>'."\n";
2093 2093
 
2094
-		$cache_key = 'ee_rss_' . md5( $rss_id );
2095
-		if ( FALSE != ( $output = get_transient( $cache_key ) ) ) {
2096
-			echo $pre . $output . $post;
2094
+		$cache_key = 'ee_rss_'.md5($rss_id);
2095
+		if (FALSE != ($output = get_transient($cache_key))) {
2096
+			echo $pre.$output.$post;
2097 2097
 			return TRUE;
2098 2098
 		}
2099 2099
 
2100
-		if ( ! $doing_ajax ) {
2101
-			echo $pre . $loading . $post;
2100
+		if ( ! $doing_ajax) {
2101
+			echo $pre.$loading.$post;
2102 2102
 			return FALSE;
2103 2103
 		}
2104 2104
 
2105 2105
 		ob_start();
2106
-		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) );
2107
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
2106
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2107
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2108 2108
 		return TRUE;
2109 2109
 
2110 2110
 	}
@@ -2116,13 +2116,13 @@  discard block
 block discarded – undo
2116 2116
 	  	<div id="espresso_news_post_box_content" class="infolinks">
2117 2117
 	  		<?php
2118 2118
 	  		// Get RSS Feed(s)
2119
-	  		$feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' );
2119
+	  		$feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/');
2120 2120
 	  		$url = urlencode($feed_url);
2121
-	  		self::cached_rss_display( 'espresso_news_post_box_content', $url );
2121
+	  		self::cached_rss_display('espresso_news_post_box_content', $url);
2122 2122
 
2123 2123
 	  		?>
2124 2124
 	  	</div>
2125
-	  	<?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2125
+	  	<?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2126 2126
 	  </div>
2127 2127
 		<?php
2128 2128
 	}
@@ -2143,32 +2143,32 @@  discard block
 block discarded – undo
2143 2143
 
2144 2144
 	protected function _espresso_sponsors_post_box() {
2145 2145
 
2146
-		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2147
-		if ( $show_sponsors )
2148
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2146
+		$show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE);
2147
+		if ($show_sponsors)
2148
+			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2149 2149
 	}
2150 2150
 
2151 2151
 
2152 2152
 	public function espresso_sponsors_post_box() {
2153
-		$templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php';
2154
-		EEH_Template::display_template( $templatepath );
2153
+		$templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php';
2154
+		EEH_Template::display_template($templatepath);
2155 2155
 	}
2156 2156
 
2157 2157
 
2158 2158
 
2159 2159
 	private function _publish_post_box() {
2160
-		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2160
+		$meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2161 2161
 
2162 2162
 		//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)
2163
-		if ( !empty( $this->_labels['publishbox'] ) ) {
2164
-			$box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2163
+		if ( ! empty($this->_labels['publishbox'])) {
2164
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2165 2165
 		} else {
2166 2166
 			$box_label = __('Publish', 'event_espresso');
2167 2167
 		}
2168 2168
 
2169
-		$box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this );
2169
+		$box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this);
2170 2170
 
2171
-		add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' );
2171
+		add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high');
2172 2172
 
2173 2173
 	}
2174 2174
 
@@ -2176,9 +2176,9 @@  discard block
 block discarded – undo
2176 2176
 
2177 2177
 	public function editor_overview() {
2178 2178
 		//if we have extra content set let's add it in if not make sure its empty
2179
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2180
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php';
2181
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2179
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2180
+		$template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php';
2181
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2182 2182
 	}
2183 2183
 
2184 2184
 
@@ -2194,8 +2194,8 @@  discard block
 block discarded – undo
2194 2194
 	 * @see $this->_set_publish_post_box_vars for param details
2195 2195
 	 * @since 4.6.0
2196 2196
 	 */
2197
-	public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) {
2198
-		$this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns );
2197
+	public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) {
2198
+		$this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns);
2199 2199
 	}
2200 2200
 
2201 2201
 
@@ -2214,24 +2214,24 @@  discard block
 block discarded – undo
2214 2214
 	 * @param	string	$post_save_redirect_URL	custom URL to redirect to after Save & Close has been completed
2215 2215
 	 * @param	boolean	$both_btns	whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button
2216 2216
 	 */
2217
-	protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) {
2217
+	protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) {
2218 2218
 
2219 2219
 		// if Save & Close, use a custom redirect URL or default to the main page?
2220
-		$save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url;
2220
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url;
2221 2221
 		// create the Save & Close and Save buttons
2222
-		$this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL );
2222
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2223 2223
 		//if we have extra content set let's add it in if not make sure its empty
2224
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2224
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2225 2225
 
2226 2226
 
2227
-		if ( $delete && ! empty( $id )  ) {
2227
+		if ($delete && ! empty($id)) {
2228 2228
 			$delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent.
2229
-			$delete_link_args = array( $name => $id );
2230
-			$delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion');
2229
+			$delete_link_args = array($name => $id);
2230
+			$delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion');
2231 2231
 		}
2232 2232
 
2233
-		$this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : '';
2234
-		if ( ! empty( $name ) && ! empty( $id ) ) {
2233
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2234
+		if ( ! empty($name) && ! empty($id)) {
2235 2235
 			$hidden_field_arr[$name] = array(
2236 2236
 				'type' => 'hidden',
2237 2237
 				'value' => $id
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
 			$hf = '';
2242 2242
 		}
2243 2243
 		// add hidden field
2244
-		$this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf;
2244
+		$this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf;
2245 2245
 
2246 2246
 	}
2247 2247
 
@@ -2258,8 +2258,8 @@  discard block
 block discarded – undo
2258 2258
 		<noscript>
2259 2259
 			<div id="no-js-message" class="error">
2260 2260
 				<p style="font-size:1.3em;">
2261
-					<span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span>
2262
-					<?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' ); ?>
2261
+					<span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span>
2262
+					<?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'); ?>
2263 2263
 				</p>
2264 2264
 			</div>
2265 2265
 		</noscript>
@@ -2279,7 +2279,7 @@  discard block
 block discarded – undo
2279 2279
 	*		@return 		string
2280 2280
 	*/
2281 2281
 	private function _display_espresso_notices() {
2282
-		$notices = $this->_get_transient( TRUE );
2282
+		$notices = $this->_get_transient(TRUE);
2283 2283
 		echo stripslashes($notices);
2284 2284
 	}
2285 2285
 
@@ -2331,11 +2331,11 @@  discard block
 block discarded – undo
2331 2331
 	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2332 2332
 	 * @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.
2333 2333
 	 */
2334
-	public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) {
2335
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback );
2334
+	public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) {
2335
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2336 2336
 
2337 2337
 		//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.
2338
-		if ( empty( $callback_args ) && $create_func ) {
2338
+		if (empty($callback_args) && $create_func) {
2339 2339
 			$callback_args = array(
2340 2340
 				'template_path' => $this->_template_path,
2341 2341
 				'template_args' => $this->_template_args,
@@ -2345,7 +2345,7 @@  discard block
 block discarded – undo
2345 2345
 		//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)
2346 2346
 		$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;
2347 2347
 
2348
-		add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args );
2348
+		add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args);
2349 2349
 	}
2350 2350
 
2351 2351
 
@@ -2358,7 +2358,7 @@  discard block
 block discarded – undo
2358 2358
 	 */
2359 2359
 	public function display_admin_page_with_metabox_columns() {
2360 2360
 		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2361
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE);
2361
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE);
2362 2362
 
2363 2363
 		//the final wrapper
2364 2364
 		$this->admin_page_wrapper();
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
 	 * @return void
2402 2402
 	 */
2403 2403
 	public function display_about_admin_page() {
2404
-		$this->_display_admin_page( FALSE, TRUE );
2404
+		$this->_display_admin_page(FALSE, TRUE);
2405 2405
 	}
2406 2406
 
2407 2407
 
@@ -2417,26 +2417,26 @@  discard block
 block discarded – undo
2417 2417
 	 * @return html           admin_page
2418 2418
 	 */
2419 2419
 	private function _display_admin_page($sidebar = false, $about = FALSE) {
2420
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2420
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2421 2421
 
2422 2422
 		//custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2423
-		do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' );
2423
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2424 2424
 
2425 2425
 		// set current wp page slug - looks like: event-espresso_page_event_categories
2426 2426
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2427 2427
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2428 2428
 
2429
-		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2429
+		$template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2430 2430
 
2431
-		if ( defined('DOING_AJAX' ) )
2432
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2431
+		if (defined('DOING_AJAX'))
2432
+			$template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2433 2433
 
2434
-		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2434
+		$template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2435 2435
 
2436
-		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2436
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '';
2437 2437
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
2438 2438
 		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '';
2439
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2439
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2440 2440
 
2441 2441
 
2442 2442
 		// the final template wrapper
@@ -2456,7 +2456,7 @@  discard block
 block discarded – undo
2456 2456
 	 * @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.
2457 2457
 	 * @return void
2458 2458
 	 */
2459
-	public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) {
2459
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) {
2460 2460
 		//let's generate a default preview action button if there isn't one already present.
2461 2461
 		$this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso');
2462 2462
 		$buy_now_url = add_query_arg(
@@ -2469,10 +2469,10 @@  discard block
 block discarded – undo
2469 2469
 			),
2470 2470
 		'http://eventespresso.com/pricing/'
2471 2471
 		);
2472
-		$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'];
2473
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php';
2474
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2475
-		$this->_display_admin_page( $display_sidebar );
2472
+		$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'];
2473
+		$template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php';
2474
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2475
+		$this->_display_admin_page($display_sidebar);
2476 2476
 	}
2477 2477
 
2478 2478
 
@@ -2506,49 +2506,49 @@  discard block
 block discarded – undo
2506 2506
 	 * @param boolean $sidebar whether to display with sidebar or not.
2507 2507
 	 * @return html
2508 2508
 	 */
2509
-	private function _display_admin_list_table_page( $sidebar = false ) {
2509
+	private function _display_admin_list_table_page($sidebar = false) {
2510 2510
 		//setup search attributes
2511 2511
 		$this->_set_search_attributes();
2512 2512
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2513
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2513
+		$template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2514 2514
 
2515
-		$this->_template_args['table_url'] = defined( 'DOING_AJAX')
2516
-			? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url )
2517
-			: add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url);
2515
+		$this->_template_args['table_url'] = defined('DOING_AJAX')
2516
+			? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url)
2517
+			: add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2518 2518
 		$this->_template_args['list_table'] = $this->_list_table_object;
2519 2519
 		$this->_template_args['current_route'] = $this->_req_action;
2520
-		$this->_template_args['list_table_class'] = get_class( $this->_list_table_object );
2520
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2521 2521
 
2522 2522
 		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2523
-		if( ! empty( $ajax_sorting_callback )) {
2523
+		if ( ! empty($ajax_sorting_callback)) {
2524 2524
 			$sortable_list_table_form_fields = wp_nonce_field(
2525
-				$ajax_sorting_callback . '_nonce',
2526
-				$ajax_sorting_callback . '_nonce',
2525
+				$ajax_sorting_callback.'_nonce',
2526
+				$ajax_sorting_callback.'_nonce',
2527 2527
 				FALSE,
2528 2528
 				FALSE
2529 2529
 			);
2530 2530
 //			$reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce';
2531 2531
 //			$sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE );
2532
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />';
2533
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />';
2532
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />';
2533
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />';
2534 2534
 		} else {
2535 2535
 			$sortable_list_table_form_fields = '';
2536 2536
 		}
2537 2537
 
2538 2538
 		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2539
-		$hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : '';
2540
-		$nonce_ref = $this->_req_action . '_nonce';
2541
-		$hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">';
2539
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : '';
2540
+		$nonce_ref = $this->_req_action.'_nonce';
2541
+		$hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
2542 2542
 		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2543 2543
 
2544 2544
 		//display message about search results?
2545 2545
 		$this->_template_args['before_list_table'] .= apply_filters(
2546 2546
 			'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
2547
-			! empty( $this->_req_data['s'] )
2548
-				? '<p class="ee-search-results">' . sprintf(
2549
-					__( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ),
2550
-					trim( $this->_req_data['s'], '%' )
2551
-					) . '</p>'
2547
+			! empty($this->_req_data['s'])
2548
+				? '<p class="ee-search-results">'.sprintf(
2549
+					__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'),
2550
+					trim($this->_req_data['s'], '%')
2551
+					).'</p>'
2552 2552
 				: '',
2553 2553
 			$this->page_slug,
2554 2554
 			$this->_req_data,
@@ -2560,7 +2560,7 @@  discard block
 block discarded – undo
2560 2560
 			true
2561 2561
 		);
2562 2562
 		// the final template wrapper
2563
-		if ( $sidebar )
2563
+		if ($sidebar)
2564 2564
 			$this->display_admin_page_with_sidebar();
2565 2565
 		else
2566 2566
 			$this->display_admin_page_with_no_sidebar();
@@ -2583,9 +2583,9 @@  discard block
 block discarded – undo
2583 2583
 	 * @param  array $items  see above for format of array
2584 2584
 	 * @return string        html string of legend
2585 2585
 	 */
2586
-	protected function _display_legend( $items ) {
2587
-		$this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this );
2588
-		$legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php';
2586
+	protected function _display_legend($items) {
2587
+		$this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this);
2588
+		$legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php';
2589 2589
 		return EEH_Template::display_template($legend_template, $this->_template_args, TRUE);
2590 2590
 	}
2591 2591
 
@@ -2610,33 +2610,33 @@  discard block
 block discarded – undo
2610 2610
 	 *
2611 2611
 	 * @return string json object
2612 2612
 	 */
2613
-	protected function _return_json( $sticky_notices = false ) {
2613
+	protected function _return_json($sticky_notices = false) {
2614 2614
 
2615 2615
 		//make sure any EE_Error notices have been handled.
2616
-		$this->_process_notices( array(), true, $sticky_notices );
2616
+		$this->_process_notices(array(), true, $sticky_notices);
2617 2617
 
2618 2618
 
2619
-		$data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array();
2619
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
2620 2620
 		unset($this->_template_args['data']);
2621 2621
 		$json = array(
2622
-			'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false,
2623
-			'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false,
2624
-			'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false,
2625
-			'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false,
2622
+			'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
2623
+			'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
2624
+			'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
2625
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
2626 2626
 			'notices' => EE_Error::get_notices(),
2627
-			'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '',
2628
-			'data' => array_merge( $data, array('template_args' => $this->_template_args ) ),
2627
+			'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '',
2628
+			'data' => array_merge($data, array('template_args' => $this->_template_args)),
2629 2629
 			'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2630 2630
 			);
2631 2631
 
2632 2632
 
2633 2633
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2634
-		if ( NULL === error_get_last() || ! headers_sent() )
2634
+		if (NULL === error_get_last() || ! headers_sent())
2635 2635
 			header('Content-Type: application/json; charset=UTF-8');
2636
-                if( function_exists( 'wp_json_encode' ) ) {
2637
-                    echo wp_json_encode( $json );
2636
+                if (function_exists('wp_json_encode')) {
2637
+                    echo wp_json_encode($json);
2638 2638
                 } else {
2639
-                    echo json_encode( $json );
2639
+                    echo json_encode($json);
2640 2640
                 }
2641 2641
 		exit();
2642 2642
 	}
@@ -2648,11 +2648,11 @@  discard block
 block discarded – undo
2648 2648
 	 * @return json_obj|EE_Error
2649 2649
 	 */
2650 2650
 	public function return_json() {
2651
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2651
+		if (defined('DOING_AJAX') && DOING_AJAX)
2652 2652
 			$this->_return_json();
2653 2653
 
2654 2654
 		else {
2655
-			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2655
+			throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__));
2656 2656
 		}
2657 2657
 	}
2658 2658
 
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
 	 * @access public
2668 2668
 	 * @return void
2669 2669
 	 */
2670
-	public function set_hook_object( EE_Admin_Hooks $hook_obj ) {
2670
+	public function set_hook_object(EE_Admin_Hooks $hook_obj) {
2671 2671
 		$this->_hook_obj = $hook_obj;
2672 2672
 	}
2673 2673
 
@@ -2683,33 +2683,33 @@  discard block
 block discarded – undo
2683 2683
 	*/
2684 2684
 	public function admin_page_wrapper($about = FALSE) {
2685 2685
 
2686
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2686
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2687 2687
 
2688 2688
 		$this->_nav_tabs = $this->_get_main_nav_tabs();
2689 2689
 
2690 2690
 		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
2691 2691
 		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
2692 2692
 
2693
-		$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'] : '');
2694
-		$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'] : '');
2693
+		$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'] : '');
2694
+		$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'] : '');
2695 2695
 
2696 2696
 		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
2697 2697
 
2698 2698
 
2699 2699
 
2700 2700
 		// load settings page wrapper template
2701
-		$template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php';
2701
+		$template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php';
2702 2702
 
2703 2703
 		//about page?
2704
-		$template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path;
2704
+		$template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path;
2705 2705
 
2706 2706
 
2707
-		if ( defined( 'DOING_AJAX' ) ) {
2708
-			$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2707
+		if (defined('DOING_AJAX')) {
2708
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2709 2709
 
2710 2710
 			$this->_return_json();
2711 2711
 		} else {
2712
-			EEH_Template::display_template( $template_path, $this->_template_args );
2712
+			EEH_Template::display_template($template_path, $this->_template_args);
2713 2713
 		}
2714 2714
 
2715 2715
 	}
@@ -2737,7 +2737,7 @@  discard block
 block discarded – undo
2737 2737
 	*		@access public
2738 2738
 	*		@return void
2739 2739
 	*/
2740
-	private function _sort_nav_tabs( $a, $b ) {
2740
+	private function _sort_nav_tabs($a, $b) {
2741 2741
 		if ($a['order'] == $b['order']) {
2742 2742
 	        return 0;
2743 2743
 	    }
@@ -2758,7 +2758,7 @@  discard block
 block discarded – undo
2758 2758
 	 * 	@uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
2759 2759
 	 * 	@uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
2760 2760
 	 */
2761
-	protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) {
2761
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) {
2762 2762
 		$content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars);
2763 2763
 		return $content;
2764 2764
 	}
@@ -2780,25 +2780,25 @@  discard block
 block discarded – undo
2780 2780
 	 * @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.
2781 2781
 	 * @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).
2782 2782
 	 */
2783
-	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) {
2783
+	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) {
2784 2784
 		//make sure $text and $actions are in an array
2785 2785
 		$text = (array) $text;
2786 2786
 		$actions = (array) $actions;
2787 2787
 		$referrer_url = empty($referrer) ? '' : $referrer;
2788
-		$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 .'" />';
2788
+		$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.'" />';
2789 2789
 
2790
-		$button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') );
2791
-		$default_names = array( 'save', 'save_and_close' );
2790
+		$button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso'));
2791
+		$default_names = array('save', 'save_and_close');
2792 2792
 
2793 2793
 		//add in a hidden index for the current page (so save and close redirects properly)
2794 2794
 		$this->_template_args['save_buttons'] = $referrer_url;
2795 2795
 
2796
-		foreach ( $button_text as $key => $button ) {
2796
+		foreach ($button_text as $key => $button) {
2797 2797
 			$ref = $default_names[$key];
2798
-			$id = $this->_current_view . '_' . $ref;
2799
-			$name = !empty($actions) ? $actions[$key] : $ref;
2800
-			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2801
-			if ( !$both ) break;
2798
+			$id = $this->_current_view.'_'.$ref;
2799
+			$name = ! empty($actions) ? $actions[$key] : $ref;
2800
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />';
2801
+			if ( ! $both) break;
2802 2802
 		}
2803 2803
 
2804 2804
 	}
@@ -2811,8 +2811,8 @@  discard block
 block discarded – undo
2811 2811
 	 * @since 4.6.0
2812 2812
 	 *
2813 2813
 	 */
2814
-	public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2815
-		$this->_set_add_edit_form_tags( $route, $additional_hidden_fields );
2814
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2815
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
2816 2816
 	}
2817 2817
 
2818 2818
 
@@ -2825,30 +2825,30 @@  discard block
 block discarded – undo
2825 2825
 	 * @param array $additional_hidden_fields any additional hidden fields required in the form header
2826 2826
 	 * @return void
2827 2827
 	 */
2828
-	protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2828
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2829 2829
 
2830
-		if ( empty( $route )) {
2830
+		if (empty($route)) {
2831 2831
 			$user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso');
2832
-			$dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ );
2833
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
2832
+			$dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__);
2833
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
2834 2834
 		}
2835 2835
 		// open form
2836
-		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >';
2836
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >';
2837 2837
 		// add nonce
2838
-		$nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE );
2838
+		$nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE);
2839 2839
 //		$nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE );
2840
-		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
2840
+		$this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
2841 2841
 		// add REQUIRED form action
2842 2842
 		$hidden_fields = array(
2843
-				'action' => array( 'type' => 'hidden', 'value' => $route ),
2843
+				'action' => array('type' => 'hidden', 'value' => $route),
2844 2844
 			);
2845 2845
 		// merge arrays
2846
-		$hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields;
2846
+		$hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields;
2847 2847
 		// generate form fields
2848
-		$form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' );
2848
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
2849 2849
 		// add fields to form
2850
-		foreach ( $form_fields as $field_name => $form_field ) {
2851
-			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
2850
+		foreach ($form_fields as $field_name => $form_field) {
2851
+			$this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
2852 2852
 		}
2853 2853
 
2854 2854
 		// close form
@@ -2865,8 +2865,8 @@  discard block
 block discarded – undo
2865 2865
 	 * @see EE_Admin_Page::_redirect_after_action() for params.
2866 2866
 	 * @since 4.5.0
2867 2867
 	 */
2868
-	public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2869
-		$this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite );
2868
+	public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2869
+		$this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite);
2870 2870
 	}
2871 2871
 
2872 2872
 
@@ -2882,32 +2882,32 @@  discard block
 block discarded – undo
2882 2882
 	 *	@access protected
2883 2883
 	 *	@return void
2884 2884
 	 */
2885
-	protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2885
+	protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2886 2886
 
2887
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2887
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2888 2888
 
2889 2889
 		//class name for actions/filters.
2890 2890
 		$classname = get_class($this);
2891 2891
 
2892 2892
 		//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
2893
-		$redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url;
2894
-		$notices = EE_Error::get_notices( FALSE );
2893
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
2894
+		$notices = EE_Error::get_notices(FALSE);
2895 2895
 
2896 2896
 		// overwrite default success messages //BUT ONLY if overwrite not overridden
2897
-		if ( ! $override_overwrite || ! empty( $notices['errors'] )) {
2897
+		if ( ! $override_overwrite || ! empty($notices['errors'])) {
2898 2898
 			EE_Error::overwrite_success();
2899 2899
 		}
2900 2900
 		// how many records affected ? more than one record ? or just one ?
2901
-		if ( $success > 1 && empty( $notices['errors'] )) {
2901
+		if ($success > 1 && empty($notices['errors'])) {
2902 2902
 			// set plural msg
2903
-			EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__);
2904
-		} else if ( $success == 1 && empty( $notices['errors'] )) {
2903
+			EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2904
+		} else if ($success == 1 && empty($notices['errors'])) {
2905 2905
 			// set singular msg
2906
-			EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ );
2906
+			EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2907 2907
 		}
2908 2908
 
2909 2909
 		// check that $query_args isn't something crazy
2910
-		if ( ! is_array( $query_args )) {
2910
+		if ( ! is_array($query_args)) {
2911 2911
 			$query_args = array();
2912 2912
 		}
2913 2913
 
@@ -2920,36 +2920,36 @@  discard block
 block discarded – undo
2920 2920
 		 * @param array $query_args   The original query_args array coming into the
2921 2921
 		 *                          		method.
2922 2922
 		 */
2923
-		do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args );
2923
+		do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args);
2924 2924
 
2925 2925
 		//calculate where we're going (if we have a "save and close" button pushed)
2926
-		if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) {
2926
+		if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) {
2927 2927
 			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
2928
-			$parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] );
2928
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
2929 2929
 			// regenerate query args array from refferer URL
2930
-			parse_str( $parsed_url['query'], $query_args );
2930
+			parse_str($parsed_url['query'], $query_args);
2931 2931
 			// correct page and action will be in the query args now
2932
-			$redirect_url = admin_url( 'admin.php' );
2932
+			$redirect_url = admin_url('admin.php');
2933 2933
 		}
2934 2934
 
2935 2935
 		//merge any default query_args set in _default_route_query_args property
2936
-		if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) {
2936
+		if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
2937 2937
 			$args_to_merge = array();
2938
-			foreach ( $this->_default_route_query_args as $query_param => $query_value ) {
2938
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
2939 2939
 				//is there a wp_referer array in our _default_route_query_args property?
2940
-				if ( $query_param == 'wp_referer'  ) {
2940
+				if ($query_param == 'wp_referer') {
2941 2941
 					$query_value = (array) $query_value;
2942
-					foreach ( $query_value as $reference => $value ) {
2943
-						if ( strpos( $reference, 'nonce' ) !== false ) {
2942
+					foreach ($query_value as $reference => $value) {
2943
+						if (strpos($reference, 'nonce') !== false) {
2944 2944
 							continue;
2945 2945
 						}
2946 2946
 
2947 2947
 						//finally we will override any arguments in the referer with
2948 2948
 						//what might be set on the _default_route_query_args array.
2949
-						if ( isset( $this->_default_route_query_args[$reference] ) ) {
2950
-							$args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] );
2949
+						if (isset($this->_default_route_query_args[$reference])) {
2950
+							$args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
2951 2951
 						} else {
2952
-							$args_to_merge[$reference] = urlencode( $value );
2952
+							$args_to_merge[$reference] = urlencode($value);
2953 2953
 						}
2954 2954
 					}
2955 2955
 					continue;
@@ -2960,7 +2960,7 @@  discard block
 block discarded – undo
2960 2960
 
2961 2961
 			//now let's merge these arguments but override with what was specifically sent in to the
2962 2962
 			//redirect.
2963
-			$query_args = array_merge( $args_to_merge, $query_args );
2963
+			$query_args = array_merge($args_to_merge, $query_args);
2964 2964
 		}
2965 2965
 
2966 2966
 		$this->_process_notices($query_args);
@@ -2969,19 +2969,19 @@  discard block
 block discarded – undo
2969 2969
 		// generate redirect url
2970 2970
 
2971 2971
 		// if redirecting to anything other than the main page, add a nonce
2972
-		if ( isset( $query_args['action'] )) {
2972
+		if (isset($query_args['action'])) {
2973 2973
 			// manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars
2974
-			$query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
2974
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
2975 2975
 		}
2976 2976
 
2977 2977
 		//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).
2978
-		do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args );
2978
+		do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
2979 2979
 
2980
-		$redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args );
2980
+		$redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args);
2981 2981
 
2982 2982
 
2983 2983
 		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
2984
-		if ( defined('DOING_AJAX' ) ) {
2984
+		if (defined('DOING_AJAX')) {
2985 2985
 			$default_data = array(
2986 2986
 				'close' => TRUE,
2987 2987
 				'redirect_url' => $redirect_url,
@@ -2990,11 +2990,11 @@  discard block
 block discarded – undo
2990 2990
 				);
2991 2991
 
2992 2992
 			$this->_template_args['success'] = $success;
2993
-			$this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data;
2993
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data;
2994 2994
 			$this->_return_json();
2995 2995
 		}
2996 2996
 
2997
-		wp_safe_redirect( $redirect_url );
2997
+		wp_safe_redirect($redirect_url);
2998 2998
 		exit();
2999 2999
 	}
3000 3000
 
@@ -3010,30 +3010,30 @@  discard block
 block discarded – undo
3010 3010
 	 * @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.
3011 3011
 	 * @return void
3012 3012
 	 */
3013
-	protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) {
3013
+	protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) {
3014 3014
 
3015 3015
 		//first let's set individual error properties if doing_ajax and the properties aren't already set.
3016
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
3017
-			$notices = EE_Error::get_notices( false );
3018
-			if ( empty( $this->_template_args['success'] ) ) {
3019
-				$this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false;
3016
+		if (defined('DOING_AJAX') && DOING_AJAX) {
3017
+			$notices = EE_Error::get_notices(false);
3018
+			if (empty($this->_template_args['success'])) {
3019
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3020 3020
 			}
3021 3021
 
3022
-			if ( empty( $this->_template_args['errors'] ) ) {
3023
-				$this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false;
3022
+			if (empty($this->_template_args['errors'])) {
3023
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3024 3024
 			}
3025 3025
 
3026
-			if ( empty( $this->_template_args['attention'] ) ) {
3027
-				$this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false;
3026
+			if (empty($this->_template_args['attention'])) {
3027
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3028 3028
 			}
3029 3029
 		}
3030 3030
 
3031 3031
 		$this->_template_args['notices'] = EE_Error::get_notices();
3032 3032
 
3033 3033
 		//IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3034
-		if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) {
3035
-			$route = isset( $query_args['action'] ) ? $query_args['action'] : 'default';
3036
-			$this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify );
3034
+		if ( ! defined('DOING_AJAX') || $sticky_notices) {
3035
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
3036
+			$this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify);
3037 3037
 		}
3038 3038
 	}
3039 3039
 
@@ -3055,32 +3055,32 @@  discard block
 block discarded – undo
3055 3055
 	 *
3056 3056
 	 * @return string html for button
3057 3057
 	 */
3058
-	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) {
3058
+	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) {
3059 3059
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3060
-		if ( !isset($this->_page_routes[$action]) && !$base_url )
3061
-			throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
3060
+		if ( ! isset($this->_page_routes[$action]) && ! $base_url)
3061
+			throw new EE_Error(sprintf(__('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action));
3062 3062
 
3063
-		if ( !isset( $this->_labels['buttons'][$type] ) )
3064
-			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) );
3063
+		if ( ! isset($this->_labels['buttons'][$type]))
3064
+			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));
3065 3065
 
3066 3066
 		//finally check user access for this button.
3067
-		$has_access = $this->check_user_access( $action, TRUE );
3068
-		if ( ! $has_access ) {
3067
+		$has_access = $this->check_user_access($action, TRUE);
3068
+		if ( ! $has_access) {
3069 3069
 			return '';
3070 3070
 		}
3071 3071
 
3072
-		$_base_url = !$base_url ? $this->_admin_base_url : $base_url;
3072
+		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
3073 3073
 
3074 3074
 		$query_args = array(
3075 3075
 			'action' => $action  );
3076 3076
 
3077 3077
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3078
-		if ( !empty($extra_request) )
3079
-			$query_args = array_merge( $extra_request, $query_args );
3078
+		if ( ! empty($extra_request))
3079
+			$query_args = array_merge($extra_request, $query_args);
3080 3080
 
3081
-		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3081
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3082 3082
 
3083
-		$button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class );
3083
+		$button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3084 3084
 
3085 3085
 		return $button;
3086 3086
 	}
@@ -3100,11 +3100,11 @@  discard block
 block discarded – undo
3100 3100
 		$args = array(
3101 3101
 			'label' => $this->_admin_page_title,
3102 3102
 			'default' => 10,
3103
-			'option' => $this->_current_page . '_' . $this->_current_view . '_per_page'
3103
+			'option' => $this->_current_page.'_'.$this->_current_view.'_per_page'
3104 3104
 			);
3105 3105
 		//ONLY add the screen option if the user has access to it.
3106
-		if ( $this->check_user_access( $this->_current_view, true ) ) {
3107
-			add_screen_option( $option, $args );
3106
+		if ($this->check_user_access($this->_current_view, true)) {
3107
+			add_screen_option($option, $args);
3108 3108
 		}
3109 3109
 	}
3110 3110
 
@@ -3120,36 +3120,36 @@  discard block
 block discarded – undo
3120 3120
 	 * @return void
3121 3121
 	 */
3122 3122
 	private function _set_per_page_screen_options() {
3123
-		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3124
-			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3123
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3124
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3125 3125
 
3126
-			if ( !$user = wp_get_current_user() )
3126
+			if ( ! $user = wp_get_current_user())
3127 3127
 			return;
3128 3128
 			$option = $_POST['wp_screen_options']['option'];
3129 3129
 			$value = $_POST['wp_screen_options']['value'];
3130 3130
 
3131
-			if ( $option != sanitize_key( $option ) )
3131
+			if ($option != sanitize_key($option))
3132 3132
 				return;
3133 3133
 
3134 3134
 			$map_option = $option;
3135 3135
 
3136 3136
 			$option = str_replace('-', '_', $option);
3137 3137
 
3138
-			switch ( $map_option ) {
3139
-				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3138
+			switch ($map_option) {
3139
+				case $this->_current_page.'_'.$this->_current_view.'_per_page':
3140 3140
 					$value = (int) $value;
3141
-					if ( $value < 1 || $value > 999 )
3141
+					if ($value < 1 || $value > 999)
3142 3142
 						return;
3143 3143
 					break;
3144 3144
 				default:
3145
-					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3146
-					if ( false === $value )
3145
+					$value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value);
3146
+					if (false === $value)
3147 3147
 						return;
3148 3148
 					break;
3149 3149
 			}
3150 3150
 
3151 3151
 			update_user_meta($user->ID, $option, $value);
3152
-			wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
3152
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3153 3153
 			exit;
3154 3154
 		}
3155 3155
 	}
@@ -3160,8 +3160,8 @@  discard block
 block discarded – undo
3160 3160
 	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3161 3161
 	 * @param array $data array that will be assigned to template args.
3162 3162
 	 */
3163
-	public function set_template_args( $data ) {
3164
-		$this->_template_args = array_merge( $this->_template_args, (array) $data );
3163
+	public function set_template_args($data) {
3164
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3165 3165
 	}
3166 3166
 
3167 3167
 
@@ -3177,26 +3177,26 @@  discard block
 block discarded – undo
3177 3177
 	 * @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.
3178 3178
 	 * @return void
3179 3179
 	 */
3180
-	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3180
+	protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) {
3181 3181
 		$user_id = get_current_user_id();
3182 3182
 
3183
-		if ( !$skip_route_verify )
3183
+		if ( ! $skip_route_verify)
3184 3184
 			$this->_verify_route($route);
3185 3185
 
3186 3186
 
3187 3187
 		//now let's set the string for what kind of transient we're setting
3188
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3189
-		$data = $notices ? array( 'notices' => $data ) : $data;
3188
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3189
+		$data = $notices ? array('notices' => $data) : $data;
3190 3190
 		//is there already a transient for this route?  If there is then let's ADD to that transient
3191
-		$existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3192
-		if ( $existing ) {
3193
-			$data = array_merge( (array) $data, (array) $existing );
3191
+		$existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3192
+		if ($existing) {
3193
+			$data = array_merge((array) $data, (array) $existing);
3194 3194
 		}
3195 3195
 
3196
-		if ( is_multisite() && is_network_admin() ) {
3197
-			set_site_transient( $transient, $data, 8 );
3196
+		if (is_multisite() && is_network_admin()) {
3197
+			set_site_transient($transient, $data, 8);
3198 3198
 		} else {
3199
-			set_transient( $transient, $data, 8 );
3199
+			set_transient($transient, $data, 8);
3200 3200
 		}
3201 3201
 	}
3202 3202
 
@@ -3208,18 +3208,18 @@  discard block
 block discarded – undo
3208 3208
 	 * @param bool $notices true we get notices transient. False we just return normal route transient
3209 3209
 	 * @return mixed data
3210 3210
 	 */
3211
-	protected function _get_transient( $notices = FALSE, $route = FALSE ) {
3211
+	protected function _get_transient($notices = FALSE, $route = FALSE) {
3212 3212
 		$user_id = get_current_user_id();
3213
-		$route = !$route ? $this->_req_action : $route;
3214
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3215
-		$data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3213
+		$route = ! $route ? $this->_req_action : $route;
3214
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3215
+		$data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3216 3216
 		//delete transient after retrieval (just in case it hasn't expired);
3217
-		if ( is_multisite() && is_network_admin() ) {
3218
-			delete_site_transient( $transient );
3217
+		if (is_multisite() && is_network_admin()) {
3218
+			delete_site_transient($transient);
3219 3219
 		} else {
3220
-			delete_transient( $transient );
3220
+			delete_transient($transient);
3221 3221
 		}
3222
-		return $notices && isset( $data['notices'] ) ? $data['notices'] : $data;
3222
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3223 3223
 	}
3224 3224
 
3225 3225
 
@@ -3236,12 +3236,12 @@  discard block
 block discarded – undo
3236 3236
 
3237 3237
 		//retrieve all existing transients
3238 3238
 		$query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3239
-		if ( $results = $wpdb->get_results( $query ) ) {
3240
-			foreach ( $results as $result ) {
3241
-				$transient = str_replace( '_transient_', '', $result->option_name );
3242
-				get_transient( $transient );
3243
-				if ( is_multisite() && is_network_admin() ) {
3244
-					get_site_transient( $transient );
3239
+		if ($results = $wpdb->get_results($query)) {
3240
+			foreach ($results as $result) {
3241
+				$transient = str_replace('_transient_', '', $result->option_name);
3242
+				get_transient($transient);
3243
+				if (is_multisite() && is_network_admin()) {
3244
+					get_site_transient($transient);
3245 3245
 				}
3246 3246
 			}
3247 3247
 		}
@@ -3391,23 +3391,23 @@  discard block
 block discarded – undo
3391 3391
 	 * @param string $line	line no where error occurred
3392 3392
 	 * @return boolean
3393 3393
 	 */
3394
-	protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) {
3394
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') {
3395 3395
 
3396 3396
 		//remove any options that are NOT going to be saved with the config settings.
3397
-		if ( isset( $config->core->ee_ueip_optin ) ) {
3397
+		if (isset($config->core->ee_ueip_optin)) {
3398 3398
 			$config->core->ee_ueip_has_notified = TRUE;
3399 3399
 			// TODO: remove the following two lines and make sure values are migrated from 3.1
3400
-			update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin);
3401
-			update_option( 'ee_ueip_has_notified', TRUE );
3400
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3401
+			update_option('ee_ueip_has_notified', TRUE);
3402 3402
 		}
3403 3403
 		// and save it (note we're also doing the network save here)
3404
-		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE;
3405
-		$config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE );
3406
-		if ( $config_saved && $net_saved ) {
3407
-			EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab ));
3404
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE;
3405
+		$config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE);
3406
+		if ($config_saved && $net_saved) {
3407
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3408 3408
 			return TRUE;
3409 3409
 		} else {
3410
-			EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line  );
3410
+			EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3411 3411
 			return FALSE;
3412 3412
 		}
3413 3413
 	}
@@ -3420,7 +3420,7 @@  discard block
 block discarded – undo
3420 3420
 	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3421 3421
 	 * @return array
3422 3422
 	 */
3423
-	public function get_yes_no_values(){
3423
+	public function get_yes_no_values() {
3424 3424
 		return $this->_yes_no_values;
3425 3425
 	}
3426 3426
 
@@ -3442,8 +3442,8 @@  discard block
 block discarded – undo
3442 3442
 	 *
3443 3443
 	 * @return string
3444 3444
 	 */
3445
-	protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) {
3446
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3445
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') {
3446
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3447 3447
 	}
3448 3448
 
3449 3449
 
@@ -3457,8 +3457,8 @@  discard block
 block discarded – undo
3457 3457
 	 *
3458 3458
 	 * @return string
3459 3459
 	 */
3460
-	protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) {
3461
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3460
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') {
3461
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3462 3462
 	}
3463 3463
 
3464 3464
 
@@ -3477,8 +3477,8 @@  discard block
 block discarded – undo
3477 3477
 	 * @return bool success/fail
3478 3478
 	 */
3479 3479
 	protected function _process_resend_registration() {
3480
-		$this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data );
3481
-		do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data );
3480
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3481
+		do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data);
3482 3482
 		return $this->_template_args['success'];
3483 3483
 	}
3484 3484
 
@@ -3491,11 +3491,11 @@  discard block
 block discarded – undo
3491 3491
 	 * @param \EE_Payment $payment
3492 3492
 	 * @return bool success/fail
3493 3493
 	 */
3494
-	protected function _process_payment_notification( EE_Payment $payment ) {
3495
-		add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' );
3496
-		do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment );
3497
-		$this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment );
3498
-		return $this->_template_args[ 'success' ];
3494
+	protected function _process_payment_notification(EE_Payment $payment) {
3495
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3496
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
3497
+		$this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment);
3498
+		return $this->_template_args['success'];
3499 3499
 	}
3500 3500
 
3501 3501
 
Please login to merge, or discard this patch.
core/CPTs/EE_CPT_Default_Strategy.core.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 * @param    array $arguments
36 36
 	 * @return    \EE_CPT_Default_Strategy
37 37
 	 */
38
-	public function __construct( $arguments = array() ) {
39
-		$this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : null;
38
+	public function __construct($arguments = array()) {
39
+		$this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : null;
40 40
 		// $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : null;
41 41
 		//EEH_Debug_Tools::printr( $this->CPT, '$this->CPT  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
42 42
 //		add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 );
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 * @param    \WP_Query $WP_Query
53 53
 	 * @return    \WP_Query
54 54
 	 */
55
-	public function pre_get_posts( WP_Query $WP_Query ) {
55
+	public function pre_get_posts(WP_Query $WP_Query) {
56 56
 		//EEH_Debug_Tools::printr( $WP_Query, '$WP_Query  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
57
-		if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) {
57
+		if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) {
58 58
 			return $WP_Query;
59 59
 		}
60 60
 //		$WP_Query->set( 'post_type', array( $this->CPT['post_type'] ));
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @param    \WP_Query  $WP_Query
73 73
 	 * @return    \WP_Post[]
74 74
 	 */
75
-	public function the_posts( $posts, WP_Query $WP_Query ) {
75
+	public function the_posts($posts, WP_Query $WP_Query) {
76 76
 		return $posts;
77 77
 	}
78 78
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @param    string $single
89 89
 	 * @return    mixed
90 90
 	 */
91
-	public function get_EE_post_type_metadata( $meta_value = null, $post_id, $meta_key, $single ) {
91
+	public function get_EE_post_type_metadata($meta_value = null, $post_id, $meta_key, $single) {
92 92
 		return $meta_value;
93 93
 	}
94 94
 
Please login to merge, or discard this patch.
core/CPTs/CptQueryModifier.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -447,14 +447,14 @@
 block discarded – undo
447 447
 			global $wpdb;
448 448
 			// adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
449 449
 			$SQL .= ' LEFT JOIN '
450
-			        . $this->meta_table->get_table_name()
451
-			        . ' ON ( '
452
-			        . $this->meta_table->get_table_name()
453
-			        . '.'
454
-			        . $this->meta_table->get_fk_on_table()
455
-			        . ' = '
456
-			        . $wpdb->posts
457
-			        . '.ID ) ';
450
+					. $this->meta_table->get_table_name()
451
+					. ' ON ( '
452
+					. $this->meta_table->get_table_name()
453
+					. '.'
454
+					. $this->meta_table->get_fk_on_table()
455
+					. ' = '
456
+					. $wpdb->posts
457
+					. '.ID ) ';
458 458
 		}
459 459
 		remove_filter( 'posts_join', array( $this, 'postsJoin' ) );
460 460
 		return $SQL;
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\Core\CPTs;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 		\WP_Query $WP_Query,
81 81
 		\EE_Request_Handler $request
82 82
 	) {
83
-		$this->setRequest( $request );
84
-		$this->setWpQuery( $WP_Query );
85
-		$this->setPostType( $post_type );
86
-		$this->setCptDetails( $cpt_details );
83
+		$this->setRequest($request);
84
+		$this->setWpQuery($WP_Query);
85
+		$this->setPostType($post_type);
86
+		$this->setCptDetails($cpt_details);
87 87
 		$this->init();
88 88
 	}
89 89
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	/**
102 102
 	 * @param string $post_type
103 103
 	 */
104
-	protected function setPostType( $post_type ) {
104
+	protected function setPostType($post_type) {
105 105
 		$this->post_type = $post_type;
106 106
 	}
107 107
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	/**
120 120
 	 * @param array $cpt_details
121 121
 	 */
122
-	protected function setCptDetails( $cpt_details ) {
122
+	protected function setCptDetails($cpt_details) {
123 123
 		$this->cpt_details = $cpt_details;
124 124
 	}
125 125
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * @param \EE_Table_Base[] $model_tables
139 139
 	 */
140
-	protected function setModelTables( $model_tables ) {
140
+	protected function setModelTables($model_tables) {
141 141
 		$this->model_tables = $model_tables;
142 142
 	}
143 143
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @return array
148 148
 	 */
149 149
 	public function taxonomies() {
150
-		if ( empty( $this->taxonomies ) ) {
150
+		if (empty($this->taxonomies)) {
151 151
 			$this->initializeTaxonomies();
152 152
 		}
153 153
 		return $this->taxonomies;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	/**
159 159
 	 * @param array $taxonomies
160 160
 	 */
161
-	protected function setTaxonomies( array $taxonomies ) {
161
+	protected function setTaxonomies(array $taxonomies) {
162 162
 		$this->taxonomies = $taxonomies;
163 163
 	}
164 164
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	/**
177 177
 	 * @param \EE_Secondary_Table $meta_table
178 178
 	 */
179
-	public function setMetaTable( \EE_Secondary_Table $meta_table ) {
179
+	public function setMetaTable(\EE_Secondary_Table $meta_table) {
180 180
 		$this->meta_table = $meta_table;
181 181
 	}
182 182
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	/**
195 195
 	 * @param \EEM_Base $CPT_model
196 196
 	 */
197
-	protected function setModel( \EEM_Base $CPT_model ) {
197
+	protected function setModel(\EEM_Base $CPT_model) {
198 198
 		$this->model = $CPT_model;
199 199
 	}
200 200
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	/**
213 213
 	 * @param \EE_Request_Handler $request
214 214
 	 */
215
-	protected function setRequest( \EE_Request_Handler $request ) {
215
+	protected function setRequest(\EE_Request_Handler $request) {
216 216
 		$this->request = $request;
217 217
 	}
218 218
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	/**
231 231
 	 * @param \WP_Query $wp_query
232 232
 	 */
233
-	public function setWpQuery( \WP_Query $wp_query ) {
233
+	public function setWpQuery(\WP_Query $wp_query) {
234 234
 		$this->wp_query = $wp_query;
235 235
 	}
236 236
 
@@ -245,22 +245,22 @@  discard block
 block discarded – undo
245 245
 	protected function initializeTaxonomies() {
246 246
 		// check if taxonomies have already been set and that this CPT has taxonomies registered for it
247 247
 		if (
248
-			empty( $this->taxonomies )
249
-			&& isset( $this->cpt_details['args'], $this->cpt_details['args']['taxonomies'] )
248
+			empty($this->taxonomies)
249
+			&& isset($this->cpt_details['args'], $this->cpt_details['args']['taxonomies'])
250 250
 		) {
251 251
 			// if so then grab them, but we want the taxonomy name as the key
252
-			$taxonomies = array_flip( $this->cpt_details['args']['taxonomies'] );
252
+			$taxonomies = array_flip($this->cpt_details['args']['taxonomies']);
253 253
 			// then grab the list of ALL taxonomies
254 254
 			$all_taxonomies = \EE_Register_CPTs::get_taxonomies();
255
-			foreach ( $taxonomies as $taxonomy => &$details ) {
255
+			foreach ($taxonomies as $taxonomy => &$details) {
256 256
 				// add details to our taxonomies if they exist
257
-				$details = isset( $all_taxonomies[ $taxonomy ] )
258
-					? $all_taxonomies[ $taxonomy ]
257
+				$details = isset($all_taxonomies[$taxonomy])
258
+					? $all_taxonomies[$taxonomy]
259 259
 					: array();
260 260
 			}
261 261
 			// ALWAYS unset() variables that were passed by reference
262
-			unset( $details );
263
-			$this->setTaxonomies( $taxonomies );
262
+			unset($details);
263
+			$this->setTaxonomies($taxonomies);
264 264
 		}
265 265
 	}
266 266
 
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 		$this->setAdditionalCptDetails();
271 271
 		$this->setRequestVarsIfCpt();
272 272
 		// convert post_type to model name
273
-		$model_name = str_replace( 'EE_', '', $this->cpt_details['class_name'] );
273
+		$model_name = str_replace('EE_', '', $this->cpt_details['class_name']);
274 274
 		// load all tables related to CPT
275
-		$this->setupModelsAndTables( $model_name );
275
+		$this->setupModelsAndTables($model_name);
276 276
 		// load and instantiate CPT_*_Strategy
277
-		$CPT_Strategy = $this->cptStrategyClass( $model_name );
277
+		$CPT_Strategy = $this->cptStrategyClass($model_name);
278 278
 		// !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
279 279
 		// here's the list of available filters in the WP_Query object
280 280
 		// 'posts_where_paged'
@@ -285,17 +285,17 @@  discard block
 block discarded – undo
285 285
 		// 'post_limits'
286 286
 		// 'posts_fields'
287 287
 		// 'posts_join'
288
-		add_filter( 'posts_fields', array( $this, 'postsFields' ) );
289
-		add_filter( 'posts_join', array( $this, 'postsJoin' ) );
288
+		add_filter('posts_fields', array($this, 'postsFields'));
289
+		add_filter('posts_join', array($this, 'postsJoin'));
290 290
 		add_filter(
291
-			'get_' . $this->post_type . '_metadata',
292
-			array( $CPT_Strategy, 'get_EE_post_type_metadata' ),
291
+			'get_'.$this->post_type.'_metadata',
292
+			array($CPT_Strategy, 'get_EE_post_type_metadata'),
293 293
 			1,
294 294
 			4
295 295
 		);
296
-		add_filter( 'the_posts', array( $this, 'thePosts' ), 1, 1 );
297
-		if ( $this->wp_query->is_main_query() ) {
298
-			add_filter( 'get_edit_post_link', array( $this, 'getEditPostLink' ), 10, 2 );
296
+		add_filter('the_posts', array($this, 'thePosts'), 1, 1);
297
+		if ($this->wp_query->is_main_query()) {
298
+			add_filter('get_edit_post_link', array($this, 'getEditPostLink'), 10, 2);
299 299
 			$this->addTemplateFilters();
300 300
 		}
301 301
 	}
@@ -312,18 +312,18 @@  discard block
 block discarded – undo
312 312
 		// the post or category or term that is triggering EE
313 313
 		$this->cpt_details['espresso_page'] = $this->request->is_espresso_page();
314 314
 		// requested post name
315
-		$this->cpt_details['post_name'] = $this->request->get( 'post_name' );
315
+		$this->cpt_details['post_name'] = $this->request->get('post_name');
316 316
 		// add support for viewing 'private', 'draft', or 'pending' posts
317 317
 		if (
318
-			isset( $this->wp_query->query_vars['p'] )
318
+			isset($this->wp_query->query_vars['p'])
319 319
 			&& $this->wp_query->query_vars['p'] !== 0
320 320
 			&& is_user_logged_in()
321
-			&& current_user_can( 'edit_post', $this->wp_query->query_vars['p'] )
321
+			&& current_user_can('edit_post', $this->wp_query->query_vars['p'])
322 322
 		) {
323 323
 			// we can just inject directly into the WP_Query object
324
-			$this->wp_query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' );
324
+			$this->wp_query->query['post_status'] = array('publish', 'private', 'draft', 'pending');
325 325
 			// now set the main 'ee' request var so that the appropriate module can load the appropriate template(s)
326
-			$this->request->set( 'ee', $this->cpt_details['singular_slug'] );
326
+			$this->request->set('ee', $this->cpt_details['singular_slug']);
327 327
 		}
328 328
 	}
329 329
 
@@ -340,15 +340,15 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	public function setRequestVarsIfCpt() {
342 342
 		// check if ee action var has been set
343
-		if ( ! $this->request->is_set( 'ee' ) ) {
343
+		if ( ! $this->request->is_set('ee')) {
344 344
 			// check that route exists for CPT archive slug
345
-			if ( is_archive() && \EE_Config::get_route( $this->cpt_details['plural_slug'] ) ) {
345
+			if (is_archive() && \EE_Config::get_route($this->cpt_details['plural_slug'])) {
346 346
 				// ie: set "ee" to "events"
347
-				$this->request->set( 'ee', $this->cpt_details['plural_slug'] );
347
+				$this->request->set('ee', $this->cpt_details['plural_slug']);
348 348
 				// or does it match a single page CPT like /event/
349
-			} else if ( is_single() && \EE_Config::get_route( $this->cpt_details['singular_slug'] ) ) {
349
+			} else if (is_single() && \EE_Config::get_route($this->cpt_details['singular_slug'])) {
350 350
 				// ie: set "ee" to "event"
351
-				$this->request->set( 'ee', $this->cpt_details['singular_slug'] );
351
+				$this->request->set('ee', $this->cpt_details['singular_slug']);
352 352
 			}
353 353
 		}
354 354
 	}
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 	 * @param string $model_name
363 363
 	 * @throws \EE_Error
364 364
 	 */
365
-	protected function setupModelsAndTables( $model_name ) {
365
+	protected function setupModelsAndTables($model_name) {
366 366
 		// get CPT table data via CPT Model
367
-		$model = \EE_Registry::instance()->load_model( $model_name );
368
-		if ( ! $model instanceof \EEM_Base ) {
369
-			throw new \EE_Error (
367
+		$model = \EE_Registry::instance()->load_model($model_name);
368
+		if ( ! $model instanceof \EEM_Base) {
369
+			throw new \EE_Error(
370 370
 				sprintf(
371 371
 					__(
372 372
 						'The "%1$s" model could not be loaded.',
@@ -376,14 +376,14 @@  discard block
 block discarded – undo
376 376
 				)
377 377
 			);
378 378
 		}
379
-		$this->setModel( $model );
380
-		$this->setModelTables( $this->model->get_tables() );
379
+		$this->setModel($model);
380
+		$this->setModelTables($this->model->get_tables());
381 381
 		// is there a Meta Table for this CPT?
382 382
 		if (
383
-			isset( $this->cpt_details['tables'][ $model_name . '_Meta' ] )
384
-			&& $this->cpt_details['tables'][ $model_name . '_Meta' ] instanceof \EE_Secondary_Table
383
+			isset($this->cpt_details['tables'][$model_name.'_Meta'])
384
+			&& $this->cpt_details['tables'][$model_name.'_Meta'] instanceof \EE_Secondary_Table
385 385
 		) {
386
-			$this->setMetaTable( $this->cpt_details['tables'][ $model_name . '_Meta' ] );
386
+			$this->setMetaTable($this->cpt_details['tables'][$model_name.'_Meta']);
387 387
 		}
388 388
 	}
389 389
 
@@ -396,18 +396,18 @@  discard block
 block discarded – undo
396 396
 	 * @param  string $model_name
397 397
 	 * @return string
398 398
 	 */
399
-	protected function cptStrategyClass( $model_name ) {
399
+	protected function cptStrategyClass($model_name) {
400 400
 		// creates classname like:  CPT_Event_Strategy
401
-		$CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy';
401
+		$CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy';
402 402
 		// load and instantiate
403 403
 		$CPT_Strategy = \EE_Registry::instance()->load_core(
404 404
 			$CPT_Strategy_class_name,
405
-			array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details )
405
+			array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details)
406 406
 		);
407
-		if ( $CPT_Strategy === null ) {
407
+		if ($CPT_Strategy === null) {
408 408
 			$CPT_Strategy = \EE_Registry::instance()->load_core(
409 409
 				'CPT_Default_Strategy',
410
-				array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details )
410
+				array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details)
411 411
 			);
412 412
 		}
413 413
 		return $CPT_Strategy;
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 	 * @param  $SQL
423 423
 	 * @return string
424 424
 	 */
425
-	public function postsFields( $SQL ) {
425
+	public function postsFields($SQL) {
426 426
 		// does this CPT have a meta table ?
427
-		if ( $this->meta_table instanceof \EE_Secondary_Table ) {
427
+		if ($this->meta_table instanceof \EE_Secondary_Table) {
428 428
 			// adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement
429
-			$SQL .= ', ' . $this->meta_table->get_table_name() . '.* ';
429
+			$SQL .= ', '.$this->meta_table->get_table_name().'.* ';
430 430
 		}
431
-		remove_filter( 'posts_fields', array( $this, 'postsFields' ) );
431
+		remove_filter('posts_fields', array($this, 'postsFields'));
432 432
 		return $SQL;
433 433
 	}
434 434
 
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 	 * @param  $SQL
442 442
 	 * @return string
443 443
 	 */
444
-	public function postsJoin( $SQL ) {
444
+	public function postsJoin($SQL) {
445 445
 		// does this CPT have a meta table ?
446
-		if ( $this->meta_table instanceof \EE_Secondary_Table ) {
446
+		if ($this->meta_table instanceof \EE_Secondary_Table) {
447 447
 			global $wpdb;
448 448
 			// adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
449 449
 			$SQL .= ' LEFT JOIN '
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			        . $wpdb->posts
457 457
 			        . '.ID ) ';
458 458
 		}
459
-		remove_filter( 'posts_join', array( $this, 'postsJoin' ) );
459
+		remove_filter('posts_join', array($this, 'postsJoin'));
460 460
 		return $SQL;
461 461
 	}
462 462
 
@@ -469,17 +469,17 @@  discard block
 block discarded – undo
469 469
 	 * @param  \WP_Post[] $posts
470 470
 	 * @return \WP_Post[]
471 471
 	 */
472
-	public function thePosts( $posts ) {
472
+	public function thePosts($posts) {
473 473
 		$CPT_class = $this->cpt_details['class_name'];
474 474
 		// loop thru posts
475
-		if ( is_array( $posts ) && $this->model instanceof \EEM_CPT_Base ) {
476
-			foreach ( $posts as $key => $post ) {
477
-				if ( $post->post_type === $this->post_type ) {
478
-					$post->{$CPT_class} = $this->model->instantiate_class_from_post_object( $post );
475
+		if (is_array($posts) && $this->model instanceof \EEM_CPT_Base) {
476
+			foreach ($posts as $key => $post) {
477
+				if ($post->post_type === $this->post_type) {
478
+					$post->{$CPT_class} = $this->model->instantiate_class_from_post_object($post);
479 479
 				}
480 480
 			}
481 481
 		}
482
-		remove_filter( 'the_posts', array( $this, 'thePosts' ), 1 );
482
+		remove_filter('the_posts', array($this, 'thePosts'), 1);
483 483
 		return $posts;
484 484
 	}
485 485
 
@@ -490,17 +490,17 @@  discard block
 block discarded – undo
490 490
 	 * @param $ID
491 491
 	 * @return string
492 492
 	 */
493
-	public function getEditPostLink( $url, $ID ) {
493
+	public function getEditPostLink($url, $ID) {
494 494
 		// need to make sure we only edit links if our cpt
495 495
 		global $post;
496
-		if ( ! $post instanceof \WP_Post || $post->post_type !== $this->post_type ) {
496
+		if ( ! $post instanceof \WP_Post || $post->post_type !== $this->post_type) {
497 497
 			return $url;
498 498
 		}
499 499
 		//k made it here so all is good.
500 500
 		return wp_nonce_url(
501 501
 			add_query_arg(
502
-				array( 'page' => $this->post_type, 'post' => $ID, 'action' => 'edit' ),
503
-				admin_url( 'admin.php' )
502
+				array('page' => $this->post_type, 'post' => $ID, 'action' => 'edit'),
503
+				admin_url('admin.php')
504 504
 			),
505 505
 			'edit',
506 506
 			'edit_nonce'
@@ -517,9 +517,9 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function addTemplateFilters() {
519 519
 		// if requested cpt supports page_templates and it's the main query
520
-		if ( ! empty( $this->cpt_details['args']['page_templates'] ) && $this->wp_query->is_main_query() ) {
520
+		if ( ! empty($this->cpt_details['args']['page_templates']) && $this->wp_query->is_main_query()) {
521 521
 			// then let's hook into the appropriate query_template hook
522
-			add_filter( 'single_template', array( $this, 'singleCptTemplate' ) );
522
+			add_filter('single_template', array($this, 'singleCptTemplate'));
523 523
 		}
524 524
 	}
525 525
 
@@ -533,20 +533,20 @@  discard block
 block discarded – undo
533 533
 	 * @param string $current_template Existing default template path derived for this page call.
534 534
 	 * @return string the path to the full template file.
535 535
 	 */
536
-	public function singleCptTemplate( $current_template ) {
536
+	public function singleCptTemplate($current_template) {
537 537
 		$object = get_queried_object();
538 538
 		//does this called object HAVE a page template set that is something other than the default.
539
-		$template = get_post_meta( $object->ID, '_wp_page_template', true );
539
+		$template = get_post_meta($object->ID, '_wp_page_template', true);
540 540
 		//exit early if default or not set or invalid path (accounts for theme changes)
541 541
 		if (
542 542
 			$template === 'default'
543
-			|| empty( $template )
544
-			|| ! is_readable( get_stylesheet_directory() . '/' . $template )
543
+			|| empty($template)
544
+			|| ! is_readable(get_stylesheet_directory().'/'.$template)
545 545
 		) {
546 546
 			return $current_template;
547 547
 		}
548 548
 		//made it here so we SHOULD be able to just locate the template and then return it.
549
-		return locate_template( array( $template ) );
549
+		return locate_template(array($template));
550 550
 	}
551 551
 
552 552
 
Please login to merge, or discard this patch.
core/exceptions/InvalidClassException.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\Core\Exceptions;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @param int        $code
26 26
 	 * @param \Exception $previous
27 27
 	 */
28
-	public function __construct( $class_name, $message = '', $code = 0, \Exception $previous = null ) {
29
-		if ( empty( $message ) ) {
28
+	public function __construct($class_name, $message = '', $code = 0, \Exception $previous = null) {
29
+		if (empty($message)) {
30 30
 			$message = sprintf(
31
-				__( 'The "%1$s" Class is either missing or invalid.', 'event_espresso' ),
31
+				__('The "%1$s" Class is either missing or invalid.', 'event_espresso'),
32 32
 				$class_name
33 33
 			);
34 34
 		}
35
-		parent::__construct( $message, $code, $previous );
35
+		parent::__construct($message, $code, $previous);
36 36
 	}
37 37
 
38 38
 }
Please login to merge, or discard this patch.
core/exceptions/InvalidInterfaceException.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\Core\Exceptions;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 	 * @param int        $code
27 27
 	 * @param \Exception $previous
28 28
 	 */
29
-	public function __construct( $interface_name, $message = '', $code = 0, \Exception $previous = null ) {
30
-		if ( empty( $message ) ) {
29
+	public function __construct($interface_name, $message = '', $code = 0, \Exception $previous = null) {
30
+		if (empty($message)) {
31 31
 			$message = sprintf(
32
-				__( 'The "%1$s" Interface is either missing or invalid.', 'event_espresso' ),
32
+				__('The "%1$s" Interface is either missing or invalid.', 'event_espresso'),
33 33
 				$interface_name
34 34
 			);
35 35
 		}
36
-		parent::__construct( $message, $code, $previous );
36
+		parent::__construct($message, $code, $previous);
37 37
 	}
38 38
 
39 39
 }
Please login to merge, or discard this patch.