Completed
Branch BUG-9951-10331-8793-pue-fixes (9f33f1)
by
unknown
29:25 queued 13:33
created
admin_pages/payments/Payments_Admin_Page.core.php 1 patch
Spacing   +173 added lines, -173 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
 /**
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
45 45
 	 * @return \Payments_Admin_Page
46 46
 	 */
47
-	public function __construct( $routing = TRUE ) {
48
-		parent::__construct( $routing );
47
+	public function __construct($routing = TRUE) {
48
+		parent::__construct($routing);
49 49
 	}
50 50
 
51 51
 
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
 	protected function _set_page_config() {
131 131
 		$payment_method_list_config = array(
132 132
 			'nav'           => array(
133
-				'label' => __( 'Payment Methods', 'event_espresso' ),
133
+				'label' => __('Payment Methods', 'event_espresso'),
134 134
 				'order' => 10
135 135
 			),
136 136
 			'metaboxes'     => $this->_default_espresso_metaboxes,
137 137
 			'help_tabs'     => array_merge(
138 138
 				array(
139 139
 					'payment_methods_overview_help_tab' => array(
140
-						'title'    => __( 'Payment Methods Overview', 'event_espresso' ),
140
+						'title'    => __('Payment Methods Overview', 'event_espresso'),
141 141
 						'filename' => 'payment_methods_overview'
142 142
 					)
143 143
 				),
144 144
 				$this->_add_payment_method_help_tabs() ),
145
-			'help_tour'     => array( 'Payment_Methods_Selection_Help_Tour' ),
145
+			'help_tour'     => array('Payment_Methods_Selection_Help_Tour'),
146 146
 			'require_nonce' => false
147 147
 		);
148 148
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 					)
161 161
 				),
162 162
 				//'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ),
163
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
163
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
164 164
 				'require_nonce' => FALSE
165 165
 			),
166 166
 			'payment_log'=>array(
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
 	/**
180 180
 	 * @return array
181 181
 	 */
182
-	protected function _add_payment_method_help_tabs(){
182
+	protected function _add_payment_method_help_tabs() {
183 183
 		EE_Registry::instance()->load_lib('Payment_Method_Manager');
184 184
 		$payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types();
185 185
 		$all_pmt_help_tabs_config = array();
186
-		foreach( $payment_method_types as $payment_method_type ){
187
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) {
186
+		foreach ($payment_method_types as $payment_method_type) {
187
+			if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) {
188 188
 				continue;
189 189
 			}
190
-			foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){
191
-				$template_args = isset( $config[ 'template_args' ] ) ? $config[ 'template_args' ] : array();
192
-				$template_args[ 'admin_page_obj' ] = $this;
190
+			foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) {
191
+				$template_args = isset($config['template_args']) ? $config['template_args'] : array();
192
+				$template_args['admin_page_obj'] = $this;
193 193
 				$all_pmt_help_tabs_config[$help_tab_name] = array(
194 194
 					'title'=>$config['title'],
195 195
 					'content'=>EEH_Template::display_template(
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 
217 217
 
218 218
 	public function load_scripts_styles() {
219
-		wp_enqueue_script( 'ee_admin_js' );
220
-		wp_enqueue_script( 'ee-text-links' );
221
-		wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
219
+		wp_enqueue_script('ee_admin_js');
220
+		wp_enqueue_script('ee-text-links');
221
+		wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
222 222
 	}
223 223
 
224 224
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 
228 228
 	public function load_scripts_styles_default() {
229 229
 		//styles
230
-		wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION );
231
-		wp_enqueue_style( 'espresso_payments' );
232
-		wp_enqueue_style( 'ee-text-links' );
230
+		wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION);
231
+		wp_enqueue_style('espresso_payments');
232
+		wp_enqueue_style('ee-text-links');
233 233
 		//scripts
234 234
 	}
235 235
 
@@ -243,44 +243,44 @@  discard block
 block discarded – undo
243 243
 		 * to the loading process.  However, people MUST setup the details for the payment method so its safe to do a
244 244
 		 * recheck here.
245 245
 		 */
246
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
246
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
247 247
 		EEM_Payment_Method::instance()->verify_button_urls();
248 248
 		//setup tabs, one for each payment method type
249 249
 		$tabs = array();
250 250
 		$payment_methods = array();
251
-		foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) {
251
+		foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
252 252
 			// we don't want to show admin-only PMTs for now
253
-			if ( $pmt_obj instanceof EE_PMT_Admin_Only ) {
253
+			if ($pmt_obj instanceof EE_PMT_Admin_Only) {
254 254
 				continue;
255 255
 			}
256 256
 			//check access
257
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) {
257
+			if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) {
258 258
 				continue;
259 259
 			}
260 260
 			//check for any active pms of that type
261
-			$payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() );
262
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
261
+			$payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name());
262
+			if ( ! $payment_method instanceof EE_Payment_Method) {
263 263
 				$payment_method = EE_Payment_Method::new_instance(
264 264
 					array(
265
-						'PMD_slug'					=>sanitize_key( $pmt_obj->system_name() ),
265
+						'PMD_slug'					=>sanitize_key($pmt_obj->system_name()),
266 266
 						'PMD_type'					=>$pmt_obj->system_name(),
267 267
 						'PMD_name'				=>$pmt_obj->pretty_name(),
268 268
 						'PMD_admin_name'	=>$pmt_obj->pretty_name()
269 269
 					)
270 270
 				);
271 271
 			}
272
-			$payment_methods[ $payment_method->slug() ] = $payment_method;
272
+			$payment_methods[$payment_method->slug()] = $payment_method;
273 273
 		}
274
-		$payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods );
275
-		foreach( $payment_methods as $payment_method ) {
276
-			if ( $payment_method instanceof EE_Payment_Method ) {
274
+		$payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods);
275
+		foreach ($payment_methods as $payment_method) {
276
+			if ($payment_method instanceof EE_Payment_Method) {
277 277
 				add_meta_box(
278 278
 					//html id
279
-					'espresso_' . $payment_method->slug() . '_payment_settings',
279
+					'espresso_'.$payment_method->slug().'_payment_settings',
280 280
 					//title
281
-					sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ),
281
+					sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()),
282 282
 					//callback
283
-					array( $this, 'payment_method_settings_meta_box' ),
283
+					array($this, 'payment_method_settings_meta_box'),
284 284
 					//post type
285 285
 					null,
286 286
 					//context
@@ -288,19 +288,19 @@  discard block
 block discarded – undo
288 288
 					//priority
289 289
 					'default',
290 290
 					//callback args
291
-					array( 'payment_method' => $payment_method )
291
+					array('payment_method' => $payment_method)
292 292
 				);
293 293
 				//setup for tabbed content
294
-				$tabs[ $payment_method->slug() ] = array(
294
+				$tabs[$payment_method->slug()] = array(
295 295
 					'label' => $payment_method->admin_name(),
296 296
 					'class' => $payment_method->active() ? 'gateway-active' : '',
297
-					'href'  => 'espresso_' . $payment_method->slug() . '_payment_settings',
298
-					'title' => __( 'Modify this Payment Method', 'event_espresso' ),
297
+					'href'  => 'espresso_'.$payment_method->slug().'_payment_settings',
298
+					'title' => __('Modify this Payment Method', 'event_espresso'),
299 299
 					'slug'  => $payment_method->slug()
300 300
 				);
301 301
 			}
302 302
 		}
303
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() );
303
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug());
304 304
 		$this->display_admin_page_with_sidebar();
305 305
 
306 306
 	}
@@ -311,20 +311,20 @@  discard block
 block discarded – undo
311 311
 	 *   _get_active_payment_method_slug
312 312
 	 * 	@return string
313 313
 	 */
314
-	protected function _get_active_payment_method_slug(){
314
+	protected function _get_active_payment_method_slug() {
315 315
 		$payment_method_slug = FALSE;
316 316
 		//decide which payment method tab to open first, as dictated by the request's 'payment_method'
317
-		if ( isset( $this->_req_data['payment_method'] )) {
317
+		if (isset($this->_req_data['payment_method'])) {
318 318
 			// if they provided the current payment method, use it
319
-			$payment_method_slug = sanitize_key( $this->_req_data['payment_method'] );
319
+			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
320 320
 		}
321
-		$payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug )));
321
+		$payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug)));
322 322
 		// if that didn't work or wasn't provided, find another way to select the current pm
