Completed
Branch FET-9643-checkin-system-docume... (5f5a9c)
by
unknown
200:04 queued 188:44
created
core/libraries/messages/defaults/default/html_main_wrapper.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@
 block discarded – undo
27 27
 		<!-- Primary Style Sheet -->
28 28
 		<link rel="stylesheet" type="text/css" href="<?php echo $main_css; ?>" />
29 29
 		<!-- Make sure the buttons don't print -->
30
-		<?php if ( isset( $extra_css )) : ?>
30
+		<?php if (isset($extra_css)) : ?>
31 31
 		<!-- Additional Style Sheet -->
32 32
 		<link rel="stylesheet" type="text/css" href="<?php echo $extra_css; ?>" />
33 33
 		<?php endif; ?>
34 34
 		<style type="text/css">
35 35
 		@media print{ .noPrint{ display:none !important;height:0!important; width:0!important; margin:0!important; padding:0!important; }}
36 36
 		</style>
37
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
37
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
38 38
 	</head>
39
-	<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
39
+	<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
40 40
 	<body>
41
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
41
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
42 42
 		<?php echo $main_body; ?>
43
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
43
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
44 44
 	</body>
45
-	<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
45
+	<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
46 46
 	<?php wp_footer(); ?>
47 47
 </html>
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/messages/messenger/EE_Email_messenger.class.php 3 patches
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * This sets up the email messenger for the EE_messages (notifications) subsystem in EE.
31 31
  */
32
-class EE_Email_messenger extends EE_messenger  {
32
+class EE_Email_messenger extends EE_messenger {
33 33
 
34 34
 	/**
35 35
 	 * The following are the properties that email requires for the message going out.
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	protected function _set_valid_shortcodes() {
76 76
 		//remember by leaving the other fields not set, those fields will inherit the valid shortcodes from the message type.
77 77
 		$this->_valid_shortcodes = array(
78
-			'to' => array('email','event_author', 'primary_registration_details', 'recipient_details'),
78
+			'to' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'),
79 79
 			'from' => array('email', 'event_author', 'primary_registration_details', 'recipient_details')
80 80
 			);
81 81
 	}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				'shortcodes' => array('organization', 'primary_registration_details', 'event_author', 'primary_registration_details', 'recipient_details')
110 110
 				),
111 111
 			'content' => array(
112
-				'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list', 'transaction', 'messenger')
112
+				'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list', 'transaction', 'messenger')
113 113
 				),
114 114
 			'attendee_list' => array(
115 115
 				'shortcodes' => array('attendee', 'event_list', 'ticket_list'),
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 				'required' => array('[EVENT_LIST]')
121 121
 				),
122 122
 			'ticket_list' => array(
123
-				'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list','primary_registration_details', 'recipient_details'),
123
+				'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'),
124 124
 				'required' => array('[TICKET_LIST]')
125 125
 				),
126 126
 			'datetime_list' => array(
@@ -139,21 +139,21 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @since 4.5.0
141 141
 	 */
142
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
143
-		if ( $sending_messenger_name = 'html' ) {
144
-			add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10, 8 );
142
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
143
+		if ($sending_messenger_name = 'html') {
144
+			add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8);
145 145
 		}
146 146
 	}
147 147
 
148 148
 
149 149
 
150 150
 
151
-	public function add_email_css( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) {
151
+	public function add_email_css($variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack) {
152 152
 		//prevent recursion on this callback.
153
-		remove_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10 );
154
-		$variation = $this->get_variation( $template_pack, $message_type, $url, 'main', $variation, FALSE  );
153
+		remove_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10);
154
+		$variation = $this->get_variation($template_pack, $message_type, $url, 'main', $variation, FALSE);
155 155
 
156
-		add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10, 8 );
156
+		add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8);
157 157
 		return $variation;
158 158
 	}
159 159
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 				'required' => FALSE,
186 186
 				'validation' => FALSE,
187 187
 				'format' => '%s',
188
-				'value' => sprintf( __('Test email sent from %s', 'event_espresso'), get_bloginfo('name') ),
188
+				'value' => sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')),
189 189
 				'default'=> '',
190 190
 				'css_class' => ''
191 191
 				)
@@ -348,8 +348,8 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	protected function _send_message() {
350 350
 		return wp_mail(
351
-			html_entity_decode( $this->_to, ENT_QUOTES, "UTF-8" ),
352
-			stripslashes( html_entity_decode( $this->_subject, ENT_QUOTES, "UTF-8" )),
351
+			html_entity_decode($this->_to, ENT_QUOTES, "UTF-8"),
352
+			stripslashes(html_entity_decode($this->_subject, ENT_QUOTES, "UTF-8")),
353 353
 			$this->_body(),
354 354
 			$this->_headers()
355 355
 		);
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 * @return string html body of the message content and the related css.
364 364
 	 */
365 365
 	protected function _preview() {
366
-		return $this->_body( TRUE );
366
+		return $this->_body(TRUE);
367 367
 	}
368 368
 
369 369
 
@@ -377,18 +377,18 @@  discard block
 block discarded – undo
377 377
 	 * @return string formatted header for email
378 378
 	 */
379 379
 	protected function _headers() {
380
-		$from = stripslashes_deep( html_entity_decode($this->_from,  ENT_QUOTES,"UTF-8" ) );
380
+		$from = stripslashes_deep(html_entity_decode($this->_from, ENT_QUOTES, "UTF-8"));
381 381
 		$headers = array(
382 382
 			'MIME-Version: 1.0',
383
-			'From:' . $from,
384
-			'Reply-To:' . $from,
383
+			'From:'.$from,
384
+			'Reply-To:'.$from,
385 385
 			'Content-Type:text/html; charset=utf-8'
386 386
 			);
387 387
 
388 388
 		//but wait!  Header's for the from is NOT reliable because some plugins don't respect From: as set in the header.
389
-		add_filter( 'wp_mail_from',  array( $this, 'set_from_address' ), 100 );
390
-		add_filter( 'wp_mail_from_name', array( $this, 'set_from_name' ), 100 );
391
-		return apply_filters( 'FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this );
389
+		add_filter('wp_mail_from', array($this, 'set_from_address'), 100);
390
+		add_filter('wp_mail_from_name', array($this, 'set_from_name'), 100);
391
+		return apply_filters('FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this);
392 392
 	}
393 393
 
394 394
 
@@ -404,19 +404,19 @@  discard block
 block discarded – undo
404 404
 	 * @return array
405 405
 	 */
406 406
 	private function _parse_from() {
407
-		if ( strpos( $this->_from, '<' ) !== false ) {
408
-			$from_name = substr( $this->_from, 0, strpos( $this->_from, '<' ) - 1 );
409
-			$from_name = str_replace( '"', '', $from_name );
410
-			$from_name = trim( $from_name );
411
-
412
-			$from_email = substr( $this->_from, strpos( $this->_from, '<' ) + 1 );
413
-			$from_email = str_replace( '>', '', $from_email );
414
-			$from_email = trim( $from_email );
407
+		if (strpos($this->_from, '<') !== false) {
408
+			$from_name = substr($this->_from, 0, strpos($this->_from, '<') - 1);
409
+			$from_name = str_replace('"', '', $from_name);
410
+			$from_name = trim($from_name);
411
+
412
+			$from_email = substr($this->_from, strpos($this->_from, '<') + 1);
413
+			$from_email = str_replace('>', '', $from_email);
414
+			$from_email = trim($from_email);
415 415
 		} else {
416 416
 			$from_name = '';
417
-			$from_email = trim( $this->_from );
417
+			$from_email = trim($this->_from);
418 418
 		}
419
-		return array( $from_name, $from_email );
419
+		return array($from_name, $from_email);
420 420
 	}
421 421
 
422 422
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 *
430 430
 	 * @param string $from_email What the original from_email is.
431 431
 	 */
432
-	public function set_from_address( $from_email ) {
432
+	public function set_from_address($from_email) {
433 433
 		$parsed_from = $this->_parse_from();
434 434
 		return $parsed_from[1];
435 435
 	}
@@ -444,13 +444,13 @@  discard block
 block discarded – undo
444 444
 	 *
445 445
 	 * @param string $from_name The original from_name.
446 446
 	 */
447
-	public function set_from_name( $from_name ) {
447
+	public function set_from_name($from_name) {
448 448
 		$parsed_from = $this->_parse_from();
449
-		if ( is_array( $parsed_from) && ! empty( $parsed_from[0] ) ) {
450
-			$from_name =  $parsed_from[0];
449
+		if (is_array($parsed_from) && ! empty($parsed_from[0])) {
450
+			$from_name = $parsed_from[0];
451 451
 		}
452 452
 
453
-		return stripslashes_deep( html_entity_decode($from_name,  ENT_QUOTES,"UTF-8" ) );
453
+		return stripslashes_deep(html_entity_decode($from_name, ENT_QUOTES, "UTF-8"));
454 454
 	}
455 455
 
456 456
 
@@ -461,14 +461,14 @@  discard block
 block discarded – undo
461 461
 	 * @param bool $preview will determine whether this is preview template or not.
462 462
 	 * @return string formatted body for email.
463 463
 	 */
464
-	protected function _body( $preview = FALSE ) {
464
+	protected function _body($preview = FALSE) {
465 465
 		//setup template args!
466 466
 		$this->_template_args = array(
467 467
 			'subject' => $this->_subject,
468 468
 			'from' => $this->_from,
469
-			'main_body' => wpautop(stripslashes_deep( html_entity_decode($this->_content,  ENT_QUOTES,"UTF-8" ) ))
469
+			'main_body' => wpautop(stripslashes_deep(html_entity_decode($this->_content, ENT_QUOTES, "UTF-8")))
470 470
 			);
471
-		$body =  $this->_get_main_template( $preview );
471
+		$body = $this->_get_main_template($preview);
472 472
 
473 473
 		/**
474 474
 		 * This filter allows one to bypass the CSSToInlineStyles tool and leave the body untouched.
@@ -476,17 +476,17 @@  discard block
 block discarded – undo
476 476
 		 * @type    bool    $preview    Indicates whether a preview is being generated or not.
477 477
 		 * @return  bool    true  indicates to use the inliner, false bypasses it.
478 478
 		 */
479
-		if ( apply_filters( 'FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview ) ) {
479
+		if (apply_filters('FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview)) {
480 480
 
481 481
 			//require CssToInlineStyles library and its dependencies via composer autoloader
482
-			require_once EE_THIRD_PARTY . 'cssinliner/vendor/autoload.php';
482
+			require_once EE_THIRD_PARTY.'cssinliner/vendor/autoload.php';
483 483
 
484 484
 			//now if this isn't a preview, let's setup the body so it has inline styles
485
-			if ( ! $preview || ( $preview && defined( 'DOING_AJAX' ) ) ) {
486
-				$style = file_get_contents( $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, FALSE, 'main', $this->_variation ), TRUE );
487
-				$CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles( $body, $style );
488
-				$body = ltrim( $CSS->convert( true ), ">\n" ); //for some reason the library has a bracket and new line at the beginning.  This takes care of that.
489
-				$body = ltrim( $body, "<?" ); //see https://events.codebasehq.com/projects/event-espresso/tickets/8609
485
+			if ( ! $preview || ($preview && defined('DOING_AJAX'))) {
486
+				$style = file_get_contents($this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, FALSE, 'main', $this->_variation), TRUE);
487
+				$CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($body, $style);
488
+				$body = ltrim($CSS->convert(true), ">\n"); //for some reason the library has a bracket and new line at the beginning.  This takes care of that.
489
+				$body = ltrim($body, "<?"); //see https://events.codebasehq.com/projects/event-espresso/tickets/8609
490 490
 			}
491 491
 
492 492
 		}
@@ -505,8 +505,8 @@  discard block
 block discarded – undo
505 505
 	public function get_existing_test_settings() {
506 506
 		$settings = parent::get_existing_test_settings();
507 507
 		//override subject if present because we always want it to be fresh.
508
-		if ( is_array( $settings ) && ! empty( $settings['subject'] ) ) {
509
-			$settings['subject'] = sprintf( __('Test email sent from %s', 'event_espresso'), get_bloginfo('name') );
508
+		if (is_array($settings) && ! empty($settings['subject'])) {
509
+			$settings['subject'] = sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name'));
510 510
 		}
511 511
 		return $settings;
512 512
 	}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -426,7 +426,7 @@
 block discarded – undo
426 426
 	 *
427 427
 	 * @since 4.3.1
428 428
 	 *
429
-	 * @return array
429
+	 * @return string[]
430 430
 	 */
431 431
 	private function _parse_from() {
432 432
 		if ( strpos( $this->_from, '<' ) !== false ) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
modules/bot_trap/EED_Bot_Trap.module.php 2 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @return EED_Bot_Trap
19 19
 	 */
20 20
 	public static function instance() {
21
-		return parent::get_instance( __CLASS__ );
21
+		return parent::get_instance(__CLASS__);
22 22
 	}
23 23
 
24 24
 
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public static function set_hooks() {
33 33
 		if (
34
-			apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) &&
34
+			apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
35 35
 			EE_Registry::instance()->CFG->registration->use_bot_trap
36 36
 		) {
37
-			define( 'EE_BOT_TRAP_BASE_URL', plugin_dir_url( __FILE__ ) . DS );
37
+			define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS);
38 38
 			add_action(
39 39
 				'AHEE__ticket_selector_chart__template__after_ticket_selector',
40
-				array( 'EED_Bot_Trap', 'generate_bot_trap' ),
40
+				array('EED_Bot_Trap', 'generate_bot_trap'),
41 41
 				10, 2
42 42
 			);
43 43
 			add_action(
44 44
 				'EED_Ticket_Selector__process_ticket_selections__before',
45
-				array( 'EED_Bot_Trap', 'process_bot_trap' ),
45
+				array('EED_Bot_Trap', 'process_bot_trap'),
46 46
 				1, 2
47 47
 			);
48 48
 			// redirect bots to bogus success page
49
-			EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' );
49
+			EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success');
50 50
 		}
51 51
 	}
52 52
 
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	public static function set_hooks_admin() {
62 62
 		add_action(
63 63
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
64
-			array( 'EED_Bot_Trap', 'bot_trap_settings_form' ),
64
+			array('EED_Bot_Trap', 'bot_trap_settings_form'),
65 65
 			10
66 66
 		);
67 67
 		add_filter(
68 68
 			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
69
-			array( 'EED_Bot_Trap', 'update_bot_trap_settings_form' ),
69
+			array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
70 70
 			10, 1
71 71
 		);
72 72
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param    WP $WP
81 81
 	 * @return    void
82 82
 	 */
83
-	public function run( $WP ) {}
83
+	public function run($WP) {}
84 84
 
85 85
 
86 86
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 * @return    void
92 92
 	 */
93 93
 	public static function generate_bot_trap() {
94
-		$do_not_enter = __( 'please do not enter anything in this input', 'event_espresso' );
94
+		$do_not_enter = __('please do not enter anything in this input', 'event_espresso');
95 95
 		$html = '<div id="tkt-slctr-request-processor-dv" style="float:left; margin-left:-999em;">';
96
-		$html .= '<label for="tkt-slctr-request-processor-email">' . $do_not_enter  . '</label>';
96
+		$html .= '<label for="tkt-slctr-request-processor-email">'.$do_not_enter.'</label>';
97 97
 		$html .= '<input type="email" name="tkt-slctr-request-processor-email" value=""/>';
98 98
 		$html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="';
99
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
100
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
101
-			$html .= EE_Encryption::instance()->encrypt( time() );
99
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
100
+			EE_Registry::instance()->load_core('EE_Encryption');
101
+			$html .= EE_Encryption::instance()->encrypt(time());
102 102
 		} else {
103 103
 			$html .= time();
104 104
 		}
@@ -117,35 +117,35 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public static function process_bot_trap() {
119 119
 		// what's your email address Mr. Bot ?
120
-		$empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] ) && $_REQUEST[ 'tkt-slctr-request-processor-email' ] == '' ? true : false;
120
+		$empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email']) && $_REQUEST['tkt-slctr-request-processor-email'] == '' ? true : false;
121 121
 		// get encrypted timestamp for when the form was originally displayed
122
-		$bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) : '';
122
+		$bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token']) ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token']) : '';
123 123
 		// decrypt and convert to absolute  integer
124
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
125
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
126
-			$bot_trap_timestamp = absint( EE_Encryption::instance()->decrypt( $bot_trap_timestamp ) );
124
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
125
+			EE_Registry::instance()->load_core('EE_Encryption');
126
+			$bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp));
127 127
 		} else {
128
-			$bot_trap_timestamp = absint( $bot_trap_timestamp );
128
+			$bot_trap_timestamp = absint($bot_trap_timestamp);
129 129
 		}
130 130
 		// ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
131
-		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS ) ? true : false;
131
+		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS) ? true : false;
132 132
 		// are we human ?
133
-		if ( $empty_trap && ! $suspicious_timing ) {
133
+		if ($empty_trap && ! $suspicious_timing) {
134 134
 			return;
135 135
 		}
136 136
 		// UH OH...
137 137
 		$redirect_url = add_query_arg(
138
-			array( 'ee' => 'ticket_selection_received' ),
138
+			array('ee' => 'ticket_selection_received'),
139 139
 			EE_Registry::instance()->CFG->core->reg_page_url()
140 140
 		);
141
-		if ( $suspicious_timing ) {
141
+		if ($suspicious_timing) {
142 142
 			$redirect_url = add_query_arg(
143
-				array( 'ee-notice' => urlencode( __( 'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso' ) ) ),
143
+				array('ee-notice' => urlencode(__('We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso'))),
144 144
 				$redirect_url
145 145
 			);
146 146
 		}
147 147
 		wp_safe_redirect(
148
-			apply_filters( 'FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url )
148
+			apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url)
149 149
 		);
150 150
 		exit();
151 151
 	}
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	 * @return    void
161 161
 	 */
162 162
 	public static function display_bot_trap_success() {
163
-		EE_Registry::instance()->load_helper( 'HTML' );
164
-		add_filter( 'FHEE__EED_Single_Page_Checkout__run', '__return_false' );
165
-		$bot_notice = __( 'Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso' );
166
-		$bot_notice = isset( $_REQUEST[ 'ee-notice' ] ) && $_REQUEST[ 'ee-notice' ] !== '' ? sanitize_text_field( stripslashes( $_REQUEST[ 'ee-notice' ] ) ) : $bot_notice;
167
-		EE_Registry::instance()->REQ->add_output( EEH_HTML::div( $bot_notice, '', 'ee-attention' ) );
163
+		EE_Registry::instance()->load_helper('HTML');
164
+		add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
165
+		$bot_notice = __('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso');
166
+		$bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice;
167
+		EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
168 168
 	}
169 169
 
170 170
 
@@ -198,20 +198,20 @@  discard block
 block discarded – undo
198 198
 				'html_id'         			=> 'bot_trap_settings',
199 199
 				'layout_strategy' 	=> new EE_Admin_Two_Column_Layout(),
200 200
 				'subsections'     		=> array(
201
-					'bot_trap_hdr' 		=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'Bot Trap Settings', 'event_espresso' ) ) ),
201
+					'bot_trap_hdr' 		=> new EE_Form_Section_HTML(EEH_HTML::h2(__('Bot Trap Settings', 'event_espresso'))),
202 202
 					'use_bot_trap' 		=> new EE_Yes_No_Input(
203 203
 						array(
204
-							'html_label_text' 	=> __( 'Enable Bot Trap', 'event_espresso' ),
205
-							'html_help_text' 		=>  __( 'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso' ),
206
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_bot_trap ) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
204
+							'html_label_text' 	=> __('Enable Bot Trap', 'event_espresso'),
205
+							'html_help_text' 		=>  __('The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso'),
206
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_bot_trap) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
207 207
 							'required'        		=> false
208 208
 						)
209 209
 					),
