Completed
Branch BUG-8698-ticket-sellouts+8511 (46747b)
by
unknown
45:43 queued 30:22
created
modules/ticket_selector/EED_Ticket_Selector.module.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
  */
27 27
 class EED_Ticket_Selector extends  EED_Module {
28 28
 
29
-    const debug = false;    //	true false
29
+	const debug = false;    //	true false
30 30
 
31
-    /**
31
+	/**
32 32
 	 * event that ticket selector is being generated for
33 33
 	 *
34 34
 	 * @access protected
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 	protected static $_event = NULL;
38 38
 
39 39
 	/**
40
-	* array of datetimes and the spaces available for them
41
-	*
42
-	* @access private
43
-	* @var array
44
-	*/
40
+	 * array of datetimes and the spaces available for them
41
+	 *
42
+	 * @access private
43
+	 * @var array
44
+	 */
45 45
 	private static $_available_spaces = array();
46 46
 
47 47
 	/**
48
-	* max attendees that can register for event at one time
49
-	*
50
-	* @access private
51
-	* @var int
52
-	*/
48
+	 * max attendees that can register for event at one time
49
+	 *
50
+	 * @access private
51
+	 * @var int
52
+	 */
53 53
 	private static $_max_atndz = EE_INF;
54 54
 
55 55
 
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 				return $permalink_string;
221 221
 			}
222 222
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
223
-			                     . __( 'Embed', 'event_espresso' )
224
-			                     . '</a> ';
223
+								 . __( 'Embed', 'event_espresso' )
224
+								 . '</a> ';
225 225
 			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
226 226
 			$iframe_string = esc_html(
227 227
 				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 		$html .= apply_filters(
507 507
 			'FHEE__EED_Ticket_Selector__proceed_to_registration_btn_txt',
508 508
 			__( 'Proceed to Registration', 'event_espresso' ),
509
-            self::$_event
509
+			self::$_event
510 510
 		);
511 511
 		$html .= ' <span class="dashicons dashicons-arrow-right-alt2"></span>';
512 512
 		$html .= '</a>';
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	 * 	@return array|boolean
652 652
 	 */
653 653
 	public function process_ticket_selections() {
654
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
654
+		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
655 655
 		// check nonce
656 656
 		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'process_ticket_selections_nonce' ) ) {
657 657
 			return false;
@@ -722,20 +722,20 @@  discard block
 block discarded – undo
722 722
 					}
723 723
 				}
724 724
 				do_action(
725
-				    'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
726
-                    EE_Registry::instance()->CART,
727
-                    $this
728
-                );
725
+					'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart',
726
+					EE_Registry::instance()->CART,
727
+					$this
728
+				);
729 729
 				//d( EE_Registry::instance()->CART );
730 730
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
731 731
 
732 732
 				if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd ) ) {
733 733
 					if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added ) ) {
734 734
 						do_action(
735
-						    'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout',
736
-                            EE_Registry::instance()->CART,
737
-                            $this
738
-                        );
735
+							'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout',
736
+							EE_Registry::instance()->CART,
737
+							$this
738
+						);
739 739
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
740 740
 						EE_Registry::instance()->CART->save_cart( FALSE );
741 741
 						EE_Registry::instance()->SSN->update();
@@ -748,20 +748,20 @@  discard block
 block discarded – undo
748 748
 
749 749
 						EE_Error::get_notices( false, true );
750 750
 						wp_safe_redirect(
751
-						    apply_filters(
752
-						        'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url',
753
-                                EE_Registry::instance()->CFG->core->reg_page_url()
754
-                            )
755
-                        );
751
+							apply_filters(
752
+								'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url',
753
+								EE_Registry::instance()->CFG->core->reg_page_url()
754
+							)
755
+						);
756 756
 						exit();
757 757
 
758 758
 					} else {
759 759
 						if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention') ) {
760 760
 							// nothing added to cart
761 761
 							EE_Error::add_attention(
762
-							    __( 'No tickets were added for the event.', 'event_espresso' ),
763
-                                __FILE__, __FUNCTION__, __LINE__
764
-                            );
762
+								__( 'No tickets were added for the event.', 'event_espresso' ),
763
+								__FILE__, __FUNCTION__, __LINE__
764
+							);
765 765
 						}
766 766
 					}
767 767
 
@@ -928,13 +928,13 @@  discard block
 block discarded – undo
928 928
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
929 929
 		// get the number of spaces left for this datetime ticket
930 930
 		$available_spaces = self::_ticket_datetime_availability( $ticket );