323
-		if ( ! $this->_verify_payment_method( $payment_method )) {
323
+		if ( ! $this->_verify_payment_method($payment_method)) {
324 324
 			// like, looking for an active one
325
-			$payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' );
325
+			$payment_method = EEM_Payment_Method::instance()->get_one_active('CART');
326 326
 			// test that one as well
327
-			if ( $this->_verify_payment_method( $payment_method )) {
327
+			if ($this->_verify_payment_method($payment_method)) {
328 328
 				$payment_method_slug = $payment_method->slug();
329 329
 			} else {
330 330
 				$payment_method_slug = 'paypal_standard';
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 	 * @param \EE_Payment_Method $payment_method
343 343
 	 * @return boolean
344 344
 	 */
345
-	protected function _verify_payment_method( $payment_method ){
345
+	protected function _verify_payment_method($payment_method) {
346 346
 		if (
347 347
 			$payment_method instanceof EE_Payment_Method &&
348 348
 			$payment_method->type_obj() instanceof EE_PMT_Base &&
349
-			EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' )
349
+			EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access')
350 350
 		) {
351 351
 			return TRUE;
352 352
 		}
@@ -363,21 +363,21 @@  discard block
 block discarded – undo
363 363
 	 * @return string
364 364
 	 * @throws EE_Error
365 365
 	 */
366
-	public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){
367
-		$payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL;
368
-		if ( ! $payment_method instanceof EE_Payment_Method ){
369
-			throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' )));
366
+	public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) {
367
+		$payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL;
368
+		if ( ! $payment_method instanceof EE_Payment_Method) {
369
+			throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso')));
370 370
 		}
371 371
 		$payment_method_scopes = $payment_method->active();
372 372
 		// if the payment method really exists show its form, otherwise the activation template
373
-		if ( $payment_method->ID() && ! empty( $payment_method_scopes )) {
374
-				$form = $this->_generate_payment_method_settings_form( $payment_method );
375
-				if ( $form->form_data_present_in( $this->_req_data )) {
376
-					$form->receive_form_submission( $this->_req_data );
373
+		if ($payment_method->ID() && ! empty($payment_method_scopes)) {
374
+				$form = $this->_generate_payment_method_settings_form($payment_method);
375
+				if ($form->form_data_present_in($this->_req_data)) {
376
+					$form->receive_form_submission($this->_req_data);
377 377
 				}
378
-				echo $form->form_open() . $form->get_html_and_js() . $form->form_close();
378
+				echo $form->form_open().$form->get_html_and_js().$form->form_close();
379 379
 		} else {
380
-			echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js();
380
+			echo $this->_activate_payment_method_button($payment_method)->get_html_and_js();
381 381
 		}
382 382
 	}
383 383
 
@@ -390,14 +390,14 @@  discard block
 block discarded – undo
390 390
 	 * @param \EE_Payment_Method $payment_method
391 391
 	 * @return \EE_Form_Section_Proper
392 392
 	 */
393
-	protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) {
394
-		if ( ! $payment_method instanceof EE_Payment_Method ){
393
+	protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) {
394
+		if ( ! $payment_method instanceof EE_Payment_Method) {
395 395
 			return new EE_Form_Section_Proper();
396 396
 		}
397 397
 		return new EE_Form_Section_Proper(
398 398
 			array(
399
-				'name' 	=> $payment_method->slug() . '_settings_form',
400
-				'html_id' 	=> $payment_method->slug() . '_settings_form',
399
+				'name' 	=> $payment_method->slug().'_settings_form',
400
+				'html_id' 	=> $payment_method->slug().'_settings_form',
401 401
 				'action' 	=> EE_Admin_Page::add_query_args_and_nonce(
402 402
 					array(
403 403
 						'action' 						=> 'update_payment_method',
@@ -409,12 +409,12 @@  discard block
 block discarded – undo
409 409
 				'subsections' 			=> apply_filters(
410 410
 					'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections',
411 411
 					array(
412
-						'pci_dss_compliance_' . $payment_method->slug() 				=> $this->_pci_dss_compliance( $payment_method ),
413
-						'currency_support_' . $payment_method->slug()					=> $this->_currency_support( $payment_method ),
414
-						'payment_method_settings_' . $payment_method->slug() 	=> $this->_payment_method_settings( $payment_method ),
415
-						'update_' . $payment_method->slug()										=> $this->_update_payment_method_button( $payment_method ),
416
-						'deactivate_' . $payment_method->slug()								=> $this->_deactivate_payment_method_button( $payment_method ),
417
-						'fine_print_' . $payment_method->slug()									=> $this->_fine_print()
412
+						'pci_dss_compliance_'.$payment_method->slug() 				=> $this->_pci_dss_compliance($payment_method),
413
+						'currency_support_'.$payment_method->slug()					=> $this->_currency_support($payment_method),
414
+						'payment_method_settings_'.$payment_method->slug() 	=> $this->_payment_method_settings($payment_method),
415
+						'update_'.$payment_method->slug()										=> $this->_update_payment_method_button($payment_method),
416
+						'deactivate_'.$payment_method->slug()								=> $this->_deactivate_payment_method_button($payment_method),
417
+						'fine_print_'.$payment_method->slug()									=> $this->_fine_print()
418 418
 					),
419 419
 					$payment_method
420 420
 				)
@@ -431,19 +431,19 @@  discard block
 block discarded – undo
431 431
 	 * @param \EE_Payment_Method $payment_method
432 432
 	 * @return \EE_Form_Section_Proper
433 433
 	 */
434
-	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) {
435
-		if ( $payment_method->type_obj()->requires_https() ) {
434
+	protected function _pci_dss_compliance(EE_Payment_Method $payment_method) {
435
+		if ($payment_method->type_obj()->requires_https()) {
436 436
 			return new EE_Form_Section_HTML(
437 437
 				EEH_HTML::tr(
438 438
 					EEH_HTML::th(
439 439
 						EEH_HTML::label(
440
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
440
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
441 441
 						)
442
-					) .
442
+					).
443 443
 					EEH_HTML::td(
444
-						EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) .
445
-						EEH_HTML::br() .
446
-						__( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' ))
444
+						EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')).
445
+						EEH_HTML::br().
446
+						__('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso'))
447 447
 					)
448 448
 				)
449 449
 			);
@@ -461,19 +461,19 @@  discard block
 block discarded – undo
461 461
 	 * @param \EE_Payment_Method $payment_method
462 462
 	 * @return \EE_Form_Section_Proper
463 463
 	 */
464
-	protected function _currency_support( EE_Payment_Method $payment_method ) {
465
-		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) {
464
+	protected function _currency_support(EE_Payment_Method $payment_method) {
465
+		if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) {
466 466
 			return new EE_Form_Section_HTML(
467 467
 				EEH_HTML::tr(
468 468
 					EEH_HTML::th(
469 469
 						EEH_HTML::label(
470
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
470
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
471 471
 						)
472
-					) .
472
+					).
473 473
 					EEH_HTML::td(
474 474
 						EEH_HTML::strong(
475 475
 							sprintf(
476
-								__( 'This payment method does not support the currency set on your site (%1$s). Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),
476
+								__('This payment method does not support the currency set on your site (%1$s). Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),
477 477
 								EE_Config::instance()->currency->code
478 478
 							)
479 479
 						)
@@ -493,9 +493,9 @@  discard block
 block discarded – undo
493 493
 	 * @param \EE_Payment_Method $payment_method
494 494
 	 * @return \EE_Form_Section_HTML
495 495
 	 */
496
-	protected function _payment_method_settings( EE_Payment_Method $payment_method ) {
496
+	protected function _payment_method_settings(EE_Payment_Method $payment_method) {
497 497
 		//modify the form so we only have/show fields that will be implemented for this version
498
-		return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() );
498
+		return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name());
499 499
 	}
500 500
 
501 501
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	 * @return \EE_Payment_Method_Form
509 509
 	 * @throws \EE_Error
510 510
 	 */
511
-	protected function _simplify_form( $form_section, $payment_method_name = '' ){
512
-		if ( $form_section instanceof EE_Payment_Method_Form ) {
511
+	protected function _simplify_form($form_section, $payment_method_name = '') {
512
+		if ($form_section instanceof EE_Payment_Method_Form) {
513 513
 			$form_section->exclude(
514 514
 				array(
515 515
 					'PMD_type', //dont want them changing the type
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 			);
521 521
 			return $form_section;
522 522
 		} else {
523
-			throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name ));
523
+			throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name));
524 524
 		}
525 525
 	}
526 526
 
@@ -533,19 +533,19 @@  discard block
 block discarded – undo
533 533
 	 * @param \EE_Payment_Method $payment_method
534 534
 	 * @return \EE_Form_Section_HTML
535 535
 	 */
536
-	protected function _update_payment_method_button( EE_Payment_Method $payment_method ) {
536
+	protected function _update_payment_method_button(EE_Payment_Method $payment_method) {
537 537
 		$update_button = new EE_Submit_Input(
538 538
 			array(
539 539
 				'name' => 'submit',
540
-				'html_id' 		=> 'save_' . $payment_method->slug() . '_settings',
541
-				'default' 		=> sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ),
540
+				'html_id' 		=> 'save_'.$payment_method->slug().'_settings',
541
+				'default' 		=> sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()),
542 542
 				'html_label' => EEH_HTML::nbsp()
543 543
 			)
544 544
 		);
545 545
 		return new EE_Form_Section_HTML(
546
-			EEH_HTML::no_row( EEH_HTML::br(2) ) .
546
+			EEH_HTML::no_row(EEH_HTML::br(2)).
547 547
 			EEH_HTML::tr(
548
-				EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) .
548
+				EEH_HTML::th(__('Update Settings', 'event_espresso')).
549 549
 				EEH_HTML::td(
550 550
 					$update_button->get_html_for_input()
551 551
 				)
@@ -562,11 +562,11 @@  discard block
 block discarded – undo
562 562
 	 * @param \EE_Payment_Method $payment_method
563 563
 	 * @return \EE_Form_Section_Proper
564 564
 	 */
565
-	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) {
566
-		$link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );
565
+	protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) {
566
+		$link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name());
567 567
 		return new EE_Form_Section_HTML(
568 568
 			EEH_HTML::tr(
569
-				EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) .
569
+				EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')).
570 570
 				EEH_HTML::td(
571 571
 					EEH_HTML::link(
572 572
 						EE_Admin_Page::add_query_args_and_nonce(
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 						),
579 579
 						$link_text_and_title,
580 580
 						$link_text_and_title,
581
-						'deactivate_' . $payment_method->slug(),
581
+						'deactivate_'.$payment_method->slug(),
582 582
 						'espresso-button button-secondary'
583 583
 					)
584 584
 				)
@@ -594,12 +594,12 @@  discard block
 block discarded – undo
594 594
 	 * @param \EE_Payment_Method $payment_method
595 595
 	 * @return \EE_Form_Section_Proper
596 596
 	 */
597
-	protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) {
598
-		$link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() );
597
+	protected function _activate_payment_method_button(EE_Payment_Method $payment_method) {
598
+		$link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name());
599 599
 		return new EE_Form_Section_Proper(
600 600
 			array(
601
-				'name' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
602
-				'html_id' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
601
+				'name' 	=> 'activate_'.$payment_method->slug().'_settings_form',
602
+				'html_id' 	=> 'activate_'.$payment_method->slug().'_settings_form',
603 603
 				'action' 	=> '#',
604 604
 				'layout_strategy'		=> new EE_Admin_Two_Column_Layout(),
605 605
 				'subsections' 			=> apply_filters(
@@ -607,17 +607,17 @@  discard block
 block discarded – undo
607 607
 					array(
608 608
 						new EE_Form_Section_HTML(
609 609
 							EEH_HTML::tr(
610
-								EEH_HTML::td( $payment_method->type_obj()->introductory_html(),
610
+								EEH_HTML::td($payment_method->type_obj()->introductory_html(),
611 611
 									'',
612 612
 									'',
613 613
 									'',
614 614
 									'colspan="2"' 
615 615
 								)
616
-							) . 
616
+							). 
617 617
 							EEH_HTML::tr(
618 618
 								EEH_HTML::th(
619
-									EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' ))
620
-								) .
619
+									EEH_HTML::label(__('Click to Activate ', 'event_espresso'))
620
+								).
621 621
 								EEH_HTML::td(
622 622
 									EEH_HTML::link(
623 623
 										EE_Admin_Page::add_query_args_and_nonce(
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 										),
630 630
 										$link_text_and_title,
631 631
 										$link_text_and_title,
632
-										'activate_' . $payment_method->slug(),
632
+										'activate_'.$payment_method->slug(),
633 633
 										'espresso-button-green button-primary'
634 634
 									)
635 635
 								)
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 	protected function _fine_print() {
652 652
 		return new EE_Form_Section_HTML(
653 653
 			EEH_HTML::tr(
654
-				EEH_HTML::th() .
654
+				EEH_HTML::th().
655 655
 				EEH_HTML::td(
656
-					EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )
656
+					EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')
657 657
 				)
658 658
 			)
659 659
 		);
@@ -665,15 +665,15 @@  discard block
 block discarded – undo
665 665
 	 * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far)
666 666
 	 * @global WP_User $current_user
667 667
 	 */
668
-	protected function _activate_payment_method(){
669
-		if(isset($this->_req_data['payment_method_type'])){
668
+	protected function _activate_payment_method() {
669
+		if (isset($this->_req_data['payment_method_type'])) {
670 670
 			$payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']);
671 671
 			//see if one exists
672
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
673
-			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );
672
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
673
+			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type);
674 674
 
675
-			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug()));
676
-		}else{
675
+			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug()));
676
+		} else {
677 677
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
678 678
 		}
679 679
 	}
@@ -681,14 +681,14 @@  discard block
 block discarded – undo
681 681
 	/**
682 682
 	 * Deactivates the payment method with the specified slug, and redirects.
683 683
 	 */
684
-	protected function _deactivate_payment_method(){
685
-		if(isset($this->_req_data['payment_method'])){
684
+	protected function _deactivate_payment_method() {
685
+		if (isset($this->_req_data['payment_method'])) {
686 686
 			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
687 687
 			//deactivate it
688 688
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
689
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );
690
-			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug));
691
-		}else{
689
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug);
690
+			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug));
691
+		} else {
692 692
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default'));
693 693
 		}
694 694
 	}
@@ -702,46 +702,46 @@  discard block
 block discarded – undo
702 702
 	 * subsequently called 'headers_sent_func' which is _payment_methods_list)
703 703
 	 * @return void
704 704
 	 */
705
-	protected function _update_payment_method(){
706
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
705
+	protected function _update_payment_method() {
706
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
707 707
 			//ok let's find which gateway form to use based on the form input
708 708
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
709 709
 			/** @var $correct_pmt_form_to_use EE_Payment_Method_Form */
710 710
 			$correct_pmt_form_to_use = NULL;
711 711
 			$payment_method = NULL;
712
-			foreach( EEM_Payment_Method::instance()->get_all() as $payment_method){
712
+			foreach (EEM_Payment_Method::instance()->get_all() as $payment_method) {
713 713
 				//get the form and simplify it, like what we do when we display it
714
-				$pmt_form = $this->_generate_payment_method_settings_form( $payment_method );
715
-				if($pmt_form->form_data_present_in($this->_req_data)){
714
+				$pmt_form = $this->_generate_payment_method_settings_form($payment_method);
715
+				if ($pmt_form->form_data_present_in($this->_req_data)) {
716 716
 					$correct_pmt_form_to_use = $pmt_form;
717 717
 					break;
718 718
 				}
719 719
 			}
720 720
 			//if we couldn't find the correct payment method type...
721
-			if( ! $correct_pmt_form_to_use ){
721
+			if ( ! $correct_pmt_form_to_use) {
722 722
 				EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
723 723
 				$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
724 724
 			}
725 725
 			$correct_pmt_form_to_use->receive_form_submission($this->_req_data);
726
-			if($correct_pmt_form_to_use->is_valid()){
727
-				$subsection_name = 'payment_method_settings_' . $payment_method->slug();
728
-				$payment_settings_subform = $correct_pmt_form_to_use->get_subsection( $subsection_name );
729
-				if( ! $payment_settings_subform instanceof EE_Payment_Method_Form ) {
726
+			if ($correct_pmt_form_to_use->is_valid()) {
727
+				$subsection_name = 'payment_method_settings_'.$payment_method->slug();
728
+				$payment_settings_subform = $correct_pmt_form_to_use->get_subsection($subsection_name);
729
+				if ( ! $payment_settings_subform instanceof EE_Payment_Method_Form) {
730 730
 					throw new EE_Error( 
731 731
 						sprintf(
732
-							__( 'The payment method could not be saved because the form sections were misnamed. We expected to find %1$s, but did not.','event_espresso' ),
732
+							__('The payment method could not be saved because the form sections were misnamed. We expected to find %1$s, but did not.', 'event_espresso'),
733 733
 							$subsection_name
734 734
 						)
735 735
 					);
736 736
 				}
737 737
 				$payment_settings_subform->save();
738 738
 				/** @var $pm EE_Payment_Method */
739
-				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$payment_method->slug()));
740
-			}else{
739
+				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$payment_method->slug()));
740
+			} else {
741 741
 				EE_Error::add_error(
742 742
 					sprintf(
743 743
 						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'),
744
-						$payment_method instanceof EE_PMT_Base ? $payment_method->pretty_name() : __( '"(unknown)"', 'event_espresso' )
744
+						$payment_method instanceof EE_PMT_Base ? $payment_method->pretty_name() : __('"(unknown)"', 'event_espresso')
745 745
 					),
746 746
 					__FILE__,
747 747
 					__FUNCTION__,
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 	protected function _payment_settings() {
759 759
 
760 760
 		$this->_template_args['values'] = $this->_yes_no_values;
761
-		$this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE;
761
+		$this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE;
762 762
 
763
-		$this->_set_add_edit_form_tags( 'update_payment_settings' );
764
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
765
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE );
763
+		$this->_set_add_edit_form_tags('update_payment_settings');
764
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
765
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE);
766 766
 		$this->display_admin_page_with_sidebar();
767 767
 
768 768
 	}
@@ -776,8 +776,8 @@  discard block
 block discarded – undo
776 776
 	*		@return array
777 777
 	*/
778 778
 	protected function _update_payment_settings() {
779
-		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE;
780
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
779
+		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE;
780
+		EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG);
781 781
 
782 782
 //		 $superform = new EE_Form_Section_Proper(
783 783
 //		 	array(
@@ -797,9 +797,9 @@  discard block
 block discarded – undo
797 797
 //		 	$this->_redirect_after_action( 0, 'settings', 'updated', array( 'action' => 'payment_settings' ) );
798 798
 //		 }
799 799
 
800
-		$what = __('Payment Settings','event_espresso');
801
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
802
-		$this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) );
800
+		$what = __('Payment Settings', 'event_espresso');
801
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
802
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings'));
803 803
 
804 804
 	}
805 805
 	protected function _payment_log_overview_list_table() {
@@ -825,18 +825,18 @@  discard block
 block discarded – undo
825 825
 	 * @param bool $count
826 826
 	 * @return array
827 827
 	 */
828
-	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){
829
-		EE_Registry::instance()->load_model( 'Change_Log' );
828
+	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) {
829
+		EE_Registry::instance()->load_model('Change_Log');
830 830
 		//we may need to do multiple queries (joining differently), so we actually wan tan array of query params
831
-		$query_params =  array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
831
+		$query_params = array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
832 832
 		//check if they've selected a specific payment method
833
-		if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){
833
+		if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') {
834 834
 			$query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'],
835 835
 				'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']);
836 836
 		}
837 837
 		//take into account search
838
-		if(isset($this->_req_data['s']) && $this->_req_data['s']){
839
-			$similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%');
838
+		if (isset($this->_req_data['s']) && $this->_req_data['s']) {
839
+			$similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%');
840 840
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string;
841 841
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string;
842 842
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string;
@@ -851,48 +851,48 @@  discard block
 block discarded – undo
851 851
 			$query_params[0]['OR*s']['LOG_message'] = $similarity_string;
852 852
 
853 853
 		}
854
-		if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){
854
+		if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) {
855 855
 			//add date
856
-			$start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] );
857
-			$end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] );
856
+			$start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']);
857
+			$end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']);
858 858
 			//make sure our timestamps start and end right at the boundaries for each day
859
-			$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
860
-			$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
859
+			$start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
860
+			$end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
861 861
 
862 862
 			//convert to timestamps
863
-			$start_date = strtotime( $start_date );
864
-			$end_date = strtotime( $end_date );
863
+			$start_date = strtotime($start_date);
864
+			$end_date = strtotime($end_date);
865 865
 
866 866
 			//makes sure start date is the lowest value and vice versa
867
-			$start_date = min( $start_date, $end_date );
868
-			$end_date = max( $start_date, $end_date );
867
+			$start_date = min($start_date, $end_date);
868
+			$end_date = max($start_date, $end_date);
869 869
 
870 870
 			//convert for query
871
-			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
872
-			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
871
+			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
872
+			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
873 873
 
874
-			$query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date));
874
+			$query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date));
875 875
 
876 876
 		}
877
-		if($count){
877
+		if ($count) {
878 878
 			return EEM_Change_Log::instance()->count($query_params);
879 879
 		}
880
-		if(isset($this->_req_data['order'])){
881
-			$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
880
+		if (isset($this->_req_data['order'])) {
881
+			$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
882 882
 			$query_params['order_by'] = array('LOG_time' => $sort);
883
-		}else{
883
+		} else {
884 884
 				$query_params['order_by'] = array('LOG_time' => 'DESC');
885 885
 		}
886
-		$offset = ($current_page-1)*$per_page;
886
+		$offset = ($current_page - 1) * $per_page;
887 887
 
888
-		if( ! isset($this->_req_data['download_results'])){
889
-			$query_params['limit'] = array( $offset, $per_page );
888
+		if ( ! isset($this->_req_data['download_results'])) {
889
+			$query_params['limit'] = array($offset, $per_page);
890 890
 		}
891 891
 
892 892
 
893 893
 
894 894
 		//now they've requested to instead just download the file instead of viewing it.
895
-		if(isset($this->_req_data['download_results'])){
895
+		if (isset($this->_req_data['download_results'])) {
896 896
 			$wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params);
897 897
 			header('Content-Disposition: attachment');
898 898
 			header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url()));
@@ -914,36 +914,36 @@  discard block
 block discarded – undo
914 914
 	 * @param EE_Change_Log $logB
915 915
 	 * @return int
916 916
 	 */
917
-	protected function _sort_logs_again($logA,$logB){
917
+	protected function _sort_logs_again($logA, $logB) {
918 918
 		$timeA = $logA->get_raw('LOG_time');
919 919
 		$timeB = $logB->get_raw('LOG_time');
920
-		if($timeA == $timeB){
920
+		if ($timeA == $timeB) {
921 921
 			return 0;
922 922
 		}
923 923
 		$comparison = $timeA < $timeB ? -1 : 1;
924
-		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){
924
+		if (strtoupper($this->_sort_logs_again_direction) == 'DESC') {
925 925
 			return $comparison * -1;
926
-		}else{
926
+		} else {
927 927
 			return $comparison;
928 928
 		}
929 929
 	}
930 930
 
931 931
 	protected function _payment_log_details() {
932
-		EE_Registry::instance()->load_model( 'Change_Log' );
932
+		EE_Registry::instance()->load_model('Change_Log');
933 933
 		/** @var $payment_log EE_Change_Log */
934 934
 		$payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']);
935 935
 		$payment_method = NULL;
936 936
 		$transaction = NULL;
937
-		if( $payment_log instanceof EE_Change_Log ){
938
-			if( $payment_log->object() instanceof EE_Payment ){
937
+		if ($payment_log instanceof EE_Change_Log) {
938
+			if ($payment_log->object() instanceof EE_Payment) {
939 939
 				$payment_method = $payment_log->object()->payment_method();
940 940
 				$transaction = $payment_log->object()->transaction();
941
-			}elseif($payment_log->object() instanceof EE_Payment_Method){
941
+			}elseif ($payment_log->object() instanceof EE_Payment_Method) {
942 942
 				$payment_method = $payment_log->object();
943 943
 			}
944 944
 		}
945 945
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
946
-			EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php',
946
+			EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php',
947 947
 			array(
948 948
 				'payment_log'=>$payment_log,
949 949
 				'payment_method'=>$payment_method,
Please login to merge, or discard this patch.
modules/batch/EED_Batch.module.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
 		wp_enqueue_script( 'batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array( 'progress_bar' ));
156 156
 		//just copy the bits of EE admin's eei18n that we need in the JS
157 157
 		wp_localize_script(
158
-		    'batch_runner',
159
-            'eei18n',
160
-            array(
161
-                'ajax_url' => WP_AJAX_URL,
162
-                'is_admin' => (bool)is_admin(),
163
-                'error_message' => esc_html__('An error occurred and the job has been stopped.', 'event_espresso')
164
-            )
165
-        );
158
+			'batch_runner',
159
+			'eei18n',
160
+			array(
161
+				'ajax_url' => WP_AJAX_URL,
162
+				'is_admin' => (bool)is_admin(),
163
+				'error_message' => esc_html__('An error occurred and the job has been stopped.', 'event_espresso')
164
+			)
165
+		);
166 166
 		$job_handler_classname = stripslashes( $_GET[ 'job_handler' ] );
167 167
 		$request_data = array_diff_key( 
168 168
 				$_REQUEST, 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 		if ( NULL === error_get_last() || ! headers_sent() ) {
259 259
 			header('Content-Type: application/json; charset=UTF-8');
260 260
 		}
261
-        echo wp_json_encode( $json );
261
+		echo wp_json_encode( $json );
262 262
 		exit();
263 263
 	}
264 264
 	
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
  * @since		 	   4.8.30.rc.007
18 18
  *
19 19
  */
20
-if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
21
-	exit( 'No direct script access allowed' );
20
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
21
+	exit('No direct script access allowed');
22 22
 }
23 23
 
24
-define( 'BATCH_URL', plugin_dir_url( __FILE__ ) );
24
+define('BATCH_URL', plugin_dir_url(__FILE__));
25 25
 
26
-class EED_Batch extends EED_Module{
26
+class EED_Batch extends EED_Module {
27 27
 	
28 28
 	/**
29 29
 	 * Possibly value for $_REQUEST[ 'batch' ]. Indicates to run a job that
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	public static function set_hooks() {
71 71
 		//because this is a possibel attack vector, let's have this disabled until 
72 72
 		//we at least have a real use for it on the frontend
73
-		if( apply_filters( 'FHEE__EED_Batch__set_hooks__enable_frontend_batch', false ) ) {
74
-			add_action( 'wp_enqueue_scripts', array( self::instance(), 'enqueue_scripts' ) );
75
-			add_filter( 'template_include', array( self::instance(), 'override_template' ), 99 );
73
+		if (apply_filters('FHEE__EED_Batch__set_hooks__enable_frontend_batch', false)) {
74
+			add_action('wp_enqueue_scripts', array(self::instance(), 'enqueue_scripts'));
75
+			add_filter('template_include', array(self::instance(), 'override_template'), 99);
76 76
 		}
77 77
 	}
78 78
 	
@@ -80,28 +80,28 @@  discard block
 block discarded – undo
80 80
 	 * Initializes some hooks for the admin in order to run batch jobs
81 81
 	 */
82 82
 	public static function set_hooks_admin() {
83
-		add_action( 'admin_menu', array( self::instance(), 'register_admin_pages' ) );
84
-		add_action( 'admin_enqueue_scripts', array( self::instance(), 'enqueue_scripts' ) );
83
+		add_action('admin_menu', array(self::instance(), 'register_admin_pages'));
84
+		add_action('admin_enqueue_scripts', array(self::instance(), 'enqueue_scripts'));
85 85
 		
86 86
 		//ajax
87
-		add_action('wp_ajax_espresso_batch_continue',array(self::instance(),'batch_continue'));
88
-		add_action('wp_ajax_espresso_batch_cleanup',array(self::instance(),'batch_cleanup'));
89
-		add_action('wp_ajax_nopriv_espresso_batch_continue',array(self::instance(),'batch_continue'));
90
-		add_action('wp_ajax_nopriv_espresso_batch_cleanup',array(self::instance(),'batch_cleanup'));
87
+		add_action('wp_ajax_espresso_batch_continue', array(self::instance(), 'batch_continue'));
88
+		add_action('wp_ajax_espresso_batch_cleanup', array(self::instance(), 'batch_cleanup'));
89
+		add_action('wp_ajax_nopriv_espresso_batch_continue', array(self::instance(), 'batch_continue'));
90
+		add_action('wp_ajax_nopriv_espresso_batch_cleanup', array(self::instance(), 'batch_cleanup'));
91 91
 	}
92 92
 	
93 93
 	/**
94 94
 	 * Enqueues batch scripts on the frontend or admin, and creates a job
95 95
 	 */
96 96
 	public function enqueue_scripts() { 
97
-		if( isset( $_REQUEST[ 'espresso_batch' ] ) 
97
+		if (isset($_REQUEST['espresso_batch']) 
98 98
 			|| 
99 99
 			( 
100
-				isset( $_REQUEST[ 'page' ] )
101
-				&& $_REQUEST[ 'page' ] == 'espresso_batch'
100
+				isset($_REQUEST['page'])
101
+				&& $_REQUEST['page'] == 'espresso_batch'
102 102
 			) 
103 103
 		) { 
104
-			switch( $this->batch_request_type() ) {
104
+			switch ($this->batch_request_type()) {
105 105
 				case self::batch_job:
106 106
 					$this->enqueue_scripts_styles_batch_create();
107 107
 					break;
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function enqueue_scripts_styles_batch_create() {	
119 119
 		$job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job();
120
-		wp_enqueue_script( 'batch_runner_init', BATCH_URL . 'assets/batch_runner_init.js', array( 'batch_runner' ), EVENT_ESPRESSO_VERSION, true );
121
-		wp_localize_script( 'batch_runner_init', 'ee_job_response', $job_response->to_array() );
122
-		wp_localize_script( 'batch_runner_init', 'ee_job_i18n', 
120
+		wp_enqueue_script('batch_runner_init', BATCH_URL.'assets/batch_runner_init.js', array('batch_runner'), EVENT_ESPRESSO_VERSION, true);
121
+		wp_localize_script('batch_runner_init', 'ee_job_response', $job_response->to_array());
122
+		wp_localize_script('batch_runner_init', 'ee_job_i18n', 
123 123
 			array(
124
-				'return_url' => $_REQUEST['return_url' ],
124
+				'return_url' => $_REQUEST['return_url'],
125 125
 			));
126 126
 	}
127 127
 	
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
 	public function enqueue_scripts_styles_batch_file_create() {
132 132
 		//creates a job based on the request variable
133 133
 		$job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job();
134
-		wp_enqueue_script( 'batch_file_runner_init', BATCH_URL . 'assets/batch_file_runner_init.js', array( 'batch_runner' ), EVENT_ESPRESSO_VERSION, true );
135
-		wp_localize_script( 'batch_file_runner_init', 'ee_job_response', $job_response->to_array() );
136
-		wp_localize_script( 'batch_file_runner_init', 'ee_job_i18n', 
134
+		wp_enqueue_script('batch_file_runner_init', BATCH_URL.'assets/batch_file_runner_init.js', array('batch_runner'), EVENT_ESPRESSO_VERSION, true);
135
+		wp_localize_script('batch_file_runner_init', 'ee_job_response', $job_response->to_array());
136
+		wp_localize_script('batch_file_runner_init', 'ee_job_i18n', 
137 137
 				array(
138 138
 					'download_and_redirecting' => sprintf( 
139 139
 							__('File Generation complete. Downloading, and %1$sredirecting%2$s...', 'event_espresso'),
140
-							'<a href="' . $_REQUEST['return_url' ] .'">',
140
+							'<a href="'.$_REQUEST['return_url'].'">',
141 141
 							'</a>' ),
142
-					'return_url' => $_REQUEST['return_url' ],
142
+					'return_url' => $_REQUEST['return_url'],
143 143
 				));
144 144
 	}
145 145
 	
@@ -150,26 +150,26 @@  discard block
 block discarded – undo
150 150
 	 * @return \EventEspressoBatchRequest\Helpers\JobStepResponse
151 151
 	 */
152 152
 	protected function _enqueue_batch_job_scripts_and_styles_and_start_job() {
153
-		wp_register_script( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js', array( 'jquery' ) );
154
-		wp_enqueue_style( 'progress_bar', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION );
155
-		wp_enqueue_script( 'batch_runner', EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js', array( 'progress_bar' ));
153
+		wp_register_script('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.js', array('jquery'));
154
+		wp_enqueue_style('progress_bar', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.css', array(), EVENT_ESPRESSO_VERSION);
155
+		wp_enqueue_script('batch_runner', EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/batch_runner.js', array('progress_bar'));
156 156
 		//just copy the bits of EE admin's eei18n that we need in the JS
157 157
 		wp_localize_script(
158 158
 		    'batch_runner',
159 159
             'eei18n',
160 160
             array(
161 161
                 'ajax_url' => WP_AJAX_URL,
162
-                'is_admin' => (bool)is_admin(),
162
+                'is_admin' => (bool) is_admin(),
163 163
                 'error_message' => esc_html__('An error occurred and the job has been stopped.', 'event_espresso')
164 164
             )
165 165
         );
166
-		$job_handler_classname = stripslashes( $_GET[ 'job_handler' ] );
166
+		$job_handler_classname = stripslashes($_GET['job_handler']);
167 167
 		$request_data = array_diff_key( 
168 168
 				$_REQUEST, 
169
-				array_flip( array( 'action',  'page', 'ee', 'batch' ) ) );
169
+				array_flip(array('action', 'page', 'ee', 'batch')) );
170 170
 		$batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
171 171
 		//eg 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport'
172
-		$job_response = $batch_runner->create_job( $job_handler_classname, $request_data );
172
+		$job_response = $batch_runner->create_job($job_handler_classname, $request_data);
173 173
 		//remember the response for later. We need it to display the page body
174 174
 		$this->_job_step_response = $job_response;
175 175
 		return $job_response;
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
 	 * @param string $template
181 181
 	 * @return string
182 182
 	 */
183
-	public function override_template( $template ) {
184
-		if( isset( $_REQUEST[ 'espresso_batch' ] ) && isset( $_REQUEST[ 'batch' ] ) ) {
185
-			return EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_frontend_wrapper.template.html';
183
+	public function override_template($template) {
184
+		if (isset($_REQUEST['espresso_batch']) && isset($_REQUEST['batch'])) {
185
+			return EE_MODULES.'batch'.DS.'templates'.DS.'batch_frontend_wrapper.template.html';
186 186
 		}
187 187
 		return $template;
188 188
 	}
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	public function register_admin_pages() {
194 194
 		add_submenu_page( 
195 195
 			'', //parent slug. we don't want this to actually appear in the menu
196
-			__( 'Batch Job', 'event_espresso' ), //page title
196
+			__('Batch Job', 'event_espresso'), //page title
197 197
 			'n/a', //menu title
198 198
 			'read', //we want this page to actually be accessible to anyone,  
199 199
 			'espresso_batch', //menu slug
200
-			array( self::instance(), 'show_admin_page' )
200
+			array(self::instance(), 'show_admin_page')
201 201
 		);
202 202
 	}
203 203
 	
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	public function show_admin_page() { 
209 209
 		echo EEH_Template::locate_template( 
210
-			EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_wrapper.template.html', 
211
-			array( 'batch_request_type' => $this->batch_request_type() )
210
+			EE_MODULES.'batch'.DS.'templates'.DS.'batch_wrapper.template.html', 
211
+			array('batch_request_type' => $this->batch_request_type())
212 212
 		);
213 213
 	}
214 214
 	
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 	 * Receives ajax calls for continuing a job
217 217
 	 */
218 218
 	public function batch_continue() {
219
-		$job_id = sanitize_text_field( $_REQUEST[ 'job_id' ] );
219
+		$job_id = sanitize_text_field($_REQUEST['job_id']);
220 220
 		$batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
221
-		$response_obj = $batch_runner->continue_job( $job_id);
222
-		$this->_return_json( $response_obj->to_array() );
221
+		$response_obj = $batch_runner->continue_job($job_id);
222
+		$this->_return_json($response_obj->to_array());
223 223
 	}
224 224
 	
225 225
 	/**
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 	 * @return type
228 228
 	 */
229 229
 	public function batch_cleanup() {
230
-		$job_id = sanitize_text_field( $_REQUEST[ 'job_id' ] );
230
+		$job_id = sanitize_text_field($_REQUEST['job_id']);
231 231
 		$batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
232
-		$response_obj = $batch_runner->cleanup_job( $job_id );
233
-		$this->_return_json( $response_obj->to_array() );
232
+		$response_obj = $batch_runner->cleanup_job($job_id);
233
+		$this->_return_json($response_obj->to_array());
234 234
 	}
235 235
 	
236 236
 	
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 *	'isEEajax' => true,//indicates this is a response from EE
247 247
 	 * )
248 248
 	 */
249
-	protected function _return_json( $data ) {
249
+	protected function _return_json($data) {
250 250
 		$json = array(
251 251
 			'notices' => EE_Error::get_notices(),
252 252
 			'data' => $data,
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
 
256 256
 
257 257
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
258
-		if ( NULL === error_get_last() || ! headers_sent() ) {
258
+		if (NULL === error_get_last() || ! headers_sent()) {
259 259
 			header('Content-Type: application/json; charset=UTF-8');
260 260
 		}
261
-        echo wp_json_encode( $json );
261
+        echo wp_json_encode($json);
262 262
 		exit();
263 263
 	}
264 264
 	
@@ -274,16 +274,16 @@  discard block
 block discarded – undo
274 274
 	 * @return string: EED_Batch::batch_job, EED_Batch::batch_file_job, EED_Batch::batch_not_job
275 275
 	 */
276 276
 	public function batch_request_type() {
277
-		if( $this->_batch_request_type === null ) {
278
-			if( isset( $_GET[ 'batch' ] ) ) {
279
-				if( $_GET[ 'batch' ] == self::batch_job ) {
277
+		if ($this->_batch_request_type === null) {
278
+			if (isset($_GET['batch'])) {
279
+				if ($_GET['batch'] == self::batch_job) {
280 280
 					$this->_batch_request_type = self::batch_job;
281
-				} elseif( $_GET[ 'batch' ] == self::batch_file_job ) {
281
+				} elseif ($_GET['batch'] == self::batch_file_job) {
282 282
 					$this->_batch_request_type = self::batch_file_job;
283 283
 				}
284 284
 			}
285 285
 			//if we didn't find that it was a batch request, indicate it wasn't
286
-			if( $this->_batch_request_type === null ) {
286
+			if ($this->_batch_request_type === null) {
287 287
 				$this->_batch_request_type = self::batch_not_job;
288 288
 			}
289 289
 		}
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 * Unnecessary
295 295
 	 * @param type $WP
296 296
 	 */
297
-	public function run( $WP ) {
297
+	public function run($WP) {
298 298
 		
299 299
 	}
300 300
 
Please login to merge, or discard this patch.
modules/ticket_selector/templates/ticket_details.template.php 2 patches
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -22,38 +22,38 @@  discard block
 block discarded – undo
22 22
                 <p><?php echo $ticket->description(); ?></p>
23 23
 
24 24
                 <?php
25
-                do_action(
26
-                    'AHEE__ticket_selector_chart_template__ticket_details__after_description',
27
-                    $ticket,
28
-                    $ticket_price,
29
-                    $display_ticket_price
30
-                );
31
-                ?>
25
+				do_action(
26
+					'AHEE__ticket_selector_chart_template__ticket_details__after_description',
27
+					$ticket,
28
+					$ticket_price,
29
+					$display_ticket_price
30
+				);
31
+				?>
32 32
 
33 33
                 <section class="tckt-slctr-tkt-sale-dates-sctn">
34 34
                     <h5><?php echo apply_filters(
35
-                        'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading',
36
-                        esc_html__( 'Sale Dates', 'event_espresso' )
37
-                        ); ?>
35
+						'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading',
36
+						esc_html__( 'Sale Dates', 'event_espresso' )
37
+						); ?>
38 38
                     </h5>
39 39
                     <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters(
40
-                        'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message',
41
-                        esc_html__( 'The dates when this option is available for purchase.', 'event_espresso' )
42
-                        ); ?></span>
40
+						'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message',
41
+						esc_html__( 'The dates when this option is available for purchase.', 'event_espresso' )
42
+						); ?></span>
43 43
                     <br/>
44 44
                     <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters(
45
-                        'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale',
46
-                        esc_html__( 'Goes On Sale:', 'event_espresso' )
47
-                        ); ?></span>
45
+						'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale',
46
+						esc_html__( 'Goes On Sale:', 'event_espresso' )
47
+						); ?></span>
48 48
                     <span class="dashicons dashicons-calendar"></span>
49 49
                     <?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format) . ' &nbsp; '; ?>
50 50
                     <span  class="dashicons dashicons-clock"></span>
51 51
                     <?php echo $ticket->get_i18n_datetime('TKT_start_date',$time_format); ?>
52 52
                     <br/>
53 53
                     <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters(
54
-                        'FHEE__ticket_selector_chart_template__ticket_details_sales_end',
55
-                        esc_html__( 'Sales End:', 'event_espresso' )
56
-                        ); ?></span>
54
+						'FHEE__ticket_selector_chart_template__ticket_details_sales_end',
55
+						esc_html__( 'Sales End:', 'event_espresso' )
56
+						); ?></span>
57 57
                     <span class="dashicons dashicons-calendar"></span>
58 58
                     <?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format) . ' &nbsp; '; ?>
59 59
                     <span class="dashicons dashicons-clock"></span>
@@ -67,34 +67,34 @@  discard block
 block discarded – undo
67 67
                 <?php if ( $ticket->min() && $ticket->max() ) { ?>
68 68
                     <section class="tckt-slctr-tkt-quantities-sctn">
69 69
                         <h5><?php echo apply_filters(
70
-                            'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading',
71
-                            esc_html__( 'Purchasable Quantities', 'event_espresso' )
72
-                            ); ?></h5>
70
+							'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading',
71
+							esc_html__( 'Purchasable Quantities', 'event_espresso' )
72
+							); ?></h5>
73 73
                         <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters(
74
-                            'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message',
75
-                            esc_html__(
76
-                            'The number of tickets that can be purchased per transaction (if available).',
77
-                            'event_espresso'
78
-                            )
79
-                            ); ?></span><br/>
74
+							'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message',
75
+							esc_html__(
76
+							'The number of tickets that can be purchased per transaction (if available).',
77
+							'event_espresso'
78
+							)
79
+							); ?></span><br/>
80 80
                         <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters(
81
-                            'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty',
82
-                            esc_html__( 'Minimum Qty:', 'event_espresso' )
83
-                            ); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
81
+							'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty',
82
+							esc_html__( 'Minimum Qty:', 'event_espresso' )
83
+							); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
84 84
                         <?php if ( $ticket->min() > $remaining ) { ?> &nbsp; <span
85 85
                         class="important-notice small-text"><?php echo apply_filters(
86
-                        'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message',
87
-                        esc_html__(
88
-                        'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining',
89
-                        'event_espresso'
90
-                        )
91
-                        ); ?></span><?php } ?><br/>
86
+						'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message',
87
+						esc_html__(
88
+						'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining',
89
+						'event_espresso'
90
+						)
91
+						); ?></span><?php } ?><br/>
92 92
                         <?php //$max = min( $max, $max_atndz );?>
93 93
                         <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters(
94
-                            'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty',
95
-                            esc_html__( 'Maximum Qty:', 'event_espresso' )
96
-                            ); ?></span><?php echo $ticket->max() === EE_INF ? esc_html__( 'no limit', 'event_espresso' )
97
-                        : max( $ticket->max(), 1 ); ?><br/>
94
+							'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty',
95
+							esc_html__( 'Maximum Qty:', 'event_espresso' )
96
+							); ?></span><?php echo $ticket->max() === EE_INF ? esc_html__( 'no limit', 'event_espresso' )
97
+						: max( $ticket->max(), 1 ); ?><br/>
98 98
                     </section>
99 99
                     <br/>
100 100
                 <?php } ?>
@@ -102,43 +102,43 @@  discard block
 block discarded – undo
102 102
                 <?php if ( ( ! defined( 'EE_DECAF' ) || EE_DECAF !== true ) && $ticket->uses() !== EE_INF ) { ?>
103 103
                     <section class="tckt-slctr-tkt-uses-sctn">
104 104
                         <h5><?php echo apply_filters(
105
-                                'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading',
106
-                                esc_html__( 'Event Date Ticket Uses', 'event_espresso' )
107
-                            ); ?></h5>
105
+								'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading',
106
+								esc_html__( 'Event Date Ticket Uses', 'event_espresso' )
107
+							); ?></h5>
108 108
                         <span class="drk-grey-text small-text no-bold"> - <?php
109
-                            echo apply_filters(
110
-                            'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message',
111
-                            sprintf(
112
-                                esc_html__(
113
-                                    'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s',
114
-                                    'event_espresso'
115
-                                ),
116
-                                '<br/>',
117
-                                '<strong>',
118
-                                '</strong>'
119
-                                )
120
-                            );
121
-                            ?></span><br/>
109
+							echo apply_filters(
110
+							'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message',
111
+							sprintf(
112
+								esc_html__(
113
+									'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s',
114
+									'event_espresso'
115
+								),
116
+								'<br/>',
117
+								'<strong>',
118
+								'</strong>'
119
+								)
120
+							);
121
+							?></span><br/>
122 122
                         <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters(
123
-                            'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes',
124
-                            esc_html__( '# Datetimes:', 'event_espresso' )
125
-                            ); ?></span><?php echo $ticket->uses(); ?><br/>
123
+							'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes',
124
+							esc_html__( '# Datetimes:', 'event_espresso' )
125
+							); ?></span><?php echo $ticket->uses(); ?><br/>
126 126
                     </section>
127 127
                 <?php } ?>
128 128
 
129 129
                 <?php
130
-                $datetimes = $ticket->datetimes_ordered( $event_is_expired, false );
131
-                $chart_column_width = $show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width';
132
-                if ( ! empty( $datetimes ) ) { ?>
130
+				$datetimes = $ticket->datetimes_ordered( $event_is_expired, false );
131
+				$chart_column_width = $show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width';
132
+				if ( ! empty( $datetimes ) ) { ?>
133 133
                     <section class="tckt-slctr-tkt-datetimes-sctn">
134 134
                         <h5><?php echo apply_filters(
135
-                            'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading',
136
-                            esc_html__( 'Access', 'event_espresso' )
137
-                            ); ?></h5>
135
+							'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading',
136
+							esc_html__( 'Access', 'event_espresso' )
137
+							); ?></h5>
138 138
                         <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters(
139
-                            'FHEE__ticket_selector_chart_template__ticket_details_event_access_message',
140
-                            esc_html__( 'This option allows access to the following dates and times.', 'event_espresso' )
141
-                            ); ?></span>
139
+							'FHEE__ticket_selector_chart_template__ticket_details_event_access_message',
140
+							esc_html__( 'This option allows access to the following dates and times.', 'event_espresso' )
141
+							); ?></span>
142 142
                         <div class="tckt-slctr-tkt-details-tbl-wrap-dv">
143 143
                             <table class="tckt-slctr-tkt-details-tbl">
144 144
                                 <thead>
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
                                     <th class="tckt-slctr-tkt-details-date-th">
147 147
                                         <span class="dashicons dashicons-calendar"></span><span
148 148
                                         class="small-text"><?php echo apply_filters(
149
-                                            'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date',
150
-                                            esc_html__( 'Date ', 'event_espresso' )
151
-                                            ); ?></span>
149
+											'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date',
150
+											esc_html__( 'Date ', 'event_espresso' )
151
+											); ?></span>
152 152
                                     </th>
153 153
                                     <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>">
154 154
                                         <span class="dashicons dashicons-clock"></span><span
@@ -157,98 +157,98 @@  discard block
 block discarded – undo
157 157
                                     <?php if ( $show_ticket_sale_columns ) : ?>
158 158
                                         <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr">
159 159
                                             <span class="smaller-text"><?php echo apply_filters(
160
-                                                'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold',
161
-                                                sprintf( esc_html__( 'Sold', 'event_espresso' ), '<br/>' )
162
-                                                ); ?></span>
160
+												'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold',
161
+												sprintf( esc_html__( 'Sold', 'event_espresso' ), '<br/>' )
162
+												); ?></span>
163 163
                                         </th>
164 164
                                         <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr">
165 165
                                             <span class="smaller-text"><?php echo apply_filters(
166
-                                                'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left',
167
-                                                sprintf( esc_html__( 'Remaining', 'event_espresso' ), '<br/>' )
168
-                                                ); ?></span>
166
+												'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left',
167
+												sprintf( esc_html__( 'Remaining', 'event_espresso' ), '<br/>' )
168
+												); ?></span>
169 169
                                         </th>
170 170
                                         <th
171 171
                                         class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr">
172 172
                                             <span class="smaller-text"><?php echo apply_filters(
173
-                                                'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold',
174
-                                                sprintf( esc_html__( 'Total%sSold', 'event_espresso' ), '<br/>' )
175
-                                                ); ?></span>
173
+												'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold',
174
+												sprintf( esc_html__( 'Total%sSold', 'event_espresso' ), '<br/>' )
175
+												); ?></span>
176 176
                                         </th>
177 177
                                         <th
178 178
                                         class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr">
179 179
                                             <span class="smaller-text"><?php echo apply_filters(
180
-                                                'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left',
181
-                                                sprintf( esc_html__( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )
182
-                                                ); ?></span>
180
+												'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left',
181
+												sprintf( esc_html__( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )
182
+												); ?></span>
183 183
                                         </th>
184 184
                                     <?php endif; //end $show_ticket_sale_columns conditional ?>
185 185
                                 </tr>
186 186
                                 </thead>
187 187
                                 <tbody>
188 188
                                 <?php
189
-                                foreach ( $datetimes as $datetime ) {
190
-                                    if ( $datetime instanceof EE_Datetime ) {
191
-                                        ?>
189
+								foreach ( $datetimes as $datetime ) {
190
+									if ( $datetime instanceof EE_Datetime ) {
191
+										?>
192 192
 
193 193
                                         <tr>
194 194
                                             <td data-th="<?php echo apply_filters(
195
-                                            'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date',
196
-                                            esc_html__( 'Event Date ', 'event_espresso' )
197
-                                            ); ?>" class="small-text">
195
+											'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date',
196
+											esc_html__( 'Event Date ', 'event_espresso' )
197
+											); ?>" class="small-text">
198 198
                                                 <?php $datetime_name = $datetime->name(); ?>
199 199
                                                 <?php echo ! empty( $datetime_name ) ? '<b>'
200
-                                                                                       . $datetime_name
201
-                                                                                       . '</b><br/>' : ''; ?>
200
+																					   . $datetime_name
201
+																					   . '</b><br/>' : ''; ?>
202 202
                                                 <?php echo $datetime->date_range(
203
-                                                $date_format,
204
-                                                esc_html__( ' to  ', 'event_espresso' )
205
-                                                ); ?>
203
+												$date_format,
204
+												esc_html__( ' to  ', 'event_espresso' )
205
+												); ?>
206 206
                                             </td>
207 207
                                             <td data-th="<?php esc_html_e( 'Time ', 'event_espresso' ); ?>"
208 208
                                                 class="cntr small-text">
209 209
                                                 <?php echo $datetime->time_range(
210
-                                                $time_format,
211
-                                                esc_html__( ' to  ', 'event_espresso' )
212
-                                                ); ?>
210
+												$time_format,
211
+												esc_html__( ' to  ', 'event_espresso' )
212
+												); ?>
213 213
                                             </td>
214 214
                                             <?php if ( $show_ticket_sale_columns ) : ?>
215 215
                                                 <td data-th="<?php echo apply_filters(
216
-                                                'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold',
217
-                                                esc_html__( 'Sold', 'event_espresso' )
218
-                                                ); ?>" class="cntr small-text">
216
+												'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold',
217
+												esc_html__( 'Sold', 'event_espresso' )
218
+												); ?>" class="cntr small-text">
219 219
                                                     <?php echo $ticket->sold(); ?>
220 220
                                                 </td>
221 221
                                                 <td data-th="<?php echo apply_filters(
222
-                                                'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left',
223
-                                                esc_html__( 'Remaining', 'event_espresso' )
224
-                                                ); ?>" class="cntr small-text">
222
+												'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left',
223
+												esc_html__( 'Remaining', 'event_espresso' )
224
+												); ?>" class="cntr small-text">
225 225
                                                     <?php echo $remaining === EE_INF
226
-                                                    ? '<span class="smaller-text">' . esc_html__(
227
-                                                    'unlimited ',
228
-                                                    'event_espresso'
229
-                                                    ) . '</span>' : $remaining; ?>
226
+													? '<span class="smaller-text">' . esc_html__(
227
+													'unlimited ',
228
+													'event_espresso'
229
+													) . '</span>' : $remaining; ?>
230 230
                                                 </td>
231 231
                                                 <td data-th="<?php echo apply_filters(
232
-                                                'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold',
233
-                                                esc_html__( 'Total Sold', 'event_espresso' )
234
-                                                ); ?>" class="cntr small-text">
232
+												'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold',
233
+												esc_html__( 'Total Sold', 'event_espresso' )
234
+												); ?>" class="cntr small-text">
235 235
                                                     <?php echo $datetime->sold(); ?>
236 236
                                                 </td>
237 237
                                                 <?php $tkts_left = $datetime->sold_out()
238
-                                                ? '<span class="sold-out smaller-text">' . esc_html__(
239
-                                                'Sold&nbsp;Out',
240
-                                                'event_espresso'
241
-                                                ) . '</span>' : $datetime->spaces_remaining(); ?>
238
+												? '<span class="sold-out smaller-text">' . esc_html__(
239
+												'Sold&nbsp;Out',
240
+												'event_espresso'
241
+												) . '</span>' : $datetime->spaces_remaining(); ?>
242 242
                                                 <td data-th="<?php echo apply_filters(
243
-                                                'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left',
244
-                                                esc_html__( 'Total Spaces Left', 'event_espresso' )
245
-                                                ); ?>" class="cntr small-text">
243
+												'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left',
244
+												esc_html__( 'Total Spaces Left', 'event_espresso' )
245
+												); ?>" class="cntr small-text">
246 246
                                                     <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'
247
-                                                                                       . esc_html__(
248
-                                                                                       'unlimited ',
249
-                                                                                       'event_espresso'
250
-                                                                                       )
251
-                                                                                       . '</span>' : $tkts_left; ?>
247
+																					   . esc_html__(
248
+																					   'unlimited ',
249
+																					   'event_espresso'
250
+																					   )
251
+																					   . '</span>' : $tkts_left; ?>
252 252
                                                 </td>
253 253
                                             <?php endif; //end $show_ticket_sale_columns conditional ?>
254 254
                                         </tr>
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
 /** @var string $price_breakdown_heading */
13 13
 /** @var \EventEspresso\modules\ticket_selector\TicketDetails $ticket_details */
14 14
 ?>
15
-<?php if ( $show_ticket_details ) : ?>
15
+<?php if ($show_ticket_details) : ?>
16 16
 <tr class="tckt-slctr-tkt-details-tr <?php echo $ticket_details_row_class; ?>">
17 17
     <td class="tckt-slctr-tkt-details-td" colspan="<?php echo $cols; ?>">
18 18
         <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
19 19
 
20 20
             <section class="tckt-slctr-tkt-details-sctn">
21
-                <h3><?php echo esc_html__( 'Details', 'event_espresso' ); ?></h3>
21
+                <h3><?php echo esc_html__('Details', 'event_espresso'); ?></h3>
22 22
                 <p><?php echo $ticket->description(); ?></p>
23 23
 
24 24
                 <?php
@@ -33,42 +33,42 @@  discard block
 block discarded – undo
33 33
                 <section class="tckt-slctr-tkt-sale-dates-sctn">
34 34
                     <h5><?php echo apply_filters(
35 35
                         'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading',
36
-                        esc_html__( 'Sale Dates', 'event_espresso' )
36
+                        esc_html__('Sale Dates', 'event_espresso')
37 37
                         ); ?>
38 38
                     </h5>
39 39
                     <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters(
40 40
                         'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message',
41
-                        esc_html__( 'The dates when this option is available for purchase.', 'event_espresso' )
41
+                        esc_html__('The dates when this option is available for purchase.', 'event_espresso')
42 42
                         ); ?></span>
43 43
                     <br/>
44 44
                     <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters(
45 45
                         'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale',
46
-                        esc_html__( 'Goes On Sale:', 'event_espresso' )
46
+                        esc_html__('Goes On Sale:', 'event_espresso')
47 47
                         ); ?></span>
48 48
                     <span class="dashicons dashicons-calendar"></span>
49
-                    <?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format) . ' &nbsp; '; ?>
49
+                    <?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' &nbsp; '; ?>
50 50
                     <span  class="dashicons dashicons-clock"></span>
51
-                    <?php echo $ticket->get_i18n_datetime('TKT_start_date',$time_format); ?>
51
+                    <?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?>
52 52
                     <br/>
53 53
                     <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters(
54 54
                         'FHEE__ticket_selector_chart_template__ticket_details_sales_end',
55
-                        esc_html__( 'Sales End:', 'event_espresso' )
55
+                        esc_html__('Sales End:', 'event_espresso')
56 56
                         ); ?></span>
57 57
                     <span class="dashicons dashicons-calendar"></span>
58
-                    <?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format) . ' &nbsp; '; ?>
58
+                    <?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' &nbsp; '; ?>
59 59
                     <span class="dashicons dashicons-clock"></span>
60 60
                     <?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?>
61 61
                     <br/>
62 62
                 </section>
63 63
                 <br/>
64 64
 
65
-                <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?>
65
+                <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?>
66 66
 
67
-                <?php if ( $ticket->min() && $ticket->max() ) { ?>
67
+                <?php if ($ticket->min() && $ticket->max()) { ?>
68 68
                     <section class="tckt-slctr-tkt-quantities-sctn">
69 69
                         <h5><?php echo apply_filters(
70 70
                             'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading',
71
-                            esc_html__( 'Purchasable Quantities', 'event_espresso' )
71
+                            esc_html__('Purchasable Quantities', 'event_espresso')
72 72
                             ); ?></h5>
73 73
                         <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters(
74 74
                             'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message',
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
                             ); ?></span><br/>
80 80
                         <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters(
81 81
                             'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty',
82
-                            esc_html__( 'Minimum Qty:', 'event_espresso' )
82
+                            esc_html__('Minimum Qty:', 'event_espresso')
83 83
                             ); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
84
-                        <?php if ( $ticket->min() > $remaining ) { ?> &nbsp; <span
84
+                        <?php if ($ticket->min() > $remaining) { ?> &nbsp; <span
85 85
                         class="important-notice small-text"><?php echo apply_filters(
86 86
                         'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message',
87 87
                         esc_html__(
@@ -92,18 +92,18 @@  discard block
 block discarded – undo
92 92
                         <?php //$max = min( $max, $max_atndz );?>
93 93
                         <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters(
94 94
                             'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty',
95
-                            esc_html__( 'Maximum Qty:', 'event_espresso' )
96
-                            ); ?></span><?php echo $ticket->max() === EE_INF ? esc_html__( 'no limit', 'event_espresso' )
97
-                        : max( $ticket->max(), 1 ); ?><br/>
95
+                            esc_html__('Maximum Qty:', 'event_espresso')
96
+                            ); ?></span><?php echo $ticket->max() === EE_INF ? esc_html__('no limit', 'event_espresso')
97
+                        : max($ticket->max(), 1); ?><br/>
98 98
                     </section>
99 99
                     <br/>
100 100
                 <?php } ?>
101 101
 
102
-                <?php if ( ( ! defined( 'EE_DECAF' ) || EE_DECAF !== true ) && $ticket->uses() !== EE_INF ) { ?>
102
+                <?php if (( ! defined('EE_DECAF') || EE_DECAF !== true) && $ticket->uses() !== EE_INF) { ?>
103 103
                     <section class="tckt-slctr-tkt-uses-sctn">
104 104
                         <h5><?php echo apply_filters(
105 105
                                 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading',
106
-                                esc_html__( 'Event Date Ticket Uses', 'event_espresso' )
106
+                                esc_html__('Event Date Ticket Uses', 'event_espresso')
107 107
                             ); ?></h5>
108 108
                         <span class="drk-grey-text small-text no-bold"> - <?php
109 109
                             echo apply_filters(
@@ -121,23 +121,23 @@  discard block
 block discarded – undo
121 121
                             ?></span><br/>
122 122
                         <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters(
123 123
                             'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes',
124
-                            esc_html__( '# Datetimes:', 'event_espresso' )
124
+                            esc_html__('# Datetimes:', 'event_espresso')
125 125
                             ); ?></span><?php echo $ticket->uses(); ?><br/>
126 126
                     </section>
127 127
                 <?php } ?>
128 128
 
129 129
                 <?php
130
-                $datetimes = $ticket->datetimes_ordered( $event_is_expired, false );
130
+                $datetimes = $ticket->datetimes_ordered($event_is_expired, false);
131 131
                 $chart_column_width = $show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width';
132
-                if ( ! empty( $datetimes ) ) { ?>
132
+                if ( ! empty($datetimes)) { ?>
133 133
                     <section class="tckt-slctr-tkt-datetimes-sctn">
134 134
                         <h5><?php echo apply_filters(
135 135
                             'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading',
136
-                            esc_html__( 'Access', 'event_espresso' )
136
+                            esc_html__('Access', 'event_espresso')
137 137
                             ); ?></h5>
138 138
                         <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters(
139 139
                             'FHEE__ticket_selector_chart_template__ticket_details_event_access_message',
140
-                            esc_html__( 'This option allows access to the following dates and times.', 'event_espresso' )
140
+                            esc_html__('This option allows access to the following dates and times.', 'event_espresso')
141 141
                             ); ?></span>
142 142
                         <div class="tckt-slctr-tkt-details-tbl-wrap-dv">
143 143
                             <table class="tckt-slctr-tkt-details-tbl">
@@ -147,38 +147,38 @@  discard block
 block discarded – undo
147 147
                                         <span class="dashicons dashicons-calendar"></span><span
148 148
                                         class="small-text"><?php echo apply_filters(
149 149
                                             'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date',
150
-                                            esc_html__( 'Date ', 'event_espresso' )
150
+                                            esc_html__('Date ', 'event_espresso')
151 151
                                             ); ?></span>
152 152
                                     </th>
153 153
                                     <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>">
154 154
                                         <span class="dashicons dashicons-clock"></span><span
155
-                                        class="small-text"><?php esc_html_e( 'Time ', 'event_espresso' ); ?></span>
155
+                                        class="small-text"><?php esc_html_e('Time ', 'event_espresso'); ?></span>
156 156
                                     </th>
157
-                                    <?php if ( $show_ticket_sale_columns ) : ?>
157
+                                    <?php if ($show_ticket_sale_columns) : ?>
158 158
                                         <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr">
159 159
                                             <span class="smaller-text"><?php echo apply_filters(
160 160
                                                 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold',
161
-                                                sprintf( esc_html__( 'Sold', 'event_espresso' ), '<br/>' )
161
+                                                sprintf(esc_html__('Sold', 'event_espresso'), '<br/>')
162 162
                                                 ); ?></span>
163 163
                                         </th>
164 164
                                         <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr">
165 165
                                             <span class="smaller-text"><?php echo apply_filters(
166 166
                                                 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left',
167
-                                                sprintf( esc_html__( 'Remaining', 'event_espresso' ), '<br/>' )
167
+                                                sprintf(esc_html__('Remaining', 'event_espresso'), '<br/>')
168 168
                                                 ); ?></span>
169 169
                                         </th>
170 170
                                         <th
171 171
                                         class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr">
172 172
                                             <span class="smaller-text"><?php echo apply_filters(
173 173
                                                 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold',
174
-                                                sprintf( esc_html__( 'Total%sSold', 'event_espresso' ), '<br/>' )
174
+                                                sprintf(esc_html__('Total%sSold', 'event_espresso'), '<br/>')
175 175
                                                 ); ?></span>
176 176
                                         </th>
177 177
                                         <th
178 178
                                         class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr">
179 179
                                             <span class="smaller-text"><?php echo apply_filters(
180 180
                                                 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left',
181
-                                                sprintf( esc_html__( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )
181
+                                                sprintf(esc_html__('Total Spaces%sLeft', 'event_espresso'), '<br/>')
182 182
                                                 ); ?></span>
183 183
                                         </th>
184 184
                                     <?php endif; //end $show_ticket_sale_columns conditional ?>
@@ -186,62 +186,62 @@  discard block
 block discarded – undo
186 186
                                 </thead>
187 187
                                 <tbody>
188 188
                                 <?php
189
-                                foreach ( $datetimes as $datetime ) {
190
-                                    if ( $datetime instanceof EE_Datetime ) {
189
+                                foreach ($datetimes as $datetime) {
190
+                                    if ($datetime instanceof EE_Datetime) {
191 191
                                         ?>
192 192
 
193 193
                                         <tr>
194 194
                                             <td data-th="<?php echo apply_filters(
195 195
                                             'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date',
196
-                                            esc_html__( 'Event Date ', 'event_espresso' )
196
+                                            esc_html__('Event Date ', 'event_espresso')
197 197
                                             ); ?>" class="small-text">
198 198
                                                 <?php $datetime_name = $datetime->name(); ?>
199
-                                                <?php echo ! empty( $datetime_name ) ? '<b>'
199
+                                                <?php echo ! empty($datetime_name) ? '<b>'
200 200
                                                                                        . $datetime_name
201 201
                                                                                        . '</b><br/>' : ''; ?>
202 202
                                                 <?php echo $datetime->date_range(
203 203
                                                 $date_format,
204
-                                                esc_html__( ' to  ', 'event_espresso' )
204
+                                                esc_html__(' to  ', 'event_espresso')
205 205
                                                 ); ?>
206 206
                                             </td>
207
-                                            <td data-th="<?php esc_html_e( 'Time ', 'event_espresso' ); ?>"
207
+                                            <td data-th="<?php esc_html_e('Time ', 'event_espresso'); ?>"
208 208
                                                 class="cntr small-text">
209 209
                                                 <?php echo $datetime->time_range(
210 210
                                                 $time_format,
211
-                                                esc_html__( ' to  ', 'event_espresso' )
211
+                                                esc_html__(' to  ', 'event_espresso')
212 212
                                                 ); ?>
213 213
                                             </td>
214
-                                            <?php if ( $show_ticket_sale_columns ) : ?>
214
+                                            <?php if ($show_ticket_sale_columns) : ?>
215 215
                                                 <td data-th="<?php echo apply_filters(
216 216
                                                 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold',
217
-                                                esc_html__( 'Sold', 'event_espresso' )
217
+                                                esc_html__('Sold', 'event_espresso')
218 218
                                                 ); ?>" class="cntr small-text">
219 219
                                                     <?php echo $ticket->sold(); ?>
220 220
                                                 </td>
221 221
                                                 <td data-th="<?php echo apply_filters(
222 222
                                                 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left',
223
-                                                esc_html__( 'Remaining', 'event_espresso' )
223
+                                                esc_html__('Remaining', 'event_espresso')
224 224
                                                 ); ?>" class="cntr small-text">
225 225
                                                     <?php echo $remaining === EE_INF
226
-                                                    ? '<span class="smaller-text">' . esc_html__(
226
+                                                    ? '<span class="smaller-text">'.esc_html__(
227 227
                                                     'unlimited ',
228 228
                                                     'event_espresso'
229
-                                                    ) . '</span>' : $remaining; ?>
229
+                                                    ).'</span>' : $remaining; ?>
230 230
                                                 </td>
231 231
                                                 <td data-th="<?php echo apply_filters(
232 232
                                                 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold',
233
-                                                esc_html__( 'Total Sold', 'event_espresso' )
233
+                                                esc_html__('Total Sold', 'event_espresso')
234 234
                                                 ); ?>" class="cntr small-text">
235 235
                                                     <?php echo $datetime->sold(); ?>
236 236
                                                 </td>
237 237
                                                 <?php $tkts_left = $datetime->sold_out()
238
-                                                ? '<span class="sold-out smaller-text">' . esc_html__(
238
+                                                ? '<span class="sold-out smaller-text">'.esc_html__(
239 239
                                                 'Sold&nbsp;Out',
240 240
                                                 'event_espresso'
241
-                                                ) . '</span>' : $datetime->spaces_remaining(); ?>
241
+                                                ).'</span>' : $datetime->spaces_remaining(); ?>
242 242
                                                 <td data-th="<?php echo apply_filters(
243 243
                                                 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left',
244
-                                                esc_html__( 'Total Spaces Left', 'event_espresso' )
244
+                                                esc_html__('Total Spaces Left', 'event_espresso')
245 245
                                                 ); ?>" class="cntr small-text">
246 246
                                                     <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'
247 247
                                                                                        . esc_html__(
@@ -266,4 +266,4 @@  discard block
 block discarded – undo
266 266
         </div>
267 267
     </td>
268 268
 </tr>
269
-<?php endif;  //end template_settings->show_ticket_details check?>
270 269
\ No newline at end of file
270
+<?php endif; //end template_settings->show_ticket_details check?>
271 271
\ No newline at end of file
Please login to merge, or discard this patch.
modules/ticket_selector_caff/EED_Ticket_Selector_Caff.module.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 	 *  @return 	void
29 29
 	 */
30 30
 	public static function set_hooks() {
31
-        add_action(
32
-            'AHEE__ticket_selector_chart_template__ticket_details__after_description',
33
-            array('EED_Ticket_Selector_Caff', 'ticket_price_details'),
34
-            10,
35
-            3
36
-        );
31
+		add_action(
32
+			'AHEE__ticket_selector_chart_template__ticket_details__after_description',
33
+			array('EED_Ticket_Selector_Caff', 'ticket_price_details'),
34
+			10,
35
+			3
36
+		);
37 37
 	}
38 38
 
39 39
 	/**
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 	 * @param \WP $WP
54 54
 	 */
55 55
 	public function run( $WP ) {
56
-        $this->set_config();
56
+		$this->set_config();
57 57
 	}
58 58
 
59 59
 
60 60
 
61 61
 
62 62
 	protected function set_config(){
63
-        $this->set_config_section( 'template_settings' );
63
+		$this->set_config_section( 'template_settings' );
64 64
 		$this->set_config_class( 'EE_Ticket_Selector_Config' );
65 65
 		$this->set_config_name( 'EED_Ticket_Selector' );
66 66
 	}
@@ -109,27 +109,27 @@  discard block
 block discarded – undo
109 109
 
110 110
 
111 111
 
112
-    /**
113
-     * @return \EE_Form_Section_Proper
114
-     * @throws \EE_Error
115
-     */
116
-    public static function _ticket_selector_appearance_settings() {
117
-        if ( ! \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) {
118
-            \EED_Ticket_Selector::instance()->set_config();
119
-            \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
120
-        }
121
-        // get option for whether to show datetime selector in TS
122
-	    $show_datetime_selector = \EE_Registry::instance()
123
-		    ->CFG
124
-		    ->template_settings
125
-		    ->EED_Ticket_Selector
126
-		    ->getShowDatetimeSelector();
127
-	    // and option for how may datetimes must exist if display is conditional
128
-	    $datetime_selector_threshold = \EE_Registry::instance()
129
-		    ->CFG
130
-		    ->template_settings
131
-		    ->EED_Ticket_Selector
132
-		    ->getDatetimeSelectorThreshold();
112
+	/**
113
+	 * @return \EE_Form_Section_Proper
114
+	 * @throws \EE_Error
115
+	 */
116
+	public static function _ticket_selector_appearance_settings() {
117
+		if ( ! \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) {
118
+			\EED_Ticket_Selector::instance()->set_config();
119
+			\EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
120
+		}
121
+		// get option for whether to show datetime selector in TS
122
+		$show_datetime_selector = \EE_Registry::instance()
123
+			->CFG
124
+			->template_settings
125
+			->EED_Ticket_Selector
126
+			->getShowDatetimeSelector();
127
+		// and option for how may datetimes must exist if display is conditional
128
+		$datetime_selector_threshold = \EE_Registry::instance()
129
+			->CFG
130
+			->template_settings
131
+			->EED_Ticket_Selector
132
+			->getDatetimeSelectorThreshold();
133 133
 
134 134
 		return new EE_Form_Section_Proper(
135 135
 			array(
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
 								)
172 172
 							),
173 173
 							'show_datetime_selector' => new EE_Select_Input(
174
-                                \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->getShowDatetimeSelectorOptions(false),
174
+								\EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->getShowDatetimeSelectorOptions(false),
175 175
 								array(
176 176
 									'html_label_text' => esc_html__( 'Show Date & Time Filter?', 'event_espresso' ),
177 177
 									'html_help_text' => sprintf(
178
-									    esc_html__(
179
-									        'Indicates whether or not to display a dropdown select box above each ticket selector that displays dates and times for the available tickets. Ticket options can be unselected, which removes (hides) them from the list of tickets being displayed.%1$sOptions include:%1$s &bull; %2$sdo not show date & time filter%3$s%1$s &nbsp; this option will NEVER display a date filter, regardless of how many dates exist.%1$s &bull; %2$smaybe show date & time filter%3$s%1$s &nbsp; this option will conditionally display the date filter when the number of dates for the event matches the value set for "Date Filter Threshold".',
180
-                                            'event_espresso'
181
-                                        ),
182
-                                        '<br>',
183
-                                        '<strong>',
184
-                                        '</strong>'
185
-
186
-                                    ),
178
+										esc_html__(
179
+											'Indicates whether or not to display a dropdown select box above each ticket selector that displays dates and times for the available tickets. Ticket options can be unselected, which removes (hides) them from the list of tickets being displayed.%1$sOptions include:%1$s &bull; %2$sdo not show date & time filter%3$s%1$s &nbsp; this option will NEVER display a date filter, regardless of how many dates exist.%1$s &bull; %2$smaybe show date & time filter%3$s%1$s &nbsp; this option will conditionally display the date filter when the number of dates for the event matches the value set for "Date Filter Threshold".',
180
+											'event_espresso'
181
+										),
182
+										'<br>',
183
+										'<strong>',
184
+										'</strong>'
185
+
186
+									),
187 187
 									'default' => ! empty( $show_datetime_selector )
188 188
 										? $show_datetime_selector
189 189
 										: \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR,
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
 								)
192 192
 							),
193 193
 							'datetime_selector_threshold' => new EE_Select_Input(
194
-                                array_combine($r = range(1, 10), $r),
194
+								array_combine($r = range(1, 10), $r),
195 195
 								array(
196 196
 									'html_label_text' => esc_html__( 'Date & Time Filter Threshold', 'event_espresso' ),
197 197
 									'html_help_text' => esc_html__(
198
-                                        'The number of unique dates an event has to have before conditionally displaying a date & time filter',
199
-                                        'event_espresso'
200
-                                    ),
198
+										'The number of unique dates an event has to have before conditionally displaying a date & time filter',
199
+										'event_espresso'
200
+									),
201 201
 									'default' => ! empty( $datetime_selector_threshold )
202 202
 										? $datetime_selector_threshold
203 203
 										: 3,
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	public static function update_template_settings( EE_Template_Config $CFG, $REQ ) {
225 225
 		if ( ! $CFG->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) {
226
-            \EED_Ticket_Selector::instance()->set_config();
227
-            $CFG->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
226
+			\EED_Ticket_Selector::instance()->set_config();
227
+			$CFG->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
228 228
 		}
229 229
 		try {
230 230
 			$ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form();
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
 					$CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details'];
247 247
 					$CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets'];
248 248
 					$CFG->EED_Ticket_Selector->setShowDatetimeSelector(
249
-					    $valid_data['appearance_settings']['show_datetime_selector']
250
-                    );
249
+						$valid_data['appearance_settings']['show_datetime_selector']
250
+					);
251 251
 					$CFG->EED_Ticket_Selector->setDatetimeSelectorThreshold(
252
-					    $valid_data['appearance_settings']['datetime_selector_threshold']
253
-                    );
252
+						$valid_data['appearance_settings']['datetime_selector_threshold']
253
+					);
254 254
 				} else {
255 255
 					if ( $ticket_selector_form->submission_error_message() !== '' ) {
256 256
 						EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
@@ -267,17 +267,17 @@  discard block
 block discarded – undo
267 267
 
268 268
 
269 269
 
270
-    /**
271
-     * @param \EE_Ticket $ticket
272
-     * @param int        $ticket_price
273
-     * @param bool       $display_ticket_price
274
-     */
275
-    public static function ticket_price_details(EE_Ticket $ticket, $ticket_price = 0, $display_ticket_price = false)
276
-    {
277
-        require(
278
-            str_replace('\\', DS, plugin_dir_path(__FILE__))
279
-            . 'templates' . DS . 'ticket_selector_price_details.template.php'
280
-        );
270
+	/**
271
+	 * @param \EE_Ticket $ticket
272
+	 * @param int        $ticket_price
273
+	 * @param bool       $display_ticket_price
274
+	 */
275
+	public static function ticket_price_details(EE_Ticket $ticket, $ticket_price = 0, $display_ticket_price = false)
276
+	{
277
+		require(
278
+			str_replace('\\', DS, plugin_dir_path(__FILE__))
279
+			. 'templates' . DS . 'ticket_selector_price_details.template.php'
280
+		);
281 281
 	}
282 282
 
283 283
 
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	 * @return EED_Ticket_Selector_Caff
17 17
 	 */
18 18
 	public static function instance() {
19
-		return parent::get_instance( __CLASS__ );
19
+		return parent::get_instance(__CLASS__);
20 20
 	}
21 21
 
22 22
 
@@ -43,26 +43,26 @@  discard block
 block discarded – undo
43 43
 	 *  @return 	void
44 44
 	 */
45 45
 	public static function set_hooks_admin() {
46
-		define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
47
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 );
48
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 );
46
+		define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
47
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10);
48
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2);
49 49
 	}
50 50
 
51 51
 
52 52
 	/**
53 53
 	 * @param \WP $WP
54 54
 	 */
55
-	public function run( $WP ) {
55
+	public function run($WP) {
56 56
         $this->set_config();
57 57
 	}
58 58
 
59 59
 
60 60
 
61 61
 
62
-	protected function set_config(){
63
-        $this->set_config_section( 'template_settings' );
64
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
65
-		$this->set_config_name( 'EED_Ticket_Selector' );
62
+	protected function set_config() {
63
+        $this->set_config_section('template_settings');
64
+		$this->set_config_class('EE_Ticket_Selector_Config');
65
+		$this->set_config_name('EED_Ticket_Selector');
66 66
 	}
67 67
 
68 68
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 					'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections',
98 98
 					array(
99 99
 						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML(
100
-							EEH_HTML::br(2) .
101
-							EEH_HTML::h2( esc_html__( 'Ticket Selector Template Settings', 'event_espresso' ))
100
+							EEH_HTML::br(2).
101
+							EEH_HTML::h2(esc_html__('Ticket Selector Template Settings', 'event_espresso'))
102 102
 						),
103 103
 						'appearance_settings' 			=> EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings()
104 104
 					)
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @throws \EE_Error
115 115
      */
116 116
     public static function _ticket_selector_appearance_settings() {
117
-        if ( ! \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) {
117
+        if ( ! \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config) {
118 118
             \EED_Ticket_Selector::instance()->set_config();
119 119
             \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
120 120
         }
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 						array(
143 143
 							'show_ticket_details' => new EE_Yes_No_Input(
144 144
 								array(
145
-									'html_label_text' => esc_html__('Show Ticket Details?', 'event_espresso' ),
146
-									'html_help_text' => esc_html__( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'),
147
-									'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details )
145
+									'html_label_text' => esc_html__('Show Ticket Details?', 'event_espresso'),
146
+									'html_help_text' => esc_html__('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'),
147
+									'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details)
148 148
 										? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details
149 149
 										: true,
150 150
 									'display_html_label_text' => false
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 							),
153 153
 							'show_ticket_sale_columns' => new EE_Yes_No_Input(
154 154
 								array(
155
-									'html_label_text' => esc_html__('Show Ticket Sale Info?', 'event_espresso' ),
156
-									'html_help_text' => esc_html__( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'),
157
-									'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns )
155
+									'html_label_text' => esc_html__('Show Ticket Sale Info?', 'event_espresso'),
156
+									'html_help_text' => esc_html__('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'),
157
+									'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns)
158 158
 										? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns
159 159
 										: true,
160 160
 									'display_html_label_text' => false
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 							),
163 163
 							'show_expired_tickets' => new EE_Yes_No_Input(
164 164
 								array(
165
-									'html_label_text' => esc_html__( 'Show Expired Tickets?', 'event_espresso' ),
166
-									'html_help_text' => esc_html__( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ),
167
-									'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets )
165
+									'html_label_text' => esc_html__('Show Expired Tickets?', 'event_espresso'),
166
+									'html_help_text' => esc_html__('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'),
167
+									'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets)
168 168
 										? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets
169 169
 										: true,
170 170
 									'display_html_label_text' => false
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 							'show_datetime_selector' => new EE_Select_Input(
174 174
                                 \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->getShowDatetimeSelectorOptions(false),
175 175
 								array(
176
-									'html_label_text' => esc_html__( 'Show Date & Time Filter?', 'event_espresso' ),
176
+									'html_label_text' => esc_html__('Show Date & Time Filter?', 'event_espresso'),
177 177
 									'html_help_text' => sprintf(
178 178
 									    esc_html__(
179 179
 									        'Indicates whether or not to display a dropdown select box above each ticket selector that displays dates and times for the available tickets. Ticket options can be unselected, which removes (hides) them from the list of tickets being displayed.%1$sOptions include:%1$s &bull; %2$sdo not show date & time filter%3$s%1$s &nbsp; this option will NEVER display a date filter, regardless of how many dates exist.%1$s &bull; %2$smaybe show date & time filter%3$s%1$s &nbsp; this option will conditionally display the date filter when the number of dates for the event matches the value set for "Date Filter Threshold".',
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                                         '</strong>'
185 185
 
186 186
                                     ),
187
-									'default' => ! empty( $show_datetime_selector )
187
+									'default' => ! empty($show_datetime_selector)
188 188
 										? $show_datetime_selector
189 189
 										: \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR,
190 190
 									'display_html_label_text' => false
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 							'datetime_selector_threshold' => new EE_Select_Input(
194 194
                                 array_combine($r = range(1, 10), $r),
195 195
 								array(
196
-									'html_label_text' => esc_html__( 'Date & Time Filter Threshold', 'event_espresso' ),
196
+									'html_label_text' => esc_html__('Date & Time Filter Threshold', 'event_espresso'),
197 197
 									'html_help_text' => esc_html__(
198 198
                                         'The number of unique dates an event has to have before conditionally displaying a date & time filter',
199 199
                                         'event_espresso'
200 200
                                     ),
201
-									'default' => ! empty( $datetime_selector_threshold )
201
+									'default' => ! empty($datetime_selector_threshold)
202 202
 										? $datetime_selector_threshold
203 203
 										: 3,
204 204
 									'display_html_label_text' => false
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 * @param array              $REQ incoming request
222 222
 	 * @return EE_Template_Config
223 223
 	 */
224
-	public static function update_template_settings( EE_Template_Config $CFG, $REQ ) {
225
-		if ( ! $CFG->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config ) {
224
+	public static function update_template_settings(EE_Template_Config $CFG, $REQ) {
225
+		if ( ! $CFG->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config) {
226 226
             \EED_Ticket_Selector::instance()->set_config();
227 227
             $CFG->EED_Ticket_Selector = \EED_Ticket_Selector::instance()->config();
228 228
 		}
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 			$ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form();
231 231
 
232 232
 			//check for form submission
233
-			if ( $ticket_selector_form->was_submitted() ) {
233
+			if ($ticket_selector_form->was_submitted()) {
234 234
 
235 235
 				//capture form data
236 236
 				$ticket_selector_form->receive_form_submission();
237 237
 
238 238
 				//validate form data
239
-				if ( $ticket_selector_form->is_valid() ) {
239
+				if ($ticket_selector_form->is_valid()) {
240 240
 
241 241
 					//grab validated data from form
242 242
 					$valid_data = $ticket_selector_form->valid_data();
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
 					    $valid_data['appearance_settings']['datetime_selector_threshold']
253 253
                     );
254 254
 				} else {
255
-					if ( $ticket_selector_form->submission_error_message() !== '' ) {
256
-						EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
255
+					if ($ticket_selector_form->submission_error_message() !== '') {
256
+						EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
257 257
 					}
258 258
 				}
259 259
 
260 260
 			}
261
-		} catch( EE_Error $e ) {
261
+		} catch (EE_Error $e) {
262 262
 			$e->get_error();
263 263
 		}
264 264
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     {
277 277
         require(
278 278
             str_replace('\\', DS, plugin_dir_path(__FILE__))
279
-            . 'templates' . DS . 'ticket_selector_price_details.template.php'
279
+            . 'templates'.DS.'ticket_selector_price_details.template.php'
280 280
         );
281 281
 	}
282 282
 
Please login to merge, or discard this patch.
ticket_selector_caff/templates/ticket_selector_price_details.template.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 if ($display_ticket_price) { ?>
8 8
     <section class="tckt-slctr-tkt-price-sctn">
9 9
         <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading',
10
-                esc_html__('Price', 'event_espresso')); ?></h5>
10
+				esc_html__('Price', 'event_espresso')); ?></h5>
11 11
         <div class="tckt-slctr-tkt-details-tbl-wrap-dv">
12 12
             <table class="tckt-slctr-tkt-details-tbl">
13 13
                 <thead>
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
                             class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
31 31
                     </tr>
32 32
                     <?php
33
-                    $running_total = $ticket->base_price()->amount();
34
-                } else {
35
-                    $running_total = 0;
36
-                }
37
-                // now add price modifiers
38
-                foreach ($ticket->price_modifiers() as $price_mod) { ?>
33
+					$running_total = $ticket->base_price()->amount();
34
+				} else {
35
+					$running_total = 0;
36
+				}
37
+				// now add price modifiers
38
+				foreach ($ticket->price_modifiers() as $price_mod) { ?>
39 39
                     <tr>
40 40
                         <td data-th="<?php esc_html_e('Name', 'event_espresso'); ?>"
41 41
                             class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
                                 %
46 46
                             </td>
47 47
                             <?php
48
-                            $new_sub_total = $running_total * ($price_mod->amount() / 100);
49
-                            $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
50
-                            ?>
48
+							$new_sub_total = $running_total * ($price_mod->amount() / 100);
49
+							$new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
50
+							?>
51 51
                         <?php } else { ?>
52 52
                             <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1
53
-                                : $price_mod->amount(); ?>
53
+								: $price_mod->amount(); ?>
54 54
                             <td data-th="<?php esc_html_e('Description', 'event_espresso'); ?>"
55 55
                                 class="small-text"><?php echo $price_mod->desc(); ?></td>
56 56
                             <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1
57
-                                : $price_mod->amount(); ?>
57
+								: $price_mod->amount(); ?>
58 58
                         <?php } ?>
59 59
                         <td data-th="<?php esc_html_e('Amount', 'event_espresso'); ?>"
60 60
                             class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td>
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                     <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?>
66 66
                     <tr>
67 67
                         <td colspan="2" class="jst-rght small-text sbttl"><b><?php esc_html_e('subtotal',
68
-                                    'event_espresso'); ?></b></td>
68
+									'event_espresso'); ?></b></td>
69 69
                         <td data-th="<?php esc_html_e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text">
70 70
                             <b><?php echo EEH_Template::format_currency($running_total); ?></b></td>
71 71
                     </tr>
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
                 <tr>
88 88
                     <td colspan="2" class="jst-rght small-text ttl-lbl-td">
89 89
                         <b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price',
90
-                                esc_html__('Total', 'event_espresso')); ?></b></td>
90
+								esc_html__('Total', 'event_espresso')); ?></b></td>
91 91
                     <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price',
92
-                        esc_html__('Total', 'event_espresso')); ?>" class="jst-rght small-text">
92
+						esc_html__('Total', 'event_espresso')); ?>" class="jst-rght small-text">
93 93
                         <b><?php echo EEH_Template::format_currency($running_total); ?></b></td>
94 94
                 </tr>
95 95
                 </tbody>
Please login to merge, or discard this patch.
core/EE_Front_Controller.core.php 2 patches
Indentation   +690 added lines, -690 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -22,695 +22,695 @@  discard block
 block discarded – undo
22 22
 final class EE_Front_Controller
23 23
 {
24 24
 
25
-    /**
26
-     *    $_template_path
27
-     * @var    string $_template_path
28
-     * @access    public
29
-     */
30
-    private $_template_path;
31
-
32
-    /**
33
-     *    $_template
34
-     * @var    string $_template
35
-     * @access    public
36
-     */
37
-    private $_template;
38
-
39
-    /**
40
-     * @type  EE_Registry $Registry
41
-     * @access    protected
42
-     */
43
-    protected $Registry;
44
-
45
-    /**
46
-     * @type  EE_Request_Handler $Request_Handler
47
-     * @access    protected
48
-     */
49
-    protected $Request_Handler;
50
-
51
-    /**
52
-     * @type  EE_Module_Request_Router $Module_Request_Router
53
-     * @access    protected
54
-     */
55
-    protected $Module_Request_Router;
56
-
57
-
58
-    /**
59
-     *    class constructor
60
-     *    should fire after shortcode, module, addon, or other plugin's default priority init phases have run
61
-     *
62
-     * @access    public
63
-     * @param \EE_Registry              $Registry
64
-     * @param \EE_Request_Handler       $Request_Handler
65
-     * @param \EE_Module_Request_Router $Module_Request_Router
66
-     */
67
-    public function __construct(
68
-        EE_Registry $Registry,
69
-        EE_Request_Handler $Request_Handler,
70
-        EE_Module_Request_Router $Module_Request_Router
71
-    ) {
72
-        $this->Registry              = $Registry;
73
-        $this->Request_Handler       = $Request_Handler;
74
-        $this->Module_Request_Router = $Module_Request_Router;
75
-        // make sure template tags are loaded immediately so that themes don't break
76
-        add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10);
77
-        // determine how to integrate WP_Query with the EE models
78
-        add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
79
-        // load other resources and begin to actually run shortcodes and modules
80
-        add_action('wp_loaded', array($this, 'wp_loaded'), 5);
81
-        // analyse the incoming WP request
82
-        add_action('parse_request', array($this, 'get_request'), 1, 1);
83
-        // process any content shortcodes
84
-        add_action('parse_request', array($this, '_initialize_shortcodes'), 5);
85
-        // process request with module factory
86
-        add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
87
-        // before headers sent
88
-        add_action('wp', array($this, 'wp'), 5);
89
-        // load css and js
90
-        add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1);
91
-        // header
92
-        add_action('wp_head', array($this, 'header_meta_tag'), 5);
93
-        add_action('wp_print_scripts', array($this, 'wp_print_scripts'), 10);
94
-        add_filter('template_include', array($this, 'template_include'), 1);
95
-        // display errors
96
-        add_action('loop_start', array($this, 'display_errors'), 2);
97
-        // the content
98
-        // add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
99
-        //exclude our private cpt comments
100
-        add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
101
-        //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
102
-        add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
103
-        // action hook EE
104
-        do_action('AHEE__EE_Front_Controller__construct__done', $this);
105
-        // for checking that browser cookies are enabled
106
-        if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) {
107
-            setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/');
108
-        }
109
-    }
110
-
111
-
112
-    /**
113
-     * @return EE_Request_Handler
114
-     */
115
-    public function Request_Handler()
116
-    {
117
-        return $this->Request_Handler;
118
-    }
119
-
120
-
121
-    /**
122
-     * @return EE_Module_Request_Router
123
-     */
124
-    public function Module_Request_Router()
125
-    {
126
-        return $this->Module_Request_Router;
127
-    }
128
-
129
-
130
-
131
-
132
-
133
-    /***********************************************        INIT ACTION HOOK         ***********************************************/
134
-
135
-
136
-    /**
137
-     *    load_espresso_template_tags - if current theme is an espresso theme, or uses ee theme template parts, then
138
-     *    load it's functions.php file ( if not already loaded )
139
-     *
140
-     * @return void
141
-     */
142
-    public function load_espresso_template_tags()
143
-    {
144
-        if (is_readable(EE_PUBLIC . 'template_tags.php')) {
145
-            require_once(EE_PUBLIC . 'template_tags.php');
146
-        }
147
-    }
148
-
149
-
150
-    /**
151
-     * filter_wp_comments
152
-     * This simply makes sure that any "private" EE CPTs do not have their comments show up in any wp comment
153
-     * widgets/queries done on frontend
154
-     *
155
-     * @param  array $clauses array of comment clauses setup by WP_Comment_Query
156
-     * @return array array of comment clauses with modifications.
157
-     */
158
-    public function filter_wp_comments($clauses)
159
-    {
160
-        global $wpdb;
161
-        if (strpos($clauses['join'], $wpdb->posts) !== false) {
162
-            $cpts = EE_Register_CPTs::get_private_CPTs();
163
-            foreach ($cpts as $cpt => $details) {
164
-                $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
165
-            }
166
-        }
167
-        return $clauses;
168
-    }
169
-
170
-
171
-    /**
172
-     *    employ_CPT_Strategy
173
-     *
174
-     * @access    public
175
-     * @return    void
176
-     */
177
-    public function employ_CPT_Strategy()
178
-    {
179
-        if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
180
-            $this->Registry->load_core('CPT_Strategy');
181
-        }
182
-    }
183
-
184
-
185
-    /**
186
-     * this just makes sure that if the site is using ssl that we force that for any admin ajax calls from frontend
187
-     *
188
-     * @param  string $url incoming url
189
-     * @return string         final assembled url
190
-     */
191
-    public function maybe_force_admin_ajax_ssl($url)
192
-    {
193
-        if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
194
-            $url = str_replace('http://', 'https://', $url);
195
-        }
196
-        return $url;
197
-    }
198
-
199
-
200
-
201
-
202
-
203
-
204
-    /***********************************************        WP_LOADED ACTION HOOK         ***********************************************/
205
-
206
-
207
-    /**
208
-     *    wp_loaded - should fire after shortcode, module, addon, or other plugin's have been registered and their
209
-     *    default priority init phases have run
210
-     *
211
-     * @access    public
212
-     * @return    void
213
-     */
214
-    public function wp_loaded()
215
-    {
216
-    }
217
-
218
-
219
-
220
-
221
-
222
-    /***********************************************        PARSE_REQUEST HOOK         ***********************************************/
223
-    /**
224
-     *    _get_request
225
-     *
226
-     * @access public
227
-     * @param WP $WP
228
-     * @return void
229
-     */
230
-    public function get_request(WP $WP)
231
-    {
232
-        do_action('AHEE__EE_Front_Controller__get_request__start');
233
-        $this->Request_Handler->parse_request($WP);
234
-        do_action('AHEE__EE_Front_Controller__get_request__complete');
235
-    }
236
-
237
-
238
-    /**
239
-     *    _initialize_shortcodes - calls init method on shortcodes that have been determined to be in the_content for
240
-     *    the currently requested page
241
-     *
242
-     * @access    public
243
-     * @param WP $WP
244
-     * @return    void
245
-     */
246
-    public function _initialize_shortcodes(WP $WP)
247
-    {
248
-        do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this);
249
-        $this->Request_Handler->set_request_vars($WP);
250
-        // grab post_name from request
251
-        $current_post  = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name',
252
-            $this->Request_Handler->get('post_name'));
253
-        $show_on_front = get_option('show_on_front');
254
-        // if it's not set, then check if frontpage is blog
255
-        if (empty($current_post)) {
256
-            // yup.. this is the posts page, prepare to load all shortcode modules
257
-            $current_post = 'posts';
258
-            // unless..
259
-            if ($show_on_front === 'page') {
260
-                // some other page is set as the homepage
261
-                $page_on_front = get_option('page_on_front');
262
-                if ($page_on_front) {
263
-                    // k now we need to find the post_name for this page
264
-                    global $wpdb;
265
-                    $page_on_front = $wpdb->get_var(
266
-                        $wpdb->prepare(
267
-                            "SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d",
268
-                            $page_on_front
269
-                        )
270
-                    );
271
-                    // set the current post slug to what it actually is
272
-                    $current_post = $page_on_front ? $page_on_front : $current_post;
273
-                }
274
-            }
275
-        }
276
-        // where are posts being displayed ?
277
-        $page_for_posts = EE_Config::get_page_for_posts();
278
-        // in case $current_post is hierarchical like: /parent-page/current-page
279
-        $current_post = basename($current_post);
280
-        // are we on a category page?
281
-        $term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name',
282
-                $WP->query_vars);
283
-        // make sure shortcodes are set
284
-        if (isset($this->Registry->CFG->core->post_shortcodes)) {
285
-            if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) {
286
-                $this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array();
287
-            }
288
-            // cycle thru all posts with shortcodes set
289
-            foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) {
290
-                // filter shortcodes so
291
-                $post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes',
292
-                    $post_shortcodes);
293
-                // now cycle thru shortcodes
294
-                foreach ($post_shortcodes as $shortcode_class => $post_id) {
295
-                    // are we on this page, or on the blog page, or an EE CPT category page ?
296
-                    if ($current_post === $post_name || $term_exists) {
297
-                        // maybe init the shortcode
298
-                        $this->initialize_shortcode_if_active_on_page(
299
-                            $shortcode_class,
300
-                            $current_post,
301
-                            $page_for_posts,
302
-                            $post_id,
303
-                            $term_exists,
304
-                            $WP
305
-                        );
306
-                        // if this is NOT the "Posts page" and we have a valid entry
307
-                        // for the "Posts page" in our tracked post_shortcodes array
308
-                        // but the shortcode is not being tracked for this page
309
-                    } else if (
310
-                        $post_name !== $page_for_posts
311
-                        && isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])
312
-                        && ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])
313
-                    ) {
314
-                        // then remove the "fallback" shortcode processor
315
-                        remove_shortcode($shortcode_class);
316
-                    }
317
-                }
318
-            }
319
-        }
320
-        do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this);
321
-    }
322
-
323
-
324
-    /**
325
-     * @param string $shortcode_class
326
-     * @param string $current_post
327
-     * @param string $page_for_posts
328
-     * @param int    $post_id
329
-     * @param bool   $term_exists
330
-     * @param WP     $WP
331
-     */
332
-    protected function initialize_shortcode_if_active_on_page(
333
-        $shortcode_class,
334
-        $current_post,
335
-        $page_for_posts,
336
-        $post_id,
337
-        $term_exists,
338
-        $WP
339
-    ) {
340
-        // verify shortcode is in list of registered shortcodes
341
-        if ( ! isset($this->Registry->shortcodes->{$shortcode_class})) {
342
-            if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) {
343
-                EE_Error::add_error(
344
-                    sprintf(
345
-                        __(
346
-                            'The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.',
347
-                            'event_espresso'
348
-                        ),
349
-                        $shortcode_class
350
-                    ),
351
-                    __FILE__,
352
-                    __FUNCTION__,
353
-                    __LINE__
354
-                );
355
-                add_filter('FHEE_run_EE_the_content', '__return_true');
356
-            }
357
-            add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor'));
358
-            return;
359
-        }
360
-        // is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ?
361
-        if (
362
-            $term_exists
363
-            || $current_post === $page_for_posts
364
-            || isset($this->Registry->CFG->core->post_shortcodes[$current_post])
365
-        ) {
366
-            // let's pause to reflect on this...
367
-            $sc_reflector = new ReflectionClass('EES_' . $shortcode_class);
368
-            // ensure that class is actually a shortcode
369
-            if (
370
-                defined('WP_DEBUG')
371
-                && WP_DEBUG === true
372
-                && ! $sc_reflector->isSubclassOf('EES_Shortcode')
373
-            ) {
374
-                EE_Error::add_error(
375
-                    sprintf(
376
-                        __(
377
-                            'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.',
378
-                            'event_espresso'
379
-                        ),
380
-                        $shortcode_class
381
-                    ),
382
-                    __FILE__,
383
-                    __FUNCTION__,
384
-                    __LINE__
385
-                );
386
-                add_filter('FHEE_run_EE_the_content', '__return_true');
387
-                return;
388
-            }
389
-            // and pass the request object to the run method
390
-            $this->Registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance();
391
-            // fire the shortcode class's run method, so that it can activate resources
392
-            $this->Registry->shortcodes->{$shortcode_class}->run($WP);
393
-        }
394
-    }
395
-
396
-
397
-    /**
398
-     *    pre_get_posts - basically a module factory for instantiating modules and selecting the final view template
399
-     *
400
-     * @access    public
401
-     * @param   WP_Query $WP_Query
402
-     * @return    void
403
-     */
404
-    public function pre_get_posts($WP_Query)
405
-    {
406
-        // only load Module_Request_Router if this is the main query
407
-        if (
408
-            $this->Module_Request_Router instanceof EE_Module_Request_Router
409
-            && $WP_Query->is_main_query()
410
-        ) {
411
-            // cycle thru module routes
412
-            while ($route = $this->Module_Request_Router->get_route($WP_Query)) {
413
-                // determine module and method for route
414
-                $module = $this->Module_Request_Router->resolve_route($route[0], $route[1]);
415
-                if ($module instanceof EED_Module) {
416
-                    // get registered view for route
417
-                    $this->_template_path = $this->Module_Request_Router->get_view($route);
418
-                    // grab module name
419
-                    $module_name = $module->module_name();
420
-                    // map the module to the module objects
421
-                    $this->Registry->modules->{$module_name} = $module;
422
-                }
423
-            }
424
-        }
425
-    }
426
-
427
-
428
-
429
-
430
-
431
-    /***********************************************        WP HOOK         ***********************************************/
432
-
433
-
434
-    /**
435
-     *    wp - basically last chance to do stuff before headers sent
436
-     *
437
-     * @access    public
438
-     * @return    void
439
-     */
440
-    public function wp()
441
-    {
442
-    }
443
-
444
-
445
-
446
-    /***********************************************        WP_ENQUEUE_SCRIPTS && WP_HEAD HOOK         ***********************************************/
447
-
448
-
449
-    /**
450
-     *    wp_enqueue_scripts
451
-     *
452
-     * @access    public
453
-     * @return    void
454
-     */
455
-    public function wp_enqueue_scripts()
456
-    {
457
-
458
-        // css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_css', '__return_false' );
459
-        if (apply_filters('FHEE_load_css', true)) {
460
-
461
-            $this->Registry->CFG->template_settings->enable_default_style = true;
462
-            //Load the ThemeRoller styles if enabled
463
-            if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) {
464
-
465
-                //Load custom style sheet if available
466
-                if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) {
467
-                    wp_register_style('espresso_custom_css',
468
-                        EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet,
469
-                        EVENT_ESPRESSO_VERSION);
470
-                    wp_enqueue_style('espresso_custom_css');
471
-                }
472
-
473
-                if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')) {
474
-                    wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css',
475
-                        array('dashicons'), EVENT_ESPRESSO_VERSION);
476
-                } else {
477
-                    wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
478
-                        array('dashicons'), EVENT_ESPRESSO_VERSION);
479
-                }
480
-                wp_enqueue_style('espresso_default');
481
-
482
-                if (is_readable(get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css')) {
483
-                    wp_register_style('espresso_style',
484
-                        get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css',
485
-                        array('dashicons', 'espresso_default'));
486
-                } else {
487
-                    wp_register_style('espresso_style',
488
-                        EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css',
489
-                        array('dashicons', 'espresso_default'));
490
-                }
491
-
492
-            }
493
-
494
-        }
495
-
496
-        // js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_js', '__return_false' );
497
-        if (apply_filters('FHEE_load_js', true)) {
498
-
499
-            wp_enqueue_script('jquery');
500
-            //let's make sure that all required scripts have been setup
501
-            if (function_exists('wp_script_is') && ! wp_script_is('jquery')) {
502
-                $msg = sprintf(
503
-                    __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.',
504
-                        'event_espresso'),
505
-                    '<em><br />',
506
-                    '</em>'
507
-                );
508
-                EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
509
-            }
510
-            // load core js
511
-            wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'),
512
-                EVENT_ESPRESSO_VERSION, true);
513
-            wp_enqueue_script('espresso_core');
514
-            wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
515
-
516
-        }
517
-
518
-        //qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
519
-        if (apply_filters('FHEE_load_qtip', false)) {
520
-            EEH_Qtip_Loader::instance()->register_and_enqueue();
521
-        }
522
-
523
-
524
-        //accounting.js library
525
-        // @link http://josscrowcroft.github.io/accounting.js/
526
-        if (apply_filters('FHEE_load_accounting_js', false)) {
527
-            $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js';
528
-            wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
529
-                array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, true);
530
-            wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', true);
531
-            wp_enqueue_script('ee-accounting');
532
-
533
-            $currency_config = array(
534
-                'currency' => array(
535
-                    'symbol'    => $this->Registry->CFG->currency->sign,
536
-                    'format'    => array(
537
-                        'pos'  => $this->Registry->CFG->currency->sign_b4 ? '%s%v' : '%v%s',
538
-                        'neg'  => $this->Registry->CFG->currency->sign_b4 ? '- %s%v' : '- %v%s',
539
-                        'zero' => $this->Registry->CFG->currency->sign_b4 ? '%s--' : '--%s',
540
-                    ),
541
-                    'decimal'   => $this->Registry->CFG->currency->dec_mrk,
542
-                    'thousand'  => $this->Registry->CFG->currency->thsnds,
543
-                    'precision' => $this->Registry->CFG->currency->dec_plc,
544
-                ),
545
-                'number'   => array(
546
-                    'precision' => 0,
547
-                    'thousand'  => $this->Registry->CFG->currency->thsnds,
548
-                    'decimal'   => $this->Registry->CFG->currency->dec_mrk,
549
-                ),
550
-            );
551
-            wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config);
552
-        }
553
-
554
-        if ( ! function_exists('wp_head')) {
555
-            $msg = sprintf(
556
-                __('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.',
557
-                    'event_espresso'),
558
-                '<em><br />',
559
-                '</em>'
560
-            );
561
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
562
-        }
563
-        if ( ! function_exists('wp_footer')) {
564
-            $msg = sprintf(
565
-                __('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.',
566
-                    'event_espresso'),
567
-                '<em><br />',
568
-                '</em>'
569
-            );
570
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
571
-        }
572
-
573
-    }
574
-
575
-
576
-    /**
577
-     *    header_meta_tag
578
-     *
579
-     * @access    public
580
-     * @return    void
581
-     */
582
-    public function header_meta_tag()
583
-    {
584
-        print(
585
-            apply_filters(
586
-                'FHEE__EE_Front_Controller__header_meta_tag',
587
-                '<meta name="generator" content="Event Espresso Version ' . EVENT_ESPRESSO_VERSION . "\" />\n")
588
-        );
589
-
590
-        //let's exclude all event type taxonomy term archive pages from search engine indexing
591
-        //@see https://events.codebasehq.com/projects/event-espresso/tickets/10249
592
-        //also exclude all critical pages from indexing
593
-        if (
594
-            (
595
-                is_tax('espresso_event_type')
596
-                && get_option( 'blog_public' ) !== '0'
597
-            )
598
-            || is_page(EE_Registry::instance()->CFG->core->get_critical_pages_array())
599
-        ) {
600
-            print(
601
-                apply_filters(
602
-                    'FHEE__EE_Front_Controller__header_meta_tag__noindex_for_event_type',
603
-                    '<meta name="robots" content="noindex,follow" />' . "\n"
604
-                )
605
-            );
606
-        }
607
-    }
608
-
609
-
610
-
611
-    /**
612
-     * wp_print_scripts
613
-     *
614
-     * @return void
615
-     */
616
-    public function wp_print_scripts()
617
-    {
618
-        global $post;
619
-        if (
620
-            get_post_type() === 'espresso_events' 
621
-            && is_singular() 
622
-            && isset($post->EE_Event)
623
-            && $post->EE_Event instanceof EE_Event
624
-        ) {
625
-            \EEH_Schema::add_json_linked_data_for_event($post->EE_Event);
626
-        }
627
-    }
628
-
629
-
630
-
631
-    /***********************************************        THE_CONTENT FILTER HOOK         ***********************************************/
632
-
633
-
634
-
635
-    /**
636
-     *    the_content
637
-     *
638
-     * @access    public
639
-     * @param   $the_content
640
-     * @return    string
641
-     */
642
-    // public function the_content( $the_content ) {
643
-    // 	// nothing gets loaded at this point unless other systems turn this hookpoint on by using:  add_filter( 'FHEE_run_EE_the_content', '__return_true' );
644
-    // 	if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) {
645
-    // 	}
646
-    // 	return $the_content;
647
-    // }
648
-
649
-
650
-    /***********************************************        WP_FOOTER         ***********************************************/
651
-
652
-
653
-    /**
654
-     *    display_errors
655
-     *
656
-     * @access    public
657
-     * @return    string
658
-     */
659
-    public function display_errors()
660
-    {
661
-        static $shown_already = false;
662
-        do_action('AHEE__EE_Front_Controller__display_errors__begin');
663
-        if (
664
-            ! $shown_already
665
-            && apply_filters('FHEE__EE_Front_Controller__display_errors', true)
666
-            && is_main_query()
667
-            && ! is_feed()
668
-            && in_the_loop()
669
-            && $this->Request_Handler->is_espresso_page()
670
-        ) {
671
-            echo EE_Error::get_notices();
672
-            $shown_already = true;
673
-            EEH_Template::display_template(EE_TEMPLATES . 'espresso-ajax-notices.template.php');
674
-        }
675
-        do_action('AHEE__EE_Front_Controller__display_errors__end');
676
-    }
677
-
678
-
679
-
680
-
681
-
682
-    /***********************************************        UTILITIES         ***********************************************/
683
-    /**
684
-     *    template_include
685
-     *
686
-     * @access    public
687
-     * @param   string $template_include_path
688
-     * @return    string
689
-     */
690
-    public function template_include($template_include_path = null)
691
-    {
692
-        if ($this->Request_Handler->is_espresso_page()) {
693
-            $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path);
694
-            $template_path        = EEH_Template::locate_template($this->_template_path, array(), false);
695
-            $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
696
-            $this->_template      = basename($this->_template_path);
697
-            return $this->_template_path;
698
-        }
699
-        return $template_include_path;
700
-    }
701
-
702
-
703
-    /**
704
-     *    get_selected_template
705
-     *
706
-     * @access    public
707
-     * @param bool $with_path
708
-     * @return    string
709
-     */
710
-    public function get_selected_template($with_path = false)
711
-    {
712
-        return $with_path ? $this->_template_path : $this->_template;
713
-    }
25
+	/**
26
+	 *    $_template_path
27
+	 * @var    string $_template_path
28
+	 * @access    public
29
+	 */
30
+	private $_template_path;
31
+
32
+	/**
33
+	 *    $_template
34
+	 * @var    string $_template
35
+	 * @access    public
36
+	 */
37
+	private $_template;
38
+
39
+	/**
40
+	 * @type  EE_Registry $Registry
41
+	 * @access    protected
42
+	 */
43
+	protected $Registry;
44
+
45
+	/**
46
+	 * @type  EE_Request_Handler $Request_Handler
47
+	 * @access    protected
48
+	 */
49
+	protected $Request_Handler;
50
+
51
+	/**
52
+	 * @type  EE_Module_Request_Router $Module_Request_Router
53
+	 * @access    protected
54
+	 */
55
+	protected $Module_Request_Router;
56
+
57
+
58
+	/**
59
+	 *    class constructor
60
+	 *    should fire after shortcode, module, addon, or other plugin's default priority init phases have run
61
+	 *
62
+	 * @access    public
63
+	 * @param \EE_Registry              $Registry
64
+	 * @param \EE_Request_Handler       $Request_Handler
65
+	 * @param \EE_Module_Request_Router $Module_Request_Router
66
+	 */
67
+	public function __construct(
68
+		EE_Registry $Registry,
69
+		EE_Request_Handler $Request_Handler,
70
+		EE_Module_Request_Router $Module_Request_Router
71
+	) {
72
+		$this->Registry              = $Registry;
73
+		$this->Request_Handler       = $Request_Handler;
74
+		$this->Module_Request_Router = $Module_Request_Router;
75
+		// make sure template tags are loaded immediately so that themes don't break
76
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10);
77
+		// determine how to integrate WP_Query with the EE models
78
+		add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
79
+		// load other resources and begin to actually run shortcodes and modules
80
+		add_action('wp_loaded', array($this, 'wp_loaded'), 5);
81
+		// analyse the incoming WP request
82
+		add_action('parse_request', array($this, 'get_request'), 1, 1);
83
+		// process any content shortcodes
84
+		add_action('parse_request', array($this, '_initialize_shortcodes'), 5);
85
+		// process request with module factory
86
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
87
+		// before headers sent
88
+		add_action('wp', array($this, 'wp'), 5);
89
+		// load css and js
90
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1);
91
+		// header
92
+		add_action('wp_head', array($this, 'header_meta_tag'), 5);
93
+		add_action('wp_print_scripts', array($this, 'wp_print_scripts'), 10);
94
+		add_filter('template_include', array($this, 'template_include'), 1);
95
+		// display errors
96
+		add_action('loop_start', array($this, 'display_errors'), 2);
97
+		// the content
98
+		// add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
99
+		//exclude our private cpt comments
100
+		add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
101
+		//make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
102
+		add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
103
+		// action hook EE
104
+		do_action('AHEE__EE_Front_Controller__construct__done', $this);
105
+		// for checking that browser cookies are enabled
106
+		if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) {
107
+			setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/');
108
+		}
109
+	}
110
+
111
+
112
+	/**
113
+	 * @return EE_Request_Handler
114
+	 */
115
+	public function Request_Handler()
116
+	{
117
+		return $this->Request_Handler;
118
+	}
119
+
120
+
121
+	/**
122
+	 * @return EE_Module_Request_Router
123
+	 */
124
+	public function Module_Request_Router()
125
+	{
126
+		return $this->Module_Request_Router;
127
+	}
128
+
129
+
130
+
131
+
132
+
133
+	/***********************************************        INIT ACTION HOOK         ***********************************************/
134
+
135
+
136
+	/**
137
+	 *    load_espresso_template_tags - if current theme is an espresso theme, or uses ee theme template parts, then
138
+	 *    load it's functions.php file ( if not already loaded )
139
+	 *
140
+	 * @return void
141
+	 */
142
+	public function load_espresso_template_tags()
143
+	{
144
+		if (is_readable(EE_PUBLIC . 'template_tags.php')) {
145
+			require_once(EE_PUBLIC . 'template_tags.php');
146
+		}
147
+	}
148
+
149
+
150
+	/**
151
+	 * filter_wp_comments
152
+	 * This simply makes sure that any "private" EE CPTs do not have their comments show up in any wp comment
153
+	 * widgets/queries done on frontend
154
+	 *
155
+	 * @param  array $clauses array of comment clauses setup by WP_Comment_Query
156
+	 * @return array array of comment clauses with modifications.
157
+	 */
158
+	public function filter_wp_comments($clauses)
159
+	{
160
+		global $wpdb;
161
+		if (strpos($clauses['join'], $wpdb->posts) !== false) {
162
+			$cpts = EE_Register_CPTs::get_private_CPTs();
163
+			foreach ($cpts as $cpt => $details) {
164
+				$clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
165
+			}
166
+		}
167
+		return $clauses;
168
+	}
169
+
170
+
171
+	/**
172
+	 *    employ_CPT_Strategy
173
+	 *
174
+	 * @access    public
175
+	 * @return    void
176
+	 */
177
+	public function employ_CPT_Strategy()
178
+	{
179
+		if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
180
+			$this->Registry->load_core('CPT_Strategy');
181
+		}
182
+	}
183
+
184
+
185
+	/**
186
+	 * this just makes sure that if the site is using ssl that we force that for any admin ajax calls from frontend
187
+	 *
188
+	 * @param  string $url incoming url
189
+	 * @return string         final assembled url
190
+	 */
191
+	public function maybe_force_admin_ajax_ssl($url)
192
+	{
193
+		if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
194
+			$url = str_replace('http://', 'https://', $url);
195
+		}
196
+		return $url;
197
+	}
198
+
199
+
200
+
201
+
202
+
203
+
204
+	/***********************************************        WP_LOADED ACTION HOOK         ***********************************************/
205
+
206
+
207
+	/**
208
+	 *    wp_loaded - should fire after shortcode, module, addon, or other plugin's have been registered and their
209
+	 *    default priority init phases have run
210
+	 *
211
+	 * @access    public
212
+	 * @return    void
213
+	 */
214
+	public function wp_loaded()
215
+	{
216
+	}
217
+
218
+
219
+
220
+
221
+
222
+	/***********************************************        PARSE_REQUEST HOOK         ***********************************************/
223
+	/**
224
+	 *    _get_request
225
+	 *
226
+	 * @access public
227
+	 * @param WP $WP
228
+	 * @return void
229
+	 */
230
+	public function get_request(WP $WP)
231
+	{
232
+		do_action('AHEE__EE_Front_Controller__get_request__start');
233
+		$this->Request_Handler->parse_request($WP);
234
+		do_action('AHEE__EE_Front_Controller__get_request__complete');
235
+	}
236
+
237
+
238
+	/**
239
+	 *    _initialize_shortcodes - calls init method on shortcodes that have been determined to be in the_content for
240
+	 *    the currently requested page
241
+	 *
242
+	 * @access    public
243
+	 * @param WP $WP
244
+	 * @return    void
245
+	 */
246
+	public function _initialize_shortcodes(WP $WP)
247
+	{
248
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this);
249
+		$this->Request_Handler->set_request_vars($WP);
250
+		// grab post_name from request
251
+		$current_post  = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name',
252
+			$this->Request_Handler->get('post_name'));
253
+		$show_on_front = get_option('show_on_front');
254
+		// if it's not set, then check if frontpage is blog
255
+		if (empty($current_post)) {
256
+			// yup.. this is the posts page, prepare to load all shortcode modules
257
+			$current_post = 'posts';
258
+			// unless..
259
+			if ($show_on_front === 'page') {
260
+				// some other page is set as the homepage
261
+				$page_on_front = get_option('page_on_front');
262
+				if ($page_on_front) {
263
+					// k now we need to find the post_name for this page
264
+					global $wpdb;
265
+					$page_on_front = $wpdb->get_var(
266
+						$wpdb->prepare(
267
+							"SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d",
268
+							$page_on_front
269
+						)
270
+					);
271
+					// set the current post slug to what it actually is
272
+					$current_post = $page_on_front ? $page_on_front : $current_post;
273
+				}
274
+			}
275
+		}
276
+		// where are posts being displayed ?
277
+		$page_for_posts = EE_Config::get_page_for_posts();
278
+		// in case $current_post is hierarchical like: /parent-page/current-page
279
+		$current_post = basename($current_post);
280
+		// are we on a category page?
281
+		$term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name',
282
+				$WP->query_vars);
283
+		// make sure shortcodes are set
284
+		if (isset($this->Registry->CFG->core->post_shortcodes)) {
285
+			if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) {
286
+				$this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array();
287
+			}
288
+			// cycle thru all posts with shortcodes set
289
+			foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) {
290
+				// filter shortcodes so
291
+				$post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes',
292
+					$post_shortcodes);
293
+				// now cycle thru shortcodes
294
+				foreach ($post_shortcodes as $shortcode_class => $post_id) {
295
+					// are we on this page, or on the blog page, or an EE CPT category page ?
296
+					if ($current_post === $post_name || $term_exists) {
297
+						// maybe init the shortcode
298
+						$this->initialize_shortcode_if_active_on_page(
299
+							$shortcode_class,
300
+							$current_post,
301
+							$page_for_posts,
302
+							$post_id,
303
+							$term_exists,
304
+							$WP
305
+						);
306
+						// if this is NOT the "Posts page" and we have a valid entry
307
+						// for the "Posts page" in our tracked post_shortcodes array
308
+						// but the shortcode is not being tracked for this page
309
+					} else if (
310
+						$post_name !== $page_for_posts
311
+						&& isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])
312
+						&& ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])
313
+					) {
314
+						// then remove the "fallback" shortcode processor
315
+						remove_shortcode($shortcode_class);
316
+					}
317
+				}
318
+			}
319
+		}
320
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this);
321
+	}
322
+
323
+
324
+	/**
325
+	 * @param string $shortcode_class
326
+	 * @param string $current_post
327
+	 * @param string $page_for_posts
328
+	 * @param int    $post_id
329
+	 * @param bool   $term_exists
330
+	 * @param WP     $WP
331
+	 */
332
+	protected function initialize_shortcode_if_active_on_page(
333
+		$shortcode_class,
334
+		$current_post,
335
+		$page_for_posts,
336
+		$post_id,
337
+		$term_exists,
338
+		$WP
339
+	) {
340
+		// verify shortcode is in list of registered shortcodes
341
+		if ( ! isset($this->Registry->shortcodes->{$shortcode_class})) {
342
+			if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) {
343
+				EE_Error::add_error(
344
+					sprintf(
345
+						__(
346
+							'The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.',
347
+							'event_espresso'
348
+						),
349
+						$shortcode_class
350
+					),
351
+					__FILE__,
352
+					__FUNCTION__,
353
+					__LINE__
354
+				);
355
+				add_filter('FHEE_run_EE_the_content', '__return_true');
356
+			}
357
+			add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor'));
358
+			return;
359
+		}
360
+		// is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ?
361
+		if (
362
+			$term_exists
363
+			|| $current_post === $page_for_posts
364
+			|| isset($this->Registry->CFG->core->post_shortcodes[$current_post])
365
+		) {
366
+			// let's pause to reflect on this...
367
+			$sc_reflector = new ReflectionClass('EES_' . $shortcode_class);
368
+			// ensure that class is actually a shortcode
369
+			if (
370
+				defined('WP_DEBUG')
371
+				&& WP_DEBUG === true
372
+				&& ! $sc_reflector->isSubclassOf('EES_Shortcode')
373
+			) {
374
+				EE_Error::add_error(
375
+					sprintf(
376
+						__(
377
+							'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.',
378
+							'event_espresso'
379
+						),
380
+						$shortcode_class
381
+					),
382
+					__FILE__,
383
+					__FUNCTION__,
384
+					__LINE__
385
+				);
386
+				add_filter('FHEE_run_EE_the_content', '__return_true');
387
+				return;
388
+			}
389
+			// and pass the request object to the run method
390
+			$this->Registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance();
391
+			// fire the shortcode class's run method, so that it can activate resources
392
+			$this->Registry->shortcodes->{$shortcode_class}->run($WP);
393
+		}
394
+	}
395
+
396
+
397
+	/**
398
+	 *    pre_get_posts - basically a module factory for instantiating modules and selecting the final view template
399
+	 *
400
+	 * @access    public
401
+	 * @param   WP_Query $WP_Query
402
+	 * @return    void
403
+	 */
404
+	public function pre_get_posts($WP_Query)
405
+	{
406
+		// only load Module_Request_Router if this is the main query
407
+		if (
408
+			$this->Module_Request_Router instanceof EE_Module_Request_Router
409
+			&& $WP_Query->is_main_query()
410
+		) {
411
+			// cycle thru module routes
412
+			while ($route = $this->Module_Request_Router->get_route($WP_Query)) {
413
+				// determine module and method for route
414
+				$module = $this->Module_Request_Router->resolve_route($route[0], $route[1]);
415
+				if ($module instanceof EED_Module) {
416
+					// get registered view for route
417
+					$this->_template_path = $this->Module_Request_Router->get_view($route);
418
+					// grab module name
419
+					$module_name = $module->module_name();
420
+					// map the module to the module objects
421
+					$this->Registry->modules->{$module_name} = $module;
422
+				}
423
+			}
424
+		}
425
+	}
426
+
427
+
428
+
429
+
430
+
431
+	/***********************************************        WP HOOK         ***********************************************/
432
+
433
+
434
+	/**
435
+	 *    wp - basically last chance to do stuff before headers sent
436
+	 *
437
+	 * @access    public
438
+	 * @return    void
439
+	 */
440
+	public function wp()
441
+	{
442
+	}
443
+
444
+
445
+
446
+	/***********************************************        WP_ENQUEUE_SCRIPTS && WP_HEAD HOOK         ***********************************************/
447
+
448
+
449
+	/**
450
+	 *    wp_enqueue_scripts
451
+	 *
452
+	 * @access    public
453
+	 * @return    void
454
+	 */
455
+	public function wp_enqueue_scripts()
456
+	{
457
+
458
+		// css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_css', '__return_false' );
459
+		if (apply_filters('FHEE_load_css', true)) {
460
+
461
+			$this->Registry->CFG->template_settings->enable_default_style = true;
462
+			//Load the ThemeRoller styles if enabled
463
+			if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) {
464
+
465
+				//Load custom style sheet if available
466
+				if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) {
467
+					wp_register_style('espresso_custom_css',
468
+						EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet,
469
+						EVENT_ESPRESSO_VERSION);
470
+					wp_enqueue_style('espresso_custom_css');
471
+				}
472
+
473
+				if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')) {
474
+					wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css',
475
+						array('dashicons'), EVENT_ESPRESSO_VERSION);
476
+				} else {
477
+					wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
478
+						array('dashicons'), EVENT_ESPRESSO_VERSION);
479
+				}
480
+				wp_enqueue_style('espresso_default');
481
+
482
+				if (is_readable(get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css')) {
483
+					wp_register_style('espresso_style',
484
+						get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css',
485
+						array('dashicons', 'espresso_default'));
486
+				} else {
487
+					wp_register_style('espresso_style',
488
+						EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css',
489
+						array('dashicons', 'espresso_default'));
490
+				}
491
+
492
+			}
493
+
494
+		}
495
+
496
+		// js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_js', '__return_false' );
497
+		if (apply_filters('FHEE_load_js', true)) {
498
+
499
+			wp_enqueue_script('jquery');
500
+			//let's make sure that all required scripts have been setup
501
+			if (function_exists('wp_script_is') && ! wp_script_is('jquery')) {
502
+				$msg = sprintf(
503
+					__('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.',
504
+						'event_espresso'),
505
+					'<em><br />',
506
+					'</em>'
507
+				);
508
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
509
+			}
510
+			// load core js
511
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'),
512
+				EVENT_ESPRESSO_VERSION, true);
513
+			wp_enqueue_script('espresso_core');
514
+			wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
515
+
516
+		}
517
+
518
+		//qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
519
+		if (apply_filters('FHEE_load_qtip', false)) {
520
+			EEH_Qtip_Loader::instance()->register_and_enqueue();
521
+		}
522
+
523
+
524
+		//accounting.js library
525
+		// @link http://josscrowcroft.github.io/accounting.js/
526
+		if (apply_filters('FHEE_load_accounting_js', false)) {
527
+			$acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js';
528
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
529
+				array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, true);
530
+			wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', true);
531
+			wp_enqueue_script('ee-accounting');
532
+
533
+			$currency_config = array(
534
+				'currency' => array(
535
+					'symbol'    => $this->Registry->CFG->currency->sign,
536
+					'format'    => array(
537
+						'pos'  => $this->Registry->CFG->currency->sign_b4 ? '%s%v' : '%v%s',
538
+						'neg'  => $this->Registry->CFG->currency->sign_b4 ? '- %s%v' : '- %v%s',
539
+						'zero' => $this->Registry->CFG->currency->sign_b4 ? '%s--' : '--%s',
540
+					),
541
+					'decimal'   => $this->Registry->CFG->currency->dec_mrk,
542
+					'thousand'  => $this->Registry->CFG->currency->thsnds,
543
+					'precision' => $this->Registry->CFG->currency->dec_plc,
544
+				),
545
+				'number'   => array(
546
+					'precision' => 0,
547
+					'thousand'  => $this->Registry->CFG->currency->thsnds,
548
+					'decimal'   => $this->Registry->CFG->currency->dec_mrk,
549
+				),
550
+			);
551
+			wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config);
552
+		}
553
+
554
+		if ( ! function_exists('wp_head')) {
555
+			$msg = sprintf(
556
+				__('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.',
557
+					'event_espresso'),
558
+				'<em><br />',
559
+				'</em>'
560
+			);
561
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
562
+		}
563
+		if ( ! function_exists('wp_footer')) {
564
+			$msg = sprintf(
565
+				__('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.',
566
+					'event_espresso'),
567
+				'<em><br />',
568
+				'</em>'
569
+			);
570
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
571
+		}
572
+
573
+	}
574
+
575
+
576
+	/**
577
+	 *    header_meta_tag
578
+	 *
579
+	 * @access    public
580
+	 * @return    void
581
+	 */
582
+	public function header_meta_tag()
583
+	{
584
+		print(
585
+			apply_filters(
586
+				'FHEE__EE_Front_Controller__header_meta_tag',
587
+				'<meta name="generator" content="Event Espresso Version ' . EVENT_ESPRESSO_VERSION . "\" />\n")
588
+		);
589
+
590
+		//let's exclude all event type taxonomy term archive pages from search engine indexing
591
+		//@see https://events.codebasehq.com/projects/event-espresso/tickets/10249
592
+		//also exclude all critical pages from indexing
593
+		if (
594
+			(
595
+				is_tax('espresso_event_type')
596
+				&& get_option( 'blog_public' ) !== '0'
597
+			)
598
+			|| is_page(EE_Registry::instance()->CFG->core->get_critical_pages_array())
599
+		) {
600
+			print(
601
+				apply_filters(
602
+					'FHEE__EE_Front_Controller__header_meta_tag__noindex_for_event_type',
603
+					'<meta name="robots" content="noindex,follow" />' . "\n"
604
+				)
605
+			);
606
+		}
607
+	}
608
+
609
+
610
+
611
+	/**
612
+	 * wp_print_scripts
613
+	 *
614
+	 * @return void
615
+	 */
616
+	public function wp_print_scripts()
617
+	{
618
+		global $post;
619
+		if (
620
+			get_post_type() === 'espresso_events' 
621
+			&& is_singular() 
622
+			&& isset($post->EE_Event)
623
+			&& $post->EE_Event instanceof EE_Event
624
+		) {
625
+			\EEH_Schema::add_json_linked_data_for_event($post->EE_Event);
626
+		}
627
+	}
628
+
629
+
630
+
631
+	/***********************************************        THE_CONTENT FILTER HOOK         ***********************************************/
632
+
633
+
634
+
635
+	/**
636
+	 *    the_content
637
+	 *
638
+	 * @access    public
639
+	 * @param   $the_content
640
+	 * @return    string
641
+	 */
642
+	// public function the_content( $the_content ) {
643
+	// 	// nothing gets loaded at this point unless other systems turn this hookpoint on by using:  add_filter( 'FHEE_run_EE_the_content', '__return_true' );
644
+	// 	if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) {
645
+	// 	}
646
+	// 	return $the_content;
647
+	// }
648
+
649
+
650
+	/***********************************************        WP_FOOTER         ***********************************************/
651
+
652
+
653
+	/**
654
+	 *    display_errors
655
+	 *
656
+	 * @access    public
657
+	 * @return    string
658
+	 */
659
+	public function display_errors()
660
+	{
661
+		static $shown_already = false;
662
+		do_action('AHEE__EE_Front_Controller__display_errors__begin');
663
+		if (
664
+			! $shown_already
665
+			&& apply_filters('FHEE__EE_Front_Controller__display_errors', true)
666
+			&& is_main_query()
667
+			&& ! is_feed()
668
+			&& in_the_loop()
669
+			&& $this->Request_Handler->is_espresso_page()
670
+		) {
671
+			echo EE_Error::get_notices();
672
+			$shown_already = true;
673
+			EEH_Template::display_template(EE_TEMPLATES . 'espresso-ajax-notices.template.php');
674
+		}
675
+		do_action('AHEE__EE_Front_Controller__display_errors__end');
676
+	}
677
+
678
+
679
+
680
+
681
+
682
+	/***********************************************        UTILITIES         ***********************************************/
683
+	/**
684
+	 *    template_include
685
+	 *
686
+	 * @access    public
687
+	 * @param   string $template_include_path
688
+	 * @return    string
689
+	 */
690
+	public function template_include($template_include_path = null)
691
+	{
692
+		if ($this->Request_Handler->is_espresso_page()) {
693
+			$this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path);
694
+			$template_path        = EEH_Template::locate_template($this->_template_path, array(), false);
695
+			$this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
696
+			$this->_template      = basename($this->_template_path);
697
+			return $this->_template_path;
698
+		}
699
+		return $template_include_path;
700
+	}
701
+
702
+
703
+	/**
704
+	 *    get_selected_template
705
+	 *
706
+	 * @access    public
707
+	 * @param bool $with_path
708
+	 * @return    string
709
+	 */
710
+	public function get_selected_template($with_path = false)
711
+	{
712
+		return $with_path ? $this->_template_path : $this->_template;
713
+	}
714 714
 