210 210
 					'use_encryption' 		=> new EE_Yes_No_Input(
211 211
 						array(
212
-							'html_label_text' 	=> __( 'Encrypt Bot Trap Data', 'event_espresso' ),
213
-							'html_help_text' 		=>  __( 'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso' ),
214
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_encryption ) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
212
+							'html_label_text' 	=> __('Encrypt Bot Trap Data', 'event_espresso'),
213
+							'html_help_text' 		=>  __('One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso'),
214
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_encryption) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
215 215
 							'required'        		=> false
216 216
 						)
217 217
 					),
@@ -229,30 +229,30 @@  discard block
 block discarded – undo
229 229
 	 * @param \EE_Registration_Config $EE_Registration_Config
230 230
 	 * @return \EE_Registration_Config
231 231
 	 */
232
-	public static function update_bot_trap_settings_form( EE_Registration_Config $EE_Registration_Config ) {
232
+	public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config) {
233 233
 		try {
234 234
 			$bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
235 235
 			// if not displaying a form, then check for form submission
236
-			if ( $bot_trap_settings_form->was_submitted() ) {
236
+			if ($bot_trap_settings_form->was_submitted()) {
237 237
 				// capture form data
238 238
 				$bot_trap_settings_form->receive_form_submission();
239 239
 				// validate form data
240
-				if ( $bot_trap_settings_form->is_valid() ) {
240
+				if ($bot_trap_settings_form->is_valid()) {
241 241
 					// grab validated data from form
242 242
 					$valid_data = $bot_trap_settings_form->valid_data();
243
-					if ( isset( $valid_data[ 'use_bot_trap' ], $valid_data[ 'use_encryption' ] ) ) {
244
-						$EE_Registration_Config->use_bot_trap = $valid_data[ 'use_bot_trap' ];
245
-						$EE_Registration_Config->use_encryption = $valid_data[ 'use_encryption' ];
243
+					if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
244
+						$EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
245
+						$EE_Registration_Config->use_encryption = $valid_data['use_encryption'];
246 246
 					} else {
247
-						EE_Error::add_error( __( 'Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
247
+						EE_Error::add_error(__('Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
248 248
 					}
249 249
 				} else {
250
-					if ( $bot_trap_settings_form->submission_error_message() != '' ) {
251
-						EE_Error::add_error( $bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
250
+					if ($bot_trap_settings_form->submission_error_message() != '') {
251
+						EE_Error::add_error($bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
252 252
 					}
253 253
 				}
254 254
 			}
255
-		} catch ( EE_Error $e ) {
255
+		} catch (EE_Error $e) {
256 256
 			$e->get_error();
257 257
 		}
258 258
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * EED_Bot_Trap Class
4 6
  *
Please login to merge, or discard this patch.
modules/ical/EED_Ical.module.php 3 patches
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @return EED_Ical
33 33
 	 */
34 34
 	public static function instance() {
35
-		return parent::get_instance( __CLASS__ );
35
+		return parent::get_instance(__CLASS__);
36 36
 	}
37 37
 
38 38
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public static function set_hooks() {
47 47
 		// create download buttons
48
-		add_filter( 'FHEE__espresso_list_of_event_dates__datetime_html', array( 'EED_Ical', 'generate_add_to_iCal_button' ), 10, 2 );
48
+		add_filter('FHEE__espresso_list_of_event_dates__datetime_html', array('EED_Ical', 'generate_add_to_iCal_button'), 10, 2);
49 49
 		 // process ics download request
50
-		EE_Config::register_route( 'download_ics_file', 'EED_Ical', 'download_ics_file' );
50
+		EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file');
51 51
 	}
52 52
 
53 53
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @param    WP $WP
71 71
 	 * @return    void
72 72
 	 */
73
-	public function run( $WP ) {}
73
+	public function run($WP) {}
74 74
 
75 75
 
76 76
 
@@ -82,30 +82,30 @@  discard block
 block discarded – undo
82 82
 	 * @param $datetime
83 83
 	 * @return    string
84 84
 	 */
85
-	public static function generate_add_to_iCal_button( $html, $datetime ) {
85
+	public static function generate_add_to_iCal_button($html, $datetime) {
86 86
 		// first verify a proper datetime object has been received
87
-		if ( $datetime instanceof EE_Datetime ) {
87
+		if ($datetime instanceof EE_Datetime) {
88 88
 			// set whether a link or submit button is shown
89
-			$iCal_type = apply_filters( 'FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit' );
89
+			$iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit');
90 90
 			// generate a link to the route we registered in set_hooks()
91
-			$URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $datetime->ID() ), site_url() );
91
+			$URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url());
92 92
 			// what type ?
93
-			switch ( $iCal_type ) {
93
+			switch ($iCal_type) {
94 94
 				// submit buttons appear as buttons and are very compatible with a theme's style
95 95
 				case 'submit' :
96
-					$html .= '<form id="download-iCal-frm-' . $datetime->ID() . '" class="download-iCal-frm" action="' . $URL . '" method="post" >';
97
-					$html .= '<input type="submit" class="ee-ical-sbmt" value="&#xf145;" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '"/>';
96
+					$html .= '<form id="download-iCal-frm-'.$datetime->ID().'" class="download-iCal-frm" action="'.$URL.'" method="post" >';
97
+					$html .= '<input type="submit" class="ee-ical-sbmt" value="&#xf145;" title="'.__('Add to iCal Calendar', 'event_espresso').'"/>';
98 98
 					$html .= '</form>';
99 99
 					break;
100 100
 				// buttons are just links that have been styled to appear as buttons, but may not be blend with a theme as well as submit buttons
101 101
 				case 'button' :
102
-					$html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">';
102
+					$html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">';
103 103
 					$html .= ' <span class="dashicons dashicons-calendar"></span>';
104 104
 					$html .= '</a>';
105 105
 					break;
106 106
 				// links are just links that use the calendar dashicon
107 107
 				case 'icon' :
108
-					$html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">';
108
+					$html .= '<a class="ee-ical-lnk" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">';
109 109
 					$html .= ' <span class="dashicons dashicons-calendar"></span>';
110 110
 					$html .= '</a>';
111 111
 					break;
@@ -123,73 +123,73 @@  discard block
 block discarded – undo
123 123
 	 *  @return 	void
124 124
 	 */
125 125
 	public static function download_ics_file() {
126
-		if ( EE_Registry::instance()->REQ->is_set( 'ics_id' )) {
127
-			$DTT_ID = absint( EE_Registry::instance()->REQ->get( 'ics_id' ));
128
-			$datetime = EE_Registry::instance()->load_model( 'Datetime' )->get_one_by_ID( $DTT_ID );
129
-			if ( $datetime instanceof EE_Datetime ) {
126
+		if (EE_Registry::instance()->REQ->is_set('ics_id')) {
127
+			$DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id'));
128
+			$datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID);
129
+			if ($datetime instanceof EE_Datetime) {
130 130
 				// get related event, venues, and event categories
131 131
 				$event = $datetime->event();
132 132
 				// get related category Term object and it's name
133 133
 				$category = $event->first_event_category();
134
-				if ( $category instanceof EE_Term ) {
134
+				if ($category instanceof EE_Term) {
135 135
 					$category = $category->name();
136 136
 				}
137 137
 				$location = '';
138 138
 				// get first related venue and convert to CSV string
139
-				$venue = $event->venues(array( 'limit'=>1 ));
140
-				if ( is_array( $venue ) && ! empty( $venue )) {
141
-					$venue = array_shift( $venue );
142
-					if ( $venue instanceof EE_Venue ) {
143
-						 EE_Registry::instance()->load_helper( 'Venue_View' );
144
-						$location = espresso_venue_raw_address( 'inline', $venue->ID(), FALSE );
139
+				$venue = $event->venues(array('limit'=>1));
140
+				if (is_array($venue) && ! empty($venue)) {
141
+					$venue = array_shift($venue);
142
+					if ($venue instanceof EE_Venue) {
143
+						 EE_Registry::instance()->load_helper('Venue_View');
144
+						$location = espresso_venue_raw_address('inline', $venue->ID(), FALSE);
145 145
 					}
146 146
 				}
147 147
 				// set variables, escape strings, convert timestamps to ics format, etc
148
-				$filename = $event->slug() . '-' . $datetime->start_date( 'Y-m-d' ) . '.ics';
149
-				$organizer = EED_Ical::_escape_ICal_data( EE_Registry::instance()->CFG->organization->name );
150
-				$UID = EED_Ical::_escape_ICal_data( md5( $event->name() . $event->ID() . $datetime->ID() ));
151
-				$org_email = EED_Ical::_escape_ICal_data( $datetime->ID() );
152
-				$timestamp = date( EED_Ical::iCal_datetime_format );
153
-				$location = EED_Ical::_escape_ICal_data( $location );
154
-				$summary = EED_Ical::_escape_ICal_data( $event->name() );
155
-				$description = EED_Ical::_escape_ICal_description( wp_strip_all_tags( $event->description() ));
148
+				$filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics';
149
+				$organizer = EED_Ical::_escape_ICal_data(EE_Registry::instance()->CFG->organization->name);
150
+				$UID = EED_Ical::_escape_ICal_data(md5($event->name().$event->ID().$datetime->ID()));
151
+				$org_email = EED_Ical::_escape_ICal_data($datetime->ID());
152
+				$timestamp = date(EED_Ical::iCal_datetime_format);
153
+				$location = EED_Ical::_escape_ICal_data($location);
154
+				$summary = EED_Ical::_escape_ICal_data($event->name());
155
+				$description = EED_Ical::_escape_ICal_description(wp_strip_all_tags($event->description()));
156 156
 				$status = $datetime->get_active_status();
157 157
 				$status = $status == EE_Datetime::cancelled ? 'Cancelled' : 'Confirmed';
158
-				$status = EED_Ical::_escape_ICal_data( $status );
159
-				$categories = EED_Ical::_escape_ICal_data( $category );
160
-				$url = EED_Ical::_escape_ICal_data( get_permalink( $event->ID() ));
161
-				$dtt_start = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->start() ));
162
-				$dtt_end = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->end() ));
158
+				$status = EED_Ical::_escape_ICal_data($status);
159
+				$categories = EED_Ical::_escape_ICal_data($category);
160
+				$url = EED_Ical::_escape_ICal_data(get_permalink($event->ID()));
161
+				$dtt_start = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->start()));
162
+				$dtt_end = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->end()));
163 163
 				// set headers
164
-				header( 'Content-type: text/calendar; charset=utf-8' );
165
-				header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
166
-				header( 'Cache-Control: private, max-age=0, must-revalidate' );
167
-				header( 'Pragma: public' );
168
-				header( 'Content-Type: application/octet-stream' );
169
-				header( 'Content-Type: application/force-download' );
170
-				header( 'Cache-Control: no-cache, must-revalidate' );
171
-				header( 'Content-Transfer-Encoding: binary' );
172
-				header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // past date
173
-				ini_set( 'zlib.output_compression', '0' );
164
+				header('Content-type: text/calendar; charset=utf-8');
165
+				header('Content-Disposition: attachment; filename="'.$filename.'"');
166
+				header('Cache-Control: private, max-age=0, must-revalidate');
167
+				header('Pragma: public');
168
+				header('Content-Type: application/octet-stream');
169
+				header('Content-Type: application/force-download');
170
+				header('Cache-Control: no-cache, must-revalidate');
171
+				header('Content-Transfer-Encoding: binary');
172
+				header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date
173
+				ini_set('zlib.output_compression', '0');
174 174
 				// echo the output
175
-				echo "BEGIN:VCALENDAR" . PHP_EOL;
176
-				echo "VERSION:2.0" . PHP_EOL;
177
-				echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN" . PHP_EOL;
178
-				echo "CALSCALE:GREGORIAN" . PHP_EOL;
179
-				echo "BEGIN:VEVENT" . PHP_EOL;
180
-				echo "UID:{$UID}" . PHP_EOL;
181
-				echo "ORGANIZER:MAILTO:{$org_email}" . PHP_EOL;
182
-				echo "DTSTAMP:{$timestamp}" . PHP_EOL;
183
-				echo "LOCATION:{$location}" . PHP_EOL;
184
-				echo "SUMMARY:{$summary}" . PHP_EOL;
185
-				echo "DESCRIPTION:{$description}" . PHP_EOL;
186
-				echo "STATUS:{$status}" . PHP_EOL;
187
-				echo "CATEGORIES:{$categories}" . PHP_EOL;
188
-				echo "URL;VALUE=URI:{$url}" . PHP_EOL;
189
-				echo "DTSTART:{$dtt_start}" . PHP_EOL;
190
-				echo "DTEND:{$dtt_end}" . PHP_EOL;
191
-				echo "END:VEVENT" . PHP_EOL;
192
-				echo "END:VCALENDAR" . PHP_EOL;
175
+				echo "BEGIN:VCALENDAR".PHP_EOL;
176
+				echo "VERSION:2.0".PHP_EOL;
177
+				echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN".PHP_EOL;
178
+				echo "CALSCALE:GREGORIAN".PHP_EOL;
179
+				echo "BEGIN:VEVENT".PHP_EOL;
180
+				echo "UID:{$UID}".PHP_EOL;
181
+				echo "ORGANIZER:MAILTO:{$org_email}".PHP_EOL;
182
+				echo "DTSTAMP:{$timestamp}".PHP_EOL;
183
+				echo "LOCATION:{$location}".PHP_EOL;
184
+				echo "SUMMARY:{$summary}".PHP_EOL;
185
+				echo "DESCRIPTION:{$description}".PHP_EOL;
186
+				echo "STATUS:{$status}".PHP_EOL;
187
+				echo "CATEGORIES:{$categories}".PHP_EOL;
188
+				echo "URL;VALUE=URI:{$url}".PHP_EOL;
189
+				echo "DTSTART:{$dtt_start}".PHP_EOL;
190
+				echo "DTEND:{$dtt_end}".PHP_EOL;
191
+				echo "END:VEVENT".PHP_EOL;
192
+				echo "END:VCALENDAR".PHP_EOL;
193 193
 			}
194 194
 		}
195 195
 		die();
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	 *  	@param	string $string
205 205
 	 *  	@return	string
206 206
 	 */
207
-	private static function _escape_ICal_data( $string = '' ) {
208
-		return preg_replace( '/([\,;])/', '\\\$1', $string );
207
+	private static function _escape_ICal_data($string = '') {
208
+		return preg_replace('/([\,;])/', '\\\$1', $string);
209 209
 	}
210 210
 
211 211
 	/**
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
 	 *  	@param	string $description
216 216
 	 *  	@return	string
217 217
 	 */
218
-	private static function _escape_ICal_description( $description = '' ) {
218
+	private static function _escape_ICal_description($description = '') {
219 219
 			
220 220
 			//Escape spcial chars within the decription
221
-			$description = EED_Ical::_escape_ICal_data( $description );
221
+			$description = EED_Ical::_escape_ICal_data($description);
222 222
 
223 223
 		    //Remove line breaks and output in iCal format
224
-		    $description = str_replace( array( "\r\n", "\n"), '\n', $description );
224
+		    $description = str_replace(array("\r\n", "\n"), '\n', $description);
225 225
 
226 226
 		return $description;
227 227
 	}
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -220,8 +220,8 @@
 block discarded – undo
220 220
 			//Escape spcial chars within the decription
221 221
 			$description = EED_Ical::_escape_ICal_data( $description );
222 222
 
223
-		    //Remove line breaks and output in iCal format
224
-		    $description = str_replace( array( "\r\n", "\n"), '\n', $description );
223
+			//Remove line breaks and output in iCal format
224
+			$description = str_replace( array( "\r\n", "\n"), '\n', $description );
225 225
 
226 226
 		return $description;
227 227
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1345,7 +1345,7 @@
 block discarded – undo
1345 1345
 	 * This just returns whatever is set as the _event object property
1346 1346
 	 *
1347 1347
 	 * //todo this will become obsolete once the models are in place
1348
-	 * @return object
1348
+	 * @return EE_CPT_Base
1349 1349
 	 */
1350 1350
 	public function get_event_object() {
1351 1351
 		return $this->_cpt_model_obj;
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -606,9 +606,9 @@
 block discarded – undo
606 606
 		// first check if event is active.
607 607
 		if (
608 608
 			$orig_status === EEM_Event::cancelled
609
-		    || $orig_status === EEM_Event::postponed
610
-		    || $event->is_expired()
611
-		    || $event->is_inactive()
609
+			|| $orig_status === EEM_Event::postponed
610
+			|| $event->is_expired()
611
+			|| $event->is_inactive()
612 612
 		) {
613 613
 			return;
614 614
 		}
Please login to merge, or discard this patch.
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if (!defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -1484,10 +1485,11 @@  discard block
 block discarded – undo
1484 1485
 			//get the earliest datetime (if present);
1485 1486
 			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1486 1487
 
1487
-			if ( !empty( $earliest_dtt ) )
1488
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1489
-			else
1490
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1488
+			if ( !empty( $earliest_dtt ) ) {
1489
+							$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1490
+			} else {
1491
+							$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1492
+			}
1491 1493
 		}
1492 1494
 
1493 1495
 		$template_args = array_merge( $template_args, $price_args );
@@ -1725,8 +1727,9 @@  discard block
 block discarded – undo
1725 1727
 		}
1726 1728
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1727 1729
 
1728
-		if ( $redirect_after )
1729
-			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1730
+		if ( $redirect_after ) {
1731
+					$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1732
+		}
1730 1733
 	}
1731 1734
 
1732 1735
 	/**
@@ -1853,8 +1856,9 @@  discard block
 block discarded – undo
1853 1856
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1854 1857
 		}
1855 1858
 
1856
-		if ( $redirect_after )
1857
-			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1859
+		if ( $redirect_after ) {
1860
+					$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1861
+		}
1858 1862
 	}
1859 1863
 
1860 1864
 	/**
@@ -2091,8 +2095,10 @@  discard block
 block discarded – undo
2091 2095
 	 * @return void
2092 2096
 	 */
2093 2097
 	private function _set_category_object() {
2094
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2095
-			return; //already have the category object so get out.
2098
+		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) {
2099
+					return;
2100
+		}
2101
+		//already have the category object so get out.
2096 2102
 
2097 2103
 		//set default category object
2098 2104
 		$this->_set_empty_category_object();
Please login to merge, or discard this patch.
Spacing   +389 added lines, -389 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$this->_cpt_edit_routes = array(
67 67
 			'espresso_events' => 'edit'
68 68
 		);
69
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
69
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
70 70
 	}
71 71
 
72 72
 	protected function _ajax_hooks() {
@@ -92,20 +92,20 @@  discard block
 block discarded – undo
92 92
 				'edit' => __('Update Event', 'event_espresso'),
93 93
 				'add_category' => __('Save New Category', 'event_espresso'),
94 94
 				'edit_category' => __('Update Category', 'event_espresso'),
95
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
95
+				'template_settings' => __('Update Settings', 'event_espresso')
96 96
 				)
97 97
 		);
98 98
 	}
99 99
 
100 100
 	protected function _set_page_routes() {
101 101
 		//load formatter helper
102
-		EE_Registry::instance()->load_helper( 'Formatter' );
102
+		EE_Registry::instance()->load_helper('Formatter');
103 103
 		//load field generator helper
104
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
104
+		EE_Registry::instance()->load_helper('Form_Fields');
105 105
 
106 106
 		//is there a evt_id in the request?
107
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
108
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
107
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
108
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
109 109
 
110 110
 
111 111
 		$this->_page_routes = array(
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 				'help_tour' => array(
320 320
 					'Event_Editor_Help_Tour'
321 321
 					),
322
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
322
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
323 323
 				'require_nonce' => FALSE
324 324
 			),
325 325
 			'edit' => array(
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 				/*'help_tour' => array(
376 376
 					'Event_Edit_Help_Tour'
377 377
 				),*/
378
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
378
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
379 379
 				'require_nonce' => FALSE
380 380
 			),
381 381
 			'default_event_settings' => array(
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 						'filename' => 'events_default_settings_status'
398 398
 					)
399 399
 				),
400
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
400
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
401 401
 				'require_nonce' => FALSE
402 402
 			),
403 403
 			//template settings
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'general_settings_templates'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Templates_Help_Tour' ),
416
+				'help_tour' => array('Templates_Help_Tour'),
417 417
 				'require_nonce' => FALSE
418 418
 			),
419 419
 			//event category stuff
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 					'label' => __('Edit Category', 'event_espresso'),
438 438
 					'order' => 15,
439 439
 					'persistent' => FALSE,
440
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
440
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
441 441
 					),
442 442
 				'help_tabs' => array(
443 443
 					'edit_category_help_tab' => array(
@@ -507,14 +507,14 @@  discard block
 block discarded – undo
507 507
 
508 508
 	public function load_scripts_styles() {
509 509
 
510
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
511
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
510
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
511
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
512 512
 		wp_enqueue_style('events-admin-css');
513 513
 		wp_enqueue_style('ee-cat-admin');
514 514
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
515 515
 		//registers for all views
516 516
 		//scripts
517
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
517
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
518 518
 	}
519 519
 
520 520
 	/**
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
 	public function load_scripts_styles_edit() {
533 533
 		//styles
534 534
 		wp_enqueue_style('espresso-ui-theme');
535
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
535
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
536 536
 		wp_enqueue_style('event-editor-css');
537 537
 
538 538
 		//scripts
539
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
539
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
540 540
 		wp_enqueue_script('event-datetime-metabox');
541 541
 
542 542
 	}
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 
572 572
 
573 573
 	public function admin_init() {
574
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
574
+		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
575 575
 	}
576 576
 
577 577
 
@@ -592,12 +592,12 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	public function verify_event_edit($event = NULL) {
594 594
 		// no event?
595
-		if ( empty( $event )) {
595
+		if (empty($event)) {
596 596
 			// set event
597 597
 			$event = $this->_cpt_model_obj;
598 598
 		}
599 599
 		// STILL no event?
600
-		if ( empty ( $event )) {
600
+		if (empty ($event)) {
601 601
 			return;
602 602
 		}
603 603
 		$orig_status = $event->status();
@@ -611,27 +611,27 @@  discard block
 block discarded – undo
611 611
 			return;
612 612
 		}
613 613
 		//made it here so it IS active... next check that any of the tickets are sold.
614
-		if ( $event->is_sold_out( true ) ) {
615
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
614
+		if ($event->is_sold_out(true)) {
615
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
616 616
 				EE_Error::add_attention(
617 617
 					sprintf(
618
-						__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso' ),
619
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
618
+						__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso'),
619
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
620 620
 					)
621 621
 				);
622 622
 			}
623 623
 			return;
624
-		} else if ( $orig_status === EEM_Event::sold_out ) {
624
+		} else if ($orig_status === EEM_Event::sold_out) {
625 625
 			EE_Error::add_attention(
626 626
 				sprintf(
627
-					__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
628
-						'event_espresso' ),
629
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
627
+					__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
628
+						'event_espresso'),
629
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
630 630
 				)
631 631
 			);
632 632
 		}
633 633
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
634
-		if ( ! $event->tickets_on_sale() ) {
634
+		if ( ! $event->tickets_on_sale()) {
635 635
 			return;
636 636
 		}
637 637
 		//made it here so show warning
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 */
651 651
 	protected function _edit_event_warning() {
652 652
 		// we don't want to add warnings during these requests
653
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
653
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
654 654
 			return;
655 655
 		}
656 656
 		EE_Error::add_attention(
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 			),
682 682
 		);
683 683
 
684
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
684
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
685 685
 			$this->_views['trash'] = array(
686 686
 				'slug' => 'trash',
687 687
 				'label' => __('Trash', 'event_espresso'),
@@ -711,39 +711,39 @@  discard block
 block discarded – undo
711 711
 				'desc' => __('View Registrations for Event', 'event_espresso')
712 712
 			)
713 713
 		);
714
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
714
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
715 715
 		$statuses = array(
716 716
 			'sold_out_status' => array(
717
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
718
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
717
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
718
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
719 719
 			),
720 720
 			'active_status' => array(
721
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
722
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
721
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
722
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
723 723
 			),
724 724
 			'upcoming_status' => array(
725
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
726
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
725
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
726
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
727 727
 			),
728 728
 			'postponed_status' => array(
729
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
730
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
729
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
730
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
731 731
 			),
732 732
 			'cancelled_status' => array(
733
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
734
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
733
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
734
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
735 735
 			),
736 736
 			'expired_status' => array(
737
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
738
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
737
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
738
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
739 739
 			),
740 740
 			'inactive_status' => array(
741
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
742
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
741
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
742
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
743 743
 			)
744 744
 		);
745
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
746
-		return array_merge( $items, $statuses );
745
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
746
+		return array_merge($items, $statuses);
747 747
 	}
748 748
 
749 749
 
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 	 * @return EEM_Event
756 756
 	 */
757 757
 	private function _event_model() {
758
-		if ( ! $this->_event_model instanceof EEM_Event ) {
759
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
758
+		if ( ! $this->_event_model instanceof EEM_Event) {
759
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
760 760
 		}
761 761
 		return $this->_event_model;
762 762
 	}
@@ -775,12 +775,12 @@  discard block
 block discarded – undo
775 775
 	 * @param  string $new_slug  what the slug is
776 776
 	 * @return string            The new html string for the permalink area
777 777
 	 */
778
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
778
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
779 779
 		//make sure this is only when editing
780
-		if ( !empty( $id ) ) {
781
-			$post = get_post( $id );
782
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
783
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
780
+		if ( ! empty($id)) {
781
+			$post = get_post($id);
782
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
783
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
784 784
 		}
785 785
 		return $return;
786 786
 	}
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 	 * @return string html for generated table
797 797
 	 */
798 798
 	protected function _events_overview_list_table() {
799
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
800
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
799
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
800
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
801 801
 		$this->_display_legend($this->_event_legend_items());
802 802
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
803 803
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -815,51 +815,51 @@  discard block
 block discarded – undo
815 815
 
816 816
 
817 817
 
818
-	protected function _insert_update_cpt_item( $post_id, $post ) {
818
+	protected function _insert_update_cpt_item($post_id, $post) {
819 819
 
820
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
820
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
821 821
 			//getout we're not processing an event save.
822 822
 			return;
823 823
 		}
824 824
 
825 825
 		$event_values = array(
826
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
827
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
826
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
827
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
828 828
 			'EVT_additional_limit' => min(
829
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
830
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
831
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
832
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
833
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
834
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
835
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
836
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
829
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
830
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
831
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
832
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
833
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
834
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
835
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
836
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
837 837
 			);
838 838
 
839 839
 		//update event
840
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
840
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
841 841
 
842 842
 
843 843
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
844
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
845
-		$event = $this->_event_model()->get_one( array($get_one_where) );
844
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
845
+		$event = $this->_event_model()->get_one(array($get_one_where));
846 846
 
847 847
 
848 848
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
849
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
849
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
850 850
 
851 851
 		$att_success = TRUE;
852 852
 
853
-		foreach ( $event_update_callbacks as $e_callback ) {
854
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
855
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
853
+		foreach ($event_update_callbacks as $e_callback) {
854
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
855
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
856 856
 		}
857 857
 
858 858
 		//any errors?
859
-		if ( $success && FALSE === $att_success ) {
860
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
861
-		} else if ( $success === FALSE ) {
862
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
859
+		if ($success && FALSE === $att_success) {
860
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
861
+		} else if ($success === FALSE) {
862
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
863 863
 		}
864 864
 	}
865 865
 
@@ -869,14 +869,14 @@  discard block
 block discarded – undo
869 869
 	/**
870 870
 	 * @see parent::restore_item()
871 871
 	 */
872
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
872
+	protected function _restore_cpt_item($post_id, $revision_id) {
873 873
 		//copy existing event meta to new post
874 874
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
875
-		if ( $post_evt instanceof EE_Event ) {
875
+		if ($post_evt instanceof EE_Event) {
876 876
 			//meta revision restore
877
-			$post_evt->restore_revision( $revision_id );
877
+			$post_evt->restore_revision($revision_id);
878 878
 			//related objs restore
879
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
879
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
880 880
 		}
881 881
 	}
882 882
 
@@ -889,52 +889,52 @@  discard block
 block discarded – undo
889 889
 	 * @param  array  $data   The request data from the form
890 890
 	 * @return bool           Success or fail.
891 891
 	 */
892
-	protected function _default_venue_update( $evtobj, $data ) {
893
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
892
+	protected function _default_venue_update($evtobj, $data) {
893
+		require_once(EE_MODELS.'EEM_Venue.model.php');
894 894
 		$venue_model = EE_Registry::instance()->load_model('Venue');
895 895
 		$rows_affected = NULL;
896
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
896
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
897 897
 
898 898
 		// very important.  If we don't have a venue name...
899 899
 		// then we'll get out because not necessary to create empty venue
900
-		if ( empty( $data['venue_title'] ) ) {
900
+		if (empty($data['venue_title'])) {
901 901
 			return false;
902 902
 		}
903 903
 
904 904
 		$venue_array = array(
905 905
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
906
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
907
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
908
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
909
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
910
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
911
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
912
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
913
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
914
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
915
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
916
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
917
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
918
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
919
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
920
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
921
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
906
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
907
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
908
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
909
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
910
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
911
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
912
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
913
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
914
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
915
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
916
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
917
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
918
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
919
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
920
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
921
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
922 922
 				'status' => 'publish'
923 923
 			);
924 924
 
925 925
 
926 926
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
927
-		if ( !empty( $venue_id ) ) {
928
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
929
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
927
+		if ( ! empty($venue_id)) {
928
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
929
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
930 930
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
931
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
931
+			$evtobj->_add_relation_to($venue_id, 'Venue');
932 932
 			return $rows_affected > 0 ? TRUE : FALSE;
933 933
 		} else {
934 934
 			//we insert the venue
935
-			$venue_id = $venue_model->insert( $venue_array );
936
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
937
-			return !empty( $venue_id ) ? TRUE : FALSE;
935
+			$venue_id = $venue_model->insert($venue_array);
936
+			$evtobj->_add_relation_to($venue_id, 'Venue');
937
+			return ! empty($venue_id) ? TRUE : FALSE;
938 938
 		}
939 939
 		//when we have the ancestor come in it's already been handled by the revision save.
940 940
 	}
@@ -948,55 +948,55 @@  discard block
 block discarded – undo
948 948
 	 * @param  array    $data   The request data from the form
949 949
 	 * @return bool             success or fail
950 950
 	 */
951
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
951
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
952 952
 		$success = true;
953 953
 		$saved_dtt = null;
954 954
 		$saved_tickets = array();
955
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
955
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
956 956
 
957
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
957
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
958 958
 			//trim all values to ensure any excess whitespace is removed.
959
-			$dtt =  array_map( 'trim', $dtt );
960
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
959
+			$dtt = array_map('trim', $dtt);
960
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
961 961
 			$datetime_values = array(
962
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
962
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
963 963
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
964 964
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
965
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
965
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
966 966
 				'DTT_order' 	=> $row,
967 967
 			);
968 968
 
969 969
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
970 970
 
971
-			if ( !empty( $dtt['DTT_ID'] ) ) {
972
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
973
-				$DTM->set_date_format( $incoming_date_formats[0] );
974
-				$DTM->set_time_format( $incoming_date_formats[1] );
975
-				foreach ( $datetime_values as $field => $value ) {
976
-					$DTM->set( $field, $value );
971
+			if ( ! empty($dtt['DTT_ID'])) {
972
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
973
+				$DTM->set_date_format($incoming_date_formats[0]);
974
+				$DTM->set_time_format($incoming_date_formats[1]);
975
+				foreach ($datetime_values as $field => $value) {
976
+					$DTM->set($field, $value);
977 977
 				}
978 978
 
979 979
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
980 980
 				$saved_dtts[$DTM->ID()] = $DTM;
981 981
 			} else {
982
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
983
-				$DTM->set_date_format( $incoming_date_formats[0] );
984
-				$DTM->set_time_format( $incoming_date_formats[1] );
985
-				$DTM->set_timezone( $evtobj->get_timezone() );
986
-				foreach ( $datetime_values as $field => $value ) {
987
-					$DTM->set( $field, $value );
982
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
983
+				$DTM->set_date_format($incoming_date_formats[0]);
984
+				$DTM->set_time_format($incoming_date_formats[1]);
985
+				$DTM->set_timezone($evtobj->get_timezone());
986
+				foreach ($datetime_values as $field => $value) {
987
+					$DTM->set($field, $value);
988 988
 				}
989 989
 			}
990 990
 			$DTM->save();
991 991
 
992
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
992
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
993 993
 
994 994
 			//load DTT helper
995 995
 			EE_Registry::instance()->load_helper('DTT_Helper');
996 996
 
997 997
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
998
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
999
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
998
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
999
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
1000 1000
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
1001 1001
 				$DTT->save();
1002 1002
 			}
@@ -1004,45 +1004,45 @@  discard block
 block discarded – undo
1004 1004
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1005 1005
 			$saved_dtt = $DTT;
1006 1006
 
1007
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1007
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1008 1008
 		}
1009 1009
 
1010 1010
 		//no dtts get deleted so we don't do any of that logic here.
1011 1011
 		//update tickets next
1012
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1013
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1014
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1012
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1013
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1014
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1015 1015
 			$update_prices = false;
1016
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1016
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1017 1017
 
1018 1018
 			// trim inputs to ensure any excess whitespace is removed.
1019
-			$tkt = array_map( 'trim', $tkt );
1019
+			$tkt = array_map('trim', $tkt);
1020 1020
 
1021
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1021
+			if (empty($tkt['TKT_start_date'])) {
1022 1022
 				//let's use now in the set timezone.
1023
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1024
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1023
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1024
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1025 1025
 			}
1026 1026
 
1027
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1027
+			if (empty($tkt['TKT_end_date'])) {
1028 1028
 				//use the start date of the first datetime
1029 1029
 				$dtt = $evtobj->first_datetime();
1030
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1030
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1031 1031
 			}
1032 1032
 
1033 1033
 			$TKT_values = array(
1034
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1035
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1036
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1037
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1034
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1035
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1036
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1037
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1038 1038
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1039 1039
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1040
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1041
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1042
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1043
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1040
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1041
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1042
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1043
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1044 1044
 				'TKT_row' 			=> $row,
1045
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1045
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1046 1046
 				'TKT_price' 		=> $ticket_price
1047 1047
 			);
1048 1048
 
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 
1052 1052
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1053
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1053
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1054 1054
 				$TKT_values['TKT_ID'] = 0;
1055 1055
 				$TKT_values['TKT_is_default'] = 0;
1056 1056
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1061,58 +1061,58 @@  discard block
 block discarded – undo
1061 1061
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1062 1062
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1063 1063
 
1064
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1065
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1066
-				if ( $TKT instanceof EE_Ticket ) {
1067
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1064
+			if ( ! empty($tkt['TKT_ID'])) {
1065
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1066
+				if ($TKT instanceof EE_Ticket) {
1067
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1068 1068
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1069
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1070
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1071
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1069
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1070
+					$TKT->set_date_format($incoming_date_formats[0]);
1071
+					$TKT->set_time_format($incoming_date_formats[1]);
1072 1072
 					//set new values
1073
-					foreach ( $TKT_values as $field => $value ) {
1074
-						if ( $field == 'TKT_qty' ) {
1075
-							$TKT->set_qty( $value );
1073
+					foreach ($TKT_values as $field => $value) {
1074
+						if ($field == 'TKT_qty') {
1075
+							$TKT->set_qty($value);
1076 1076
 						} else {
1077
-							$TKT->set( $field, $value );
1077
+							$TKT->set($field, $value);
1078 1078
 						}
1079 1079
 					}
1080 1080
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1081
-					if ( $create_new_TKT ) {
1081
+					if ($create_new_TKT) {
1082 1082
 						//archive the old ticket first
1083
-						$TKT->set( 'TKT_deleted', 1 );
1083
+						$TKT->set('TKT_deleted', 1);
1084 1084
 						$TKT->save();
1085 1085
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1086
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1086
+						$saved_tickets[$TKT->ID()] = $TKT;
1087 1087
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1088 1088
 						$TKT = clone $TKT;
1089
-						$TKT->set( 'TKT_ID', 0 );
1090
-						$TKT->set( 'TKT_deleted', 0 );
1091
-						$TKT->set( 'TKT_price', $ticket_price );
1092
-						$TKT->set( 'TKT_sold', 0 );
1089
+						$TKT->set('TKT_ID', 0);
1090
+						$TKT->set('TKT_deleted', 0);
1091
+						$TKT->set('TKT_price', $ticket_price);
1092
+						$TKT->set('TKT_sold', 0);
1093 1093
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1094 1094
 						$update_prices = true;
1095 1095
 					}
1096 1096
 					//make sure price is set if it hasn't been already
1097
-					$TKT->set( 'TKT_price', $ticket_price );
1097
+					$TKT->set('TKT_price', $ticket_price);
1098 1098
 				}
1099 1099
 
1100 1100
 			} else {
1101 1101
 				//no TKT_id so a new TKT
1102 1102
 				$TKT_values['TKT_price'] = $ticket_price;
1103
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1104
-				if ( $TKT instanceof EE_Ticket ) {
1103
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1104
+				if ($TKT instanceof EE_Ticket) {
1105 1105
 					//need to reset values to properly account for the date formats
1106
-					$TKT->set_date_format( $incoming_date_formats[0] );
1107
-					$TKT->set_time_format( $incoming_date_formats[1] );
1108
-					$TKT->set_timezone( $evtobj->get_timezone() );
1106
+					$TKT->set_date_format($incoming_date_formats[0]);
1107
+					$TKT->set_time_format($incoming_date_formats[1]);
1108
+					$TKT->set_timezone($evtobj->get_timezone());
1109 1109
 
1110 1110
 					//set new values
1111
-					foreach ( $TKT_values as $field => $value ) {
1112
-						if ( $field == 'TKT_qty' ) {
1113
-							$TKT->set_qty( $value );
1111
+					foreach ($TKT_values as $field => $value) {
1112
+						if ($field == 'TKT_qty') {
1113
+							$TKT->set_qty($value);
1114 1114
 						} else {
1115
-							$TKT->set( $field, $value );
1115
+							$TKT->set($field, $value);
1116 1116
 						}
1117 1117
 					}
1118 1118
 
@@ -1120,32 +1120,32 @@  discard block
 block discarded – undo
1120 1120
 				}
1121 1121
 			}
1122 1122
 			// cap ticket qty by datetime reg limits
1123
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1123
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1124 1124
 			//update ticket.
1125 1125
 			$TKT->save();
1126 1126
 
1127 1127
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1128
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1129
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1128
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1129
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1130 1130
 				EE_Registry::instance()->load_helper('DTT_Helper');
1131 1131
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1132 1132
 				$TKT->save();
1133 1133
 			}
1134 1134
 
1135 1135
 			//initially let's add the ticket to the dtt
1136
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1136
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1137 1137
 
1138 1138
 			$saved_tickets[$TKT->ID()] = $TKT;
1139 1139
 
1140 1140
 			//add prices to ticket
1141
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1141
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1142 1142
 		}
1143 1143
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1144
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1145
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1144
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1145
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1146 1146
 
1147
-		foreach ( $tickets_removed as $id ) {
1148
-			$id = absint( $id );
1147
+		foreach ($tickets_removed as $id) {
1148
+			$id = absint($id);
1149 1149
 
1150 1150
 			//get the ticket for this id
1151 1151
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1154 1154
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1155 1155
 
1156
-			foreach( $dtts as $dtt ) {
1156
+			foreach ($dtts as $dtt) {
1157 1157
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1158 1158
 			}
1159 1159
 
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1165 1165
 			$tkt_to_remove->delete_permanently();
1166 1166
 		}
1167
-		return array( $saved_dtt, $saved_tickets );
1167
+		return array($saved_dtt, $saved_tickets);
1168 1168
 	}
1169 1169
 
1170 1170
 
@@ -1179,31 +1179,31 @@  discard block
 block discarded – undo
1179 1179
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1180 1180
 	 * @return  void
1181 1181
 	 */
1182
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1183
-		foreach ( $prices as $row => $prc ) {
1182
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1183
+		foreach ($prices as $row => $prc) {
1184 1184
 			$PRC_values = array(
1185
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1186
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1187
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1188
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1189
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1185
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1186
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1187
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1188
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1189
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1190 1190
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1191 1191
 				'PRC_order' => $row
1192 1192
 			);
1193 1193
 
1194
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1194
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1195 1195
 				$PRC_values['PRC_ID'] = 0;
1196
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1196
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1197 1197
 			} else {
1198
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1198
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1199 1199
 				//update this price with new values
1200
-				foreach ( $PRC_values as $field => $newprc ) {
1201
-					$PRC->set( $field, $newprc );
1200
+				foreach ($PRC_values as $field => $newprc) {
1201
+					$PRC->set($field, $newprc);
1202 1202
 				}
1203 1203
 				$PRC->save();
1204 1204
 			}
1205 1205
 
1206
-			$ticket->_add_relation_to( $PRC, 'Price' );
1206
+			$ticket->_add_relation_to($PRC, 'Price');
1207 1207
 		}
1208 1208
 	}
1209 1209
 
@@ -1239,12 +1239,12 @@  discard block
 block discarded – undo
1239 1239
 	private function _generate_publish_box_extra_content() {
1240 1240
 
1241 1241
 		//load formatter helper
1242
-  		EE_Registry::instance()->load_helper( 'Formatter' );
1242
+  		EE_Registry::instance()->load_helper('Formatter');
1243 1243
 
1244 1244
   		//args for getting related registrations
1245
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1246
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1247
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1245
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1246
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1247
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1248 1248
 
1249 1249
 
1250 1250
 		// publish box
@@ -1273,9 +1273,9 @@  discard block
 block discarded – undo
1273 1273
 				),
1274 1274
 				REG_ADMIN_URL
1275 1275
 			),
1276
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1277
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1278
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1276
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1277
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1278
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1279 1279
 			'misc_pub_section_class' => apply_filters(
1280 1280
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1281 1281
 				'misc-pub-section'
@@ -1294,9 +1294,9 @@  discard block
 block discarded – undo
1294 1294
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1295 1295
 			$this->_cpt_model_obj
1296 1296
 		);
1297
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1297
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1298 1298
 		// load template
1299
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1299
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1300 1300
 	}
1301 1301
 
1302 1302
 
@@ -1328,16 +1328,16 @@  discard block
 block discarded – undo
1328 1328
 		$this->verify_cpt_object();
1329 1329
 		add_meta_box(
1330 1330
 			'espresso_event_editor_tickets',
1331
-			__( 'Event Datetime & Ticket', 'event_espresso' ),
1332
-			array( $this, 'ticket_metabox' ),
1331
+			__('Event Datetime & Ticket', 'event_espresso'),
1332
+			array($this, 'ticket_metabox'),
1333 1333
 			$this->page_slug,
1334 1334
 			'normal',
1335 1335
 			'high'
1336 1336
 		);
1337 1337
 		add_meta_box(
1338 1338
 			'espresso_event_editor_event_options',
1339
-			__( 'Event Registration Options', 'event_espresso' ),
1340
-			array( $this, 'registration_options_meta_box' ),
1339
+			__('Event Registration Options', 'event_espresso'),
1340
+			array($this, 'registration_options_meta_box'),
1341 1341
 			$this->page_slug,
1342 1342
 			'side',
1343 1343
 			'default'
@@ -1367,37 +1367,37 @@  discard block
 block discarded – undo
1367 1367
 			'disabled' => ''
1368 1368
 			);
1369 1369
 
1370
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1370
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1371 1371
 
1372
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1372
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1373 1373
 
1374 1374
 		/**
1375 1375
 		 * 1. Start with retrieving Datetimes
1376 1376
 		 * 2. Fore each datetime get related tickets
1377 1377
 		 * 3. For each ticket get related prices
1378 1378
 		 */
1379
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1380
-		EE_Registry::instance()->load_helper('DTT_Helper' );
1379
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1380
+		EE_Registry::instance()->load_helper('DTT_Helper');
1381 1381
 		/** @type EE_Datetime $first_datetime */
1382
-		$first_datetime = reset( $times );
1382
+		$first_datetime = reset($times);
1383 1383
 		//do we get related tickets?
1384
-		if ( $first_datetime instanceof EE_Datetime
1385
-			&& $first_datetime->ID() !== 0 ) {
1384
+		if ($first_datetime instanceof EE_Datetime
1385
+			&& $first_datetime->ID() !== 0) {
1386 1386
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1387 1387
 			$template_args['time'] = $first_datetime;
1388 1388
 			$related_tickets = $first_datetime->tickets(
1389 1389
 				array(
1390
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1390
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1391 1391
 					'default_where_conditions' => 'none'
1392 1392
 				)
1393 1393
 			);
1394 1394
 
1395
-			if ( !empty($related_tickets) ) {
1395
+			if ( ! empty($related_tickets)) {
1396 1396
 				$template_args['total_ticket_rows'] = count($related_tickets);
1397 1397
 				$row = 0;
1398
-				foreach ( $related_tickets as $ticket ) {
1398
+				foreach ($related_tickets as $ticket) {
1399 1399
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1400
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1400
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1401 1401
 
1402 1402
 					$row++;
1403 1403
 				}
@@ -1405,13 +1405,13 @@  discard block
 block discarded – undo
1405 1405
 				$template_args['total_ticket_rows'] = 1;
1406 1406
 				/** @type EE_Ticket $ticket */
1407 1407
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1408
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1408
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1409 1409
 			}
1410 1410
 		} else {
1411 1411
 			$template_args['time'] = $times[0];
1412 1412
 			/** @type EE_Ticket $ticket */
1413 1413
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1414
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1414
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1415 1415
 			// NOTE: we're just sending the first default row
1416 1416
 			// (decaf can't manage default tickets so this should be sufficient);
1417 1417
 		}
@@ -1420,8 +1420,8 @@  discard block
 block discarded – undo
1420 1420
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1421 1421
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1422 1422
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1423
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1424
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1423
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1424
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1425 1425
 		EEH_Template::display_template($template, $template_args);
1426 1426
 	}
1427 1427
 
@@ -1436,21 +1436,21 @@  discard block
 block discarded – undo
1436 1436
 	 * @param int        $row
1437 1437
 	 * @return string generated html for the ticket row.
1438 1438
 	 */
1439
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1439
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1440 1440
 		$template_args = array(
1441
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1442
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1441
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1442
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1443 1443
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1444 1444
 			'TKT_ID' => $ticket->get('TKT_ID'),
1445 1445
 			'TKT_name' => $ticket->get('TKT_name'),
1446 1446
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1447 1447
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1448 1448
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1449
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1449
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1450 1450
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1451 1451
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1452
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1453
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1452
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1453
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1454 1454
 			);
1455 1455
 
1456 1456
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1466,23 +1466,23 @@  discard block
 block discarded – undo
1466 1466
 
1467 1467
 		//make sure we have default start and end dates if skeleton
1468 1468
 		//handle rows that should NOT be empty
1469
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1469
+		if (empty($template_args['TKT_start_date'])) {
1470 1470
 			//if empty then the start date will be now.
1471 1471
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1472 1472
 		}
1473 1473
 
1474
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1474
+		if (empty($template_args['TKT_end_date'])) {
1475 1475
 			//get the earliest datetime (if present);
1476
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1476
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1477 1477
 
1478
-			if ( !empty( $earliest_dtt ) )
1478
+			if ( ! empty($earliest_dtt))
1479 1479
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1480 1480
 			else
1481
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1481
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1482 1482
 		}
1483 1483
 
1484
-		$template_args = array_merge( $template_args, $price_args );
1485
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1484
+		$template_args = array_merge($template_args, $price_args);
1485
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1486 1486
 		return EEH_Template::display_template($template, $template_args, TRUE);
1487 1487
 	}
1488 1488
 
@@ -1511,8 +1511,8 @@  discard block
 block discarded – undo
1511 1511
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1512 1512
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1513 1513
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1514
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1515
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1514
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1515
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1516 1516
 		EEH_Template::display_template($templatepath, $template_args);
1517 1517
 	}
1518 1518
 
@@ -1540,21 +1540,21 @@  discard block
 block discarded – undo
1540 1540
 		$EEME = $this->_event_model();
1541 1541
 
1542 1542
 		$offset = ($current_page - 1) * $per_page;
1543
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1543
+		$limit = $count ? NULL : $offset.','.$per_page;
1544 1544
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1545 1545
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1546 1546
 
1547 1547
 		if (isset($this->_req_data['month_range'])) {
1548 1548
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1549
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1550
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1549
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1550
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1551 1551
 		}
1552 1552
 
1553 1553
 		$where = array();
1554 1554
 
1555
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1555
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1556 1556
 		//determine what post_status our condition will have for the query.
1557
-		switch ( $status ) {
1557
+		switch ($status) {
1558 1558
 			case 'month' :
1559 1559
 			case 'today' :
1560 1560
 			case NULL :
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 				break;
1563 1563
 
1564 1564
 			case 'draft' :
1565
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1565
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1566 1566
 				break;
1567 1567
 
1568 1568
 			default :
@@ -1570,43 +1570,43 @@  discard block
 block discarded – undo
1570 1570
 		}
1571 1571
 
1572 1572
 		//categories?
1573
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1573
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1574 1574
 
1575
-		if ( !empty ( $category ) ) {
1575
+		if ( ! empty ($category)) {
1576 1576
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1577 1577
 			$where['Term_Taxonomy.term_id'] = $category;
1578 1578
 		}
1579 1579
 
1580 1580
 		//date where conditions
1581
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1581
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1582 1582
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1583
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1584
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1585
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1586
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1583
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1584
+			$start = $DateTime->format(implode(' ', $start_formats));
1585
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1586
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1587 1587
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1588
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1589
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1590
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1591
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1592
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1593
-			$now = date( 'Y-m-01' );
1594
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1595
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1596
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1597
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1588
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1589
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1590
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1591
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1592
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1593
+			$now = date('Y-m-01');
1594
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1595
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1596
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1597
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1598 1598
 		}
1599 1599
 
1600 1600
 
1601
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1602
-			$where['EVT_wp_user'] =  get_current_user_id();
1601
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1602
+			$where['EVT_wp_user'] = get_current_user_id();
1603 1603
 		} else {
1604
-			if ( ! isset( $where['status'] ) ) {
1605
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1604
+			if ( ! isset($where['status'])) {
1605
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1606 1606
 					$where['OR'] = array(
1607
-						'status*restrict_private' => array( '!=', 'private' ),
1607
+						'status*restrict_private' => array('!=', 'private'),
1608 1608
 						'AND' => array(
1609
-							'status*inclusive' => array( '=', 'private' ),
1609
+							'status*inclusive' => array('=', 'private'),
1610 1610
 							'EVT_wp_user' => get_current_user_id()
1611 1611
 						)
1612 1612
 					);
@@ -1614,16 +1614,16 @@  discard block
 block discarded – undo
1614 1614
 			}
1615 1615
 		}
1616 1616
 
1617
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1618
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1617
+		if (isset($this->_req_data['EVT_wp_user'])) {
1618
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1619 1619
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1620 1620
 			}
1621 1621
 		}
1622 1622
 
1623 1623
 
1624 1624
 		//search query handling
1625
-		if ( isset( $this->_req_data['s'] ) ) {
1626
-			$search_string = '%' . $this->_req_data['s'] . '%';
1625
+		if (isset($this->_req_data['s'])) {
1626
+			$search_string = '%'.$this->_req_data['s'].'%';
1627 1627
 			$where['OR'] = array(
1628 1628
 				'EVT_name' => array('LIKE', $search_string),
1629 1629
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1632,32 +1632,32 @@  discard block
 block discarded – undo
1632 1632
 		}
1633 1633
 
1634 1634
 
1635
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1636
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1635
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1636
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1637 1637
 
1638 1638
 
1639 1639
 		//let's first check if we have special requests coming in.
1640
-		if ( isset( $this->_req_data['active_status'] ) ) {
1641
-			switch ( $this->_req_data['active_status'] ) {
1640
+		if (isset($this->_req_data['active_status'])) {
1641
+			switch ($this->_req_data['active_status']) {
1642 1642
 				case 'upcoming' :
1643
-					return $EEME->get_upcoming_events( $query_params, $count );
1643
+					return $EEME->get_upcoming_events($query_params, $count);
1644 1644
 					break;
1645 1645
 
1646 1646
 				case 'expired' :
1647
-					return $EEME->get_expired_events( $query_params, $count );
1647
+					return $EEME->get_expired_events($query_params, $count);
1648 1648
 					break;
1649 1649
 
1650 1650
 				case 'active' :
1651
-					return $EEME->get_active_events( $query_params, $count );
1651
+					return $EEME->get_active_events($query_params, $count);
1652 1652
 					break;
1653 1653
 
1654 1654
 				case 'inactive' :
1655
-					return $EEME->get_inactive_events( $query_params, $count );
1655
+					return $EEME->get_inactive_events($query_params, $count);
1656 1656
 					break;
1657 1657
 			}
1658 1658
 		}
1659 1659
 
1660
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1660
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1661 1661
 
1662 1662
 		return $events;
1663 1663
 	}
@@ -1666,23 +1666,23 @@  discard block
 block discarded – undo
1666 1666
 
1667 1667
 
1668 1668
 	//handling for WordPress CPT actions (trash, restore, delete)
1669
-	public function trash_cpt_item( $post_id ) {
1669
+	public function trash_cpt_item($post_id) {
1670 1670
 		$this->_req_data['EVT_ID'] = $post_id;
1671
-		$this->_trash_or_restore_event( 'trash', FALSE );
1671
+		$this->_trash_or_restore_event('trash', FALSE);
1672 1672
 	}
1673 1673
 
1674 1674
 
1675 1675
 
1676 1676
 
1677
-	public function restore_cpt_item( $post_id ) {
1677
+	public function restore_cpt_item($post_id) {
1678 1678
 		$this->_req_data['EVT_ID'] = $post_id;
1679
-		$this->_trash_or_restore_event( 'draft', FALSE );
1679
+		$this->_trash_or_restore_event('draft', FALSE);
1680 1680
 	}
1681 1681
 
1682 1682
 
1683
-	public function delete_cpt_item( $post_id ) {
1683
+	public function delete_cpt_item($post_id) {
1684 1684
 		$this->_req_data['EVT_ID'] = $post_id;
1685
-		$this->_delete_event( FALSE );
1685
+		$this->_delete_event(FALSE);
1686 1686
 	}
1687 1687
 
1688 1688
 
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 	 * @param  string $event_status
1695 1695
 	 * @return void
1696 1696
 	 */
1697
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1697
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1698 1698
 		//determine the event id and set to array.
1699 1699
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1700 1700
 		// loop thru events
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
 			// clean status
1703 1703
 			$event_status = sanitize_key($event_status);
1704 1704
 			// grab status
1705
-			if (!empty($event_status)) {
1705
+			if ( ! empty($event_status)) {
1706 1706
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1707 1707
 			} else {
1708 1708
 				$success = FALSE;
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
 		}
1717 1717
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1718 1718
 
1719
-		if ( $redirect_after )
1719
+		if ($redirect_after)
1720 1720
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1721 1721
 	}
1722 1722
 
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 		// clean status
1732 1732
 		$event_status = sanitize_key($event_status);
1733 1733
 		// grab status
1734
-		if (!empty($event_status)) {
1734
+		if ( ! empty($event_status)) {
1735 1735
 			$success = TRUE;
1736 1736
 			//determine the event id and set to array.
1737 1737
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1766,15 +1766,15 @@  discard block
 block discarded – undo
1766 1766
 	 * @param  string $event_status
1767 1767
 	 * @return bool
1768 1768
 	 */
1769
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1769
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1770 1770
 		// grab event id
1771
-		if (!$EVT_ID) {
1771
+		if ( ! $EVT_ID) {
1772 1772
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1773 1773
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1774 1774
 			return FALSE;
1775 1775
 		}
1776 1776
 
1777
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1777
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1778 1778
 
1779 1779
 		// clean status
1780 1780
 		$event_status = sanitize_key($event_status);
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 				$hook = FALSE;
1801 1801
 		}
1802 1802
 		//use class to change status
1803
-		$this->_cpt_model_obj->set_status( $event_status );
1803
+		$this->_cpt_model_obj->set_status($event_status);
1804 1804
 		$success = $this->_cpt_model_obj->save();
1805 1805
 
1806 1806
 		if ($success === FALSE) {
@@ -1822,15 +1822,15 @@  discard block
 block discarded – undo
1822 1822
 	 * @access protected
1823 1823
 	 * @param bool $redirect_after
1824 1824
 	 */
1825
-	protected function _delete_event( $redirect_after = TRUE ) {
1825
+	protected function _delete_event($redirect_after = TRUE) {
1826 1826
 		//determine the event id and set to array.
1827 1827
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1828
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1828
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1829 1829
 
1830 1830
 
1831 1831
 		// loop thru events
1832 1832
 		if ($EVT_ID) {
1833
-			$success = $this->_permanently_delete_event( $EVT_ID );
1833
+			$success = $this->_permanently_delete_event($EVT_ID);
1834 1834
 			// get list of events with no prices
1835 1835
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1836 1836
 			// remove this event from the list of events with no prices
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1845 1845
 		}
1846 1846
 
1847
-		if ( $redirect_after )
1847
+		if ($redirect_after)
1848 1848
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1849 1849
 	}
1850 1850
 
@@ -1862,12 +1862,12 @@  discard block
 block discarded – undo
1862 1862
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1863 1863
 		// loop thru events
1864 1864
 		foreach ($EVT_IDs as $EVT_ID) {
1865
-			$EVT_ID = absint( $EVT_ID );
1866
-			if ( $EVT_ID ) {
1867
-				$results = $this->_permanently_delete_event( $EVT_ID );
1865
+			$EVT_ID = absint($EVT_ID);
1866
+			if ($EVT_ID) {
1867
+				$results = $this->_permanently_delete_event($EVT_ID);
1868 1868
 				$success = $results !== FALSE ? $success : FALSE;
1869 1869
 				// remove this event from the list of events with no prices
1870
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1870
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1871 1871
 			} else {
1872 1872
 				$success = FALSE;
1873 1873
 				$msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1887,9 +1887,9 @@  discard block
 block discarded – undo
1887 1887
 	 * @param  int $EVT_ID
1888 1888
 	 * @return bool
1889 1889
 	 */
1890
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1890
+	private function _permanently_delete_event($EVT_ID = 0) {
1891 1891
 		// grab event id
1892
-		if ( ! $EVT_ID ) {
1892
+		if ( ! $EVT_ID) {
1893 1893
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1894 1894
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1895 1895
 			return FALSE;
@@ -1898,19 +1898,19 @@  discard block
 block discarded – undo
1898 1898
 			! $this->_cpt_model_obj instanceof EE_Event
1899 1899
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
1900 1900
 		) {
1901
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1901
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1902 1902
 		}
1903 1903
 
1904
-		if ( ! $this->_cpt_model instanceof EE_Event ) {
1904
+		if ( ! $this->_cpt_model instanceof EE_Event) {
1905 1905
 			return false;
1906 1906
 		}
1907 1907
 
1908 1908
 		//need to delete related tickets and prices first.
1909 1909
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1910
-		foreach ( $datetimes as $datetime ) {
1910
+		foreach ($datetimes as $datetime) {
1911 1911
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1912 1912
 			$tickets = $datetime->get_many_related('Ticket');
1913
-			foreach ( $tickets as $ticket ) {
1913
+			foreach ($tickets as $ticket) {
1914 1914
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1915 1915
 				$ticket->delete_related_permanently('Price');
1916 1916
 				$ticket->delete_permanently();
@@ -1920,14 +1920,14 @@  discard block
 block discarded – undo
1920 1920
 
1921 1921
 		//what about related venues or terms?
1922 1922
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1923
-		foreach ( $venues as $venue ) {
1923
+		foreach ($venues as $venue) {
1924 1924
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1925 1925
 		}
1926 1926
 
1927 1927
 		//any attached question groups?
1928 1928
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1929
-		if ( !empty( $question_groups ) ) {
1930
-			foreach ( $question_groups as $question_group ) {
1929
+		if ( ! empty($question_groups)) {
1930
+			foreach ($question_groups as $question_group) {
1931 1931
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1932 1932
 			}
1933 1933
 		}
@@ -1936,12 +1936,12 @@  discard block
 block discarded – undo
1936 1936
 
1937 1937
 
1938 1938
 		//Message Template Groups
1939
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1939
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1940 1940
 
1941 1941
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1942 1942
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1943 1943
 
1944
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1944
+		foreach ($term_taxonomies as $term_taxonomy) {
1945 1945
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1946 1946
 		}
1947 1947
 
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1956 1956
 			return FALSE;
1957 1957
 		}
1958
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1958
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1959 1959
 		return TRUE;
1960 1960
 	}
1961 1961
 
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 	 */
1973 1973
 	public function total_events() {
1974 1974
 
1975
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
1975
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
1976 1976
 		return $count;
1977 1977
 	}
1978 1978
 
@@ -1987,10 +1987,10 @@  discard block
 block discarded – undo
1987 1987
 	 */
1988 1988
 	public function total_events_draft() {
1989 1989
 		$where = array(
1990
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1990
+			'status' => array('IN', array('draft', 'auto-draft'))
1991 1991
 			);
1992 1992
 
1993
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1993
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1994 1994
 		return $count;
1995 1995
 	}
1996 1996
 
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
 			'status' => 'trash'
2010 2010
 			);
2011 2011
 
2012
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2012
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2013 2013
 		return $count;
2014 2014
 	}
2015 2015
 
@@ -2037,11 +2037,11 @@  discard block
 block discarded – undo
2037 2037
 			// translated
2038 2038
 			TRUE
2039 2039
 		);
2040
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2040
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2041 2041
 
2042 2042
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2043 2043
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2044
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2044
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2045 2045
 		$this->display_admin_page_with_sidebar();
2046 2046
 	}
2047 2047
 
@@ -2067,9 +2067,9 @@  discard block
 block discarded – undo
2067 2067
 
2068 2068
 	protected function _template_settings() {
2069 2069
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2070
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2071
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2072
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2070
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2071
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2072
+		$this->display_admin_caf_preview_page('template_settings_tab');
2073 2073
 	}
2074 2074
 
2075 2075
 
@@ -2082,22 +2082,22 @@  discard block
 block discarded – undo
2082 2082
 	 * @return void
2083 2083
 	 */
2084 2084
 	private function _set_category_object() {
2085
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2085
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2086 2086
 			return; //already have the category object so get out.
2087 2087
 
2088 2088
 		//set default category object
2089 2089
 		$this->_set_empty_category_object();
2090 2090
 
2091 2091
 		//only set if we've got an id
2092
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2092
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2093 2093
 			return;
2094 2094
 		}
2095 2095
 
2096 2096
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2097 2097
 
2098
-		$term = get_term( $category_id, 'espresso_event_categories' );
2098
+		$term = get_term($category_id, 'espresso_event_categories');
2099 2099
 
2100
-		if ( !empty( $term ) ) {
2100
+		if ( ! empty($term)) {
2101 2101
 			$this->_category->category_name = $term->name;
2102 2102
 			$this->_category->category_identifier = $term->slug;
2103 2103
 			$this->_category->category_desc = $term->description;
@@ -2111,13 +2111,13 @@  discard block
 block discarded – undo
2111 2111
 
2112 2112
 	private function _set_empty_category_object() {
2113 2113
 		$this->_category = new stdClass();
2114
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2114
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2115 2115
 		$this->_category->id = $this->_category->parent = 0;
2116 2116
 	}
2117 2117
 
2118 2118
 
2119 2119
 	protected function _category_list_table() {
2120
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2120
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2121 2121
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2122 2122
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2123 2123
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2127,22 +2127,22 @@  discard block
 block discarded – undo
2127 2127
 	protected function _category_details($view) {
2128 2128
 
2129 2129
 		//load formatter helper
2130
-		EE_Registry::instance()->load_helper( 'Formatter' );
2130
+		EE_Registry::instance()->load_helper('Formatter');
2131 2131
 		//load field generator helper
2132
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
2132
+		EE_Registry::instance()->load_helper('Form_Fields');
2133 2133
 
2134 2134
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
2135 2135
 		$this->_set_add_edit_form_tags($route);
2136 2136
 
2137 2137
 		$this->_set_category_object();
2138
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2138
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2139 2139
 
2140 2140
 		$delete_action = 'delete_category';
2141 2141
 
2142 2142
 		//custom redirect
2143
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2143
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2144 2144
 
2145
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2145
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2146 2146
 
2147 2147
 		//take care of contents
2148 2148
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2156,25 +2156,25 @@  discard block
 block discarded – undo
2156 2156
 			'type' => 'wp_editor',
2157 2157
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2158 2158
 			'class' => 'my_editor_custom',
2159
-			'wpeditor_args' => array('media_buttons' => FALSE )
2159
+			'wpeditor_args' => array('media_buttons' => FALSE)
2160 2160
 		);
2161
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2161
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2162 2162
 
2163
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2163
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2164 2164
 
2165 2165
 		//setup category select for term parents.
2166 2166
 		$category_select_values[] = array(
2167 2167
 			'text' => __('No Parent', 'event_espresso'),
2168 2168
 			'id' => 0
2169 2169
 			);
2170
-		foreach ( $all_terms as $term ) {
2170
+		foreach ($all_terms as $term) {
2171 2171
 			$category_select_values[] = array(
2172 2172
 				'text' => $term->name,
2173 2173
 				'id' => $term->term_id
2174 2174
 				);
2175 2175
 		}
2176 2176
 
2177
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2177
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2178 2178
 
2179 2179
 		$template_args = array(
2180 2180
 			'category' => $this->_category,
@@ -2184,15 +2184,15 @@  discard block
 block discarded – undo
2184 2184
 			'disable' => '',
2185 2185
 			'disabled_message' => FALSE
2186 2186
 			);
2187
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2188
-		return EEH_Template::display_template($template, $template_args, TRUE );
2187
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2188
+		return EEH_Template::display_template($template, $template_args, TRUE);
2189 2189
 	}
2190 2190
 
2191 2191
 
2192 2192
 	protected function _delete_categories() {
2193
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2193
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2194 2194
 
2195
-		foreach ( $cat_ids as $cat_id ) {
2195
+		foreach ($cat_ids as $cat_id) {
2196 2196
 			$this->_delete_category($cat_id);
2197 2197
 		}
2198 2198
 
@@ -2200,7 +2200,7 @@  discard block
 block discarded – undo
2200 2200
 		$query_args = array(
2201 2201
 			'action' => 'category_list'
2202 2202
 			);
2203
-		$this->_redirect_after_action(0,'','',$query_args);
2203
+		$this->_redirect_after_action(0, '', '', $query_args);
2204 2204
 
2205 2205
 	}
2206 2206
 
@@ -2210,61 +2210,61 @@  discard block
 block discarded – undo
2210 2210
 
2211 2211
 	protected function _delete_category($cat_id) {
2212 2212
 		global $wpdb;
2213
-		$cat_id = absint( $cat_id );
2214
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2213
+		$cat_id = absint($cat_id);
2214
+		wp_delete_term($cat_id, 'espresso_event_categories');
2215 2215
 	}
2216 2216
 
2217 2217
 
2218 2218
 
2219 2219
 	protected function _insert_or_update_category($new_category) {
2220 2220
 
2221
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2221
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2222 2222
 		$success = 0; //we already have a success message so lets not send another.
2223 2223
 
2224
-		if ( $cat_id ) {
2224
+		if ($cat_id) {
2225 2225
 			$query_args = array(
2226 2226
 				'action'     => 'edit_category',
2227 2227
 				'EVT_CAT_ID' => $cat_id
2228 2228
 			);
2229 2229
 		} else {
2230
-			$query_args = array( 'action' => 'add_category' );
2230
+			$query_args = array('action' => 'add_category');
2231 2231
 		}
2232
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2232
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2233 2233
 
2234 2234
 	}
2235 2235
 
2236 2236
 
2237 2237
 
2238
-	private function _insert_category( $update = FALSE ) {
2238
+	private function _insert_category($update = FALSE) {
2239 2239
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2240
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2241
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2242
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2240
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2241
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2242
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2243 2243
 
2244
-		if ( empty( $category_name ) ) {
2245
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2246
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2244
+		if (empty($category_name)) {
2245
+			$msg = __('You must add a name for the category.', 'event_espresso');
2246
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2247 2247
 			return false;
2248 2248
 		}
2249 2249
 
2250
-		$term_args=array(
2250
+		$term_args = array(
2251 2251
 			'name'=>$category_name,
2252 2252
 			'description'=>$category_desc,
2253 2253
 			'parent'=>$category_parent
2254 2254
 		);
2255 2255
 		//was the category_identifier input disabled?
2256
-		if(isset($this->_req_data['category_identifier'])){
2256
+		if (isset($this->_req_data['category_identifier'])) {
2257 2257
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2258 2258
 		}
2259
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2259
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2260 2260
 
2261
-		if ( !is_array( $insert_ids ) ) {
2262
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2263
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2261
+		if ( ! is_array($insert_ids)) {
2262
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2263
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2264 2264
 		} else {
2265 2265
 			$cat_id = $insert_ids['term_id'];
2266
-			$msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2267
-			EE_Error::add_success( $msg );
2266
+			$msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name);
2267
+			EE_Error::add_success($msg);
2268 2268
 		}
2269 2269
 
2270 2270
 		return $cat_id;
@@ -2273,32 +2273,32 @@  discard block
 block discarded – undo
2273 2273
 
2274 2274
 
2275 2275
 
2276
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2276
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2277 2277
 		global $wpdb;
2278 2278
 
2279 2279
 		//testing term stuff
2280
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2281
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2282
-		$limit = ($current_page-1)*$per_page;
2280
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2281
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2282
+		$limit = ($current_page - 1) * $per_page;
2283 2283
 
2284
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2284
+		$where = array('taxonomy' => 'espresso_event_categories');
2285 2285
 
2286
-		if ( isset( $this->_req_data['s'] ) ) {
2287
-			$sstr = '%' . $this->_req_data['s'] . '%';
2286
+		if (isset($this->_req_data['s'])) {
2287
+			$sstr = '%'.$this->_req_data['s'].'%';
2288 2288
 			$where['OR'] = array(
2289
-				'Term.name' => array( 'LIKE', $sstr),
2290
-				'description' => array( 'LIKE', $sstr )
2289
+				'Term.name' => array('LIKE', $sstr),
2290
+				'description' => array('LIKE', $sstr)
2291 2291
 				);
2292 2292
 		}
2293 2293
 
2294 2294
 		$query_params = array(
2295
-			$where ,
2296
-			'order_by' => array( $orderby => $order ),
2297
-			'limit' => $limit . ',' . $per_page,
2295
+			$where,
2296
+			'order_by' => array($orderby => $order),
2297
+			'limit' => $limit.','.$per_page,
2298 2298
 			'force_join' => array('Term')
2299 2299
 			);
2300 2300
 
2301
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2301
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2302 2302
 
2303 2303
 		return $categories;
2304 2304
 	}
Please login to merge, or discard this patch.
caffeinated/modules/event_single_caff/EED_Event_Single_Caff.module.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 	 * @access    	public
117 117
 	 * @param 		EE_Template_Config $CFG
118 118
 	 * @param 		array $REQ
119
-	 * @return    	EE_Event_Single_Config
119
+	 * @return    	EE_Template_Config
120 120
 	 */
121 121
 	public static function update_template_settings( $CFG, $REQ ) {
122 122
 		$display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100;
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return EED_Event_Single_Caff
30 30
 	 */
31 31
 	public static function instance() {
32
-		return parent::get_instance( __CLASS__ );
32
+		return parent::get_instance(__CLASS__);
33 33
 	}
34 34
 
35 35
 
@@ -50,34 +50,34 @@  discard block
 block discarded – undo
50 50
 	 *  @return 	void
51 51
 	 */
52 52
 	public static function set_hooks_admin() {
53
-		define( 'EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS );
54
-		define( 'EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
53
+		define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS);
54
+		define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
55 55
 		add_action(
56 56
 			'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings',
57
-			array( 'EED_Event_Single_Caff', 'load_scripts_styles' ),
57
+			array('EED_Event_Single_Caff', 'load_scripts_styles'),
58 58
 			10
59 59
 		);
60
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Event_Single_Caff', 'template_settings_form' ), 10 );
61
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Event_Single_Caff', 'update_template_settings' ), 10, 2 );
60
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Event_Single_Caff', 'template_settings_form'), 10);
61
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Event_Single_Caff', 'update_template_settings'), 10, 2);
62 62
 		// AJAX
63
-		add_action( 'wp_ajax_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) );
64
-		add_action( 'wp_ajax_nopriv_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) );
63
+		add_action('wp_ajax_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order'));
64
+		add_action('wp_ajax_nopriv_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order'));
65 65
 
66 66
 	}
67 67
 
68 68
 
69 69
 
70 70
 	public static function load_scripts_styles() {
71
-		add_action( 'admin_enqueue_scripts', array( 'EED_Event_Single_Caff', 'enqueue_scripts_styles' ), 10 );
71
+		add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10);
72 72
 	}
73 73
 
74 74
 
75 75
 
76 76
 	public static function enqueue_scripts_styles() {
77
-		wp_register_style( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION );
78
-		wp_enqueue_style( 'eed-event-single-sortable' );
79
-		wp_register_script( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', array( 'jquery-ui-sortable' ), EVENT_ESPRESSO_VERSION, true );
80
-		wp_enqueue_script( 'eed-event-single-sortable' );
77
+		wp_register_style('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION);
78
+		wp_enqueue_style('eed-event-single-sortable');
79
+		wp_register_script('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
80
+		wp_enqueue_script('eed-event-single-sortable');
81 81
 	}
82 82
 
83 83
 
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public static function template_settings_form() {
93 93
 		$config = EE_Registry::instance()->CFG->template_settings;
94
-		$config = isset( $config->EED_Event_Single ) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config();
95
-		$config->use_sortable_display_order = isset( $config->use_sortable_display_order ) ? $config->use_sortable_display_order : false;
96
-		$config = apply_filters( 'FHEE__EED_Event_Single__template_settings_form__event_list_config', $config );
94
+		$config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config();
95
+		$config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false;
96
+		$config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config);
97 97
 
98 98
 		$event_single_order_array = array();
99
-		$event_single_order_array[ $config->display_order_tickets ] = 'tickets';
100
-		$event_single_order_array[ $config->display_order_datetimes ] = 'datetimes';
101
-		$event_single_order_array[ $config->display_order_event ] = 'event';
102
-		$event_single_order_array[ $config->display_order_venue ] = 'venue';
99
+		$event_single_order_array[$config->display_order_tickets] = 'tickets';
100
+		$event_single_order_array[$config->display_order_datetimes] = 'datetimes';
101
+		$event_single_order_array[$config->display_order_event] = 'event';
102
+		$event_single_order_array[$config->display_order_venue] = 'venue';
103 103
 		// get template parts
104
-		$template_parts = EED_Event_Single::instance()->initialize_template_parts( $config );
104
+		$template_parts = EED_Event_Single::instance()->initialize_template_parts($config);
105 105
 		// convert to array so that we can add more properties
106
-		$config = get_object_vars( $config );
107
-		$config[ 'event_single_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-single-sortable-js', '', 'single-sortable-li single-sortable-js' );
108
-		EEH_Template::display_template( EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $config );
106
+		$config = get_object_vars($config);
107
+		$config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-single-sortable-js', '', 'single-sortable-li single-sortable-js');
108
+		EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', $config);
109 109
 	}
110 110
 
111 111
 
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
 	 * @param 		array $REQ
119 119
 	 * @return    	EE_Event_Single_Config
120 120
 	 */
121
-	public static function update_template_settings( $CFG, $REQ ) {
122
-		$display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100;
123
-		$display_order_datetimes = isset( $CFG->EED_Event_Single->display_order_datetimes ) ? $CFG->EED_Event_Single->display_order_datetimes : 110;
124
-		$display_order_event = isset( $CFG->EED_Event_Single->display_order_event ) ? $CFG->EED_Event_Single->display_order_event : 120;
125
-		$display_order_venue = isset( $CFG->EED_Event_Single->display_order_venue ) ? $CFG->EED_Event_Single->display_order_venue : 130;
121
+	public static function update_template_settings($CFG, $REQ) {
122
+		$display_order_tickets = isset($CFG->EED_Event_Single->display_order_tickets) ? $CFG->EED_Event_Single->display_order_tickets : 100;
123
+		$display_order_datetimes = isset($CFG->EED_Event_Single->display_order_datetimes) ? $CFG->EED_Event_Single->display_order_datetimes : 110;
124
+		$display_order_event = isset($CFG->EED_Event_Single->display_order_event) ? $CFG->EED_Event_Single->display_order_event : 120;
125
+		$display_order_venue = isset($CFG->EED_Event_Single->display_order_venue) ? $CFG->EED_Event_Single->display_order_venue : 130;
126 126
 		$CFG->EED_Event_Single = new EE_Event_Single_Config();
127
-		$CFG->EED_Event_Single->display_status_banner_single = !empty( $REQ['display_status_banner_single'] ) && $REQ['display_status_banner_single'] ? TRUE : FALSE;
128
-		$CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue'] ? TRUE : FALSE;
129
-		$CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) : 0;
127
+		$CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) && $REQ['display_status_banner_single'] ? TRUE : FALSE;
128
+		$CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue'] ? TRUE : FALSE;
129
+		$CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order']) ? absint($REQ['EED_Events_Single_use_sortable_display_order']) : 0;
130 130
 		$CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_tickets : 100;
131 131
 		$CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_datetimes : 110;
132 132
 		$CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_event : 120;
133 133
 		$CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_venue : 130;
134
-		do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ );
134
+		do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ);
135 135
 		return $CFG;
136 136
 	}
137 137
 
@@ -145,23 +145,23 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	public static function update_event_single_order() {
147 147
 		$config_saved = false;
148
-		$template_parts = sanitize_text_field( $_POST[ 'elements' ] );
149
-		if ( ! empty( $template_parts ) ) {
150
-			$template_parts = explode( ',', trim( $template_parts, ',' ) );
151
-			foreach ( $template_parts as $key => $template_part ) {
148
+		$template_parts = sanitize_text_field($_POST['elements']);
149
+		if ( ! empty($template_parts)) {
150
+			$template_parts = explode(',', trim($template_parts, ','));
151
+			foreach ($template_parts as $key => $template_part) {
152 152
 				$template_part = "display_order_$template_part";
153
-				$priority = ( $key * 10 ) + 100;
153
+				$priority = ($key * 10) + 100;
154 154
 				EE_Registry::instance()->CFG->template_settings->EED_Event_Single->{$template_part} = $priority;
155
-				do_action( "AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority );
155
+				do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority);
156 156
 			}
157
-			$config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false );
157
+			$config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false);
158 158
 		}
159
-		if ( $config_saved ) {
160
-			EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) );
159
+		if ($config_saved) {
160
+			EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso'));
161 161
 		} else {
162
-			EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
162
+			EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
163 163
 		}
164
-		echo wp_json_encode( EE_Error::get_notices( false ));
164
+		echo wp_json_encode(EE_Error::get_notices(false));
165 165
 		exit();
166 166
 	}
167 167
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @param WP $WP
175 175
 	 * @return    void
176 176
 	 */
177
-	public function run( $WP ) {
177
+	public function run($WP) {
178 178
 	}
179 179
 
180 180
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
caffeinated/modules/events_archive_caff/EED_Events_Archive_Caff.module.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
 	 *  @access 	public
124 124
 	 *  @param    EE_Template_Config $CFG
125 125
 	 *  @param 	array $REQ
126
-	 *  @return    EE_Events_Archive_Config
126
+	 *  @return    EE_Template_Config
127 127
 	 */
128 128
 	public static function update_template_settings( $CFG, $REQ ) {
129 129
 		$config = new EE_Events_Archive_Config();
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @return EED_Events_Archive_Caff
29 29
 	 */
30 30
 	public static function instance() {
31
-		return parent::get_instance( __CLASS__ );
31
+		return parent::get_instance(__CLASS__);
32 32
 	}
33 33
 
34 34
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 *  @return 	void
50 50
 	 */
51 51
 	public static function set_hooks_admin() {
52
-		define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
53
-		define( 'EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
54
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 );
55
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 );
52
+		define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
53
+		define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
54
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10);
55
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2);
56 56
 		// AJAX
57
-		add_action( 'wp_ajax_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) );
58
-		add_action( 'wp_ajax_nopriv_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) );
57
+		add_action('wp_ajax_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order'));
58
+		add_action('wp_ajax_nopriv_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order'));
59 59
 	}
60 60
 
61 61
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param    WP $WP
69 69
 	 * @return    void
70 70
 	 */
71
-	public function run( $WP ) {
71
+	public function run($WP) {
72 72
 	}
73 73
 
74 74
 
@@ -83,33 +83,33 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public static function template_settings_form() {
85 85
 		// grab general settings admin page and remove the existing hook callback
86
-		$gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' );
87
-		if ( $gen_set_admin instanceof General_Settings_Admin_Page ) {
88
-			remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 );
86
+		$gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings');
87
+		if ($gen_set_admin instanceof General_Settings_Admin_Page) {
88
+			remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100);
89 89
 		}
90 90
 		// first just grab the template settings
91 91
 		$config = EE_Registry::instance()->CFG->template_settings;
92 92
 		// then if the Event Archive config is valid, use that, else create a new one
93
-		$config = isset( $config->EED_Events_Archive ) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config();
94
-		$config = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config );
95
-		$config->display_status_banner = isset( $config->display_status_banner ) ? $config->display_status_banner : 0;
96
-		$config->display_description = isset( $config->display_description ) ? $config->display_description : 1;
97
-		$config->display_ticket_selector = isset( $config->display_ticket_selector ) ? $config->display_ticket_selector : 0;
98
-		$config->display_datetimes = isset( $config->display_datetimes ) ? $config->display_datetimes : 1;
99
-		$config->display_venue = isset( $config->display_venue ) ? $config->display_venue : 0;
100
-		$config->display_expired_events = isset( $config->display_expired_events ) ? $config->display_expired_events : 0;
93
+		$config = isset($config->EED_Events_Archive) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config();
94
+		$config = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config);
95
+		$config->display_status_banner = isset($config->display_status_banner) ? $config->display_status_banner : 0;
96
+		$config->display_description = isset($config->display_description) ? $config->display_description : 1;
97
+		$config->display_ticket_selector = isset($config->display_ticket_selector) ? $config->display_ticket_selector : 0;
98
+		$config->display_datetimes = isset($config->display_datetimes) ? $config->display_datetimes : 1;
99
+		$config->display_venue = isset($config->display_venue) ? $config->display_venue : 0;
100
+		$config->display_expired_events = isset($config->display_expired_events) ? $config->display_expired_events : 0;
101 101
 		// display order options
102
-		$config->use_sortable_display_order = isset( $config->use_sortable_display_order  )? $config->use_sortable_display_order : false;
103
-		$config->display_order_tickets = isset( $config->display_order_tickets  )? $config->display_order_tickets : 100;
104
-		$config->display_order_datetimes = isset( $config->display_order_datetimes  )? $config->display_order_datetimes : 110;
105
-		$config->display_order_event = isset( $config->display_order_event  )? $config->display_order_event : 120;
106
-		$config->display_order_venue = isset( $config->display_order_venue  )? $config->display_order_venue : 130;
102
+		$config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false;
103
+		$config->display_order_tickets = isset($config->display_order_tickets) ? $config->display_order_tickets : 100;
104
+		$config->display_order_datetimes = isset($config->display_order_datetimes) ? $config->display_order_datetimes : 110;
105
+		$config->display_order_event = isset($config->display_order_event) ? $config->display_order_event : 120;
106
+		$config->display_order_venue = isset($config->display_order_venue) ? $config->display_order_venue : 130;
107 107
 		// get template parts
108
-		$template_parts = EED_Events_Archive::instance()->initialize_template_parts( $config );
108
+		$template_parts = EED_Events_Archive::instance()->initialize_template_parts($config);
109 109
 		// convert to array so that we can add more properties
110
-		$config = get_object_vars( $config );
111
-		$config[ 'event_archive_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js' );
112
-		EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $config );
110
+		$config = get_object_vars($config);
111
+		$config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js');
112
+		EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $config);
113 113
 	}
114 114
 
115 115
 
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
 	 *  @param 	array $REQ
126 126
 	 *  @return    EE_Events_Archive_Config
127 127
 	 */
128
-	public static function update_template_settings( $CFG, $REQ ) {
128
+	public static function update_template_settings($CFG, $REQ) {
129 129
 		$config = new EE_Events_Archive_Config();
130 130
 		// unless we are resetting the config...
131
-		if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) {
132
-			$config->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0;
133
-			$config->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1;
134
-			$config->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0;
135
-			$config->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1;
136
-			$config->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0;
137
-			$config->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0;
138
-			$config->use_sortable_display_order = isset( $REQ['EED_Events_Archive_use_sortable_display_order'] ) ? absint( $REQ['EED_Events_Archive_use_sortable_display_order'] ) : 0;
139
-			$config->display_order_tickets = isset( $CFG->EED_Events_Archive->display_order_tickets ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100;
140
-			$config->display_order_datetimes = isset( $CFG->EED_Events_Archive->display_order_datetimes ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110;
141
-			$config->display_order_event = isset( $CFG->EED_Events_Archive->display_order_event ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120;
142
-			$config->display_order_venue = isset( $CFG->EED_Events_Archive->display_order_venue ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130;
131
+		if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) {
132
+			$config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0;
133
+			$config->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1;
134
+			$config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0;
135
+			$config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1;
136
+			$config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0;
137
+			$config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0;
138
+			$config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) : 0;
139
+			$config->display_order_tickets = isset($CFG->EED_Events_Archive->display_order_tickets) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100;
140
+			$config->display_order_datetimes = isset($CFG->EED_Events_Archive->display_order_datetimes) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110;
141
+			$config->display_order_event = isset($CFG->EED_Events_Archive->display_order_event) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120;
142
+			$config->display_order_venue = isset($CFG->EED_Events_Archive->display_order_venue) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130;
143 143
 		}
144 144
 		$CFG->EED_Events_Archive = $config;
145
-		do_action( 'AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ );
145
+		do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ);
146 146
 		return $CFG;
147 147
 	}
148 148
 
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public static function update_event_archive_order() {
158 158
 		$config_saved = false;
159
-		$template_parts = sanitize_text_field( $_POST[ 'elements' ] );
160
-		if ( ! empty( $template_parts ) ) {
161
-			$template_parts = explode( ',', trim( $template_parts, ',' ) );
162
-			foreach ( $template_parts as $key => $template_part ) {
159
+		$template_parts = sanitize_text_field($_POST['elements']);
160
+		if ( ! empty($template_parts)) {
161
+			$template_parts = explode(',', trim($template_parts, ','));
162
+			foreach ($template_parts as $key => $template_part) {
163 163
 				$template_part = "display_order_$template_part";
164
-				$priority = ( $key * 10 ) + 100;
164
+				$priority = ($key * 10) + 100;
165 165
 				if (
166 166
 					property_exists(
167 167
 						EE_Registry::instance()->CFG->template_settings->EED_Events_Archive,
@@ -170,16 +170,16 @@  discard block
 block discarded – undo
170 170
 				) {
171 171
 					EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->{$template_part} = $priority;
172 172
 				}
173
-				do_action( "AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority );
173
+				do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority);
174 174
 			}
175
-			$config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false );
175
+			$config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false);
176 176
 		}
177
-		if ( $config_saved ) {
178
-			EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) );
177
+		if ($config_saved) {
178
+			EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso'));
179 179
 		} else {
180
-			EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
180
+			EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
181 181
 		}
182
-		echo wp_json_encode( EE_Error::get_notices( false ) );
182
+		echo wp_json_encode(EE_Error::get_notices(false));
183 183
 		exit();
184 184
 	}
185 185
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
templates/txn_admin_details_side_meta_box_billing_info.template.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@
 block discarded – undo
1 1
 	<div id="admin-side-mbox-billing-info-dv" class="admin-side-mbox-dv">
2
-<?php if ( empty($billing_form) ) : ?>
2
+<?php if (empty($billing_form)) : ?>
3 3
 		<div class="clearfix">
4
-			<?php _e( 'There is no billing info for this transaction.', 'event_espresso' );?><br/>
4
+			<?php _e('There is no billing info for this transaction.', 'event_espresso'); ?><br/>
5 5
 		</div>
6 6
 <?php else :
7
-	function ee_show_billing_info_cleaned( EE_Form_Section_Proper $form_section, $found_cc_data = false ) {
8
-		foreach( $form_section->subsections() as $subsection ) {
9
-			if( $subsection instanceof EE_Form_Input_Base ) {
10
-				if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal ||
11
-					$subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal ){
7
+	function ee_show_billing_info_cleaned(EE_Form_Section_Proper $form_section, $found_cc_data = false) {
8
+		foreach ($form_section->subsections() as $subsection) {
9
+			if ($subsection instanceof EE_Form_Input_Base) {
10
+				if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal ||
11
+					$subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal) {
12 12
 					continue;
13 13
 				}
14
-				if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) {
14
+				if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal) {
15 15
 					$found_cc_data = true;
16 16
 				}
17 17
 				?>
18 18
 					<div class="clearfix">
19
-						<span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label();?></span><?php echo $subsection->pretty_value();?>
19
+						<span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label(); ?></span><?php echo $subsection->pretty_value(); ?>
20 20
 					</div><?php
21
-			} elseif( $subsection instanceof EE_Form_Section_Proper ) {
22
-				$found_cc_data = ee_show_billing_info_cleaned( $subsection, $found_cc_data);
21
+			} elseif ($subsection instanceof EE_Form_Section_Proper) {
22
+				$found_cc_data = ee_show_billing_info_cleaned($subsection, $found_cc_data);
23 23
 			}
24 24
 		}
25 25
 		return $found_cc_data;
26 26
 	}
27
-	$found_cc_data = ee_show_billing_info_cleaned( $billing_form );
28
-	if( apply_filters( 
27
+	$found_cc_data = ee_show_billing_info_cleaned($billing_form);
28
+	if (apply_filters( 
29 29
 			'FHEE__txn_admin_details_side_meta_box_billing_info__show_default_note', 
30 30
 			$found_cc_data,
31
-			$billing_form ) ) {?>
32
-		<p class="help"><?php _e( 'Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso' );?></p>
31
+			$billing_form )) {?>
32
+		<p class="help"><?php _e('Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso'); ?></p>
33 33
 	<?php }
34
-	do_action( 'AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form );
34
+	do_action('AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form);
35 35
 	endif; ?>
36 36
 
37 37
 	</div>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,13 +3,15 @@
 block discarded – undo
3 3
 		<div class="clearfix">
4 4
 			<?php _e( 'There is no billing info for this transaction.', 'event_espresso' );?><br/>
5 5
 		</div>
6
-<?php else :
6
+<?php else {
7
+	:
7 8
 	function ee_show_billing_info_cleaned( EE_Form_Section_Proper $form_section, $found_cc_data = false ) {
8 9
 		foreach( $form_section->subsections() as $subsection ) {
9 10
 			if( $subsection instanceof EE_Form_Input_Base ) {
10 11
 				if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal ||
11 12
 					$subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal ){
12 13
 					continue;
14
+}
13 15
 				}
14 16
 				if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) {
15 17
 					$found_cc_data = true;
Please login to merge, or discard this patch.
event_single_caff/templates/admin-event-single-settings.template.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' );
3
-EE_Registry::instance()->load_helper( 'Event_View' );
4
-EE_Registry::instance()->load_helper( 'Form_Fields' );
2
+add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
3
+EE_Registry::instance()->load_helper('Event_View');
4
+EE_Registry::instance()->load_helper('Form_Fields');
5 5
 $values = EEH_Form_Fields::prep_answer_options(
6 6
 	array(
7
-		array( 'id' => 1, 'text' => __( 'Yes', 'event_espresso' ) ),
8
-		array( 'id' => 0, 'text' => __( 'No', 'event_espresso' ) )
7
+		array('id' => 1, 'text' => __('Yes', 'event_espresso')),
8
+		array('id' => 0, 'text' => __('No', 'event_espresso'))
9 9
 	)
10 10
 );
11 11
 ?>
@@ -24,27 +24,27 @@  discard block
 block discarded – undo
24 24
 					</label>
25 25
 				</th>
26 26
 				<td>
27
-					<?php echo EEH_Form_Fields::select( 'display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single' ); ?>
28
-					<p class="description"><?php _e( 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso' ); ?></p>
27
+					<?php echo EEH_Form_Fields::select('display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single'); ?>
28
+					<p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso'); ?></p>
29 29
 				</td>
30 30
 			</tr>
31 31
 
32 32
 			<tr>
33 33
 				<th>
34 34
 					<label for="display_venue">
35
-						<?php _e( 'Display Venue Details', 'event_espresso' ); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?>
35
+						<?php _e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?>
36 36
 					</label>
37 37
 				</th>
38 38
 				<td>
39
-					<?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'display_venue', 'display_venue' ); ?>
40
-					<p class="description"><?php _e( 'Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso' ); ?></p>
39
+					<?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'display_venue', 'display_venue'); ?>
40
+					<p class="description"><?php _e('Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso'); ?></p>
41 41
 				</td>
42 42
 			</tr>
43 43
 
44 44
 			<tr>
45 45
 				<th>
46 46
 					<label for="EED_Events_Single_use_sortable_display_order">
47
-						<?php _e( 'Use Custom Display Order?', 'event_espresso' ); ?>
47
+						<?php _e('Use Custom Display Order?', 'event_espresso'); ?>
48 48
 					</label>
49 49
 				</th>
50 50
 				<td>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 					<p class="description ">
61 61
 						<?php
62 62
 						echo sprintf(
63
-							__( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ),
63
+							__('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'),
64 64
 							'<span class="important-notice">',
65 65
 							'</span>',
66 66
 							'<br />'
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 
73 73
 			<tr>
74 74
 				<th>
75
-					<?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?>
75
+					<?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?>
76 76
 				</th>
77 77
 				<td>
78 78
 
79
-					<?php wp_nonce_field( 'espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false ); ?>
79
+					<?php wp_nonce_field('espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false); ?>
80 80
 					<?php echo $event_single_display_order; ?>
81 81
 
82 82
 					<p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the single event page.', 'event_espresso'); ?></p>
Please login to merge, or discard this patch.