931
-        if (self::debug) {
932
-            echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()";
933
-            echo "<br /> . ticket->ID(): " . $ticket->ID();
934
-            echo "<br /> . requested qty: " . $qty;
935
-            echo "<br /> . available_spaces: " . $available_spaces;
936
-        }
937
-        // compare available spaces against the number of tickets being purchased
931
+		if (self::debug) {
932
+			echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()";
933
+			echo "<br /> . ticket->ID(): " . $ticket->ID();
934
+			echo "<br /> . requested qty: " . $qty;
935
+			echo "<br /> . available_spaces: " . $available_spaces;
936
+		}
937
+		// compare available spaces against the number of tickets being purchased
938 938
 		if ( $available_spaces >= $qty ) {
939 939
 			// allow addons to prevent a ticket from being added to cart
940 940
 			if (
@@ -1115,11 +1115,11 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
 
1117 1117
 	/**
1118
-	* 	load js
1119
-	*
1120
-	* 	@access 		public
1121
-	* 	@return 		void
1122
-	*/
1118
+	 * 	load js
1119
+	 *
1120
+	 * 	@access 		public
1121
+	 * 	@return 		void
1122
+	 */
1123 1123
 	public static function load_tckt_slctr_assets() {
1124 1124
 		// add some style
1125 1125
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.
Spacing   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 class EED_Ticket_Selector extends  EED_Module {
28 28
 
29
-    const debug = false;    //	true false
29
+    const debug = false; //	true false
30 30
 
31 31
     /**
32 32
 	 * event that ticket selector is being generated for
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
 	 * @return EED_Ticket_Selector
68 68
 	 */
69 69
 	public static function instance() {
70
-		return parent::get_instance( __CLASS__ );
70
+		return parent::get_instance(__CLASS__);
71 71
 	}
72 72
 
73 73
 
74 74
 
75
-	protected function set_config(){
76
-		$this->set_config_section( 'template_settings' );
77
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
78
-		$this->set_config_name( 'EED_Ticket_Selector' );
75
+	protected function set_config() {
76
+		$this->set_config_section('template_settings');
77
+		$this->set_config_class('EE_Ticket_Selector_Config');
78
+		$this->set_config_name('EED_Ticket_Selector');
79 79
 	}
80 80
 
81 81
 
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public static function set_hooks() {
92 92
 		// routing
93
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
94
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
95
-		EE_Config::register_route( 'cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections' );
96
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
93
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
94
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
95
+		EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections');
96
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
97 97
 		//add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
98
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
98
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
99 99
 		//add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
100 100
 		//add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
101
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
101
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
102 102
 	}
103 103
 
104 104
 
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 	 *  @return 	void
111 111
 	 */
112 112
 	public static function set_hooks_admin() {
113
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
113
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
114 114
 		//add button for iframe code to event editor.
115
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
116
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
115
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
116
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
117 117
 	}
118 118
 
119 119
 
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
 	 *  @return 	void
126 126
 	 */
127 127
 	public static function set_definitions() {
128
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
129
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
128
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
129
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
130 130
 
131 131
 		//if config is not set, initialize
132 132
 		//If config is not set, set it.
133
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
133
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
134 134
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
135 135
 		}
136
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
136
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
137 137
 	}
138 138
 
139 139
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * 	@param	object 			$WP
145 145
 	 * 	@return 	void
146 146
 	 */
147
-	public function run( $WP ) {}
147
+	public function run($WP) {}
148 148
 
149 149
 
150 150
 	/**
@@ -156,23 +156,23 @@  discard block
 block discarded – undo
156 156
 	public function ticket_selector_iframe() {
157 157
 		self::$_in_iframe = true;
158 158
 		/** @type EEM_Event $EEM_Event */
159
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
159
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
160 160
 		$event = $EEM_Event->get_one_by_ID(
161
-			EE_Registry::instance()->REQ->get( 'event', 0 )
161
+			EE_Registry::instance()->REQ->get('event', 0)
162 162
 		);
163
-		EE_Registry::instance()->REQ->set_espresso_page( true );
164
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
163
+		EE_Registry::instance()->REQ->set_espresso_page(true);
164
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
165 165
 		$template_args['css'] = apply_filters(
166 166
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
167 167
 			array(
168
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
169
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
170
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
171
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
168
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
169
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
170
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
171
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
172 172
 			)
173 173
 		);
174
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
175
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' );
174
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
175
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso');
176 176
 		$template_args['eei18n'] = apply_filters(
177 177
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
178 178
 			EE_Registry::localize_i18n_js_strings()
@@ -181,18 +181,18 @@  discard block
 block discarded – undo
181 181
 		$template_args['js'] = apply_filters(
182 182
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
183 183
 			array(
184
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
185
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
186
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
184
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
185
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
186
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
187 187
 			)
188 188
 		);
189
-		$template_args[ 'notices' ] = EEH_Template::display_template(
190
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
189
+		$template_args['notices'] = EEH_Template::display_template(
190
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
191 191
 			array(),
192 192
 			true
193 193
 		);
194 194
 		EEH_Template::display_template(
195
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
195
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
196 196
 			$template_args
197 197
 		);
198 198
 		exit;
@@ -211,25 +211,25 @@  discard block
 block discarded – undo
211 211
 	 *
212 212
 	 * @return string The new html string for the permalink area.
213 213
 	 */
214
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
214
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
215 215
 		//make sure this is ONLY when editing and the event id has been set.
216
-		if ( ! empty( $id ) ) {
217
-			$post = get_post( $id );
216
+		if ( ! empty($id)) {
217
+			$post = get_post($id);
218 218
 			//if NOT event then let's get out.
219
-			if ( $post->post_type !== 'espresso_events' ) {
219
+			if ($post->post_type !== 'espresso_events') {
220 220
 				return $permalink_string;
221 221
 			}
222 222
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
223
-			                     . __( 'Embed', 'event_espresso' )
223
+			                     . __('Embed', 'event_espresso')
224 224
 			                     . '</a> ';
225
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
225
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
226 226
 			$iframe_string = esc_html(
227
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
227
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
228 228
 			);
229 229
 			$permalink_string .= '
230 230
 <div id="js-ts-iframe" style="display:none">
231 231
 	<div style="width:100%; height: 500px;">
232
-		' . $iframe_string . '
232
+		' . $iframe_string.'
233 233
 	</div>
234 234
 </div>';
235 235
 		}
@@ -248,22 +248,22 @@  discard block
 block discarded – undo
248 248
 	 * @param 	mixed $event
249 249
 	 * @return 	bool
250 250
 	 */
251
-	protected static function set_event( $event = null ) {
252
-		if( $event === null ) {
251
+	protected static function set_event($event = null) {
252
+		if ($event === null) {
253 253
 			global $post;
254 254
 			$event = $post;
255 255
 		}
256
-		if ( $event instanceof EE_Event ) {
256
+		if ($event instanceof EE_Event) {
257 257
 			self::$_event = $event;
258
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
258
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
259 259
 			self::$_event = $event->EE_Event;
260
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
261
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
260
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
261
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
262 262
 			self::$_event = $event->EE_Event;
263 263
 		} else {
264
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
265
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
266
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
264
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
265
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
266
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
267 267
 			return false;
268 268
 		}
269 269
 		return true;
@@ -282,11 +282,11 @@  discard block
 block discarded – undo
282 282
 	 * @param 	bool 	$view_details
283 283
 	 * @return 	string
284 284
 	 */
285
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
285
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
286 286
 		// reset filter for displaying submit button
287
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
287
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
288 288
 		// poke and prod incoming event till it tells us what it is
289
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
289
+		if ( ! EED_Ticket_Selector::set_event($event)) {
290 290
 			return false;
291 291
 		}
292 292
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			&& (
298 298
 				! self::$_event->display_ticket_selector()
299 299
 				|| $view_details
300
-				|| post_password_required( $event_post )
300
+				|| post_password_required($event_post)
301 301
 				|| (
302 302
 					$_event_active_status != EE_Datetime::active
303 303
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -315,34 +315,34 @@  discard block
 block discarded – undo
315 315
 		$template_args = array();
316 316
 		$template_args['event_status'] = $_event_active_status;
317 317
 
318
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
319
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
318
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
319
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
320 320
 
321 321
 		$template_args['EVT_ID'] = self::$_event->ID();
322 322
 		$template_args['event'] = self::$_event;
323 323
 
324 324
 		// is the event expired ?
325 325
 		$template_args['event_is_expired'] = self::$_event->is_expired();
326
-		if ( $template_args['event_is_expired'] ) {
327
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
326
+		if ($template_args['event_is_expired']) {
327
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
328 328
 		}
329 329
 
330 330
 		$ticket_query_args = array(
331
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
332
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
331
+			array('Datetime.EVT_ID' => self::$_event->ID()),
332
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
333 333
 		);
334 334
 
335
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
335
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
336 336
 			//use the correct applicable time query depending on what version of core is being run.
337
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
338
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
337
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
338
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
339 339
 		}
340 340
 
341 341
 		// get all tickets for this event ordered by the datetime
342
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
342
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
343 343
 
344
-		if ( count( $template_args['tickets'] ) < 1 ) {
345
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
344
+		if (count($template_args['tickets']) < 1) {
345
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
346 346
 		}
347 347
 
348 348
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
@@ -351,36 +351,36 @@  discard block
 block discarded – undo
351 351
 			self::$_event->additional_limit()
352 352
 		);
353 353
 		$template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz;
354
-		if ( $template_args['max_atndz'] < 1 ) {
355
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
356
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
357
-				$sales_closed_msg .=  sprintf(
358
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
354
+		if ($template_args['max_atndz'] < 1) {
355
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
356
+			if (current_user_can('edit_post', self::$_event->ID())) {
357
+				$sales_closed_msg .= sprintf(
358
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
359 359
 					'<div class="ee-attention" style="text-align: left;"><b>',
360 360
 					'</b><br />',
361
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
361
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
362 362
 					'</a></span></div>'
363 363
 				);
364 364
 			}
365
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
365
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
366 366
 		}
367 367
 
368
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
369
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
368
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
369
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
370 370
 
371 371
 		// redirecting to another site for registration ??
372 372
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
373 373
 		// set up the form (but not for the admin)
374
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
374
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
375 375
 		// if not redirecting to another site for registration
376
-		if ( ! $external_url ) {
376
+		if ( ! $external_url) {
377 377
 			// then display the ticket selector
378
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
378
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
379 379
 		} else {
380 380
 			// if not we still need to trigger the display of the submit button
381
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
381
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
382 382
 			//display notice to admin that registration is external
383
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
383
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
384 384
 		}
385 385
 		// submit button and form close tag
386 386
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -400,25 +400,25 @@  discard block
 block discarded – undo
400 400
 	 * @param 		string $external_url
401 401
 	 * @return 		string
402 402
 	 */
403
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
403
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
404 404
 		// if redirecting, we don't need any anything else
405
-		if ( $external_url ) {
406
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
407
-			$query_args = EEH_URL::get_query_string( $external_url );
408
-			foreach ( $query_args as $query_arg => $value ) {
409
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
405
+		if ($external_url) {
406
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
407
+			$query_args = EEH_URL::get_query_string($external_url);
408
+			foreach ($query_args as $query_arg => $value) {
409
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
410 410
 			}
411 411
 			return $html;
412 412
 		}
413
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
414
-		if ( ! $checkout_url ) {
415
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
413
+		$checkout_url = EEH_Event_View::event_link_url($ID);
414
+		if ( ! $checkout_url) {
415
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
416 416
 		}
417 417
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
418
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
419
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
418
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
419
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
420 420
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
421
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
421
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
422 422
 		return $html;
423 423
 	}
424 424
 
@@ -433,18 +433,18 @@  discard block
 block discarded – undo
433 433
 	 * 	@return		string
434 434
 	 */
435 435
 	public static function display_ticket_selector_submit() {
436
-		if ( ! is_admin() ) {
437
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
436
+		if ( ! is_admin()) {
437
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
438 438
 				$btn_text = apply_filters(
439 439
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
440
-					__('Register Now', 'event_espresso' ),
440
+					__('Register Now', 'event_espresso'),
441 441
 					EED_Ticket_Selector::$_event
442 442
 				);
443 443
 				$external_url = EED_Ticket_Selector::$_event->external_url();
444
-				$html = '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"';
444
+				$html = '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"';
445 445
 				$html .= ' class="ticket-selector-submit-btn ';
446
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
447
-				$html .= ' type="submit" value="' . $btn_text . '" />';
446
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
447
+				$html .= ' type="submit" value="'.$btn_text.'" />';
448 448
 				$html .= apply_filters(
449 449
 					'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
450 450
 					'',
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
 				);
453 453
 				$html .= '<div class="clear"><br/></div></form>';
454 454
 				return $html;
455
-			} else if ( is_archive() ) {
456
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
455
+			} else if (is_archive()) {
456
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
457 457
 			} else if (
458 458
 				EED_Ticket_Selector::$_event instanceof EE_Event
459 459
 				// if $_max_atndz === 1 (ie: a "Dude Where's my Ticket Selector?" type event)
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 				$html = apply_filters(
466 466
 					'FHEE__EE_Ticket_Selector__no_ticket_selector_submit',
467 467
 					sprintf(
468
-						__( '%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso' ),
468
+						__('%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso'),
469 469
 						'<p class="no-ticket-selector-msg important-notice">',
470 470
 						EED_Ticket_Selector::$_event->name(),
471 471
 						'</p>'
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 				);
475 475
 				$html .= '<div class="clear"></div></form>';
476 476
 				return $html;
477
-			} else if ( EE_Registry::instance()->SSN->cart() instanceof EE_Cart ) {
478
-				if ( ! EE_Registry::instance()->SSN->cart()->all_ticket_quantity_count() ) {
477
+			} else if (EE_Registry::instance()->SSN->cart() instanceof EE_Cart) {
478
+				if ( ! EE_Registry::instance()->SSN->cart()->all_ticket_quantity_count()) {
479 479
 					return '';
480 480
 				}
481 481
 				return EED_Ticket_Selector::display_proceed_btn_when_tickets_in_cart();
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
 		$html .= '">';
506 506
 		$html .= apply_filters(
507 507
 			'FHEE__EED_Ticket_Selector__proceed_to_registration_btn_txt',
508
-			__( 'Proceed to Registration', 'event_espresso' ),
508
+			__('Proceed to Registration', 'event_espresso'),
509 509
             self::$_event
510 510
 		);
511 511
 		$html .= ' <span class="dashicons dashicons-arrow-right-alt2"></span>';
512 512
 		$html .= '</a>';
513 513
 		$html .= '<div class="clear"></div>';
514
-		$cancel_url = EEH_Event_View::event_link_url( self::$_event->ID() );
514
+		$cancel_url = EEH_Event_View::event_link_url(self::$_event->ID());
515 515
 		$cancel_url = add_query_arg(
516 516
 			array(
517 517
 				'ee'       => 'cancel_ticket_selections',
@@ -520,11 +520,11 @@  discard block
 block discarded – undo
520 520
 			),
521 521
 			$cancel_url
522 522
 		);
523
-		$cancel_url = wp_nonce_url( $cancel_url, 'cancel_ticket_selections', 'cancel_ticket_selections_nonce' );
524
-		$html .= '<a class="ticket-selector-submit-btn small-text" href="' . $cancel_url . '">';
523
+		$cancel_url = wp_nonce_url($cancel_url, 'cancel_ticket_selections', 'cancel_ticket_selections_nonce');
524
+		$html .= '<a class="ticket-selector-submit-btn small-text" href="'.$cancel_url.'">';
525 525
 		$html .= apply_filters(
526 526
 			'FHEE__EED_Ticket_Selector__cancel_ticket_selections_txt',
527
-			__( 'cancel ticket selection', 'event_espresso' )
527
+			__('cancel ticket selection', 'event_espresso')
528 528
 		);
529 529
 		$html .= '</a>';
530 530
 		$html .= '<div class="clear"><br/></div>';
@@ -557,8 +557,8 @@  discard block
 block discarded – undo
557 557
 	 * 	@return		string
558 558
 	 */
559 559
 	public static function display_view_details_btn() {
560
-		if ( ! self::$_event->get_permalink() ) {
561
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
560
+		if ( ! self::$_event->get_permalink()) {
561
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
562 562
 		}
563 563
 		$view_details_btn = '<form method="POST" action="';
564 564
 		$view_details_btn .= apply_filters(
@@ -567,9 +567,9 @@  discard block
 block discarded – undo
567 567
 			self::$_event
568 568
 		);
569 569
 		$view_details_btn .= '">';
570
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
571
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
572
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
570
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
571
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
572
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
573 573
 		$view_details_btn .= '<div class="clear"><br/></div>';
574 574
 		$view_details_btn .= '</form>';
575 575
 		return $view_details_btn;
@@ -586,19 +586,19 @@  discard block
 block discarded – undo
586 586
 	 */
587 587
 	public static function cancel_ticket_selections() {
588 588
 		// check nonce
589
-		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'cancel_ticket_selections_nonce' ) ) {
589
+		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce('cancel_ticket_selections_nonce')) {
590 590
 			return false;
591 591
 		}
592
-		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__ );
593
-		if ( EE_Registry::instance()->REQ->is_set( 'event_id' ) ) {
592
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
593
+		if (EE_Registry::instance()->REQ->is_set('event_id')) {
594 594
 			wp_safe_redirect(
595 595
 				EEH_Event_View::event_link_url(
596
-					EE_Registry::instance()->REQ->get( 'event_id' )
596
+					EE_Registry::instance()->REQ->get('event_id')
597 597
 				)
598 598
 			);
599 599
 		} else {
600 600
 			wp_safe_redirect(
601
-				site_url( '/' . EE_Registry::instance()->CFG->core->event_cpt_slug . '/' )
601
+				site_url('/'.EE_Registry::instance()->CFG->core->event_cpt_slug.'/')
602 602
 			);
603 603
 		}
604 604
 		die();
@@ -613,15 +613,15 @@  discard block
 block discarded – undo
613 613
 	 * @param  string $nonce_name
614 614
 	 * @return bool
615 615
 	 */
616
-	public static function process_ticket_selector_nonce( $nonce_name ) {
616
+	public static function process_ticket_selector_nonce($nonce_name) {
617 617
 		if (
618 618
 			! is_admin()
619 619
 			&& (
620
-				! EE_Registry::instance()->REQ->is_set( $nonce_name )
620
+				! EE_Registry::instance()->REQ->is_set($nonce_name)
621 621
 				||
622 622
 				! wp_verify_nonce(
623
-					EE_Registry::instance()->REQ->get( $nonce_name ),
624
-					str_replace( '_nonce', '', $nonce_name )
623
+					EE_Registry::instance()->REQ->get($nonce_name),
624
+					str_replace('_nonce', '', $nonce_name)
625 625
 				)
626 626
 			)
627 627
 		) {
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 	 * 	@return array|boolean
652 652
 	 */
653 653
 	public function process_ticket_selections() {
654
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
654
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
655 655
 		// check nonce
656
-		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'process_ticket_selections_nonce' ) ) {
656
+		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce('process_ticket_selections_nonce')) {
657 657
 			return false;
658 658
 		}
659 659
 
@@ -663,58 +663,58 @@  discard block
 block discarded – undo
663 663
 		);
664 664
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
665 665
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
666
-		EE_Registry::instance()->load_core( 'Session' );
666
+		EE_Registry::instance()->load_core('Session');
667 667
 		// unless otherwise requested, clear the session
668
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
669
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
668
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
669
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
670 670
 		}
671 671
 		//d( EE_Registry::instance()->SSN );
672 672
 
673
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
673
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
674 674
 		// do we have an event id?
675
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
675
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
676 676
 			// validate/sanitize data
677 677
 			$valid = self::_validate_post_data();
678 678
 			//check total tickets ordered vs max number of attendees that can register
679
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
679
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
680 680
 
681 681
 				// ordering too many tickets !!!
682 682
 				$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
683
-				$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
683
+				$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
684 684
 				// dev only message
685 685
 				$max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso');
686
-				$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
687
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
686
+				$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
687
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
688 688
 			} else {
689 689
 
690 690
 				// all data appears to be valid
691 691
 				$tckts_slctd = false;
692 692
 				$tickets_added = 0;
693 693
 				// validate/sanitize data
694
-				$valid = apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', $valid );
695
-				if ( $valid[ 'total_tickets' ] >0 ) {
694
+				$valid = apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', $valid);
695
+				if ($valid['total_tickets'] > 0) {
696 696
 					// load cart
697
-					EE_Registry::instance()->load_core( 'Cart' );
697
+					EE_Registry::instance()->load_core('Cart');
698 698
 
699 699
 					// cycle thru the number of data rows sent from the event listing
700
-					for ( $x = 0; $x < $valid['rows']; $x++ ) {
700
+					for ($x = 0; $x < $valid['rows']; $x++) {
701 701
 						// does this row actually contain a ticket quantity?
702
-						if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
702
+						if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
703 703
 							// YES we have a ticket quantity
704 704
 							$tckts_slctd = TRUE;
705 705
 							// d( $valid['ticket_obj'][$x] );
706
-							if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
706
+							if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
707 707
 								// then add ticket to cart
708
-								$tickets_added += self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
708
+								$tickets_added += self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
709 709
 								//echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
710 710
 								//echo "\n . ticket_added: " . $ticket_added . '<br />';
711
-								if ( EE_Error::has_error() ) {
711
+								if (EE_Error::has_error()) {
712 712
 									break;
713 713
 								}
714 714
 							} else {
715 715
 								// nothing added to cart retrieved
716 716
 								EE_Error::add_error(
717
-									sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
717
+									sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
718 718
 									__FILE__, __FUNCTION__, __LINE__
719 719
 								);
720 720
 							}
@@ -729,24 +729,24 @@  discard block
 block discarded – undo
729 729
 				//d( EE_Registry::instance()->CART );
730 730
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
731 731
 
732
-				if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd ) ) {
733
-					if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added ) ) {
732
+				if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd)) {
733
+					if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) {
734 734
 						do_action(
735 735
 						    'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout',
736 736
                             EE_Registry::instance()->CART,
737 737
                             $this
738 738
                         );
739 739
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
740
-						EE_Registry::instance()->CART->save_cart( FALSE );
740
+						EE_Registry::instance()->CART->save_cart(FALSE);
741 741
 						EE_Registry::instance()->SSN->update();
742 742
 						//d( EE_Registry::instance()->CART );
743 743
 						// die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
744 744
 						// just return TRUE for registrations being made from admin
745
-						if ( is_admin() ) {
745
+						if (is_admin()) {
746 746
 							return TRUE;
747 747
 						}
748 748
 
749
-						EE_Error::get_notices( false, true );
749
+						EE_Error::get_notices(false, true);
750 750
 						wp_safe_redirect(
751 751
 						    apply_filters(
752 752
 						        'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url',
@@ -756,10 +756,10 @@  discard block
 block discarded – undo
756 756
 						exit();
757 757
 
758 758
 					} else {
759
-						if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention') ) {
759
+						if ( ! EE_Error::has_error() && ! EE_Error::has_error(true, 'attention')) {
760 760
 							// nothing added to cart
761 761
 							EE_Error::add_attention(
762
-							    __( 'No tickets were added for the event.', 'event_espresso' ),
762
+							    __('No tickets were added for the event.', 'event_espresso'),
763 763
                                 __FILE__, __FUNCTION__, __LINE__
764 764
                             );
765 765
 						}
@@ -767,21 +767,21 @@  discard block
 block discarded – undo
767 767
 
768 768
 				} else {
769 769
 					// no ticket quantities were selected
770
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
770
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
771 771
 				}
772 772
 			}
773 773
 			// die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
774 774
 			// at this point, just return if registration is being made from admin
775
-			if ( is_admin() ) {
775
+			if (is_admin()) {
776 776
 				return FALSE;
777 777
 			}
778
-			if ( $valid['return_url'] ) {
779
-				EE_Error::get_notices( FALSE, TRUE );
780
-				wp_safe_redirect( $valid['return_url'] );
778
+			if ($valid['return_url']) {
779
+				EE_Error::get_notices(FALSE, TRUE);
780
+				wp_safe_redirect($valid['return_url']);
781 781
 				exit();
782
-			} elseif ( isset( $event_to_add['id'] )) {
783
-				EE_Error::get_notices( FALSE, TRUE );
784
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
782
+			} elseif (isset($event_to_add['id'])) {
783
+				EE_Error::get_notices(FALSE, TRUE);
784
+				wp_safe_redirect(get_permalink($event_to_add['id']));
785 785
 				exit();
786 786
 			} else {
787 787
 				echo EE_Error::get_notices();
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
 		} else {
791 791
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
792 792
 			EE_Error::add_error(
793
-				sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
793
+				sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
794 794
 				__FILE__, __FUNCTION__, __LINE__
795 795
 			);
796 796
 		}
@@ -808,18 +808,18 @@  discard block
 block discarded – undo
808 808
 	 * @return        array  or FALSE
809 809
 	 */
810 810
 	private static function _validate_post_data() {
811
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
811
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
812 812
 
813 813
 		// start with an empty array()
814 814
 		$valid_data = array();
815 815
 		//		d( $_POST );
816 816
 		//if event id is valid
817
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
818
-		if ( $id ) {
817
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
818
+		if ($id) {
819 819
 			// grab valid id
820 820
 			$valid_data['id'] = $id;
821 821
 			// grab and sanitize return-url
822
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
822
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
823 823
 			// array of other form names
824 824
 			$inputs_to_clean = array(
825 825
 				'event_id' => 'tkt-slctr-event-id',
@@ -832,22 +832,22 @@  discard block
 block discarded – undo
832 832
 			// let's track the total number of tickets ordered.'
833 833
 			$valid_data['total_tickets'] = 0;
834 834
 			// cycle through $inputs_to_clean array
835
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
835
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
836 836
 				// check for POST data
837
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
837
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
838 838
 					// grab value
839
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
839
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
840 840
 					switch ($what) {
841 841
 
842 842
 						// integers
843 843
 						case 'event_id':
844
-							$valid_data[$what] = absint( $input_value );
844
+							$valid_data[$what] = absint($input_value);
845 845
 							// get event via the event id we put in the form
846
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
846
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
847 847
 							break;
848 848
 						case 'rows':
849 849
 						case 'max_atndz':
850
-							$valid_data[$what] = absint( $input_value );
850
+							$valid_data[$what] = absint($input_value);
851 851
 							break;
852 852
 
853 853
 						// arrays of integers
@@ -855,27 +855,27 @@  discard block
 block discarded – undo
855 855
 							//							d( $input_value );
856 856
 							$row_qty = $input_value;
857 857
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
858
-							if( ! is_array( $row_qty )) {
858
+							if ( ! is_array($row_qty)) {
859 859
 								// get number of rows
860
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
860
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
861 861
 								//								d( $rows );
862 862
 								// explode ints by the dash
863
-								$row_qty = explode( '-', $row_qty );
864
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
865
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
866
-								$row_qty = array( $row => $qty );
863
+								$row_qty = explode('-', $row_qty);
864
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
865
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
866
+								$row_qty = array($row => $qty);
867 867
 								//								 d( $row_qty );
868
-								for( $x = 1; $x <= $rows; $x++ ) {
869
-									if ( ! isset( $row_qty[$x] )) {
868
+								for ($x = 1; $x <= $rows; $x++) {
869
+									if ( ! isset($row_qty[$x])) {
870 870
 										$row_qty[$x] = 0;
871 871
 									}
872 872
 								}
873 873
 							}
874
-							ksort( $row_qty );
874
+							ksort($row_qty);
875 875
 							//							 d( $row_qty );
876 876
 							// cycle thru values
877
-							foreach ( $row_qty as $qty ) {
878
-								$qty = absint( $qty );
877
+							foreach ($row_qty as $qty) {
878
+								$qty = absint($qty);
879 879
 								// sanitize as integers
880 880
 								$valid_data[$what][] = $qty;
881 881
 								$valid_data['total_tickets'] += $qty;
@@ -886,19 +886,19 @@  discard block
 block discarded – undo
886 886
 						case 'ticket_id':
887 887
 							$value_array = array();
888 888
 							// cycle thru values
889
-							foreach ( $input_value as $key=>$value ) {
889
+							foreach ($input_value as $key=>$value) {
890 890
 								// allow only numbers, letters,  spaces, commas and dashes
891
-								$value_array[ $key ] = wp_strip_all_tags( $value );
891
+								$value_array[$key] = wp_strip_all_tags($value);
892 892
 								// get ticket via the ticket id we put in the form
893
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
894
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
893
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
894
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
895 895
 							}
896
-							$valid_data[ $what ] = $value_array;
896
+							$valid_data[$what] = $value_array;
897 897
 							break;
898 898
 
899 899
 						case 'return_url' :
900 900
 							// grab and sanitize return-url
901
-							$valid_data[$what] = esc_url_raw( $input_value );
901
+							$valid_data[$what] = esc_url_raw($input_value);
902 902
 							break;
903 903
 
904 904
 					} 	// end switch $what
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 			} 	// end foreach $inputs_to_clean
907 907
 
908 908
 		} else {
909
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
909
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
910 910
 			return FALSE;
911 911
 		}
912 912
 
@@ -924,18 +924,18 @@  discard block
 block discarded – undo
924 924
 	 * @param int       $qty
925 925
 	 * @return int quantity of tickets added
926 926
 	 */
927
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
928
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
927
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
928
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
929 929
 		// get the number of spaces left for this datetime ticket
930
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
930
+		$available_spaces = self::_ticket_datetime_availability($ticket);
931 931
         if (self::debug) {
932
-            echo "<br /><br /> " . __LINE__ . ") " . __METHOD__ . "()";
933
-            echo "<br /> . ticket->ID(): " . $ticket->ID();
934
-            echo "<br /> . requested qty: " . $qty;
935
-            echo "<br /> . available_spaces: " . $available_spaces;
932
+            echo "<br /><br /> ".__LINE__.") ".__METHOD__."()";
933
+            echo "<br /> . ticket->ID(): ".$ticket->ID();
934
+            echo "<br /> . requested qty: ".$qty;
935
+            echo "<br /> . available_spaces: ".$available_spaces;
936 936
         }
937 937
         // compare available spaces against the number of tickets being purchased
938
-		if ( $available_spaces >= $qty ) {
938
+		if ($available_spaces >= $qty) {
939 939
 			// allow addons to prevent a ticket from being added to cart
940 940
 			if (
941 941
 				! apply_filters(
@@ -948,10 +948,10 @@  discard block
 block discarded – undo
948 948
 			) {
949 949
 				return 0;
950 950
 			}
951
-			$qty = apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket );
951
+			$qty = apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket);
952 952
 			// add event to cart
953
-			if( $qty && EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
954
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
953
+			if ($qty && EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
954
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
955 955
 				return $qty;
956 956
 			} else {
957 957
 				return 0;
@@ -959,9 +959,9 @@  discard block
 block discarded – undo
959 959
 		} else {
960 960
 			// tickets can not be purchased but let's find the exact number left
961 961
 			// for the last ticket selected PRIOR to subtracting tickets
962
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
962
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
963 963
 			// greedy greedy greedy eh?
964
-			if ( $available_spaces > 0 ) {
964
+			if ($available_spaces > 0) {
965 965
 				if (
966 966
 					apply_filters(
967 967
 						'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_display_availability_error',
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
 						$available_spaces
972 972
 					)
973 973
 				) {
974
-					EED_Ticket_Selector::_display_availability_error( $available_spaces );
974
+					EED_Ticket_Selector::_display_availability_error($available_spaces);
975 975
 				}
976 976
 			} else {
977 977
 				EE_Error::add_error(
@@ -996,10 +996,10 @@  discard block
 block discarded – undo
996 996
 	 * @access    private
997 997
 	 * @param int $available_spaces
998 998
 	 */
999
-	private static function _display_availability_error( $available_spaces = 1 ) {
999
+	private static function _display_availability_error($available_spaces = 1) {
1000 1000
 		// add error messaging - we're using the _n function that will generate
1001 1001
 		// the appropriate singular or plural message based on the number of $available_spaces
1002
-		if ( EE_Registry::instance()->CART->all_ticket_quantity_count() ) {
1002
+		if (EE_Registry::instance()->CART->all_ticket_quantity_count()) {
1003 1003
 			$msg = sprintf(
1004 1004
 				_n(
1005 1005
 					'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.',
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 				'<br />'
1023 1023
 			);
1024 1024
 		}
1025
-		EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1025
+		EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1026 1026
 	}
1027 1027
 
1028 1028
 
@@ -1037,22 +1037,22 @@  discard block
 block discarded – undo
1037 1037
 	 * @param 	bool         $get_original_ticket_spaces
1038 1038
 	 * @return 	int
1039 1039
 	 */
1040
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
1040
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
1041 1041
 		// if the $_available_spaces array has not been set up yet...
1042
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
1043
-				self::_set_initial_ticket_datetime_availability( $ticket );
1042
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
1043
+				self::_set_initial_ticket_datetime_availability($ticket);
1044 1044
 		}
1045 1045
 		$available_spaces = $ticket->qty() - $ticket->sold();
1046
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
1046
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
1047 1047
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
1048
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
1048
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
1049 1049
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
1050
-				if ( $get_original_ticket_spaces ) {
1050
+				if ($get_original_ticket_spaces) {
1051 1051
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
1052
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
1052
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
1053 1053
 				} else {
1054 1054
 					// we want the updated ticket availability as stored in the "datetimes" array
1055
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
1055
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
1056 1056
 				}
1057 1057
 			}
1058 1058
 		}
@@ -1068,23 +1068,23 @@  discard block
 block discarded – undo
1068 1068
 	 * @param 	EE_Ticket $ticket
1069 1069
 	 * @return 	int
1070 1070
 	 */
1071
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
1071
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
1072 1072
 		// first, get all of the datetimes that are available to this ticket
1073 1073
 		$datetimes = $ticket->get_many_related(
1074 1074
 			'Datetime',
1075
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
1075
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
1076 1076
 		);
1077
-		if ( ! empty( $datetimes )) {
1077
+		if ( ! empty($datetimes)) {
1078 1078
 			// now loop thru all of the datetimes
1079
-			foreach ( $datetimes as $datetime  ) {
1080
-				if ( $datetime instanceof EE_Datetime ) {
1079
+			foreach ($datetimes as $datetime) {
1080
+				if ($datetime instanceof EE_Datetime) {
1081 1081
 					// the number of spaces available for the datetime without considering individual ticket quantities
1082 1082
 					$spaces_remaining = $datetime->spaces_remaining();
1083 1083
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
1084
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
1084
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
1085 1085
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
1086 1086
 					// else just take the datetime spaces remaining, and assign to the datetimes array
1087
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
1087
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
1088 1088
 				}
1089 1089
 			}
1090 1090
 		}
@@ -1100,12 +1100,12 @@  discard block
 block discarded – undo
1100 1100
 	 * @param 	int   $qty
1101 1101
 	 * @return 	int
1102 1102
 	 */
1103
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
1104
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
1103
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
1104
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
1105 1105
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
1106
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
1106
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
1107 1107
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
1108
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
1108
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
1109 1109
 			}
1110 1110
 		}
1111 1111
 	}
@@ -1122,8 +1122,8 @@  discard block
 block discarded – undo
1122 1122
 	*/
1123 1123
 	public static function load_tckt_slctr_assets() {
1124 1124
 		// add some style
1125
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
1126
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
1125
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
1126
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
1127 1127
 			wp_enqueue_style('ticket_selector');
1128 1128
 			// make it dance
1129 1129
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -1137,9 +1137,9 @@  discard block
 block discarded – undo
1137 1137
 
1138 1138
 	public static function load_tckt_slctr_assets_admin() {
1139 1139
 		//iframe button js on admin event editor page
1140
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
1141
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
1142
-			wp_enqueue_script( 'ticket_selector_embed' );
1140
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
1141
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1142
+			wp_enqueue_script('ticket_selector_embed');
1143 1143
 		}
1144 1144
 	}
1145 1145
 
Please login to merge, or discard this patch.