715 715
 
716 716
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function load_espresso_template_tags()
143 143
     {
144
-        if (is_readable(EE_PUBLIC . 'template_tags.php')) {
145
-            require_once(EE_PUBLIC . 'template_tags.php');
144
+        if (is_readable(EE_PUBLIC.'template_tags.php')) {
145
+            require_once(EE_PUBLIC.'template_tags.php');
146 146
         }
147 147
     }
148 148
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             || isset($this->Registry->CFG->core->post_shortcodes[$current_post])
365 365
         ) {
366 366
             // let's pause to reflect on this...
367
-            $sc_reflector = new ReflectionClass('EES_' . $shortcode_class);
367
+            $sc_reflector = new ReflectionClass('EES_'.$shortcode_class);
368 368
             // ensure that class is actually a shortcode
369 369
             if (
370 370
                 defined('WP_DEBUG')
@@ -465,27 +465,27 @@  discard block
 block discarded – undo
465 465
                 //Load custom style sheet if available
466 466
                 if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) {
467 467
                     wp_register_style('espresso_custom_css',
468
-                        EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet,
468
+                        EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->Registry->CFG->template_settings->custom_style_sheet,
469 469
                         EVENT_ESPRESSO_VERSION);
470 470
                     wp_enqueue_style('espresso_custom_css');
471 471
                 }
472 472
 
473
-                if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')) {
474
-                    wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css',
473
+                if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) {
474
+                    wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css',
475 475
                         array('dashicons'), EVENT_ESPRESSO_VERSION);
476 476
                 } else {
477
-                    wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
477
+                    wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css',
478 478
                         array('dashicons'), EVENT_ESPRESSO_VERSION);
479 479
                 }
480 480
                 wp_enqueue_style('espresso_default');
481 481
 
482
-                if (is_readable(get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css')) {
482
+                if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) {
483 483
                     wp_register_style('espresso_style',
484
-                        get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css',
484
+                        get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css',
485 485
                         array('dashicons', 'espresso_default'));
486 486
                 } else {
487 487
                     wp_register_style('espresso_style',
488
-                        EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css',
488
+                        EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css',
489 489
                         array('dashicons', 'espresso_default'));
490 490
                 }
491 491
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
                 EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
509 509
             }
510 510
             // load core js
511
-            wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'),
511
+            wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'),
512 512
                 EVENT_ESPRESSO_VERSION, true);
513 513
             wp_enqueue_script('espresso_core');
514 514
             wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
         //accounting.js library
525 525
         // @link http://josscrowcroft.github.io/accounting.js/
526 526
         if (apply_filters('FHEE_load_accounting_js', false)) {
527
-            $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js';
528
-            wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
527
+            $acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js';
528
+            wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js',
529 529
                 array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, true);
530 530
             wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', true);
531 531
             wp_enqueue_script('ee-accounting');
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
         print(
585 585
             apply_filters(
586 586
                 'FHEE__EE_Front_Controller__header_meta_tag',
587
-                '<meta name="generator" content="Event Espresso Version ' . EVENT_ESPRESSO_VERSION . "\" />\n")
587
+                '<meta name="generator" content="Event Espresso Version '.EVENT_ESPRESSO_VERSION."\" />\n")
588 588
         );
589 589
 
590 590
         //let's exclude all event type taxonomy term archive pages from search engine indexing
@@ -593,14 +593,14 @@  discard block
 block discarded – undo
593 593
         if (
594 594
             (
595 595
                 is_tax('espresso_event_type')
596
-                && get_option( 'blog_public' ) !== '0'
596
+                && get_option('blog_public') !== '0'
597 597
             )
598 598
             || is_page(EE_Registry::instance()->CFG->core->get_critical_pages_array())
599 599
         ) {
600 600
             print(
601 601
                 apply_filters(
602 602
                     'FHEE__EE_Front_Controller__header_meta_tag__noindex_for_event_type',
603
-                    '<meta name="robots" content="noindex,follow" />' . "\n"
603
+                    '<meta name="robots" content="noindex,follow" />'."\n"
604 604
                 )
605 605
             );
606 606
         }
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
         ) {
671 671
             echo EE_Error::get_notices();
672 672
             $shown_already = true;
673
-            EEH_Template::display_template(EE_TEMPLATES . 'espresso-ajax-notices.template.php');
673
+            EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php');
674 674
         }
675 675
         do_action('AHEE__EE_Front_Controller__display_errors__end');
676 676
     }
Please login to merge, or discard this patch.
core/admin/EE_Admin_List_Table.core.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  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
-if ( ! class_exists( 'WP_List_Table' ) ) {
6
-	require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
5
+if ( ! class_exists('WP_List_Table')) {
6
+	require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php');
7 7
 }
8 8
 
9 9
 
@@ -206,16 +206,16 @@  discard block
 block discarded – undo
206 206
 	/**
207 207
 	 * @param \EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table
208 208
 	 */
209
-	public function __construct( EE_Admin_Page $admin_page ) {
209
+	public function __construct(EE_Admin_Page $admin_page) {
210 210
 		$this->_admin_page = $admin_page;
211 211
 		$this->_req_data = $this->_admin_page->get_request_data();
212 212
 		$this->_view = $this->_admin_page->get_view();
213
-		$this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
213
+		$this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
214 214
 		$this->_current_page = $this->get_pagenum();
215
-		$this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();
216
-		$this->_yes_no = array(  __('No', 'event_espresso'), __('Yes', 'event_espresso'));
215
+		$this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view();
216
+		$this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso'));
217 217
 
218
-		$this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 );
218
+		$this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10);
219 219
 
220 220
 		$this->_setup_data();
221 221
 		$this->_add_view_counts();
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		$this->_set_properties();
226 226
 
227 227
 		//set primary column
228
-		add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) );
228
+		add_filter('list_table_primary_column', array($this, 'set_primary_column'));
229 229
 
230 230
 		//set parent defaults
231 231
 		parent::__construct($this->_wp_list_args);
@@ -301,17 +301,17 @@  discard block
 block discarded – undo
301 301
 	 * @return string
302 302
 	 */
303 303
 	protected function _get_hidden_fields() {
304
-		$action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : '';
305
-		$action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action;
304
+		$action = isset($this->_req_data['route']) ? $this->_req_data['route'] : '';
305
+		$action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;
306 306
 		//if action is STILL empty, then we set it to default
307
-		$action = empty( $action ) ? 'default' : $action;
308
-		$field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n";
309
-		$field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/
310
-		$field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n";
307
+		$action = empty($action) ? 'default' : $action;
308
+		$field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n";
309
+		$field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/
310
+		$field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n";
311 311
 
312 312
 		$bulk_actions = $this->_get_bulk_actions();
313
-		foreach ( $bulk_actions as $bulk_action => $label ) {
314
-			$field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce  ( $bulk_action . '_nonce' ) . '" />' . "\n";
313
+		foreach ($bulk_actions as $bulk_action => $label) {
314
+			$field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n";
315 315
 		}
316 316
 
317 317
 		return $field;
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
 		 *
342 342
 		 * @var array
343 343
 		 */
344
-		$_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen );
344
+		$_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen);
345 345
 
346 346
 		$sortable = array();
347
-		foreach ( $_sortable as $id => $data ) {
348
-			if ( empty( $data ) ) {
347
+		foreach ($_sortable as $id => $data) {
348
+			if (empty($data)) {
349 349
 				continue;
350 350
 			}
351 351
 			//fix for offset errors with WP_List_Table default get_columninfo()
352
-			if ( is_array($data) ) {
352
+			if (is_array($data)) {
353 353
 				$_data[0] = key($data);
354 354
 				$_data[1] = isset($data[1]) ? $data[1] : false;
355 355
 			} else {
@@ -358,14 +358,14 @@  discard block
 block discarded – undo
358 358
 
359 359
 			$data = (array) $data;
360 360
 
361
-			if ( !isset( $data[1] ) ) {
361
+			if ( ! isset($data[1])) {
362 362
 				$_data[1] = false;
363 363
 			}
364 364
 
365 365
 			$sortable[$id] = $_data;
366 366
 		}
367 367
 		$primary = $this->get_primary_column_name();
368
-		$this->_column_headers = array( $columns, $hidden, $sortable, $primary );
368
+		$this->_column_headers = array($columns, $hidden, $sortable, $primary);
369 369
 	}
370 370
 
371 371
 
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
 	 * @return string
375 375
 	 */
376 376
 	protected function get_primary_column_name() {
377
-		foreach( class_parents( $this ) as $parent ) {
378
-			if ( $parent === 'WP_List_Table' && method_exists( $parent, 'get_primary_column_name' ) ) {
377
+		foreach (class_parents($this) as $parent) {
378
+			if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) {
379 379
 				return parent::get_primary_column_name();
380 380
 			}
381 381
 		}
@@ -392,10 +392,10 @@  discard block
 block discarded – undo
392 392
 	 * @param string $primary
393 393
 	 * @return string
394 394
 	 */
395
-	protected function handle_row_actions( $item, $column_name, $primary ) {
396
-		foreach( class_parents( $this ) as $parent ) {
397
-			if ( $parent === 'WP_List_Table' && method_exists( $parent, 'handle_row_actions' ) ) {
398
-				return parent::handle_row_actions( $item, $column_name, $primary );
395
+	protected function handle_row_actions($item, $column_name, $primary) {
396
+		foreach (class_parents($this) as $parent) {
397
+			if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) {
398
+				return parent::handle_row_actions($item, $column_name, $primary);
399 399
 			}
400 400
 		}
401 401
 		return '';
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 	protected function _get_bulk_actions() {
414 414
 		$actions = array();
415 415
 		//the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table();
416
-		foreach ( $this->_views as $view => $args) {
417
-			if ( $this->_view === $view  && isset( $args['bulk_action']) && is_array($args['bulk_action']) ) {
416
+		foreach ($this->_views as $view => $args) {
417
+			if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) {
418 418
 				//each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user.
419
-				foreach ( $args['bulk_action'] as $route =>$label ) {
420
-					if ( $this->_admin_page->check_user_access( $route, true ) ) {
419
+				foreach ($args['bulk_action'] as $route =>$label) {
420
+					if ($this->_admin_page->check_user_access($route, true)) {
421 421
 						$actions[$route] = $label;
422 422
 					}
423 423
 				}
@@ -436,18 +436,18 @@  discard block
 block discarded – undo
436 436
 	 */
437 437
 	private function _filters() {
438 438
 		$classname = get_class($this);
439
-		$filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen );
439
+		$filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen);
440 440
 
441
-		if ( empty( $filters )) {
441
+		if (empty($filters)) {
442 442
 			return;
443 443
 		}
444
-		foreach ( $filters as $filter ) {
444
+		foreach ($filters as $filter) {
445 445
 			echo $filter;
446 446
 		}
447 447
 		//add filter button at end
448
-		echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />';
448
+		echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />';
449 449
 		//add reset filters button at end
450
-		echo '<a class="button button-secondary"  href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>';
450
+		echo '<a class="button button-secondary"  href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>';
451 451
 	}
452 452
 
453 453
 
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 	 * @param string $column_name
462 462
 	 * @return string
463 463
 	 */
464
-	public function set_primary_column( $column_name ) {
465
-		return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name;
464
+	public function set_primary_column($column_name) {
465
+		return ! empty($this->_primary_column) ? $this->_primary_column : $column_name;
466 466
 	}
467 467
 
468 468
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 			array(
483 483
 				'total_items' => $total_items,
484 484
 				'per_page' => $this->_per_page,
485
-				'total_pages' => ceil($total_items / $this->_per_page )
485
+				'total_pages' => ceil($total_items / $this->_per_page)
486 486
 			)
487 487
 		);
488 488
 	}
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @param string        $column_name The column being called.
497 497
 	 * @return string html content for the column
498 498
 	 */
499
-	public function column_default( $item, $column_name ) {
499
+	public function column_default($item, $column_name) {
500 500
 		/**
501 501
 		 * Dynamic hook allowing for adding additional column content in this list table.
502 502
 		 * Note that $this->screen->id is in the format
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 		 * hook prefix ("event-espresso") will be different.
507 507
 		 *
508 508
 		 */
509
-		do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen );
509
+		do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen);
510 510
 	}
511 511
 
512 512
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 		 *
533 533
 		 * @var array
534 534
 		 */
535
-		$columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen );
535
+		$columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen);
536 536
 		return $columns;
537 537
 	}
538 538
 
@@ -555,18 +555,18 @@  discard block
 block discarded – undo
555 555
 		$views = $this->get_views();
556 556
 		$assembled_views = array();
557 557
 
558
-		if ( empty( $views )) {
558
+		if (empty($views)) {
559 559
 			return;
560 560
 		}
561 561
 		echo "<ul class='subsubsub'>\n";
562
-		foreach ( $views as $view ) {
563
-			$count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] )  : 0;
564
-			if ( isset( $view['slug'], $view['class'], $view['url'], $view['label']) ) {
565
-				$assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>';
562
+		foreach ($views as $view) {
563
+			$count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;
564
+			if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) {
565
+				$assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>';
566 566
 			}
567 567
 		}
568 568
 
569
-		echo ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : '';
569
+		echo ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : '';
570 570
 		echo "</ul>";
571 571
 	}
572 572
 
@@ -578,10 +578,10 @@  discard block
 block discarded – undo
578 578
 	 * @access public
579 579
 	 * @param EE_Base_Class $item The current item
580 580
 	 */
581
-	public function single_row( $item ) {
582
-		$row_class = $this->_get_row_class( $item );
583
-		echo '<tr class="' . esc_attr( $row_class ) . '">';
584
-		$this->single_row_columns( $item );
581
+	public function single_row($item) {
582
+		$row_class = $this->_get_row_class($item);
583
+		echo '<tr class="'.esc_attr($row_class).'">';
584
+		$this->single_row_columns($item);
585 585
 		echo '</tr>';
586 586
 	}
587 587
 
@@ -593,13 +593,13 @@  discard block
 block discarded – undo
593 593
 	 * @param  EE_Base_Class $item the current item
594 594
 	 * @return string
595 595
 	 */
596
-	protected function _get_row_class( $item ) {
596
+	protected function _get_row_class($item) {
597 597
 		static $row_class = '';
598
-		$row_class = ( $row_class === '' ? 'alternate' : '' );
598
+		$row_class = ($row_class === '' ? 'alternate' : '');
599 599
 
600 600
 		$new_row_class = $row_class;
601 601
 
602
-		if ( !empty($this->_ajax_sorting_callback) ) {
602
+		if ( ! empty($this->_ajax_sorting_callback)) {
603 603
 			$new_row_class .= ' rowsortable';
604 604
 		}
605 605
 
@@ -631,13 +631,13 @@  discard block
 block discarded – undo
631 631
 	 */
632 632
 	public function get_hidden_columns() {
633 633
 		$user_id = get_current_user_id();
634
-		$has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id);
635
-		if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) {
636
-			update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE);
637
-			update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE );
634
+		$has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id);
635
+		if (empty($has_default) && ! empty($this->_hidden_columns)) {
636
+			update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE);
637
+			update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE);
638 638
 		}
639
-		$ref = 'manage' . $this->screen->id . 'columnshidden';
640
-		return (array) get_user_option( $ref, $user_id );
639
+		$ref = 'manage'.$this->screen->id.'columnshidden';
640
+		return (array) get_user_option($ref, $user_id);
641 641
 	}
642 642
 
643 643
 
@@ -650,47 +650,47 @@  discard block
 block discarded – undo
650 650
 	 * @since 3.1.0
651 651
 	 * @param EE_Base_Class $item The current item
652 652
 	 */
653
-	public function single_row_columns( $item ) {
654
-		list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
653
+	public function single_row_columns($item) {
654
+		list($columns, $hidden, $sortable, $primary) = $this->get_column_info();
655 655
 
656 656
 		global $wp_version;
657
-		$use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' );
657
+		$use_hidden_class = version_compare($wp_version, '4.3-RC', '>=');
658 658
 
659
-		foreach ( $columns as $column_name => $column_display_name ) {
659
+		foreach ($columns as $column_name => $column_display_name) {
660 660
 
661 661
 			/**
662 662
 			 * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are
663 663
 			 * hidden or not instead of using "display:none;".  This bit of code provides backward compat.
664 664
 			 */
665
-			$hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : '';
666
-			$style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : '';
665
+			$hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : '';
666
+			$style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : '';
667 667
 
668
-			$classes = $column_name . ' column-' . $column_name.$hidden_class;
669
-			if ( $primary === $column_name ) {
668
+			$classes = $column_name.' column-'.$column_name.$hidden_class;
669
+			if ($primary === $column_name) {
670 670
 				$classes .= ' has-row-actions column-primary';
671 671
 			}
672 672
 
673
-			$data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
673
+			$data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"';
674 674
 
675 675
 			$class = "class='$classes'";
676 676
 
677 677
 			$attributes = "$class$style$data";
678 678
 
679
-			if ( $column_name === 'cb' ) {
679
+			if ($column_name === 'cb') {
680 680
 				echo '<th scope="row" class="check-column">';
681
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this );
681
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this);
682 682
 				echo '</th>';
683 683
 			}
684
-			elseif ( method_exists( $this, 'column_' . $column_name ) ) {
684
+			elseif (method_exists($this, 'column_'.$column_name)) {
685 685
 				echo "<td $attributes>";
686
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this );
687
-				echo $this->handle_row_actions( $item, $column_name, $primary );
686
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this);
687
+				echo $this->handle_row_actions($item, $column_name, $primary);
688 688
 				echo "</td>";
689 689
 			}
690 690
 			else {
691 691
 				echo "<td $attributes>";
692
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this );
693
-				echo $this->handle_row_actions( $item, $column_name, $primary );
692
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this);
693
+				echo $this->handle_row_actions($item, $column_name, $primary);
694 694
 				echo "</td>";
695 695
 			}
696 696
 		}
@@ -705,15 +705,15 @@  discard block
 block discarded – undo
705 705
 	 * @param string $which
706 706
 	 * @throws \EE_Error
707 707
 	 */
708
-	public function extra_tablenav( $which ) {
709
-		if ( $which === 'top' ) {
708
+	public function extra_tablenav($which) {
709
+		if ($which === 'top') {
710 710
 			$this->_filters();
711 711
 			echo $this->_get_hidden_fields();
712 712
 		} else {
713 713
 			echo '<div class="list-table-bottom-buttons alignleft actions">';
714
-			foreach ( $this->_bottom_buttons as $type => $action ){
715
-				$route = isset( $action['route'] ) ? $action['route'] : '';
716
-				$extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : '';
714
+			foreach ($this->_bottom_buttons as $type => $action) {
715
+				$route = isset($action['route']) ? $action['route'] : '';
716
+				$extra_request = isset($action['extra_request']) ? $action['extra_request'] : '';
717 717
 				echo $this->_admin_page->get_action_link_or_button(
718 718
 					$route,
719 719
 					$type,
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 					false
724 724
 				);
725 725
 			}
726
-			do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen );
726
+			do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen);
727 727
 			echo '</div>';
728 728
 		}
729 729
 		//echo $this->_entries_per_page_dropdown;
@@ -779,11 +779,11 @@  discard block
 block discarded – undo
779 779
 	 *                                                  the actions.
780 780
 	 * @return string The assembled action elements container.
781 781
 	 */
782
-	protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) {
782
+	protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') {
783 783
 		$content = '';
784
-		$action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : '';
785
-		$action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : '';
786
-		$content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : '';
784
+		$action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : '';
785
+		$action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : '';
786
+		$content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : '';
787 787
         try {
788 788
             $content .= apply_filters(
789 789
                 'FHEE__EE_Admin_List_Table___action_string__action_items',
@@ -793,11 +793,11 @@  discard block
 block discarded – undo
793 793
             );
794 794
         } catch (\Exception $e) {
795 795
             if (WP_DEBUG) {
796
-                \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
796
+                \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
797 797
             }
798 798
             $content .= $action_items;
799 799
         }
800
-		$content .= ! empty( $action_container ) ? '</' . $action_container . '>' : '';
800
+		$content .= ! empty($action_container) ? '</'.$action_container.'>' : '';
801 801
 		return $content;
802 802
 	}
803 803
 }
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 
168 168
 
169 169
 	/**
170
-	* init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
171
-	*
172
-	* @access public
173
-	* @return void
174
-	*/
170
+	 * init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
171
+	 *
172
+	 * @access public
173
+	 * @return void
174
+	 */
175 175
 	public function init() {
176 176
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
177 177
 		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
 
457 457
 
458 458
 	/**
459
-	* admin_init
460
-	*
461
-	* @access public
462
-	* @return void
463
-	*/
459
+	 * admin_init
460
+	 *
461
+	 * @access public
462
+	 * @return void
463
+	 */
464 464
 	public function admin_init() {
465 465
 
466 466
 		/**
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 
479 479
 		/**
480 480
 		 * This code excludes EE critical pages anywhere `wp_dropdown_pages` is used to create a dropdown for selecting
481
-         * critical pages.  The only place critical pages need included in a generated dropdown is on the "Critical Pages"
482
-         * tab in the EE General Settings Admin page.
483
-         * This is for user-proofing.
481
+		 * critical pages.  The only place critical pages need included in a generated dropdown is on the "Critical Pages"
482
+		 * tab in the EE General Settings Admin page.
483
+		 * This is for user-proofing.
484 484
 		 */
485
-        add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
485
+		add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
486 486
 
487 487
 	}
488 488
 
@@ -611,24 +611,24 @@  discard block
 block discarded – undo
611 611
 
612 612
 
613 613
 	/**
614
-	* 	dismiss_persistent_admin_notice
615
-	*
616
-	*	@access 	public
617
-	* 	@return 		void
618
-	*/
614
+	 * 	dismiss_persistent_admin_notice
615
+	 *
616
+	 *	@access 	public
617
+	 * 	@return 		void
618
+	 */
619 619
 	public function dismiss_ee_nag_notice_callback() {
620 620
 		EE_Error::dismiss_persistent_admin_notice();
621 621
 	}
622 622
 
623 623
 
624 624
 
625
-    /**
626
-     * @param array $elements
627
-     * @return array
628
-     * @throws \EE_Error
629
-     */
625
+	/**
626
+	 * @param array $elements
627
+	 * @return array
628
+	 * @throws \EE_Error
629
+	 */
630 630
 	public function dashboard_glance_items($elements) {
631
-        $elements = is_array($elements) ? $elements : array($elements);
631
+		$elements = is_array($elements) ? $elements : array($elements);
632 632
 		$events = EEM_Event::instance()->count();
633 633
 		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
634 634
 		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function instance() {
42 42
 		// check if class object is instantiated
43
-		if (  ! self::$_instance instanceof EE_Admin ) {
43
+		if ( ! self::$_instance instanceof EE_Admin) {
44 44
 			self::$_instance = new self();
45 45
 		}
46 46
 		return self::$_instance;
@@ -57,30 +57,30 @@  discard block
 block discarded – undo
57 57
 		// define global EE_Admin constants
58 58
 		$this->_define_all_constants();
59 59
 		// set autoloaders for our admin page classes based on included path information
60
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
60
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
61 61
 		// admin hooks
62
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
62
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
63 63
 		// load EE_Request_Handler early
64
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
65
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
64
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
65
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
66 66
 		// post shortcode tracking
67 67
 		add_action(
68 68
 			'AHEE__EE_System__initialize_last',
69
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' )
69
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin')
70 70
 		);
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103 103
 	}
104 104
 
105 105
 
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
 	 * @param 	string 	$plugin
113 113
 	 * @return 	array
114 114
 	 */
115
-	public function filter_plugin_actions( $links, $plugin ) {
115
+	public function filter_plugin_actions($links, $plugin) {
116 116
 		// set $main_file in stone
117 117
 		static $main_file;
118 118
 		// if $main_file is not set yet
119
-		if ( ! $main_file ) {
120
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
119
+		if ( ! $main_file) {
120
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
121 121
 		}
122
-		 if ( $plugin === $main_file ) {
122
+		 if ($plugin === $main_file) {
123 123
 		 	// compare current plugin to this one
124
-			if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) {
125
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
126
-				array_unshift( $links, $maintenance_link );
124
+			if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) {
125
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
126
+				array_unshift($links, $maintenance_link);
127 127
 			} else {
128
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
129
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
128
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
129
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
130 130
 				// add before other links
131
-				array_unshift( $links, $org_settings_link, $events_link );
131
+				array_unshift($links, $org_settings_link, $events_link);
132 132
 			}
133 133
 		}
134 134
 		return $links;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *	@return void
144 144
 	 */
145 145
 	public function get_request() {
146
-		EE_Registry::instance()->load_core( 'Request_Handler' );
147
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
146
+		EE_Registry::instance()->load_core('Request_Handler');
147
+		EE_Registry::instance()->load_core('CPT_Strategy');
148 148
 	}
149 149
 
150 150
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param array $admin_page_folder_names
157 157
 	 * @return array
158 158
 	 */
159
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
159
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
160 160
 		return array(
161
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
162
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
163
-			'support' => EE_ADMIN_PAGES . 'support' . DS
161
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
162
+			'about' => EE_ADMIN_PAGES.'about'.DS,
163
+			'support' => EE_ADMIN_PAGES.'support'.DS
164 164
 		);
165 165
 	}
166 166
 
@@ -174,31 +174,31 @@  discard block
 block discarded – undo
174 174
 	*/
175 175
 	public function init() {
176 176
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
177
-		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
177
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
178 178
 			//ok so we want to enable the entire admin
179
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
180
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
181
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
179
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
180
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
181
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
182 182
 			//at a glance dashboard widget
183
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 );
183
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
184 184
 			//filter for get_edit_post_link used on comments for custom post types
185
-			add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 );
185
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2);
186 186
 		}
187 187
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
188
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
188
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
189 189
 			try {
190 190
 				//this loads the controller for the admin pages which will setup routing etc
191
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
192
-			} catch ( EE_Error $e ) {
191
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
192
+			} catch (EE_Error $e) {
193 193
 				$e->get_error();
194 194
 			}
195 195
 		}
196
-		add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
196
+		add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
197 197
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
198
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
199
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
198
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
199
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
200 200
 		//exclude EE critical pages from all nav menus and wp_list_pages
201
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
201
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
202 202
 	}
203 203
 
204 204
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	 * @param  object $post_type WP post type object
212 212
 	 * @return object            WP post type object
213 213
 	 */
214
-	public function remove_pages_from_nav_menu( $post_type ) {
214
+	public function remove_pages_from_nav_menu($post_type) {
215 215
 		//if this isn't the "pages" post type let's get out
216
-		if ( $post_type->name !== 'page' ) {
216
+		if ($post_type->name !== 'page') {
217 217
 			return $post_type;
218 218
 		}
219 219
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -233,28 +233,28 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function enable_hidden_ee_nav_menu_metaboxes() {
235 235
 		global $wp_meta_boxes, $pagenow;
236
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
236
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
237 237
 			return;
238 238
 		}
239 239
 		$user = wp_get_current_user();
240 240
 		//has this been done yet?
241
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
241
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
242 242
 			return;
243 243
 		}
244 244
 
245
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
246
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) );
245
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
246
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page'));
247 247
 
248
-		if ( is_array( $hidden_meta_boxes ) ) {
249
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
250
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
251
-					unset( $hidden_meta_boxes[ $key ] );
248
+		if (is_array($hidden_meta_boxes)) {
249
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
250
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
251
+					unset($hidden_meta_boxes[$key]);
252 252
 				}
253 253
 			}
254 254
 		}
255 255
 
256
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
257
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
256
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
257
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
258 258
 	}
259 259
 
260 260
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return void
274 274
 	 */
275 275
 	public function register_custom_nav_menu_boxes() {
276
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
276
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
277 277
 	}
278 278
 
279 279
 
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string  the (maybe) modified link
291 291
 	 */
292
-	public function modify_edit_post_link( $link, $id ) {
293
-		if ( ! $post = get_post( $id ) ){
292
+	public function modify_edit_post_link($link, $id) {
293
+		if ( ! $post = get_post($id)) {
294 294
 			return $link;
295 295
 		}
296
-		if ( $post->post_type === 'espresso_attendees' ) {
296
+		if ($post->post_type === 'espresso_attendees') {
297 297
 			$query_args = array(
298 298
 				'action' => 'edit_attendee',
299 299
 				'post' => $id
300 300
 			);
301
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
301
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
302 302
 		}
303 303
 		return $link;
304 304
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		global $nav_menu_selected_id;
311 311
 
312 312
 		$db_fields = false;
313
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
313
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
314 314
 		$current_tab = 'event-archives';
315 315
 
316 316
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 		?>
330 330
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
331 331
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
332
-				<li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>>
333
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
334
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
332
+				<li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>>
333
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
334
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
335 335
 					</a>
336 336
 				</li>
337 337
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
  			<?php */ ?>
350 350
 
351 351
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
352
-			echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
352
+			echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
353 353
 			?>">
354 354
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
355 355
 					<?php
356 356
 					$pages = $this->_get_extra_nav_menu_pages_items();
357 357
 					$args['walker'] = $walker;
358
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
358
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
359 359
 					?>
360 360
 				</ul>
361 361
 			</div><!-- /.tabs-panel -->
@@ -363,18 +363,18 @@  discard block
 block discarded – undo
363 363
 			<p class="button-controls">
364 364
 				<span class="list-controls">
365 365
 					<a href="<?php
366
-						echo esc_url( add_query_arg(
366
+						echo esc_url(add_query_arg(
367 367
 							array(
368 368
 								'extra-nav-menu-pages-tab' => 'event-archives',
369 369
 								'selectall' => 1,
370 370
 							),
371
-							remove_query_arg( $removed_args )
371
+							remove_query_arg($removed_args)
372 372
 						));
373 373
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
374 374
 				</span>
375 375
 
376 376
 				<span class="add-to-menu">
377
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
377
+					<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" />
378 378
 					<span class="spinner"></span>
379 379
 				</span>
380 380
 			</p>
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
 	private function _get_extra_nav_menu_pages_items() {
396 396
 		$menuitems[] = array(
397 397
 			'title' => __('Event List', 'event_espresso'),
398
-			'url' => get_post_type_archive_link( 'espresso_events' ),
398
+			'url' => get_post_type_archive_link('espresso_events'),
399 399
 			'description' => __('Archive page for all events.', 'event_espresso')
400 400
 		);
401
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
401
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
402 402
 	}
403 403
 
404 404
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @param $menu_item_values
411 411
 	 * @return stdClass
412 412
 	 */
413
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
413
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
414 414
 		$menu_item = new stdClass();
415 415
 		$keys = array(
416 416
 			'ID' => 0,
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 			'xfn' => ''
431 431
 		);
432 432
 
433
-		foreach ( $keys as $key => $value) {
434
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
433
+		foreach ($keys as $key => $value) {
434
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
435 435
 		}
436 436
 		return $menu_item;
437 437
 	}
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 		 * - check if doing post processing of one of EE CPTs
471 471
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
472 472
 		 */
473
-		if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) {
474
-			EE_Registry::instance()->load_core( 'Register_CPTs' );
475
-			EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
473
+		if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') {
474
+			EE_Registry::instance()->load_core('Register_CPTs');
475
+			EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
476 476
 		}
477 477
 
478 478
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
          * tab in the EE General Settings Admin page.
483 483
          * This is for user-proofing.
484 484
 		 */
485
-        add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
485
+        add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
486 486
 
487 487
 	}
488 488
 
@@ -493,25 +493,25 @@  discard block
 block discarded – undo
493 493
 	 * @param string $output  Current output.
494 494
 	 * @return string
495 495
 	 */
496
-	public function modify_dropdown_pages( $output ) {
496
+	public function modify_dropdown_pages($output) {
497 497
 		//get critical pages
498 498
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
499 499
 
500 500
 		//split current output by line break for easier parsing.
501
-		$split_output = explode( "\n", $output );
501
+		$split_output = explode("\n", $output);
502 502
 
503 503
 		//loop through to remove any critical pages from the array.
504
-		foreach ( $critical_pages as $page_id ) {
505
-			$needle = 'value="' . $page_id . '"';
506
-			foreach( $split_output as $key => $haystack ) {
507
-				if( strpos( $haystack, $needle ) !== false ) {
508
-					unset( $split_output[$key] );
504
+		foreach ($critical_pages as $page_id) {
505
+			$needle = 'value="'.$page_id.'"';
506
+			foreach ($split_output as $key => $haystack) {
507
+				if (strpos($haystack, $needle) !== false) {
508
+					unset($split_output[$key]);
509 509
 				}
510 510
 			}
511 511
 		}
512 512
 
513 513
 		//replace output with the new contents
514
-		return implode( "\n", $split_output );
514
+		return implode("\n", $split_output);
515 515
 	}
516 516
 
517 517
 
@@ -525,36 +525,36 @@  discard block
 block discarded – undo
525 525
 	public function enqueue_admin_scripts() {
526 526
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
527 527
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
528
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
528
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
529 529
 		// register cookie script for future dependencies
530
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
530
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
531 531
 		// jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
532
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
532
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
533 533
 			// register jQuery Validate
534
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
534
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
535 535
 		}
536 536
 		//joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' );
537
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
537
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
538 538
 			//joyride style
539
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
540
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
541
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
539
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
540
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
541
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
542 542
 			//joyride JS
543
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
543
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
544 544
 			// wanna go for a joyride?
545 545
 			wp_enqueue_style('ee-joyride-css');
546 546
 			wp_enqueue_script('jquery-joyride');
547 547
 		}
548 548
 		//qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' );
549
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
549
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
550 550
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
551 551
 		}
552 552
 		//accounting.js library
553 553
 		// @link http://josscrowcroft.github.io/accounting.js/
554
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
555
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
556
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
557
-			wp_enqueue_script( 'ee-accounting' );
554
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
555
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
556
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
557
+			wp_enqueue_script('ee-accounting');
558 558
 			// array of settings to get converted to JSON array via wp_localize_script
559 559
 			$currency_config = array(
560 560
 				'currency' => array(
@@ -601,11 +601,11 @@  discard block
 block discarded – undo
601 601
 	public function get_persistent_admin_notices() {
602 602
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
603 603
 		$args = array(
604
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
605
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
604
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
605
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
606 606
 		);
607
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
608
-		echo EE_Error::get_persistent_admin_notices( $return_url );
607
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
608
+		echo EE_Error::get_persistent_admin_notices($return_url);
609 609
 	}
610 610
 
611 611
 
@@ -630,24 +630,24 @@  discard block
 block discarded – undo
630 630
 	public function dashboard_glance_items($elements) {
631 631
         $elements = is_array($elements) ? $elements : array($elements);
632 632
 		$events = EEM_Event::instance()->count();
633
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
634
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
633
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
634
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
635 635
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
636 636
 		$registrations = EEM_Registration::instance()->count(
637 637
 			array(
638 638
 				array(
639
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
639
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
640 640
 				)
641 641
 			)
642 642
 		);
643
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
644
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
643
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
644
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
645 645
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
646 646
 
647
-		$items = (array) apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
647
+		$items = (array) apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
648 648
 
649
-		foreach ( $items as $type => $item_properties ) {
650
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
649
+		foreach ($items as $type => $item_properties) {
650
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
651 651
 		}
652 652
 		return $elements;
653 653
 	}
@@ -664,31 +664,31 @@  discard block
 block discarded – undo
664 664
 	 * @throws EE_Error
665 665
 	 * @return    string
666 666
 	 */
667
-	public function check_for_invalid_datetime_formats( $value, $option ) {
667
+	public function check_for_invalid_datetime_formats($value, $option) {
668 668
 		// check for date_format or time_format
669
-		switch ( $option ) {
669
+		switch ($option) {
670 670
 			case 'date_format' :
671
-				$date_time_format = $value . ' ' . get_option('time_format');
671
+				$date_time_format = $value.' '.get_option('time_format');
672 672
 				break;
673 673
 			case 'time_format' :
674
-				$date_time_format = get_option('date_format') . ' ' . $value;
674
+				$date_time_format = get_option('date_format').' '.$value;
675 675
 				break;
676 676
 			default :
677 677
 				$date_time_format = FALSE;
678 678
 		}
679 679
 		// do we have a date_time format to check ?
680
-		if ( $date_time_format ) {
681
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
680
+		if ($date_time_format) {
681
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
682 682
 
683
-			if ( is_array( $error_msg ) ) {
684
-				$msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format  ) . '</p><p><ul>';
683
+			if (is_array($error_msg)) {
684
+				$msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>';
685 685
 
686 686
 
687
-				foreach ( $error_msg as $error ) {
688
-					$msg .= '<li>' . $error . '</li>';
687
+				foreach ($error_msg as $error) {
688
+					$msg .= '<li>'.$error.'</li>';
689 689
 				}
690 690
 
691
-				$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
691
+				$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
692 692
 
693 693
 				// trigger WP settings error
694 694
 				add_settings_error(
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 				);
699 699
 
700 700
 				// set format to something valid
701
-				switch ( $option ) {
701
+				switch ($option) {
702 702
 					case 'date_format' :
703 703
 						$value = 'F j, Y';
704 704
 						break;
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
 	 * @param $content
721 721
 	 * @return    string
722 722
 	 */
723
-	public function its_eSpresso( $content ) {
724
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
723
+	public function its_eSpresso($content) {
724
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
725 725
 	}
726 726
 
727 727
 
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 	 *  @return 	string
734 734
 	 */
735 735
 	public function espresso_admin_footer() {
736
-		return \EEH_Template::powered_by_event_espresso( 'aln-cntr', '', array( 'utm_content' => 'admin_footer' ));
736
+		return \EEH_Template::powered_by_event_espresso('aln-cntr', '', array('utm_content' => 'admin_footer'));
737 737
 	}
738 738
 
739 739
 
@@ -752,12 +752,12 @@  discard block
 block discarded – undo
752 752
 	 * @param array $config
753 753
 	 * @return void
754 754
 	 */
755
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
756
-		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
757
-		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
755
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
756
+		EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3');
757
+		if (class_exists('EE_Register_Admin_Page')) {
758 758
 			$config['page_path'] = $page_path;
759 759
 		}
760
-		EE_Register_Admin_Page::register( $page_basename, $config );
760
+		EE_Register_Admin_Page::register($page_basename, $config);
761 761
 
762 762
 	}
763 763
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 	 * @param  \WP_Post $post
771 771
 	 * @return void
772 772
 	 */
773
-	public static function parse_post_content_on_save( $post_ID, $post ) {
773
+	public static function parse_post_content_on_save($post_ID, $post) {
774 774
 		EE_Error::doing_it_wrong(
775 775
 			__METHOD__,
776 776
 			__(
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 			),
780 780
 			'4.8.41'
781 781
 		);
782
-		EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post );
782
+		EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post);
783 783
 	}
784 784
 
785 785
 
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 	 * @param  $value
793 793
 	 * @return void
794 794
 	 */
795
-	public function reset_page_for_posts_on_change( $option, $old_value, $value ) {
795
+	public function reset_page_for_posts_on_change($option, $old_value, $value) {
796 796
 		EE_Error::doing_it_wrong(
797 797
 			__METHOD__,
798 798
 			__(
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 			),
802 802
 			'4.8.41'
803 803
 		);
804
-		EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value );
804
+		EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value);
805 805
 	}
806 806
 
807 807
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Attendee.class.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 /**
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
      */
34 34
     protected function __construct($fieldValues = null, $bydb = false, $timezone = null, $date_formats = array())
35 35
     {
36
-        if (! isset($fieldValues['ATT_full_name'])) {
37
-            $fname                        = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'] . ' ' : '';
36
+        if ( ! isset($fieldValues['ATT_full_name'])) {
37
+            $fname                        = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'].' ' : '';
38 38
             $lname                        = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : '';
39
-            $fieldValues['ATT_full_name'] = $fname . $lname;
39
+            $fieldValues['ATT_full_name'] = $fname.$lname;
40 40
         }
41
-        if (! isset($fieldValues['ATT_slug'])) {
41
+        if ( ! isset($fieldValues['ATT_slug'])) {
42 42
             //			$fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20));
43 43
             $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']);
44 44
         }
45
-        if (! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) {
45
+        if ( ! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) {
46 46
             $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50);
47 47
         }
48 48
         parent::__construct($fieldValues, $bydb, $timezone, $date_formats);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      */
252 252
     public function full_name($apply_html_entities = false)
253 253
     {
254
-        $full_name = $this->fname() . ' ' . $this->lname();
254
+        $full_name = $this->fname().' '.$this->lname();
255 255
         return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name;
256 256
     }
257 257
 
@@ -282,22 +282,22 @@  discard block
 block discarded – undo
282 282
         $initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',);
283 283
         foreach ($initial_address_fields as $address_field_name) {
284 284
             $address_fields_value = $this->get($address_field_name);
285
-            if (! empty($address_fields_value)) {
285
+            if ( ! empty($address_fields_value)) {
286 286
                 $full_address_array[] = $address_fields_value;
287 287
             }
288 288
         }
289 289
         //now handle state and country
290 290
         $state_obj = $this->state_obj();
291
-        if (! empty($state_obj)) {
291
+        if ( ! empty($state_obj)) {
292 292
             $full_address_array[] = $state_obj->name();
293 293
         }
294 294
         $country_obj = $this->country_obj();
295
-        if (! empty($country_obj)) {
295
+        if ( ! empty($country_obj)) {
296 296
             $full_address_array[] = $country_obj->name();
297 297
         }
298 298
         //lastly get the xip
299 299
         $zip_value = $this->zip();
300
-        if (! empty($zip_value)) {
300
+        if ( ! empty($zip_value)) {
301 301
             $full_address_array[] = $zip_value;
302 302
         }
303 303
         return $full_address_array;
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
     public function get_most_recent_registration_for_event($event_id)
532 532
     {
533 533
         return $this->get_first_related('Registration',
534
-            array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' );
534
+            array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC'))); //, '=', 'OBJECT_K' );
535 535
     }
536 536
 
537 537
 
@@ -557,11 +557,11 @@  discard block
 block discarded – undo
557 557
     public function billing_info_for_payment_method($payment_method)
558 558
     {
559 559
         $pm_type = $payment_method->type_obj();
560
-        if (! $pm_type instanceof EE_PMT_Base) {
560
+        if ( ! $pm_type instanceof EE_PMT_Base) {
561 561
             return null;
562 562
         }
563 563
         $billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true);
564
-        if (! $billing_info) {
564
+        if ( ! $billing_info) {
565 565
             return null;
566 566
         }
567 567
         $billing_form = $pm_type->billing_form();
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
     public function get_billing_info_postmeta_name($payment_method)
583 583
     {
584 584
         if ($payment_method->type_obj() instanceof EE_PMT_Base) {
585
-            return 'billing_info_' . $payment_method->type_obj()->system_name();
585
+            return 'billing_info_'.$payment_method->type_obj()->system_name();
586 586
         } else {
587 587
             return null;
588 588
         }
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
      */
600 600
     public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method)
601 601
     {
602
-        if (! $billing_form instanceof EE_Billing_Attendee_Info_Form) {
602
+        if ( ! $billing_form instanceof EE_Billing_Attendee_Info_Form) {
603 603
             EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso'));
604 604
             return false;
605 605
         }
Please login to merge, or discard this patch.
Indentation   +660 added lines, -660 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -23,665 +23,665 @@  discard block
 block discarded – undo
23 23
 class EE_Attendee extends EE_CPT_Base implements EEI_Contact, EEI_Address, EEI_Admin_Links, EEI_Attendee
24 24
 {
25 25
 
26
-    /**
27
-     * Sets some dynamic defaults
28
-     *
29
-     * @param array  $fieldValues
30
-     * @param bool   $bydb
31
-     * @param string $timezone
32
-     * @param array  $date_formats
33
-     */
34
-    protected function __construct($fieldValues = null, $bydb = false, $timezone = null, $date_formats = array())
35
-    {
36
-        if (! isset($fieldValues['ATT_full_name'])) {
37
-            $fname                        = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'] . ' ' : '';
38
-            $lname                        = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : '';
39
-            $fieldValues['ATT_full_name'] = $fname . $lname;
40
-        }
41
-        if (! isset($fieldValues['ATT_slug'])) {
42
-            //			$fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20));
43
-            $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']);
44
-        }
45
-        if (! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) {
46
-            $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50);
47
-        }
48
-        parent::__construct($fieldValues, $bydb, $timezone, $date_formats);
49
-    }
50
-
51
-
52
-    /**
53
-     * @param array  $props_n_values          incoming values
54
-     * @param string $timezone                incoming timezone (if not set the timezone set for the website will be
55
-     *                                        used.)
56
-     * @param array  $date_formats            incoming date_formats in an array where the first value is the
57
-     *                                        date_format and the second value is the time format
58
-     * @return EE_Attendee
59
-     */
60
-    public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array())
61
-    {
62
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
63
-        return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
64
-    }
65
-
66
-
67
-    /**
68
-     * @param array  $props_n_values  incoming values from the database
69
-     * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
70
-     *                                the website will be used.
71
-     * @return EE_Attendee
72
-     */
73
-    public static function new_instance_from_db($props_n_values = array(), $timezone = null)
74
-    {
75
-        return new self($props_n_values, true, $timezone);
76
-    }
77
-
78
-
79
-    /**
80
-     *        Set Attendee First Name
81
-     *
82
-     * @access        public
83
-     * @param string $fname
84
-     */
85
-    public function set_fname($fname = '')
86
-    {
87
-        $this->set('ATT_fname', $fname);
88
-    }
89
-
90
-
91
-    /**
92
-     *        Set Attendee Last Name
93
-     *
94
-     * @access        public
95
-     * @param string $lname
96
-     */
97
-    public function set_lname($lname = '')
98
-    {
99
-        $this->set('ATT_lname', $lname);
100
-    }
101
-
102
-
103
-    /**
104
-     *        Set Attendee Address
105
-     *
106
-     * @access        public
107
-     * @param string $address
108
-     */
109
-    public function set_address($address = '')
110
-    {
111
-        $this->set('ATT_address', $address);
112
-    }
113
-
114
-
115
-    /**
116
-     *        Set Attendee Address2
117
-     *
118
-     * @access        public
119
-     * @param        string $address2
120
-     */
121
-    public function set_address2($address2 = '')
122
-    {
123
-        $this->set('ATT_address2', $address2);
124
-    }
125
-
126
-
127
-    /**
128
-     *        Set Attendee City
129
-     *
130
-     * @access        public
131
-     * @param        string $city
132
-     */
133
-    public function set_city($city = '')
134
-    {
135
-        $this->set('ATT_city', $city);
136
-    }
137
-
138
-
139
-    /**
140
-     *        Set Attendee State ID
141
-     *
142
-     * @access        public
143
-     * @param        int $STA_ID
144
-     */
145
-    public function set_state($STA_ID = 0)
146
-    {
147
-        $this->set('STA_ID', $STA_ID);
148
-    }
149
-
150
-
151
-    /**
152
-     *        Set Attendee Country ISO Code
153
-     *
154
-     * @access        public
155
-     * @param        string $CNT_ISO
156
-     */
157
-    public function set_country($CNT_ISO = '')
158
-    {
159
-        $this->set('CNT_ISO', $CNT_ISO);
160
-    }
161
-
162
-
163
-    /**
164
-     *        Set Attendee Zip/Postal Code
165
-     *
166
-     * @access        public
167
-     * @param        string $zip
168
-     */
169
-    public function set_zip($zip = '')
170
-    {
171
-        $this->set('ATT_zip', $zip);
172
-    }
173
-
174
-
175
-    /**
176
-     *        Set Attendee Email Address
177
-     *
178
-     * @access        public
179
-     * @param        string $email
180
-     */
181
-    public function set_email($email = '')
182
-    {
183
-        $this->set('ATT_email', $email);
184
-    }
185
-
186
-
187
-    /**
188
-     *        Set Attendee Phone
189
-     *
190
-     * @access        public
191
-     * @param        string $phone
192
-     */
193
-    public function set_phone($phone = '')
194
-    {
195
-        $this->set('ATT_phone', $phone);
196
-    }
197
-
198
-
199
-    /**
200
-     *        set deleted
201
-     *
202
-     * @access        public
203
-     * @param        bool $ATT_deleted
204
-     */
205
-    public function set_deleted($ATT_deleted = false)
206
-    {
207
-        $this->set('ATT_deleted', $ATT_deleted);
208
-    }
209
-
210
-
211
-    /**
212
-     * Returns the value for the post_author id saved with the cpt
213
-     *
214
-     * @since 4.5.0
215
-     * @return int
216
-     */
217
-    public function wp_user()
218
-    {
219
-        return $this->get('ATT_author');
220
-    }
221
-
222
-
223
-    /**
224
-     *        get Attendee First Name
225
-     *
226
-     * @access        public
227
-     * @return string
228
-     */
229
-    public function fname()
230
-    {
231
-        return $this->get('ATT_fname');
232
-    }
233
-
234
-
235
-    /**
236
-     * echoes out the attendee's first name
237
-     *
238
-     * @return void
239
-     */
240
-    public function e_full_name()
241
-    {
242
-        echo $this->full_name();
243
-    }
244
-
245
-
246
-    /**
247
-     * Returns the first and last name concatenated together with a space.
248
-     *
249
-     * @param bool $apply_html_entities
250
-     * @return string
251
-     */
252
-    public function full_name($apply_html_entities = false)
253
-    {
254
-        $full_name = $this->fname() . ' ' . $this->lname();
255
-        return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name;
256
-    }
257
-
258
-
259
-    /**
260
-     * This returns the value of the `ATT_full_name` field which is usually equivalent to calling `full_name()` unless
261
-     * the post_title field has been directly modified in the db for the post (espresso_attendees post type) for this
262
-     * attendee.
263
-     *
264
-     * @param bool $apply_html_entities
265
-     * @return string
266
-     */
267
-    public function ATT_full_name($apply_html_entities = false)
268
-    {
269
-        return $apply_html_entities
270
-            ? htmlentities($this->get('ATT_full_name'), ENT_QUOTES, 'UTF-8')
271
-            : $this->get('ATT_full_name');
272
-    }
273
-
274
-
275
-    /**
276
-     *        get Attendee Last Name
277
-     *
278
-     * @access        public
279
-     * @return string
280
-     */
281
-    public function lname()
282
-    {
283
-        return $this->get('ATT_lname');
284
-    }
285
-
286
-
287
-    /**
288
-     * Gets the attendee's full address as an array so client code can decide hwo to display it
289
-     *
290
-     * @return array numerically indexed, with each part of the address that is known.
291
-     * Eg, if the user only responded to state and country,
292
-     * it would be array(0=>'Alabama',1=>'USA')
293
-     * @return array
294
-     */
295
-    public function full_address_as_array()
296
-    {
297
-        $full_address_array     = array();
298
-        $initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',);
299
-        foreach ($initial_address_fields as $address_field_name) {
300
-            $address_fields_value = $this->get($address_field_name);
301
-            if (! empty($address_fields_value)) {
302
-                $full_address_array[] = $address_fields_value;
303
-            }
304
-        }
305
-        //now handle state and country
306
-        $state_obj = $this->state_obj();
307
-        if (! empty($state_obj)) {
308
-            $full_address_array[] = $state_obj->name();
309
-        }
310
-        $country_obj = $this->country_obj();
311
-        if (! empty($country_obj)) {
312
-            $full_address_array[] = $country_obj->name();
313
-        }
314
-        //lastly get the xip
315
-        $zip_value = $this->zip();
316
-        if (! empty($zip_value)) {
317
-            $full_address_array[] = $zip_value;
318
-        }
319
-        return $full_address_array;
320
-    }
321
-
322
-
323
-    /**
324
-     *        get Attendee Address
325
-     *
326
-     * @return string
327
-     */
328
-    public function address()
329
-    {
330
-        return $this->get('ATT_address');
331
-    }
332
-
333
-
334
-    /**
335
-     *        get Attendee Address2
336
-     *
337
-     * @return string
338
-     */
339
-    public function address2()
340
-    {
341
-        return $this->get('ATT_address2');
342
-    }
343
-
344
-
345
-    /**
346
-     *        get Attendee City
347
-     *
348
-     * @return string
349
-     */
350
-    public function city()
351
-    {
352
-        return $this->get('ATT_city');
353
-    }
354
-
355
-
356
-    /**
357
-     *        get Attendee State ID
358
-     *
359
-     * @return string
360
-     */
361
-    public function state_ID()
362
-    {
363
-        return $this->get('STA_ID');
364
-    }
365
-
366
-
367
-    /**
368
-     * @return string
369
-     */
370
-    public function state_abbrev()
371
-    {
372
-        return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : '';
373
-    }
374
-
375
-
376
-    /**
377
-     * Gets the state set to this attendee
378
-     *
379
-     * @return EE_State
380
-     */
381
-    public function state_obj()
382
-    {
383
-        return $this->get_first_related('State');
384
-    }
385
-
386
-
387
-    /**
388
-     * Returns the state's name, otherwise 'Unknown'
389
-     *
390
-     * @return string
391
-     */
392
-    public function state_name()
393
-    {
394
-        if ($this->state_obj()) {
395
-            return $this->state_obj()->name();
396
-        } else {
397
-            return '';
398
-        }
399
-    }
400
-
401
-
402
-    /**
403
-     * either displays the state abbreviation or the state name, as determined
404
-     * by the "FHEE__EEI_Address__state__use_abbreviation" filter.
405
-     * defaults to abbreviation
406
-     *
407
-     * @return string
408
-     */
409
-    public function state()
410
-    {
411
-        if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) {
412
-            return $this->state_abbrev();
413
-        } else {
414
-            return $this->state_name();
415
-        }
416
-    }
417
-
418
-
419
-    /**
420
-     *    get Attendee Country ISO Code
421
-     *
422
-     * @return string
423
-     */
424
-    public function country_ID()
425
-    {
426
-        return $this->get('CNT_ISO');
427
-    }
428
-
429
-
430
-    /**
431
-     * Gets country set for this attendee
432
-     *
433
-     * @return EE_Country
434
-     */
435
-    public function country_obj()
436
-    {
437
-        return $this->get_first_related('Country');
438
-    }
439
-
440
-
441
-    /**
442
-     * Returns the country's name if known, otherwise 'Unknown'
443
-     *
444
-     * @return string
445
-     */
446
-    public function country_name()
447
-    {
448
-        if ($this->country_obj()) {
449
-            return $this->country_obj()->name();
450
-        } else {
451
-            return '';
452
-        }
453
-    }
454
-
455
-
456
-    /**
457
-     * either displays the country ISO2 code or the country name, as determined
458
-     * by the "FHEE__EEI_Address__country__use_abbreviation" filter.
459
-     * defaults to abbreviation
460
-     *
461
-     * @return string
462
-     */
463
-    public function country()
464
-    {
465
-        if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) {
466
-            return $this->country_ID();
467
-        } else {
468
-            return $this->country_name();
469
-        }
470
-    }
471
-
472
-
473
-    /**
474
-     *        get Attendee Zip/Postal Code
475
-     *
476
-     * @return string
477
-     */
478
-    public function zip()
479
-    {
480
-        return $this->get('ATT_zip');
481
-    }
482
-
483
-
484
-    /**
485
-     *        get Attendee Email Address
486
-     *
487
-     * @return string
488
-     */
489
-    public function email()
490
-    {
491
-        return $this->get('ATT_email');
492
-    }
493
-
494
-
495
-    /**
496
-     *        get Attendee Phone #
497
-     *
498
-     * @return string
499
-     */
500
-    public function phone()
501
-    {
502
-        return $this->get('ATT_phone');
503
-    }
504
-
505
-
506
-    /**
507
-     *    get deleted
508
-     *
509
-     * @return        bool
510
-     */
511
-    public function deleted()
512
-    {
513
-        return $this->get('ATT_deleted');
514
-    }
515
-
516
-
517
-    /**
518
-     * Gets registrations of this attendee
519
-     *
520
-     * @param array $query_params
521
-     * @return EE_Registration[]
522
-     */
523
-    public function get_registrations($query_params = array())
524
-    {
525
-        return $this->get_many_related('Registration', $query_params);
526
-    }
527
-
528
-
529
-    /**
530
-     * Gets the most recent registration of this attendee
531
-     *
532
-     * @return EE_Registration
533
-     */
534
-    public function get_most_recent_registration()
535
-    {
536
-        return $this->get_first_related('Registration',
537
-            array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K');
538
-    }
539
-
540
-
541
-    /**
542
-     * Gets the most recent registration for this attend at this event
543
-     *
544
-     * @param int $event_id
545
-     * @return EE_Registration
546
-     */
547
-    public function get_most_recent_registration_for_event($event_id)
548
-    {
549
-        return $this->get_first_related('Registration',
550
-            array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' );
551
-    }
552
-
553
-
554
-    /**
555
-     * returns any events attached to this attendee ($_Event property);
556
-     *
557
-     * @return array
558
-     */
559
-    public function events()
560
-    {
561
-        return $this->get_many_related('Event');
562
-    }
563
-
564
-
565
-    /**
566
-     * Gets the billing info array where keys match espresso_reg_page_billing_inputs(),
567
-     * and keys are their cleaned values. @see EE_Attendee::save_and_clean_billing_info_for_payment_method() which was
568
-     * used to save the billing info
569
-     *
570
-     * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class
571
-     * @return EE_Form_Section_Proper|null
572
-     */
573
-    public function billing_info_for_payment_method($payment_method)
574
-    {
575
-        $pm_type = $payment_method->type_obj();
576
-        if (! $pm_type instanceof EE_PMT_Base) {
577
-            return null;
578
-        }
579
-        $billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true);
580
-        if (! $billing_info) {
581
-            return null;
582
-        }
583
-        $billing_form = $pm_type->billing_form();
584
-        if ($billing_form instanceof EE_Form_Section_Proper) {
585
-            $billing_form->receive_form_submission(array($billing_form->name() => $billing_info), false);
586
-        }
587
-        return $billing_form;
588
-    }
589
-
590
-
591
-    /**
592
-     * Gets the postmeta key that holds this attendee's billing info for the
593
-     * specified payment method
594
-     *
595
-     * @param EE_Payment_Method $payment_method
596
-     * @return string
597
-     */
598
-    public function get_billing_info_postmeta_name($payment_method)
599
-    {
600
-        if ($payment_method->type_obj() instanceof EE_PMT_Base) {
601
-            return 'billing_info_' . $payment_method->type_obj()->system_name();
602
-        } else {
603
-            return null;
604
-        }
605
-    }
606
-
607
-
608
-    /**
609
-     * Saves the billing info to the attendee. @see EE_Attendee::billing_info_for_payment_method() which is used to
610
-     * retrieve it
611
-     *
612
-     * @param EE_Billing_Attendee_Info_Form $billing_form
613
-     * @param EE_Payment_Method             $payment_method
614
-     * @return boolean
615
-     */
616
-    public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method)
617
-    {
618
-        if (! $billing_form instanceof EE_Billing_Attendee_Info_Form) {
619
-            EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso'));
620
-            return false;
621
-        }
622
-        $billing_form->clean_sensitive_data();
623
-        return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method),
624
-            $billing_form->input_values(true));
625
-    }
626
-
627
-
628
-    /**
629
-     * Return the link to the admin details for the object.
630
-     *
631
-     * @return string
632
-     */
633
-    public function get_admin_details_link()
634
-    {
635
-        return $this->get_admin_edit_link();
636
-    }
637
-
638
-
639
-    /**
640
-     * Returns the link to the editor for the object.  Sometimes this is the same as the details.
641
-     *
642
-     * @return string
643
-     */
644
-    public function get_admin_edit_link()
645
-    {
646
-        EE_Registry::instance()->load_helper('URL');
647
-        return EEH_URL::add_query_args_and_nonce(
648
-            array(
649
-                'page'   => 'espresso_registrations',
650
-                'action' => 'edit_attendee',
651
-                'post'   => $this->ID(),
652
-            ),
653
-            admin_url('admin.php')
654
-        );
655
-    }
656
-
657
-
658
-    /**
659
-     * Returns the link to a settings page for the object.
660
-     *
661
-     * @return string
662
-     */
663
-    public function get_admin_settings_link()
664
-    {
665
-        return $this->get_admin_edit_link();
666
-    }
667
-
668
-
669
-    /**
670
-     * Returns the link to the "overview" for the object (typically the "list table" view).
671
-     *
672
-     * @return string
673
-     */
674
-    public function get_admin_overview_link()
675
-    {
676
-        EE_Registry::instance()->load_helper('URL');
677
-        return EEH_URL::add_query_args_and_nonce(
678
-            array(
679
-                'page'   => 'espresso_registrations',
680
-                'action' => 'contact_list',
681
-            ),
682
-            admin_url('admin.php')
683
-        );
684
-    }
26
+	/**
27
+	 * Sets some dynamic defaults
28
+	 *
29
+	 * @param array  $fieldValues
30
+	 * @param bool   $bydb
31
+	 * @param string $timezone
32
+	 * @param array  $date_formats
33
+	 */
34
+	protected function __construct($fieldValues = null, $bydb = false, $timezone = null, $date_formats = array())
35
+	{
36
+		if (! isset($fieldValues['ATT_full_name'])) {
37
+			$fname                        = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'] . ' ' : '';
38
+			$lname                        = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : '';
39
+			$fieldValues['ATT_full_name'] = $fname . $lname;
40
+		}
41
+		if (! isset($fieldValues['ATT_slug'])) {
42
+			//			$fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20));
43
+			$fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']);
44
+		}
45
+		if (! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) {
46
+			$fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50);
47
+		}
48
+		parent::__construct($fieldValues, $bydb, $timezone, $date_formats);
49
+	}
50
+
51
+
52
+	/**
53
+	 * @param array  $props_n_values          incoming values
54
+	 * @param string $timezone                incoming timezone (if not set the timezone set for the website will be
55
+	 *                                        used.)
56
+	 * @param array  $date_formats            incoming date_formats in an array where the first value is the
57
+	 *                                        date_format and the second value is the time format
58
+	 * @return EE_Attendee
59
+	 */
60
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array())
61
+	{
62
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
63
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
64
+	}
65
+
66
+
67
+	/**
68
+	 * @param array  $props_n_values  incoming values from the database
69
+	 * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
70
+	 *                                the website will be used.
71
+	 * @return EE_Attendee
72
+	 */
73
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null)
74
+	{
75
+		return new self($props_n_values, true, $timezone);
76
+	}
77
+
78
+
79
+	/**
80
+	 *        Set Attendee First Name
81
+	 *
82
+	 * @access        public
83
+	 * @param string $fname
84
+	 */
85
+	public function set_fname($fname = '')
86
+	{
87
+		$this->set('ATT_fname', $fname);
88
+	}
89
+
90
+
91
+	/**
92
+	 *        Set Attendee Last Name
93
+	 *
94
+	 * @access        public
95
+	 * @param string $lname
96
+	 */
97
+	public function set_lname($lname = '')
98
+	{
99
+		$this->set('ATT_lname', $lname);
100
+	}
101
+
102
+
103
+	/**
104
+	 *        Set Attendee Address
105
+	 *
106
+	 * @access        public
107
+	 * @param string $address
108
+	 */
109
+	public function set_address($address = '')
110
+	{
111
+		$this->set('ATT_address', $address);
112
+	}
113
+
114
+
115
+	/**
116
+	 *        Set Attendee Address2
117
+	 *
118
+	 * @access        public
119
+	 * @param        string $address2
120
+	 */
121
+	public function set_address2($address2 = '')
122
+	{
123
+		$this->set('ATT_address2', $address2);
124
+	}
125
+
126
+
127
+	/**
128
+	 *        Set Attendee City
129
+	 *
130
+	 * @access        public
131
+	 * @param        string $city
132
+	 */
133
+	public function set_city($city = '')
134
+	{
135
+		$this->set('ATT_city', $city);
136
+	}
137
+
138
+
139
+	/**
140
+	 *        Set Attendee State ID
141
+	 *
142
+	 * @access        public
143
+	 * @param        int $STA_ID
144
+	 */
145
+	public function set_state($STA_ID = 0)
146
+	{
147
+		$this->set('STA_ID', $STA_ID);
148
+	}
149
+
150
+
151
+	/**
152
+	 *        Set Attendee Country ISO Code
153
+	 *
154
+	 * @access        public
155
+	 * @param        string $CNT_ISO
156
+	 */
157
+	public function set_country($CNT_ISO = '')
158
+	{
159
+		$this->set('CNT_ISO', $CNT_ISO);
160
+	}
161
+
162
+
163
+	/**
164
+	 *        Set Attendee Zip/Postal Code
165
+	 *
166
+	 * @access        public
167
+	 * @param        string $zip
168
+	 */
169
+	public function set_zip($zip = '')
170
+	{
171
+		$this->set('ATT_zip', $zip);
172
+	}
173
+
174
+
175
+	/**
176
+	 *        Set Attendee Email Address
177
+	 *
178
+	 * @access        public
179
+	 * @param        string $email
180
+	 */
181
+	public function set_email($email = '')
182
+	{
183
+		$this->set('ATT_email', $email);
184
+	}
185
+
186
+
187
+	/**
188
+	 *        Set Attendee Phone
189
+	 *
190
+	 * @access        public
191
+	 * @param        string $phone
192
+	 */
193
+	public function set_phone($phone = '')
194
+	{
195
+		$this->set('ATT_phone', $phone);
196
+	}
197
+
198
+
199
+	/**
200
+	 *        set deleted
201
+	 *
202
+	 * @access        public
203
+	 * @param        bool $ATT_deleted
204
+	 */
205
+	public function set_deleted($ATT_deleted = false)
206
+	{
207
+		$this->set('ATT_deleted', $ATT_deleted);
208
+	}
209
+
210
+
211
+	/**
212
+	 * Returns the value for the post_author id saved with the cpt
213
+	 *
214
+	 * @since 4.5.0
215
+	 * @return int
216
+	 */
217
+	public function wp_user()
218
+	{
219
+		return $this->get('ATT_author');
220
+	}
221
+
222
+
223
+	/**
224
+	 *        get Attendee First Name
225
+	 *
226
+	 * @access        public
227
+	 * @return string
228
+	 */
229
+	public function fname()
230
+	{
231
+		return $this->get('ATT_fname');
232
+	}
233
+
234
+
235
+	/**
236
+	 * echoes out the attendee's first name
237
+	 *
238
+	 * @return void
239
+	 */
240
+	public function e_full_name()
241
+	{
242
+		echo $this->full_name();
243
+	}
244
+
245
+
246
+	/**
247
+	 * Returns the first and last name concatenated together with a space.
248
+	 *
249
+	 * @param bool $apply_html_entities
250
+	 * @return string
251
+	 */
252
+	public function full_name($apply_html_entities = false)
253
+	{
254
+		$full_name = $this->fname() . ' ' . $this->lname();
255
+		return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name;
256
+	}
257
+
258
+
259
+	/**
260
+	 * This returns the value of the `ATT_full_name` field which is usually equivalent to calling `full_name()` unless
261
+	 * the post_title field has been directly modified in the db for the post (espresso_attendees post type) for this
262
+	 * attendee.
263
+	 *
264
+	 * @param bool $apply_html_entities
265
+	 * @return string
266
+	 */
267
+	public function ATT_full_name($apply_html_entities = false)
268
+	{
269
+		return $apply_html_entities
270
+			? htmlentities($this->get('ATT_full_name'), ENT_QUOTES, 'UTF-8')
271
+			: $this->get('ATT_full_name');
272
+	}
273
+
274
+
275
+	/**
276
+	 *        get Attendee Last Name
277
+	 *
278
+	 * @access        public
279
+	 * @return string
280
+	 */
281
+	public function lname()
282
+	{
283
+		return $this->get('ATT_lname');
284
+	}
285
+
286
+
287
+	/**
288
+	 * Gets the attendee's full address as an array so client code can decide hwo to display it
289
+	 *
290
+	 * @return array numerically indexed, with each part of the address that is known.
291
+	 * Eg, if the user only responded to state and country,
292
+	 * it would be array(0=>'Alabama',1=>'USA')
293
+	 * @return array
294
+	 */
295
+	public function full_address_as_array()
296
+	{
297
+		$full_address_array     = array();
298
+		$initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',);
299
+		foreach ($initial_address_fields as $address_field_name) {
300
+			$address_fields_value = $this->get($address_field_name);
301
+			if (! empty($address_fields_value)) {
302
+				$full_address_array[] = $address_fields_value;
303
+			}
304
+		}
305
+		//now handle state and country
306
+		$state_obj = $this->state_obj();
307
+		if (! empty($state_obj)) {
308
+			$full_address_array[] = $state_obj->name();
309
+		}
310
+		$country_obj = $this->country_obj();
311
+		if (! empty($country_obj)) {
312
+			$full_address_array[] = $country_obj->name();
313
+		}
314
+		//lastly get the xip
315
+		$zip_value = $this->zip();
316
+		if (! empty($zip_value)) {
317
+			$full_address_array[] = $zip_value;
318
+		}
319
+		return $full_address_array;
320
+	}
321
+
322
+
323
+	/**
324
+	 *        get Attendee Address
325
+	 *
326
+	 * @return string
327
+	 */
328
+	public function address()
329
+	{
330
+		return $this->get('ATT_address');
331
+	}
332
+
333
+
334
+	/**
335
+	 *        get Attendee Address2
336
+	 *
337
+	 * @return string
338
+	 */
339
+	public function address2()
340
+	{
341
+		return $this->get('ATT_address2');
342
+	}
343
+
344
+
345
+	/**
346
+	 *        get Attendee City
347
+	 *
348
+	 * @return string
349
+	 */
350
+	public function city()
351
+	{
352
+		return $this->get('ATT_city');
353
+	}
354
+
355
+
356
+	/**
357
+	 *        get Attendee State ID
358
+	 *
359
+	 * @return string
360
+	 */
361
+	public function state_ID()
362
+	{
363
+		return $this->get('STA_ID');
364
+	}
365
+
366
+
367
+	/**
368
+	 * @return string
369
+	 */
370
+	public function state_abbrev()
371
+	{
372
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : '';
373
+	}
374
+
375
+
376
+	/**
377
+	 * Gets the state set to this attendee
378
+	 *
379
+	 * @return EE_State
380
+	 */
381
+	public function state_obj()
382
+	{
383
+		return $this->get_first_related('State');
384
+	}
385
+
386
+
387
+	/**
388
+	 * Returns the state's name, otherwise 'Unknown'
389
+	 *
390
+	 * @return string
391
+	 */
392
+	public function state_name()
393
+	{
394
+		if ($this->state_obj()) {
395
+			return $this->state_obj()->name();
396
+		} else {
397
+			return '';
398
+		}
399
+	}
400
+
401
+
402
+	/**
403
+	 * either displays the state abbreviation or the state name, as determined
404
+	 * by the "FHEE__EEI_Address__state__use_abbreviation" filter.
405
+	 * defaults to abbreviation
406
+	 *
407
+	 * @return string
408
+	 */
409
+	public function state()
410
+	{
411
+		if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) {
412
+			return $this->state_abbrev();
413
+		} else {
414
+			return $this->state_name();
415
+		}
416
+	}
417
+
418
+
419
+	/**
420
+	 *    get Attendee Country ISO Code
421
+	 *
422
+	 * @return string
423
+	 */
424
+	public function country_ID()
425
+	{
426
+		return $this->get('CNT_ISO');
427
+	}
428
+
429
+
430
+	/**
431
+	 * Gets country set for this attendee
432
+	 *
433
+	 * @return EE_Country
434
+	 */
435
+	public function country_obj()
436
+	{
437
+		return $this->get_first_related('Country');
438
+	}
439
+
440
+
441
+	/**
442
+	 * Returns the country's name if known, otherwise 'Unknown'
443
+	 *
444
+	 * @return string
445
+	 */
446
+	public function country_name()
447
+	{
448
+		if ($this->country_obj()) {
449
+			return $this->country_obj()->name();
450
+		} else {
451
+			return '';
452
+		}
453
+	}
454
+
455
+
456
+	/**
457
+	 * either displays the country ISO2 code or the country name, as determined
458
+	 * by the "FHEE__EEI_Address__country__use_abbreviation" filter.
459
+	 * defaults to abbreviation
460
+	 *
461
+	 * @return string
462
+	 */
463
+	public function country()
464
+	{
465
+		if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) {
466
+			return $this->country_ID();
467
+		} else {
468
+			return $this->country_name();
469
+		}
470
+	}
471
+
472
+
473
+	/**
474
+	 *        get Attendee Zip/Postal Code
475
+	 *
476
+	 * @return string
477
+	 */
478
+	public function zip()
479
+	{
480
+		return $this->get('ATT_zip');
481
+	}
482
+
483
+
484
+	/**
485
+	 *        get Attendee Email Address
486
+	 *
487
+	 * @return string
488
+	 */
489
+	public function email()
490
+	{
491
+		return $this->get('ATT_email');
492
+	}
493
+
494
+
495
+	/**
496
+	 *        get Attendee Phone #
497
+	 *
498
+	 * @return string
499
+	 */
500
+	public function phone()
501
+	{
502
+		return $this->get('ATT_phone');
503
+	}
504
+
505
+
506
+	/**
507
+	 *    get deleted
508
+	 *
509
+	 * @return        bool
510
+	 */
511
+	public function deleted()
512
+	{
513
+		return $this->get('ATT_deleted');
514
+	}
515
+
516
+
517
+	/**
518
+	 * Gets registrations of this attendee
519
+	 *
520
+	 * @param array $query_params
521
+	 * @return EE_Registration[]
522
+	 */
523
+	public function get_registrations($query_params = array())
524
+	{
525
+		return $this->get_many_related('Registration', $query_params);
526
+	}
527
+
528
+
529
+	/**
530
+	 * Gets the most recent registration of this attendee
531
+	 *
532
+	 * @return EE_Registration
533
+	 */
534
+	public function get_most_recent_registration()
535
+	{
536
+		return $this->get_first_related('Registration',
537
+			array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K');
538
+	}
539
+
540
+
541
+	/**
542
+	 * Gets the most recent registration for this attend at this event
543
+	 *
544
+	 * @param int $event_id
545
+	 * @return EE_Registration
546
+	 */
547
+	public function get_most_recent_registration_for_event($event_id)
548
+	{
549
+		return $this->get_first_related('Registration',
550
+			array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' );
551
+	}
552
+
553
+
554
+	/**
555
+	 * returns any events attached to this attendee ($_Event property);
556
+	 *
557
+	 * @return array
558
+	 */
559
+	public function events()
560
+	{
561
+		return $this->get_many_related('Event');
562
+	}
563
+
564
+
565
+	/**
566
+	 * Gets the billing info array where keys match espresso_reg_page_billing_inputs(),
567
+	 * and keys are their cleaned values. @see EE_Attendee::save_and_clean_billing_info_for_payment_method() which was
568
+	 * used to save the billing info
569
+	 *
570
+	 * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class
571
+	 * @return EE_Form_Section_Proper|null
572
+	 */
573
+	public function billing_info_for_payment_method($payment_method)
574
+	{
575
+		$pm_type = $payment_method->type_obj();
576
+		if (! $pm_type instanceof EE_PMT_Base) {
577
+			return null;
578
+		}
579
+		$billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true);
580
+		if (! $billing_info) {
581
+			return null;
582
+		}
583
+		$billing_form = $pm_type->billing_form();
584
+		if ($billing_form instanceof EE_Form_Section_Proper) {
585
+			$billing_form->receive_form_submission(array($billing_form->name() => $billing_info), false);
586
+		}
587
+		return $billing_form;
588
+	}
589
+
590
+
591
+	/**
592
+	 * Gets the postmeta key that holds this attendee's billing info for the
593
+	 * specified payment method
594
+	 *
595
+	 * @param EE_Payment_Method $payment_method
596
+	 * @return string
597
+	 */
598
+	public function get_billing_info_postmeta_name($payment_method)
599
+	{
600
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
601
+			return 'billing_info_' . $payment_method->type_obj()->system_name();
602
+		} else {
603
+			return null;
604
+		}
605
+	}
606
+
607
+
608
+	/**
609
+	 * Saves the billing info to the attendee. @see EE_Attendee::billing_info_for_payment_method() which is used to
610
+	 * retrieve it
611
+	 *
612
+	 * @param EE_Billing_Attendee_Info_Form $billing_form
613
+	 * @param EE_Payment_Method             $payment_method
614
+	 * @return boolean
615
+	 */
616
+	public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method)
617
+	{
618
+		if (! $billing_form instanceof EE_Billing_Attendee_Info_Form) {
619
+			EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso'));
620
+			return false;
621
+		}
622
+		$billing_form->clean_sensitive_data();
623
+		return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method),
624
+			$billing_form->input_values(true));
625
+	}
626
+
627
+
628
+	/**
629
+	 * Return the link to the admin details for the object.
630
+	 *
631
+	 * @return string
632
+	 */
633
+	public function get_admin_details_link()
634
+	{
635
+		return $this->get_admin_edit_link();
636
+	}
637
+
638
+
639
+	/**
640
+	 * Returns the link to the editor for the object.  Sometimes this is the same as the details.
641
+	 *
642
+	 * @return string
643
+	 */
644
+	public function get_admin_edit_link()
645
+	{
646
+		EE_Registry::instance()->load_helper('URL');
647
+		return EEH_URL::add_query_args_and_nonce(
648
+			array(
649
+				'page'   => 'espresso_registrations',
650
+				'action' => 'edit_attendee',
651
+				'post'   => $this->ID(),
652
+			),
653
+			admin_url('admin.php')
654
+		);
655
+	}
656
+
657
+
658
+	/**
659
+	 * Returns the link to a settings page for the object.
660
+	 *
661
+	 * @return string
662
+	 */
663
+	public function get_admin_settings_link()
664
+	{
665
+		return $this->get_admin_edit_link();
666
+	}
667
+
668
+
669
+	/**
670
+	 * Returns the link to the "overview" for the object (typically the "list table" view).
671
+	 *
672
+	 * @return string
673
+	 */
674
+	public function get_admin_overview_link()
675
+	{
676
+		EE_Registry::instance()->load_helper('URL');
677
+		return EEH_URL::add_query_args_and_nonce(
678
+			array(
679
+				'page'   => 'espresso_registrations',
680
+				'action' => 'contact_list',
681
+			),
682
+			admin_url('admin.php')
683
+		);
684
+	}
685 685
 
686 686
 
687 687
 }
Please login to merge, or discard this patch.