Completed
Branch FET-8394-move-rules-into-core (5a0f96)
by
unknown
09:47 queued 10s
created
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 4 patches
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 	/**
479 479
 	 * 		generates Business Report showing total registratiopns per day
480 480
 	*		@access private
481
-	*		@return void
481
+	*		@return string
482 482
 	*/
483 483
 	private function _registrations_per_day_report( $period = '-1 month' ) {
484 484
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * 		generates Business Report showing total registratiopns per event
537 537
 	*		@access private
538
-	*		@return void
538
+	*		@return string
539 539
 	*/
540 540
 	private function _get_registrations_per_event_report( $period = '-1 month' ) {
541 541
 
@@ -650,8 +650,6 @@  discard block
 block discarded – undo
650 650
 	/**
651 651
 	 * 		handles toggleing the checkin status for the registration,
652 652
 	*		@access protected
653
-	*		@param boolean 	$check_in
654
-	*		@return void
655 653
 	*/
656 654
 	protected function _toggle_checkin_status() {
657 655
 		//first let's get the query args out of the way for the redirect
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 
448 448
 	/**
449 449
 	 * 		generates Business Reports regarding Registrations
450
-	*		@access protected
451
-	*		@return void
452
-	*/
450
+	 *		@access protected
451
+	 *		@return void
452
+	 */
453 453
 	protected function _registration_reports() {
454 454
 
455 455
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
 
478 478
 	/**
479 479
 	 * 		generates Business Report showing total registratiopns per day
480
-	*		@access private
481
-	*		@return void
482
-	*/
480
+	 *		@access private
481
+	 *		@return void
482
+	 */
483 483
 	private function _registrations_per_day_report( $period = '-1 month' ) {
484 484
 
485 485
 		$report_ID = 'reg-admin-registrations-per-day-report-dv';
@@ -534,9 +534,9 @@  discard block
 block discarded – undo
534 534
 
535 535
 	/**
536 536
 	 * 		generates Business Report showing total registratiopns per event
537
-	*		@access private
538
-	*		@return void
539
-	*/
537
+	 *		@access private
538
+	 *		@return void
539
+	 */
540 540
 	private function _get_registrations_per_event_report( $period = '-1 month' ) {
541 541
 
542 542
 		$report_ID = 'reg-admin-registrations-per-event-report-dv';
@@ -649,10 +649,10 @@  discard block
 block discarded – undo
649 649
 
650 650
 	/**
651 651
 	 * 		handles toggleing the checkin status for the registration,
652
-	*		@access protected
653
-	*		@param boolean 	$check_in
654
-	*		@return void
655
-	*/
652
+	 *		@access protected
653
+	 *		@param boolean 	$check_in
654
+	 *		@return void
655
+	 */
656 656
 	protected function _toggle_checkin_status() {
657 657
 		//first let's get the query args out of the way for the redirect
658 658
 		$query_args = array(
@@ -773,9 +773,9 @@  discard block
 block discarded – undo
773 773
 
774 774
 	/**
775 775
 	 * 		generates HTML for the Event Registrations List Table
776
-	*		@access protected
777
-	*		@return void
778
-	*/
776
+	 *		@access protected
777
+	 *		@return void
778
+	 */
779 779
 	protected function _event_registrations_list_table() {
780 780
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
781 781
 		$this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
@@ -805,11 +805,11 @@  discard block
 block discarded – undo
805 805
 				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
806 806
 				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
807 807
 				),
808
-            'cancelled_status' => array(
808
+			'cancelled_status' => array(
809 809
 				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
810 810
 				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
811 811
 				),
812
-            'declined_status' => array(
812
+			'declined_status' => array(
813 813
 				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
814 814
 				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
815 815
 				),
@@ -837,9 +837,9 @@  discard block
 block discarded – undo
837 837
 	/**
838 838
 	 * 		get_attendees
839 839
 	 * 		@param bool $count whether to return count or data.
840
-	*		@access public
841
-	*		@return array
842
-	*/
840
+	 *		@access public
841
+	 *		@return array
842
+	 */
843 843
 	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) {
844 844
 
845 845
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Spacing   +216 added lines, -216 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
 /**
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class Extend_Registrations_Admin_Page extends Registrations_Admin_Page {
31 31
 
32
-	public function __construct( $routing = TRUE ) {
33
-		parent::__construct( $routing );
34
-		define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
35
-		define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
36
-		define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
32
+	public function __construct($routing = TRUE) {
33
+		parent::__construct($routing);
34
+		define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/');
35
+		define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/');
36
+		define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/');
37 37
 	}
38 38
 
39 39
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
 	protected function _extend_page_config() {
45
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
45
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';
46 46
 
47
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
48
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0;
49
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
47
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
48
+		$att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0;
49
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
50 50
 
51 51
 		$new_page_routes = array(
52 52
 			'reports' => array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 				)
86 86
 			);
87 87
 
88
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
88
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
89 89
 
90 90
 		$new_page_config = array(
91 91
 			'reports' => array(
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 						'filename' => 'registrations_reports'
100 100
 						)
101 101
 					),
102
-				'help_tour' => array( 'Registration_Reports_Help_Tour' ),
102
+				'help_tour' => array('Registration_Reports_Help_Tour'),
103 103
 				'require_nonce' => FALSE
104 104
 				),
105 105
 			'event_registrations' => array(
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 						'filename' => 'registrations_event_checkin_other'
131 131
 					)
132 132
 				),
133
-				'help_tour' => array( 'Event_Checkin_Help_Tour' ),
134
-				'qtips' => array('Registration_List_Table_Tips' ),
133
+				'help_tour' => array('Event_Checkin_Help_Tour'),
134
+				'qtips' => array('Registration_List_Table_Tips'),
135 135
 				'list_table' => 'EE_Event_Registrations_List_Table',
136 136
 				'metaboxes' => array(),
137 137
 				'require_nonce' => FALSE
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		// var_dump($this->_req_data);
153 153
 		// exit();
154 154
 
155
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
155
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
156 156
 		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
157 157
 		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
158 158
 	}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 	protected function _ajax_hooks() {
163 163
 		parent::_ajax_hooks();
164
-		add_action('wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content') );
164
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
165 165
 	}
166 166
 
167 167
 
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
 
172 172
 		//if newsletter message type is active then let's add filter and load js for it.
173 173
 		EE_Registry::instance()->load_helper('MSG_Template');
174
-		if ( EEH_MSG_Template::is_mt_active('newsletter') ) {
174
+		if (EEH_MSG_Template::is_mt_active('newsletter')) {
175 175
 			//enqueue newsletter js
176
-			wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE );
177
-			wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION );
176
+			wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE);
177
+			wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION);
178 178
 			//hook in buttons for newsletter message type trigger.
179
-			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 );
179
+			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10);
180 180
 		}
181 181
 	}
182 182
 
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
 
189 189
 		//scripts
190 190
 		global $is_IE;
191
-		if ( $is_IE ) {
192
-			wp_enqueue_script( 'excanvas' );
191
+		if ($is_IE) {
192
+			wp_enqueue_script('excanvas');
193 193
 		}
194 194
 
195
-		wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL  . 'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE );
196
-		wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL . 'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE );
195
+		wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE);
196
+		wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE);
197 197
 	}
198 198
 
199 199
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 				'slug' => 'all',
225 225
 				'label' => __('All', 'event_espresso'),
226 226
 				'count' => 0,
227
-				'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array(
227
+				'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array(
228 228
 					'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'),
229 229
 					//'trash_registrations' => __('Trash Registrations', 'event_espresso')
230 230
 					)
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 				'slug' => 'all',
243 243
 				'label' => __('All', 'event_espresso'),
244 244
 				'count' => 0,
245
-				'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') )
245
+				'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso'))
246 246
 				),
247 247
 			);
248 248
 	}
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function get_newsletter_form_content() {
260 260
 		//do a nonce check cause we're not coming in from an normal route here.
261
-		$nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : '';
261
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : '';
262 262
 		$nonce_ref = 'get_newsletter_form_content_nonce';
263 263
 
264
-		$this->_verify_nonce( $nonce, $nonce_ref );
264
+		$this->_verify_nonce($nonce, $nonce_ref);
265 265
 		//let's get the mtp for the incoming MTP_ ID
266
-		if ( !isset( $this->_req_data['GRP_ID'] ) ) {
267
-			EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
266
+		if ( ! isset($this->_req_data['GRP_ID'])) {
267
+			EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
268 268
 			$this->_template_args['success'] = FALSE;
269 269
 			$this->_template_args['error'] = TRUE;
270 270
 			$this->_return_json();
271 271
 		}
272
-		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] );
273
-		if ( ! $MTPG instanceof EE_Message_Template_Group ) {
274
-			EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__  );
272
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
273
+		if ( ! $MTPG instanceof EE_Message_Template_Group) {
274
+			EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__);
275 275
 			$this->_template_args['success'] = FALSE;
276 276
 			$this->_template_args['error'] = TRUE;
277 277
 			$this->_return_json();
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 		$MTPs = $MTPG->context_templates();
281 281
 		$MTPs = $MTPs['attendee'];
282 282
 		$template_fields = array();
283
-		foreach ( $MTPs as $MTP ) {
283
+		foreach ($MTPs as $MTP) {
284 284
 			$field = $MTP->get('MTP_template_field');
285
-			if ( $field == 'content'  ) {
285
+			if ($field == 'content') {
286 286
 				$content = $MTP->get('MTP_content');
287
-				if ( !empty( $content['newsletter_content'] ) ) {
287
+				if ( ! empty($content['newsletter_content'])) {
288 288
 					$template_fields['newsletter_content'] = $content['newsletter_content'];
289 289
 					}
290 290
 				continue;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		$this->_template_args['data'] = array(
298 298
 			'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '',
299 299
 			'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '',
300
-			'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : ''
300
+			'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : ''
301 301
 			);
302 302
 		$this->_return_json();
303 303
 	}
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 	 * @param EE_Admin_List_Table $list_table
314 314
 	 * @return string html string for extra buttons
315 315
 	 */
316
-	public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) {
317
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) {
316
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) {
317
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) {
318 318
 			return '';
319 319
 		}
320 320
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 			'event_registrations',
324 324
 			'default'
325 325
 			);
326
-		if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to )  ) {
327
-			if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) {
326
+		if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
327
+			if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) {
328 328
 				echo '';
329 329
 			} else {
330
-				$button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' );
331
-				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>';
332
-				add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') );
330
+				$button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>');
331
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>';
332
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
333 333
 			}
334 334
 		}
335 335
 	}
@@ -341,38 +341,38 @@  discard block
 block discarded – undo
341 341
 		$list_table = $this->_list_table_object;
342 342
 		$codes = array();
343 343
 		//need to templates for the newsletter message type for the template selector.
344
-		$values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 );
345
-		$mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) );
346
-		foreach ( $mtps as $mtp ) {
344
+		$values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0);
345
+		$mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email')));
346
+		foreach ($mtps as $mtp) {
347 347
 			$name = $mtp->name();
348 348
 			$values[] = array(
349
-				'text' => empty( $name ) ? __('Global', 'event_espresso') : $name,
349
+				'text' => empty($name) ? __('Global', 'event_espresso') : $name,
350 350
 				'id' => $mtp->ID()
351 351
 				);
352 352
 		}
353 353
 
354 354
 		//need to get a list of shortcodes that are available for the newsletter message type.
355 355
 		EE_Registry::instance()->load_helper('MSG_Template');
356
-		$shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE );
357
-		foreach ( $shortcodes as $field => $shortcode_array ) {
358
-			$codes[$field] = implode(', ', array_keys($shortcode_array ) );
356
+		$shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE);
357
+		foreach ($shortcodes as $field => $shortcode_array) {
358
+			$codes[$field] = implode(', ', array_keys($shortcode_array));
359 359
 		}
360 360
 
361 361
 		$shortcodes = $codes;
362 362
 
363
-		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
363
+		$form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';
364 364
 		$form_template_args = array(
365 365
 			'form_action' => admin_url('admin.php?page=espresso_registrations'),
366 366
 			'form_route' => 'newsletter_selected_send',
367 367
 			'form_nonce_name' => 'newsletter_selected_send_nonce',
368
-			'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ),
368
+			'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'),
369 369
 			'redirect_back_to' => $this->_req_action,
370
-			'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'),
371
-			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ),
370
+			'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'),
371
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
372 372
 			'shortcodes' => $shortcodes,
373 373
 			'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration'
374 374
 			);
375
-		EEH_Template::display_template( $form_template, $form_template_args );
375
+		EEH_Template::display_template($form_template, $form_template_args);
376 376
 	}
377 377
 
378 378
 
@@ -387,35 +387,35 @@  discard block
 block discarded – undo
387 387
 	protected function _newsletter_selected_send() {
388 388
 		$success = TRUE;
389 389
 		//first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
390
-		if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) {
391
-			EE_Error::add_error( __('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
390
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
391
+			EE_Error::add_error(__('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
392 392
 			$success = FALSE;
393 393
 		}
394 394
 
395
-		if ( $success ) {
395
+		if ($success) {
396 396
 			//update Message template in case there are any changes
397
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['newsletter_mtp_selected'] );
397
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['newsletter_mtp_selected']);
398 398
 			$MTPs = $MTPG instanceof EE_Message_Template_Group ? $MTPG->context_templates() : array();
399
-			if ( empty( $MTPs ) ) {
400
-				EE_Error::add_error( __('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
399
+			if (empty($MTPs)) {
400
+				EE_Error::add_error(__('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
401 401
 				$success = FALSE;
402 402
 			}
403 403
 
404 404
 			//let's just update the specific fields
405
-			foreach ( $MTPs['attendee'] as $MTP ) {
405
+			foreach ($MTPs['attendee'] as $MTP) {
406 406
 				$field = $MTP->get('MTP_template_field');
407 407
 				$content = $MTP->get('MTP_content');
408 408
 				$new_content = $content;
409
-				switch( $field ) {
409
+				switch ($field) {
410 410
 					case 'from' :
411
-						$new_content = !empty( $this->_req_data['batch_message']['from'] ) ? $this->_req_data['batch_message']['from'] : $content;
411
+						$new_content = ! empty($this->_req_data['batch_message']['from']) ? $this->_req_data['batch_message']['from'] : $content;
412 412
 						break;
413 413
 					case 'subject' :
414
-						$new_content = !empty( $this->_req_data['batch_message']['subject'] ) ? $this->_req_data['batch_message']['subject'] : $content;
414
+						$new_content = ! empty($this->_req_data['batch_message']['subject']) ? $this->_req_data['batch_message']['subject'] : $content;
415 415
 						break;
416 416
 					case 'content' :
417 417
 						$new_content = $content;
418
-						$new_content['newsletter_content'] = !empty( $this->_req_data['batch_message']['content'] ) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content'];
418
+						$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content'];
419 419
 						break;
420 420
 					default :
421 421
 						continue;
@@ -426,20 +426,20 @@  discard block
 block discarded – undo
426 426
 			}
427 427
 
428 428
 			//great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
429
-			$id_type = !empty( $this->_req_data['batch_message']['id_type'] ) ? $this->_req_data['batch_message']['id_type'] : 'registration';
429
+			$id_type = ! empty($this->_req_data['batch_message']['id_type']) ? $this->_req_data['batch_message']['id_type'] : 'registration';
430 430
 
431 431
 			//id_type will affect how we assemble the ids.
432
-			$ids = !empty( $this->_req_data['batch_message']['ids'] ) ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) : array();
432
+			$ids = ! empty($this->_req_data['batch_message']['ids']) ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) : array();
433 433
 
434
-			$contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) );
434
+			$contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
435 435
 
436 436
 			//we do _action because ALL triggers are handled in EED_Messages.
437
-			do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID() );
437
+			do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID());
438 438
 		}
439 439
 		$query_args = array(
440
-			'action' => !empty( $this->_req_data['redirect_back_to'] ) ? $this->_req_data['redirect_back_to'] : 'default'
440
+			'action' => ! empty($this->_req_data['redirect_back_to']) ? $this->_req_data['redirect_back_to'] : 'default'
441 441
 			);
442
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
442
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
443 443
 	}
444 444
 
445 445
 
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
 	*/
453 453
 	protected function _registration_reports() {
454 454
 
455
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
455
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
456 456
 
457 457
 		$page_args = array();
458 458
 
459
-		$page_args['admin_reports'][] = $this->_registrations_per_day_report( '-1 month' );  //  option: '-1 week', '-2 weeks' defaults to '-1 month'
460
-		$page_args['admin_reports'][] = $this->_get_registrations_per_event_report( '-1 month' ); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
459
+		$page_args['admin_reports'][] = $this->_registrations_per_day_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
460
+		$page_args['admin_reports'][] = $this->_get_registrations_per_event_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
461 461
 //		$page_args['admin_reports'][] = 'chart1';
462 462
 
463
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
464
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE );
463
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
464
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE);
465 465
 
466 466
 //		EEH_Debug_Tools::printr( $page_args, '$page_args' );
467 467
 
@@ -480,36 +480,36 @@  discard block
 block discarded – undo
480 480
 	*		@access private
481 481
 	*		@return void
482 482
 	*/
483
-	private function _registrations_per_day_report( $period = '-1 month' ) {
483
+	private function _registrations_per_day_report($period = '-1 month') {
484 484
 
485 485
 		$report_ID = 'reg-admin-registrations-per-day-report-dv';
486 486
 		$report_JS = 'espresso_reg_admin_regs_per_day';
487 487
 
488
-		wp_enqueue_script( $report_JS );
488
+		wp_enqueue_script($report_JS);
489 489
 
490 490
 		$REG = EEM_Registration::instance();
491 491
 
492
-		$results = $REG->get_registrations_per_day_report( $period );
492
+		$results = $REG->get_registrations_per_day_report($period);
493 493
 
494 494
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_day' );
495 495
 		$regs = array();
496
-		$xmin = date( 'Y-m-d', strtotime( '+1 year' ));
496
+		$xmin = date('Y-m-d', strtotime('+1 year'));
497 497
 		$xmax = 0;
498 498
 		$ymax = 0;
499 499
 		$results = (array) $results;
500
-		foreach ( $results as $result ) {
501
-			$regs[] = array( $result->regDate, (int)$result->total );
502
-			$xmin = strtotime( $result->regDate ) < strtotime( $xmin ) ? $result->regDate : $xmin;
503
-			$xmax = strtotime( $result->regDate ) > strtotime( $xmax ) ? $result->regDate : $xmax;
500
+		foreach ($results as $result) {
501
+			$regs[] = array($result->regDate, (int) $result->total);
502
+			$xmin = strtotime($result->regDate) < strtotime($xmin) ? $result->regDate : $xmin;
503
+			$xmax = strtotime($result->regDate) > strtotime($xmax) ? $result->regDate : $xmax;
504 504
 			$ymax = $result->total > $ymax ? $result->total : $ymax;
505 505
 		}
506 506
 
507
-		$xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' ));
508
-		$xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' ));
507
+		$xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day'));
508
+		$xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day'));
509 509
 		// calculate # days between our min and max dates
510
-		$span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1;
510
+		$span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1;
511 511
 
512
-		$report_title = __( 'Total Registrations per Day', 'event_espresso' );
512
+		$report_title = __('Total Registrations per Day', 'event_espresso');
513 513
 
514 514
 		$report_params = array(
515 515
 				'title' 	=> $report_title,
@@ -520,9 +520,9 @@  discard block
 block discarded – undo
520 520
 				'ymax' 	=> ceil($ymax * 1.25),
521 521
 				'span' 	=> $span,
522 522
 				'width'	=> ceil(900 / $span),
523
-				'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title )
523
+				'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title)
524 524
 			);
525
-		wp_localize_script( $report_JS, 'regPerDay', $report_params );
525
+		wp_localize_script($report_JS, 'regPerDay', $report_params);
526 526
 
527 527
 		return $report_ID;
528 528
 	}
@@ -537,29 +537,29 @@  discard block
 block discarded – undo
537 537
 	*		@access private
538 538
 	*		@return void
539 539
 	*/
540
-	private function _get_registrations_per_event_report( $period = '-1 month' ) {
540
+	private function _get_registrations_per_event_report($period = '-1 month') {
541 541
 
542 542
 		$report_ID = 'reg-admin-registrations-per-event-report-dv';
543 543
 		$report_JS = 'espresso_reg_admin_regs_per_event';
544 544
 
545
-		wp_enqueue_script( $report_JS );
545
+		wp_enqueue_script($report_JS);
546 546
 
547
-		require_once ( EE_MODELS . 'EEM_Registration.model.php' );
547
+		require_once (EE_MODELS.'EEM_Registration.model.php');
548 548
 		$REG = EEM_Registration::instance();
549 549
 
550
-		$results = $REG->get_registrations_per_event_report( $period );
550
+		$results = $REG->get_registrations_per_event_report($period);
551 551
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_event' );
552 552
 		$regs = array();
553 553
 		$ymax = 0;
554 554
 		$results = (array) $results;
555
-		foreach ( $results as $result ) {
556
-			$regs[] = array( wp_trim_words( $result->event_name, 4, '...' ), (int)$result->total );
555
+		foreach ($results as $result) {
556
+			$regs[] = array(wp_trim_words($result->event_name, 4, '...'), (int) $result->total);
557 557
 			$ymax = $result->total > $ymax ? $result->total : $ymax;
558 558
 		}
559 559
 
560 560
 		$span = $period == 'week' ? 9 : 33;
561 561
 
562
-		$report_title = __( 'Total Registrations per Event', 'event_espresso' );
562
+		$report_title = __('Total Registrations per Event', 'event_espresso');
563 563
 
564 564
 		$report_params = array(
565 565
 			'title' 	=> $report_title,
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
 			'ymax' 	=> ceil($ymax * 1.25),
569 569
 			'span' 	=> $span,
570 570
 			'width'	=> ceil(900 / $span),
571
-			'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title )
571
+			'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title)
572 572
 		);
573
-		wp_localize_script( $report_JS, 'regPerEvent', $report_params );
573
+		wp_localize_script($report_JS, 'regPerEvent', $report_params);
574 574
 
575 575
 		return $report_ID;
576 576
 	}
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @return void
585 585
 	 */
586 586
 	protected function _registration_checkin_list_table() {
587
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
588
-		$reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null;
587
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
588
+		$reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null;
589 589
 		$reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
590 590
 		$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2');
591 591
 
@@ -599,15 +599,15 @@  discard block
 block discarded – undo
599 599
 				'desc' => __('This indicates the attendee has been checked out', 'event_espresso')
600 600
 				)
601 601
 			);
602
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
602
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
603 603
 
604 604
 
605
-		$dtt_id = isset(  $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
606
-		$go_back_url = !empty( $reg_id )  ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : '';
605
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
606
+		$go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : '';
607 607
 
608
-		$this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : '';
609
-		$this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';
610
-		$this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
608
+		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : '';
609
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : '';
610
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';
611 611
 
612 612
 		$this->display_admin_list_table_page_with_no_sidebar();
613 613
 	}
@@ -620,24 +620,24 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	public function toggle_checkin_status() {
622 622
 		//first make sure we have the necessary data
623
-		if ( !isset( $this->_req_data['_regid'] ) ) {
624
-			EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
623
+		if ( ! isset($this->_req_data['_regid'])) {
624
+			EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
625 625
 			$this->_template_args['success'] = FALSE;
626 626
 			$this->_template_args['error'] = TRUE;
627 627
 			$this->_return_json();
628 628
 		};
629 629
 
630 630
 		//do a nonce check cause we're not coming in from an normal route here.
631
-		$nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : '';
631
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : '';
632 632
 		$nonce_ref = 'checkin_nonce';
633 633
 
634
-		$this->_verify_nonce( $nonce, $nonce_ref );
634
+		$this->_verify_nonce($nonce, $nonce_ref);
635 635
 
636 636
 		//beautiful! Made it this far so let's get the status.
637 637
 		$new_status = $this->_toggle_checkin_status();
638 638
 
639 639
 		//setup new class to return via ajax
640
-		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status;
640
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status;
641 641
 		$this->_template_args['success'] = TRUE;
642 642
 		$this->_return_json();
643 643
 	}
@@ -657,32 +657,32 @@  discard block
 block discarded – undo
657 657
 		//first let's get the query args out of the way for the redirect
658 658
 		$query_args = array(
659 659
 			'action' => 'event_registrations',
660
-			'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL,
661
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL
660
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL,
661
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL
662 662
 			);
663 663
 		$new_status = FALSE;
664 664
 
665 665
 		// bulk action check in toggle
666
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
666
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
667 667
 			// cycle thru checkboxes
668
-			while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) {
669
-				$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
668
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
669
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
670 670
 				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
671 671
 			}
672 672
 
673
-		} elseif ( isset( $this->_req_data['_regid'] ) ) {
673
+		} elseif (isset($this->_req_data['_regid'])) {
674 674
 			//coming from ajax request
675
-			$DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL;
675
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL;
676 676
 			$query_args['DTT_ID'] = $DTT_ID;
677 677
 			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
678 678
 		} else {
679
-			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
679
+			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
680 680
 		}
681 681
 
682
-		if ( defined('DOING_AJAX' ) )
682
+		if (defined('DOING_AJAX'))
683 683
 			return $new_status;
684 684
 
685
-		$this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );
685
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
686 686
 
687 687
 	}
688 688
 
@@ -698,11 +698,11 @@  discard block
 block discarded – undo
698 698
 	 */
699 699
 	private function _toggle_checkin($REG_ID, $DTT_ID) {
700 700
 		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
701
-		$new_status = $REG->toggle_checkin_status( $DTT_ID );
702
-		if ( $new_status !== FALSE ) {
703
-			EE_Error::add_success($REG->get_checkin_msg($DTT_ID) );
701
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
702
+		if ($new_status !== FALSE) {
703
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
704 704
 		} else {
705
-			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ );
705
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__);
706 706
 			$new_status = FALSE;
707 707
 		}
708 708
 		return $new_status;
@@ -718,28 +718,28 @@  discard block
 block discarded – undo
718 718
 	protected function _delete_checkin_rows() {
719 719
 		$query_args = array(
720 720
 			'action' => 'registration_checkins',
721
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
722
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
721
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
722
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
723 723
 			);
724
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
725
-			while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
724
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
725
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
726 726
 				$errors = 0;
727
-				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) {
727
+				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
728 728
 					$errors++;
729 729
 				}
730 730
 			}
731 731
 		} else {
732
-			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
733
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
732
+			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
733
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
734 734
 		}
735 735
 
736
-		if ( $errors > 0 ) {
737
-			EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ );
736
+		if ($errors > 0) {
737
+			EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__);
738 738
 		} else {
739
-			EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') );
739
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
740 740
 		}
741 741
 
742
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
742
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
743 743
 	}
744 744
 
745 745
 
@@ -751,20 +751,20 @@  discard block
 block discarded – undo
751 751
 	protected function _delete_checkin_row() {
752 752
 		$query_args = array(
753 753
 			'action' => 'registration_checkins',
754
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
755
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
754
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
755
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
756 756
 			);
757 757
 
758
-		if ( !empty( $this->_req_data['CHK_ID'] ) ) {
759
-			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) {
760
-				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
758
+		if ( ! empty($this->_req_data['CHK_ID'])) {
759
+			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
760
+				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
761 761
 			} else {
762
-				EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') );
762
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
763 763
 			}
764 764
 		} else {
765
-			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
765
+			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
766 766
 		}
767
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
767
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
768 768
 	}
769 769
 
770 770
 
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
 	*		@return void
778 778
 	*/
779 779
 	protected function _event_registrations_list_table() {
780
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
781
-		$this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
780
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
781
+		$this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
782 782
 
783 783
 		$legend_items = array(
784 784
 			'star-icon' => array(
@@ -802,31 +802,31 @@  discard block
 block discarded – undo
802 802
 				'desc' => __('View All Check-in Records for this Registrant', 'event_espresso')
803 803
 				),
804 804
 			'approved_status' => array(
805
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
806
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
805
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
806
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
807 807
 				),
808 808
             'cancelled_status' => array(
809
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
810
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
809
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
810
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
811 811
 				),
812 812
             'declined_status' => array(
813
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
814
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
813
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
814
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
815 815
 				),
816 816
 			'not_approved' => array(
817
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
818
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
817
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
818
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
819 819
 				),
820 820
 			'pending_status' => array(
821
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
822
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
821
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
822
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
823 823
 				)/**/
824 824
 			);
825
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
825
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
826 826
 
827
-		$event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;
828
-		$this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : '';
829
-		$this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : '';
827
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
828
+		$this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : '';
829
+		$this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : '';
830 830
 
831 831
 		$this->display_admin_list_table_page_with_no_sidebar();
832 832
 	}
@@ -840,15 +840,15 @@  discard block
 block discarded – undo
840 840
 	*		@access public
841 841
 	*		@return array
842 842
 	*/
843
-	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) {
843
+	public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') {
844 844
 
845
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
846
-		require_once(EE_MODELS . 'EEM_Attendee.model.php');
845
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
846
+		require_once(EE_MODELS.'EEM_Attendee.model.php');
847 847
 		//$ATT_MDL = EEM_Attendee::instance();
848 848
 
849
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
850
-		$CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE;
851
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
849
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
850
+		$CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE;
851
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
852 852
 
853 853
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
854 854
 
@@ -861,92 +861,92 @@  discard block
 block discarded – undo
861 861
 //				$orderby = 'reg.REG_final_price';
862 862
 		}
863 863
 
864
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
864
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
865 865
 
866
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
867
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
866
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
867
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
868 868
 
869 869
 
870
-		$offset = ($current_page-1)*$per_page;
871
-		$limit = $count ? NULL : array( $offset, $per_page );
872
-		$query_params = array(array('Event.status'=>array('IN',  array_keys(EEM_Event::instance()->get_status_array()))));
873
-		if ($EVT_ID){
874
-			$query_params[0]['EVT_ID']=$EVT_ID;
870
+		$offset = ($current_page - 1) * $per_page;
871
+		$limit = $count ? NULL : array($offset, $per_page);
872
+		$query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array()))));
873
+		if ($EVT_ID) {
874
+			$query_params[0]['EVT_ID'] = $EVT_ID;
875 875
 		}
876
-		if($CAT_ID){
876
+		if ($CAT_ID) {
877 877
 			throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?");
878 878
 		}
879 879
 
880 880
 		//if DTT is included we do multiple datetimes.
881
-		if ( $DTT_ID ) {
881
+		if ($DTT_ID) {
882 882
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
883 883
 			$query_params['default_where_conditions'] = 'this_model_only';
884 884
 		}
885 885
 
886
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
886
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
887 887
 
888
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
888
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
889 889
 
890
-		if($trash){
891
-			$query_params[0]['Attendee.status']=  EEM_CPT_Base::post_status_trashed;
890
+		if ($trash) {
891
+			$query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed;
892 892
 		}
893 893
 
894
-		if ( isset( $this->_req_data['s'] ) ) {
895
-			$sstr = '%' . $this->_req_data['s'] . '%';
894
+		if (isset($this->_req_data['s'])) {
895
+			$sstr = '%'.$this->_req_data['s'].'%';
896 896
 			$query_params[0]['OR'] = array(
897
-				'Event.EVT_name' => array( 'LIKE', $sstr),
898
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
899
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
900
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
901
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
902
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
903
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
904
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
905
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
906
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
907
-				'REG_final_price' => array( 'LIKE', $sstr ),
908
-				'REG_code' => array( 'LIKE', $sstr ),
909
-				'REG_count' => array( 'LIKE' , $sstr ),
910
-				'REG_group_size' => array( 'LIKE' , $sstr ),
911
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
912
-				'Ticket.TKT_description' => array( 'LIKE', $sstr )
897
+				'Event.EVT_name' => array('LIKE', $sstr),
898
+				'Event.EVT_desc' => array('LIKE', $sstr),
899
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
900
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
901
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
902
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
903
+				'Attendee.ATT_email' => array('LIKE', $sstr),
904
+				'Attendee.ATT_address' => array('LIKE', $sstr),
905
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
906
+				'Attendee.ATT_city' => array('LIKE', $sstr),
907
+				'REG_final_price' => array('LIKE', $sstr),
908
+				'REG_code' => array('LIKE', $sstr),
909
+				'REG_count' => array('LIKE', $sstr),
910
+				'REG_group_size' => array('LIKE', $sstr),
911
+				'Ticket.TKT_name' => array('LIKE', $sstr),
912
+				'Ticket.TKT_description' => array('LIKE', $sstr)
913 913
 				);
914 914
 		}
915 915
 
916 916
 		$query_params['order_by'][$orderby] = $sort;
917 917
 		$query_params['limit'] = $limit;
918
-		$query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
919
-		if($count){
918
+		$query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
919
+		if ($count) {
920 920
 			$registrations = EEM_Registration::instance()->count(array($query_params[0]));
921
-		}else{
921
+		} else {
922 922
 			$registrations = EEM_Registration::instance()->get_all($query_params);
923 923
 
924 924
 
925 925
 	//		$registrations = EEM_Registration::instance();
926 926
 	//		$all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output );
927
-			if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) {
927
+			if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) {
928 928
 				//EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0]  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
929 929
 				// name
930 930
 				$first_registration = $registrations[0];
931 931
 				$event_obj = $first_registration->event_obj();
932
-				if($event_obj){
932
+				if ($event_obj) {
933 933
 					$event_name = $first_registration->event_obj()->name();
934
-					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
934
+					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
935 935
 					// edit event link
936
-					if ( $event_name != '' ) {
937
-						$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
938
-						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
939
-						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
936
+					if ($event_name != '') {
937
+						$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
938
+						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
939
+						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
940 940
 					}
941 941
 
942
-					$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
943
-					$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
942
+					$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
943
+					$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
944 944
 
945 945
 					$this->_template_args['before_admin_page_content'] = '
946 946
 				<div id="admin-page-header">
947
-					<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
948
-					<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
949
-					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
947
+					<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
948
+					<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
949
+					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
950 950
 				</div>
951 951
 				';
952 952
 				}
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 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
@@ -679,8 +680,9 @@  discard block
 block discarded – undo
679 680
 			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
680 681
 		}
681 682
 
682
-		if ( defined('DOING_AJAX' ) )
683
-			return $new_status;
683
+		if ( defined('DOING_AJAX' ) ) {
684
+					return $new_status;
685
+		}
684 686
 
685 687
 		$this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );
686 688
 
@@ -918,7 +920,7 @@  discard block
 block discarded – undo
918 920
 		$query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
919 921
 		if($count){
920 922
 			$registrations = EEM_Registration::instance()->count(array($query_params[0]));
921
-		}else{
923
+		} else{
922 924
 			$registrations = EEM_Registration::instance()->get_all($query_params);
923 925
 
924 926
 
Please login to merge, or discard this patch.
admin/extend/transactions/Extend_Transactions_Admin_Page.core.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @access private
137 137
 	 * @param string $period
138
-	 * @return int
138
+	 * @return string
139 139
 	 */
140 140
 	private function _revenue_per_day_report( $period = '-1 month' ) {
141 141
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @access private
195 195
 	 * @param string $period
196
-	 * @return int
196
+	 * @return string
197 197
 	 */
198 198
 	private function _revenue_per_event_report( $period = '-1 month' ) {
199 199
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,10 +105,10 @@
 block discarded – undo
105 105
 	/**
106 106
 	 * _transaction_reports
107 107
 	 * 	generates Business Reports regarding Transactions
108
-	*
108
+	 *
109 109
 	 * @access protected
110
-	*	@return void
111
-	*/
110
+	 *	@return void
111
+	 */
112 112
 	protected function _transaction_reports() {
113 113
 
114 114
 		$page_args = array();
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 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
 /**
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	 * @param bool $routing
36 36
 	 * @return \Extend_Transactions_Admin_Page
37 37
 	 */
38
-	public function __construct( $routing = TRUE ) {
39
-		parent::__construct( $routing );
40
-		define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/');
41
-		define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/');
42
-		define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/');
38
+	public function __construct($routing = TRUE) {
39
+		parent::__construct($routing);
40
+		define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/');
41
+		define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/');
42
+		define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/');
43 43
 	}
44 44
 
45 45
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return void
52 52
 	 */
53 53
 	protected function _extend_page_config() {
54
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions';
54
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions';
55 55
 
56 56
 		$new_page_routes = array(
57 57
 			'reports' => array(
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			)
61 61
 		);
62 62
 
63
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
63
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
64 64
 
65 65
 		$new_page_config = array(
66 66
 			'reports' => array(
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 						'filename' => 'transactions_reports'
75 75
 					)
76 76
 				),
77
-				'help_tour' => array( 'Transaction_Reports_Help_Tour' ),
77
+				'help_tour' => array('Transaction_Reports_Help_Tour'),
78 78
 				'require_nonce' => FALSE
79 79
 			)
80 80
 		);
81
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
81
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
82 82
 	}
83 83
 
84 84
 
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 		wp_enqueue_style('jquery-jqplot-css');
95 95
 		//scripts
96 96
 		global $is_IE;
97
-		if ( $is_IE ) {
98
-			wp_enqueue_script( 'excanvas' );
97
+		if ($is_IE) {
98
+			wp_enqueue_script('excanvas');
99 99
 		}
100 100
 		wp_enqueue_script('jqplot-all');
101 101
 	}
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$page_args = array();
115 115
 
116
-		$page_args['admin_reports'][] = $this->_revenue_per_day_report( '-1 month' );  //  option: '-1 week', '-2 weeks' defaults to '-1 month'
117
-		$page_args['admin_reports'][] = $this->_revenue_per_event_report( '-1 month' ); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
116
+		$page_args['admin_reports'][] = $this->_revenue_per_day_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
117
+		$page_args['admin_reports'][] = $this->_revenue_per_event_report('-1 month'); //  option: '-1 week', '-2 weeks' defaults to '-1 month'
118 118
 //		$page_args['admin_reports'][] = 'chart1';
119 119
 
120
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
120
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
121 121
 		$this->_admin_page_title = __('Transactions', 'event_espresso');
122
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE );
122
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE);
123 123
 
124 124
 
125 125
 		// the final template wrapper
@@ -137,37 +137,37 @@  discard block
 block discarded – undo
137 137
 	 * @param string $period
138 138
 	 * @return int
139 139
 	 */
140
-	private function _revenue_per_day_report( $period = '-1 month' ) {
140
+	private function _revenue_per_day_report($period = '-1 month') {
141 141
 
142 142
 		$report_ID = 'txn-admin-revenue-per-day-report-dv';
143 143
 		$report_JS = 'espresso_txn_admin_revenue_per_day';
144 144
 
145
-		wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE);
145
+		wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE);
146 146
 
147 147
 		$TXN = EEM_Transaction::instance();
148 148
 
149
-		$results = $TXN->get_revenue_per_day_report( $period );
149
+		$results = $TXN->get_revenue_per_day_report($period);
150 150
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_day' );
151 151
 		$revenue = array();
152
-		$xmin = date( 'Y-m-d', strtotime( '+1 year' ));
152
+		$xmin = date('Y-m-d', strtotime('+1 year'));
153 153
 		$xmax = 0;
154 154
 		$ymax = 0;
155 155
 
156 156
 		$results = (array) $results;
157 157
 
158
-		foreach ( $results as $result ) {
159
-			$revenue[] = array( $result->txnDate, (float)$result->revenue );
160
-			$xmin = strtotime( $result->txnDate ) < strtotime( $xmin ) ? $result->txnDate : $xmin;
161
-			$xmax = strtotime( $result->txnDate ) > strtotime( $xmax ) ? $result->txnDate : $xmax;
158
+		foreach ($results as $result) {
159
+			$revenue[] = array($result->txnDate, (float) $result->revenue);
160
+			$xmin = strtotime($result->txnDate) < strtotime($xmin) ? $result->txnDate : $xmin;
161
+			$xmax = strtotime($result->txnDate) > strtotime($xmax) ? $result->txnDate : $xmax;
162 162
 			$ymax = $result->revenue > $ymax ? $result->revenue : $ymax;
163 163
 		}
164 164
 
165
-		$xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' ));
166
-		$xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' ));
165
+		$xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day'));
166
+		$xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day'));
167 167
 		// calculate # days between our min and max dates
168
-		$span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1;
168
+		$span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1;
169 169
 
170
-		$report_title = __( 'Total Revenue per Day' );
170
+		$report_title = __('Total Revenue per Day');
171 171
 
172 172
 		$report_params = array(
173 173
 			'title' 		=> $report_title,
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 			'ymax' 		=> ceil($ymax * 1.25),
179 179
 			'span' 		=> $span,
180 180
 			'width'		=> ceil(900 / $span),
181
-			'noTxnMsg'	=> sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title )
181
+			'noTxnMsg'	=> sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title)
182 182
 		);
183
-		wp_localize_script( $report_JS, 'txnRevPerDay', $report_params );
183
+		wp_localize_script($report_JS, 'txnRevPerDay', $report_params);
184 184
 
185 185
 		return $report_ID;
186 186
 	}
@@ -195,29 +195,29 @@  discard block
 block discarded – undo
195 195
 	 * @param string $period
196 196
 	 * @return int
197 197
 	 */
198
-	private function _revenue_per_event_report( $period = '-1 month' ) {
198
+	private function _revenue_per_event_report($period = '-1 month') {
199 199
 
200 200
 		$report_ID = 'txn-admin-revenue-per-event-report-dv';
201 201
 		$report_JS = 'espresso_txn_admin_revenue_per_event';
202 202
 
203
-		wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE);
203
+		wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE);
204 204
 
205 205
 		$TXN = EEM_Transaction::instance();
206 206
 
207
-		$results = $TXN->get_revenue_per_event_report( $period );
207
+		$results = $TXN->get_revenue_per_event_report($period);
208 208
 
209 209
 		//EEH_Debug_Tools::printr( $results, '$registrations_per_event' );
210 210
 		$revenue = array();
211 211
 		$results = (array) $results;
212
-		foreach ( $results as $result ) {
213
-			$event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' ));
214
-			$event_name = wp_trim_words( $event_name, 5, '...' );
215
-			$revenue[] = array( $event_name, (float)$result->revenue );
212
+		foreach ($results as $result) {
213
+			$event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8'));
214
+			$event_name = wp_trim_words($event_name, 5, '...');
215
+			$revenue[] = array($event_name, (float) $result->revenue);
216 216
 		}
217 217
 
218 218
 		$span = $period == 'week' ? 9 : 33;
219 219
 
220
-		$report_title = __( 'Total Revenue per Event' );
220
+		$report_title = __('Total Revenue per Event');
221 221
 
222 222
 		$report_params = array(
223 223
 			'title' 		=> $report_title,
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 			'revenue'	=> $revenue,
226 226
 			'span' 		=> $span,
227 227
 			'width'		=> ceil(900 / $span),
228
-			'noTxnMsg'	=> sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title )
228
+			'noTxnMsg'	=> sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title)
229 229
 		);
230
-		wp_localize_script( $report_JS, 'revenuePerEvent', $report_params );
230
+		wp_localize_script($report_JS, 'revenuePerEvent', $report_params);
231 231
 
232 232
 		return $report_ID;
233 233
 	}
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.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 3 patches
Doc Comments   +19 added lines, -2 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
182 182
 	 * @param  EE_Event $evtobj The Event object we're attaching data to
183 183
 	 * @param  array    $data   The request data from the form
184
-	 * @return bool             success or fail
184
+	 * @return boolean|null             success or fail
185 185
 	 */
186 186
 	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
187 187
 		//first we need to start with datetimes cause they are the "root" items attached to events.
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
614 614
 	 * @param int|bool 		$base_price if FALSE then NOT doing a base price add.
615 615
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
616
-	 * @return  void
616
+	 * @return  EE_Ticket
617 617
 	 */
618 618
 	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
619 619
 
@@ -825,6 +825,9 @@  discard block
 block discarded – undo
825 825
 
826 826
 
827 827
 
828
+	/**
829
+	 * @param integer $dttrow
830
+	 */
828 831
 	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
829 832
 
830 833
 		$dtt_display_template_args = array(
@@ -848,6 +851,7 @@  discard block
 block discarded – undo
848 851
 	 *                               				object.
849 852
 	 * @param bool   $default  		         Whether a default row is being generated or not.
850 853
 	 * @param EE_Datetime[] $all_dtts             This is the array of all datetimes used in the editor.
854
+	 * @param EE_Datetime|null $dtt
851 855
 	 *
852 856
 	 * @return string Generated edit row.
853 857
 	 */
@@ -882,6 +886,10 @@  discard block
 block discarded – undo
882 886
 	}
883 887
 
884 888
 
889
+	/**
890
+	 * @param EE_Datetime|null $dtt
891
+	 * @param boolean $default
892
+	 */
885 893
 	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
886 894
 
887 895
 		$template_args = array(
@@ -1088,6 +1096,9 @@  discard block
 block discarded – undo
1088 1096
 
1089 1097
 
1090 1098
 
1099
+	/**
1100
+	 * @param integer $tktrow
1101
+	 */
1091 1102
 	protected function _get_tax_rows( $tktrow, $ticket ) {
1092 1103
 		$tax_rows = '';
1093 1104
 		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
@@ -1121,6 +1132,9 @@  discard block
 block discarded – undo
1121 1132
 
1122 1133
 
1123 1134
 
1135
+	/**
1136
+	 * @param boolean $default
1137
+	 */
1124 1138
 	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1125 1139
 		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1126 1140
 		$template_args = array(
@@ -1227,6 +1241,9 @@  discard block
 block discarded – undo
1227 1241
 
1228 1242
 
1229 1243
 
1244
+	/**
1245
+	 * @param boolean $default
1246
+	 */
1230 1247
 	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1231 1248
 		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1232 1249
 		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
Please login to merge, or discard this patch.
Braces   +30 added lines, -19 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
@@ -166,8 +167,9 @@  discard block
 block discarded – undo
166 167
 
167 168
 	public function caf_updates( $update_callbacks ) {
168 169
 		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
170
+			if ( $callback[1] == '_default_tickets_update' ) {
171
+							unset( $update_callbacks[$key] );
172
+			}
171 173
 		}
172 174
 
173 175
 		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
@@ -268,8 +270,9 @@  discard block
 block discarded – undo
268 270
 			$dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) );
269 271
 			foreach ( $dtts_to_delete as $id ) {
270 272
 				$id = absint( $id );
271
-				if ( empty( $id ) )
272
-					continue;
273
+				if ( empty( $id ) ) {
274
+									continue;
275
+				}
273 276
 
274 277
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
275 278
 
@@ -507,8 +510,9 @@  discard block
 block discarded – undo
507 510
 				}
508 511
 
509 512
 				//if we have a new_tkt... let's add to it as well
510
-				if ( !empty( $new_tkt ) )
511
-					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
513
+				if ( !empty( $new_tkt ) ) {
514
+									$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
515
+				}
512 516
 			}
513 517
 
514 518
 
@@ -518,8 +522,9 @@  discard block
 block discarded – undo
518 522
 			foreach ( $dtts_removed as $dttrow ) {
519 523
 				$dttrow = (int) $dttrow;
520 524
 				//its entirely possible that a datetime got deleted (instead of just removed from relationship.  So make sure we skip over this if the dtt isn't in the saved_dtts array)
521
-				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime )
522
-					continue;
525
+				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime ) {
526
+									continue;
527
+				}
523 528
 
524 529
 				$TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
525 530
 
@@ -529,8 +534,9 @@  discard block
 block discarded – undo
529 534
 					$saved_dtts[$dttrow]->save();
530 535
 				}
531 536
 
532
-				if ( !empty( $new_tkt ) )
533
-					$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
537
+				if ( !empty( $new_tkt ) ) {
538
+									$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
539
+				}
534 540
 			}
535 541
 
536 542
 
@@ -572,8 +578,9 @@  discard block
 block discarded – undo
572 578
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
573 579
 
574 580
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
575
-			if ( $tkt_to_remove->get('TKT_is_default') )
576
-				continue;
581
+			if ( $tkt_to_remove->get('TKT_is_default') ) {
582
+							continue;
583
+			}
577 584
 
578 585
 			//if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets.
579 586
 			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
@@ -634,13 +641,16 @@  discard block
 block discarded – undo
634 641
 		}
635 642
 
636 643
 		//possibly need to save tkt
637
-		if ( ! $ticket->ID() )
638
-			$ticket->save();
644
+		if ( ! $ticket->ID() ) {
645
+					$ticket->save();
646
+		}
639 647
 
640 648
 		foreach ( $prices as $row => $prc ) {
641 649
 			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
642
-			if ( empty($prt_id) )
643
-				continue; //prices MUST have a price type id.
650
+			if ( empty($prt_id) ) {
651
+							continue;
652
+			}
653
+			//prices MUST have a price type id.
644 654
 			$PRC_values = array(
645 655
 				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
646 656
 				'PRT_ID' => $prt_id,
@@ -784,8 +794,9 @@  discard block
 block discarded – undo
784 794
 				$datetime_tickets[$dttid][] = $tktrow;
785 795
 
786 796
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
787
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
788
-					$ticket_datetimes[$tktid][] = $dttrow;
797
+				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) {
798
+									$ticket_datetimes[$tktid][] = $dttrow;
799
+				}
789 800
 			}
790 801
 		}
791 802
 
Please login to merge, or discard this patch.
Spacing   +356 added lines, -356 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 		$this->_name = 'pricing';
55 55
 
56 56
 		//capability check
57
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
57
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
58 58
 			return;
59 59
 		}
60 60
 
61
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
61
+		EE_Registry::instance()->load_helper('DTT_Helper');
62 62
 
63 63
 		//if we were going to add our own metaboxes we'd use the below.
64 64
 		$this->_metaboxes = array(
65 65
 			0 => array(
66
-				'page_route' => array('edit','create_new'),
66
+				'page_route' => array('edit', 'create_new'),
67 67
 				'func' => 'pricing_metabox',
68 68
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
69 69
 				'priority' => 'high',
70 70
 				'context' => 'normal'
71 71
 				),
72 72
 
73
-			);/**/
73
+			); /**/
74 74
 
75 75
 		$this->_remove_metaboxes = array(
76 76
 			0 => array(
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
 		 *
90 90
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
91 91
 		 */
92
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
93 93
 				'date' => 'Y-m-d',
94 94
 				'time' => 'h:i a'
95 95
 			));
96 96
 
97 97
 		//validate
98
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
99
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
98
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
99
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
100 100
 
101 101
 		//validate format strings
102
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
103
-		if ( is_array( $format_validation ) ) {
104
-			$msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>';
105
-			foreach ( $format_validation as $error ) {
106
-				$msg .= '<li>' . $error . '</li>';
102
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
103
+		if (is_array($format_validation)) {
104
+			$msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
105
+			foreach ($format_validation as $error) {
106
+				$msg .= '<li>'.$error.'</li>';
107 107
 			}
108
-			$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
109
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
108
+			$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
109
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
110 110
 			$this->_date_format_strings = array(
111 111
 				'date' => 'Y-m-d',
112 112
 				'time' => 'h:i a'
@@ -117,60 +117,60 @@  discard block
 block discarded – undo
117 117
 		$this->_scripts_styles = array(
118 118
 			'registers' => array(
119 119
 				'ee-tickets-datetimes-css' => array(
120
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
120
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
121 121
 					'type' => 'css'
122 122
 					),
123 123
 				'ee-dtt-ticket-metabox' => array(
124
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
124
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
125 125
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
126 126
 					)
127 127
 				),
128 128
 			'deregisters' => array(
129
-				'event-editor-css' => array('type' => 'css' ),
129
+				'event-editor-css' => array('type' => 'css'),
130 130
 				'event-datetime-metabox' => array('type' => 'js')
131 131
 				),
132 132
 			'enqueues' => array(
133
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
134
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
133
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
134
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
135 135
 				),
136 136
 			'localize' => array(
137 137
 				'ee-dtt-ticket-metabox' => array(
138 138
 					'DTT_TRASH_BLOCK' => array(
139 139
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
140 140
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
141
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
141
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
142 142
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
143 143
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
144
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
144
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
145 145
 						),
146 146
 					'DTT_ERROR_MSG' => array(
147 147
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
148
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
148
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
149 149
 						),
150 150
 					'DTT_OVERSELL_WARNING' => array(
151 151
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
152 152
 						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')
153 153
 						),
154
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
155
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
154
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
155
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
156 156
 					)
157 157
 				)
158 158
 			);
159 159
 
160 160
 
161
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
162
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
161
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
162
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
163 163
 	}
164 164
 
165 165
 
166 166
 
167
-	public function caf_updates( $update_callbacks ) {
168
-		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
167
+	public function caf_updates($update_callbacks) {
168
+		foreach ($update_callbacks as $key => $callback) {
169
+			if ($callback[1] == '_default_tickets_update')
170
+				unset($update_callbacks[$key]);
171 171
 		}
172 172
 
173
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
173
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
174 174
 		return $update_callbacks;
175 175
 	}
176 176
 
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param  array    $data   The request data from the form
184 184
 	 * @return bool             success or fail
185 185
 	 */
186
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
186
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
187 187
 		//first we need to start with datetimes cause they are the "root" items attached to events.
188
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
188
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
189 189
 		//next tackle the tickets (and prices?)
190
-		$success = $this->_update_tkts( $evtobj, $saved_dtts, $data );
190
+		$success = $this->_update_tkts($evtobj, $saved_dtts, $data);
191 191
 	}
192 192
 
193 193
 
@@ -198,56 +198,56 @@  discard block
 block discarded – undo
198 198
 	 * @param  array    	$data    the request data from the form
199 199
 	 * @return EE_Datetime           array of EE_Datetime ids created/updated.
200 200
 	 */
201
-	protected function _update_dtts( $evt_obj, $data ) {
202
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
201
+	protected function _update_dtts($evt_obj, $data) {
202
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
203 203
 		$success = TRUE;
204 204
 
205
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
206
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
205
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
206
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
207 207
 			$datetime_values = array(
208
-				'DTT_ID' => !empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
209
-				'DTT_name' => !empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
210
-				'DTT_description' => !empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
208
+				'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
209
+				'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
210
+				'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
211 211
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
212 212
 				'DTT_EVT_end' => $dtt['DTT_EVT_end'],
213
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? INF : $dtt['DTT_reg_limit'],
214
-				'DTT_order' => !isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
213
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? INF : $dtt['DTT_reg_limit'],
214
+				'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
215 215
 				);
216 216
 
217 217
 			//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.
218 218
 
219
-			if ( !empty( $dtt['DTT_ID'] ) ) {
220
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
219
+			if ( ! empty($dtt['DTT_ID'])) {
220
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
221 221
 
222 222
 				//set date and time format according to what is set in this class.
223
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
224
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
223
+				$DTM->set_date_format($this->_date_format_strings['date']);
224
+				$DTM->set_time_format($this->_date_format_strings['time']);
225 225
 
226
-				foreach ( $datetime_values as $field => $value ) {
227
-					$DTM->set( $field, $value );
226
+				foreach ($datetime_values as $field => $value) {
227
+					$DTM->set($field, $value);
228 228
 				}
229 229
 
230 230
 				//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.
231 231
 				$saved_dtts[$DTM->ID()] = $DTM;
232 232
 
233 233
 			} else {
234
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
234
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
235 235
 
236 236
 				//reset date and times to match the format
237
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
238
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
239
-				foreach( $datetime_values as $field => $value ) {
240
-					$DTM->set( $field, $value );
237
+				$DTM->set_date_format($this->_date_format_strings['date']);
238
+				$DTM->set_time_format($this->_date_format_strings['time']);
239
+				foreach ($datetime_values as $field => $value) {
240
+					$DTM->set($field, $value);
241 241
 				}
242 242
 			}
243 243
 
244 244
 
245 245
 			$DTM->save();
246
-			$DTT = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
246
+			$DTT = $evt_obj->_add_relation_to($DTM, 'Datetime');
247 247
 
248 248
 			//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.
249
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
250
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
249
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
250
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
251 251
 				EE_Registry::instance()->load_helper('DTT_Helper');
252 252
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
253 253
 				$DTT->save();
@@ -257,30 +257,30 @@  discard block
 block discarded – undo
257 257
 			$saved_dtts[$DTT->ID()] = $DTT;
258 258
 			$saved_dtt_objs[$row] = $DTT;
259 259
 
260
-			$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.
260
+			$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.
261 261
 		}
262 262
 
263 263
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
264
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
264
+		$old_datetimes = explode(',', $data['datetime_IDs']);
265 265
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
266 266
 
267
-		if ( is_array( $old_datetimes ) ) {
268
-			$dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) );
269
-			foreach ( $dtts_to_delete as $id ) {
270
-				$id = absint( $id );
271
-				if ( empty( $id ) )
267
+		if (is_array($old_datetimes)) {
268
+			$dtts_to_delete = array_diff($old_datetimes, array_keys($saved_dtts));
269
+			foreach ($dtts_to_delete as $id) {
270
+				$id = absint($id);
271
+				if (empty($id))
272 272
 					continue;
273 273
 
274 274
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
275 275
 
276 276
 				//remove tkt relationships.
277 277
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
278
-				foreach ( $related_tickets as $tkt ) {
278
+				foreach ($related_tickets as $tkt) {
279 279
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
280 280
 				}
281 281
 
282 282
 
283
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
283
+				$evt_obj->_remove_relation_to($id, 'Datetime');
284 284
 			}
285 285
 		}
286 286
 
@@ -299,77 +299,77 @@  discard block
 block discarded – undo
299 299
 	 * @param  array            $data       incoming request data
300 300
 	 * @return EE_Ticket[]
301 301
 	 */
302
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
302
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
303 303
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
304 304
 		$data = stripslashes_deep($data);
305
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
305
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
306 306
 		$saved_tickets = $dtts_on_existing = array();
307
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
307
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
308 308
 
309 309
 		//load money helper
310
-		EE_Registry::instance()->load_helper( 'Money' );
310
+		EE_Registry::instance()->load_helper('Money');
311 311
 
312
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
312
+		foreach ($data['edit_tickets'] as $row => $tkt) {
313 313
 
314 314
 			$update_prices = $create_new_TKT = $ticket_sold = FALSE;
315 315
 			$new_default = $new_tkt = NULL;
316 316
 
317 317
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
318 318
 
319
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
320
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
319
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
320
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
321 321
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
322 322
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
323 323
 
324 324
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
325 325
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
326
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
326
+			$ticket_price = isset($tkt['TKT_price']) ?  round ((float) $tkt['TKT_price'], 3) : 0;
327 327
 
328 328
 			//note incoming base price needs converted from localized value.
329
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
329
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
330 330
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
331 331
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
332
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
332
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
333 333
 
334 334
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
335 335
 
336 336
 			$now = null;
337
-			if ( empty( $tkt['TKT_start_date'] ) ) {
337
+			if (empty($tkt['TKT_start_date'])) {
338 338
 				//lets' use now in the set timezone.
339
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
340
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
339
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
340
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
341 341
 			}
342 342
 
343
-			if ( empty( $tkt['TKT_end_date'] ) ) {
343
+			if (empty($tkt['TKT_end_date'])) {
344 344
 				/**
345 345
 				 * set the TKT_end_date to the first datetime attached to the ticket.
346 346
 				 */
347
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
348
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
347
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
348
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
349 349
 			}
350 350
 
351 351
 			$TKT_values = array(
352
-				'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
353
-				'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
354
-				'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
355
-				'TKT_description' => !empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
352
+				'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
353
+				'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
354
+				'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
355
+				'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
356 356
 				'TKT_start_date' => $tkt['TKT_start_date'],
357 357
 				'TKT_end_date' => $tkt['TKT_end_date'],
358
-				'TKT_qty' => empty( $tkt['TKT_qty'] ) ? INF : $tkt['TKT_qty'],
359
-				'TKT_uses' => empty( $tkt['TKT_uses'] ) ? INF : $tkt['TKT_uses'],
360
-				'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
361
-				'TKT_max' => empty( $tkt['TKT_max'] ) ? INF : $tkt['TKT_max'],
358
+				'TKT_qty' => empty($tkt['TKT_qty']) ? INF : $tkt['TKT_qty'],
359
+				'TKT_uses' => empty($tkt['TKT_uses']) ? INF : $tkt['TKT_uses'],
360
+				'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
361
+				'TKT_max' => empty($tkt['TKT_max']) ? INF : $tkt['TKT_max'],
362 362
 				'TKT_row' => $row,
363
-				'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
364
-				'TKT_taxable' => !empty( $tkt['TKT_taxable'] ) ? 1 : 0,
365
-				'TKT_required' => !empty( $tkt['TKT_required'] ) ? 1 : 0,
363
+				'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
364
+				'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0,
365
+				'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0,
366 366
 				'TKT_price' => $ticket_price
367 367
 				);
368 368
 
369 369
 
370 370
 
371 371
 			//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.
372
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
372
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
373 373
 				$TKT_values['TKT_ID'] = 0;
374 374
 				$TKT_values['TKT_is_default'] = 0;
375 375
 				$update_prices = TRUE;
@@ -379,28 +379,28 @@  discard block
 block discarded – undo
379 379
 			//we actually do our saves ahead 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.
380 380
 			//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.
381 381
 
382
-			if ( !empty( $TKT_values['TKT_ID'] ) ) {
383
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
382
+			if ( ! empty($TKT_values['TKT_ID'])) {
383
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
384 384
 
385 385
 				//set ticket formats
386
-				$ticket_sold = $TKT->count_related('Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
387
-				$TKT->set_date_format( $this->_date_format_strings['date'] );
388
-				$TKT->set_time_format( $this->_date_format_strings['time'] );
386
+				$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
387
+				$TKT->set_date_format($this->_date_format_strings['date']);
388
+				$TKT->set_time_format($this->_date_format_strings['time']);
389 389
 
390 390
 				//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.
391 391
 				$orig_price = $TKT->price();
392
-				$create_new_TKT = $ticket_sold && $ticket_price != $orig_price && !$TKT->get('TKT_deleted') ? TRUE : FALSE;
392
+				$create_new_TKT = $ticket_sold && $ticket_price != $orig_price && ! $TKT->get('TKT_deleted') ? TRUE : FALSE;
393 393
 
394 394
 				//set new values
395
-				foreach ( $TKT_values as $field => $value ) {
396
-					$TKT->set( $field, $value );
395
+				foreach ($TKT_values as $field => $value) {
396
+					$TKT->set($field, $value);
397 397
 				}
398 398
 
399 399
 				//make sure price is set if it hasn't been already
400
-				$TKT->set( 'TKT_price', $ticket_price );
400
+				$TKT->set('TKT_price', $ticket_price);
401 401
 
402 402
 				//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
403
-				if ( $create_new_TKT ) {
403
+				if ($create_new_TKT) {
404 404
 					//@TODO need to move this logic into its own method that just receives the ticket object (and other necessary info)
405 405
 					$new_tkt = clone($TKT);
406 406
 
@@ -410,26 +410,26 @@  discard block
 block discarded – undo
410 410
 					//TKT will get archived later b/c we are NOT adding it to the saved_tickets array.
411 411
 
412 412
 					//if existing $TKT has sold amount, then we need to adjust the qty for the new TKT to = the remaining available.
413
-					if ( $TKT->get('TKT_sold') > 0 ) {
413
+					if ($TKT->get('TKT_sold') > 0) {
414 414
 						$new_qty = $TKT->get('TKT_qty') - $TKT->get('TKT_sold');
415 415
 						$new_tkt->set_qty($new_qty);
416 416
 					}
417 417
 
418 418
 
419 419
 					//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.
420
-					$new_tkt->set( 'TKT_ID', 0 );
421
-					$new_tkt->set( 'TKT_deleted', 0 );
422
-					$new_tkt->set( 'TKT_price', $ticket_price );
423
-					$new_tkt->set( 'TKT_sold', 0 );
420
+					$new_tkt->set('TKT_ID', 0);
421
+					$new_tkt->set('TKT_deleted', 0);
422
+					$new_tkt->set('TKT_price', $ticket_price);
423
+					$new_tkt->set('TKT_sold', 0);
424 424
 
425 425
 					//now we update the prices just for this ticket
426
-					$new_tkt = $this->_add_prices_to_ticket( $price_rows, $new_tkt, TRUE );
426
+					$new_tkt = $this->_add_prices_to_ticket($price_rows, $new_tkt, TRUE);
427 427
 
428 428
 					//and we update the base price
429
-					$new_tkt =  $this->_add_prices_to_ticket( array(), $new_tkt, TRUE, $base_price, $base_price_id );
429
+					$new_tkt = $this->_add_prices_to_ticket(array(), $new_tkt, TRUE, $base_price, $base_price_id);
430 430
 
431
-					foreach ( $dtts_on_existing as $adddtt ) {
432
-						$new_tkt->_add_relation_to( $adddtt, 'Datetime' );
431
+					foreach ($dtts_on_existing as $adddtt) {
432
+						$new_tkt->_add_relation_to($adddtt, 'Datetime');
433 433
 					}
434 434
 
435 435
 				}
@@ -437,15 +437,15 @@  discard block
 block discarded – undo
437 437
 			} else {
438 438
 				//no TKT_id so a new TKT
439 439
 				$TKT_values['TKT_price'] = $ticket_price;
440
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values, $timezone ), FALSE, FALSE );
440
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values, $timezone), FALSE, FALSE);
441 441
 
442 442
 				//reset values so that new formats are correctly considered when converting date and time strings
443
-				$TKT->set_date_format( $this->_date_format_strings['date'] );
444
-				$TKT->set_time_format( $this->_date_format_strings['time'] );
443
+				$TKT->set_date_format($this->_date_format_strings['date']);
444
+				$TKT->set_time_format($this->_date_format_strings['time']);
445 445
 
446 446
 				//reset values
447
-				foreach ( $TKT_values as $field => $value ) {
448
-					$TKT->set( $field, $value );
447
+				foreach ($TKT_values as $field => $value) {
448
+					$TKT->set($field, $value);
449 449
 				}
450 450
 
451 451
 				$update_prices = TRUE;
@@ -454,31 +454,31 @@  discard block
 block discarded – undo
454 454
 			$TKT->save(); //make sure any current values have been saved.
455 455
 
456 456
 			//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.
457
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
458
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
457
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
458
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
459 459
 				EE_Registry::instance()->load_helper('DTT_Helper');
460 460
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
461 461
 			}
462 462
 
463 463
 			//let's make sure the base price is handled
464
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
464
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
465 465
 
466 466
 			//add/update price_modifiers
467
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
467
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
468 468
 
469 469
 			//need to make sue that the TKT_price is accurate after saving the prices.
470 470
 			$TKT->ensure_TKT_Price_correct();
471 471
 
472 472
 
473 473
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
474
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
475
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
474
+			if ( ! defined('DOING_AUTOSAVE')) {
475
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
476 476
 					$update_prices = TRUE;
477 477
 					$new_default = clone $TKT;
478
-					$new_default->set( 'TKT_ID', 0 );
479
-					$new_default->set( 'TKT_is_default', 1 );
480
-					$new_default->set( 'TKT_row', 1 );
481
-					$new_default->set( 'TKT_price', $ticket_price );
478
+					$new_default->set('TKT_ID', 0);
479
+					$new_default->set('TKT_is_default', 1);
480
+					$new_default->set('TKT_row', 1);
481
+					$new_default->set('TKT_price', $ticket_price);
482 482
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
483 483
 					$new_default->_remove_relations('Datetime');
484 484
 					$new_default->save();
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
487 487
 
488 488
 					//don't forget the base price!
489
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
489
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
490 490
 				}
491 491
 			}
492 492
 
@@ -494,42 +494,42 @@  discard block
 block discarded – undo
494 494
 
495 495
 
496 496
 			//first let's do the add_relation_to()
497
-			$dtts_added = empty( $dtts_added ) || ( is_array( $dtts_added ) && ( isset( $dtts_added[0] ) && $dtts_added[0] == '' ) ) ? array() : $dtts_added;
497
+			$dtts_added = empty($dtts_added) || (is_array($dtts_added) && (isset($dtts_added[0]) && $dtts_added[0] == '')) ? array() : $dtts_added;
498 498
 
499
-			foreach ( $dtts_added as $dttrow ) {
499
+			foreach ($dtts_added as $dttrow) {
500 500
 				$dttrow = (int) $dttrow;
501 501
 				$TKT->_add_relation_to($saved_dtts[$dttrow], 'Datetime');
502 502
 
503 503
 				//now wait a minute.  Does this tkt have any sold?  Cause if it does then we need to add that to the DTT sold because this DTT is getting added.
504
-				if ( $TKT->get('TKT_sold') > 0 ) {
505
-					$saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold') );
504
+				if ($TKT->get('TKT_sold') > 0) {
505
+					$saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold'));
506 506
 					$saved_dtts[$dttrow]->save();
507 507
 				}
508 508
 
509 509
 				//if we have a new_tkt... let's add to it as well
510
-				if ( !empty( $new_tkt ) )
511
-					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
510
+				if ( ! empty($new_tkt))
511
+					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime');
512 512
 			}
513 513
 
514 514
 
515
-			$dtts_removed = empty( $dtts_removed ) || ( is_array( $dtts_removed ) && isset( $dtts_removed[0] ) && $dtts_removed[0] == '' ) ? array() : $dtts_removed;
515
+			$dtts_removed = empty($dtts_removed) || (is_array($dtts_removed) && isset($dtts_removed[0]) && $dtts_removed[0] == '') ? array() : $dtts_removed;
516 516
 
517 517
 			//now let's do the remove_relation_to()
518
-			foreach ( $dtts_removed as $dttrow ) {
518
+			foreach ($dtts_removed as $dttrow) {
519 519
 				$dttrow = (int) $dttrow;
520 520
 				//its entirely possible that a datetime got deleted (instead of just removed from relationship.  So make sure we skip over this if the dtt isn't in the saved_dtts array)
521
-				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime )
521
+				if (empty($saved_dtts[$dttrow]) || ! $saved_dtts[$dttrow] instanceof EE_Datetime)
522 522
 					continue;
523 523
 
524 524
 				$TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
525 525
 
526 526
 				//now wait a minute.  Does this tkt have any sold? Cause if it does then we need to remove it's sold from the DTT_sold.
527
-				if ( $TKT->get('TKT_sold') > 0 ) {
528
-					$saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold') );
527
+				if ($TKT->get('TKT_sold') > 0) {
528
+					$saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold'));
529 529
 					$saved_dtts[$dttrow]->save();
530 530
 				}
531 531
 
532
-				if ( !empty( $new_tkt ) )
532
+				if ( ! empty($new_tkt))
533 533
 					$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
534 534
 			}
535 535
 
@@ -540,43 +540,43 @@  discard block
 block discarded – undo
540 540
 			//let's assign any tickets that have been setup to the saved_tickets tracker
541 541
 			//save existing TKT
542 542
 			$TKT->save();
543
-			if ( $create_new_TKT ) {
543
+			if ($create_new_TKT) {
544 544
 				//save new TKT
545 545
 				$new_tkt->save();
546 546
 				//add new ticket to array
547 547
 				$saved_tickets[$new_tkt->ID()] = $new_tkt;
548 548
 
549
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
549
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
550 550
 
551 551
 			} else {
552 552
 				//add tkt to saved tkts
553 553
 				//save existing TKT
554 554
 				$saved_tickets[$TKT->ID()] = $TKT;
555 555
 
556
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
556
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
557 557
 			}
558 558
 
559 559
 		}
560 560
 
561 561
 		//now we need to handle tickets actually "deleted permanently".  There are cases where we'd want this to happen (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).  Or a draft event was saved and in the process of editing a ticket is trashed.  No sense in keeping all the related data in the db!
562
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
563
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
562
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
563
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
564 564
 		/*var_dump($old_tickets);
565 565
 		var_dump($saved_tickets);
566 566
 		var_dump($tickets_removed);*/
567 567
 
568
-		foreach ( $tickets_removed as $id ) {
569
-			$id = absint( $id );
568
+		foreach ($tickets_removed as $id) {
569
+			$id = absint($id);
570 570
 
571 571
 			//get the ticket for this id
572 572
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
573 573
 
574 574
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
575
-			if ( $tkt_to_remove->get('TKT_is_default') )
575
+			if ($tkt_to_remove->get('TKT_is_default'))
576 576
 				continue;
577 577
 
578 578
 			//if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets.
579
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
579
+			if ($tkt_to_remove->count_related('Registration') > 0) {
580 580
 				$tkt_to_remove->delete();
581 581
 				continue;
582 582
 			}
@@ -584,14 +584,14 @@  discard block
 block discarded – undo
584 584
 			//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)
585 585
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
586 586
 
587
-			foreach( $dtts as $dtt ) {
587
+			foreach ($dtts as $dtt) {
588 588
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
589 589
 			}
590 590
 
591 591
 			//need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
592 592
 			$tkt_to_remove->delete_related_permanently('Price');
593 593
 
594
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
594
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
595 595
 
596 596
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
597 597
 			$tkt_to_remove->delete_permanently();
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
616 616
 	 * @return  void
617 617
 	 */
618
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
618
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
619 619
 
620 620
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
621 621
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 		$updated_prices = array();
624 624
 
625 625
 		// if $base_price ! FALSE then updating a base price.
626
-		if ( $base_price !== FALSE ) {
626
+		if ($base_price !== FALSE) {
627 627
 			$prices[1] = array(
628 628
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
629 629
 				'PRT_ID' => 1,
@@ -634,47 +634,47 @@  discard block
 block discarded – undo
634 634
 		}
635 635
 
636 636
 		//possibly need to save tkt
637
-		if ( ! $ticket->ID() )
637
+		if ( ! $ticket->ID())
638 638
 			$ticket->save();
639 639
 
640
-		foreach ( $prices as $row => $prc ) {
641
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
642
-			if ( empty($prt_id) )
640
+		foreach ($prices as $row => $prc) {
641
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
642
+			if (empty($prt_id))
643 643
 				continue; //prices MUST have a price type id.
644 644
 			$PRC_values = array(
645
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
645
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
646 646
 				'PRT_ID' => $prt_id,
647
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
648
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
649
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
647
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
648
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
649
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
650 650
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
651 651
 				'PRC_order' => $row
652 652
 				);
653
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
653
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
654 654
 				$PRC_values['PRC_ID'] = 0;
655
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
655
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
656 656
 			} else {
657
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
657
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
658 658
 				//update this price with new values
659
-				foreach ( $PRC_values as $field => $newprc ) {
660
-					$PRC->set( $field, $newprc );
659
+				foreach ($PRC_values as $field => $newprc) {
660
+					$PRC->set($field, $newprc);
661 661
 				}
662 662
 			}
663 663
 			$PRC->save();
664 664
 			$prcid = $PRC->ID();
665 665
 			$updated_prices[$prcid] = $PRC;
666
-			$ticket->_add_relation_to( $PRC, 'Price' );
666
+			$ticket->_add_relation_to($PRC, 'Price');
667 667
 		}
668 668
 
669 669
 		//now let's remove any prices that got removed from the ticket
670
-		if ( !empty ( $current_prices_on_ticket ) ) {
670
+		if ( ! empty ($current_prices_on_ticket)) {
671 671
 			$current = array_keys($current_prices_on_ticket);
672 672
 			$updated = array_keys($updated_prices);
673 673
 			$prices_to_remove = array_diff($current, $updated);
674
-			if ( !empty( $prices_to_remove ) ) {
675
-				foreach ( $prices_to_remove as $prc_id ) {
674
+			if ( ! empty($prices_to_remove)) {
675
+				foreach ($prices_to_remove as $prc_id) {
676 676
 					$p = $current_prices_on_ticket[$prc_id];
677
-					$ticket->_remove_relation_to( $p, 'Price' );
677
+					$ticket->_remove_relation_to($p, 'Price');
678 678
 
679 679
 					//delete permanently the price
680 680
 					$p->delete_permanently();
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 
688 688
 
689 689
 
690
-	public function autosave_handling( $event_admin_obj ) {
690
+	public function autosave_handling($event_admin_obj) {
691 691
 		return $event_admin_obj; //doing nothing for the moment.
692 692
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
693 693
 
@@ -721,12 +721,12 @@  discard block
 block discarded – undo
721 721
 
722 722
 		//default main template args
723 723
 		$main_template_args = array(
724
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
724
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
725 725
 			'existing_datetime_ids' => '',
726 726
 			'total_dtt_rows' => 1,
727
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
727
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
728 728
 			'datetime_rows' => '',
729
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
729
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
730 730
 			'ticket_rows' => '',
731 731
 			'existing_ticket_ids' => '',
732 732
 			'total_ticket_rows' => 1,
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 
737 737
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
738 738
 
739
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
739
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
740 740
 
741 741
 		/**
742 742
 		 * 1. Start with retrieving Datetimes
@@ -744,25 +744,25 @@  discard block
 block discarded – undo
744 744
 		 * 3. For each ticket get related prices
745 745
 		 */
746 746
 
747
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
748
-		$times = $DTM->get_all_event_dates( $evtID );
747
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
748
+		$times = $DTM->get_all_event_dates($evtID);
749 749
 
750 750
 
751 751
 
752 752
 		$main_template_args['total_dtt_rows'] = count($times);
753
-		foreach ( $times as $time ) {
753
+		foreach ($times as $time) {
754 754
 			$dttid = $time->get('DTT_ID');
755 755
 			$dttrow = $time->get('DTT_order');
756 756
 			$existing_datetime_ids[] = $dttid;
757 757
 
758 758
 			//tickets attached
759
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
759
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
760 760
 
761 761
 			//if there are no related tickets this is likely a new event OR autodraft
762 762
 			// event so we need to generate the default tickets because dtts
763 763
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
764 764
 			// datetime on the event.
765
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
765
+			if (empty ($related_tickets) && count($times) < 2) {
766 766
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
767 767
 			}
768 768
 
@@ -771,11 +771,11 @@  discard block
 block discarded – undo
771 771
 
772 772
 			//loop through and setup the ticket rows and make sure the order is set.
773 773
 			$order = 0;
774
-			foreach ( $related_tickets as $ticket ) {
774
+			foreach ($related_tickets as $ticket) {
775 775
 				$tktid = $ticket->get('TKT_ID');
776 776
 				$tktrow = $ticket->get('TKT_row');
777 777
 				//we only want unique tickets in our final display!!
778
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
778
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
779 779
 					$existing_ticket_ids[] = $tktid;
780 780
 					$all_tickets[] = $ticket;
781 781
 				}
@@ -784,56 +784,56 @@  discard block
 block discarded – undo
784 784
 				$datetime_tickets[$dttid][] = $tktrow;
785 785
 
786 786
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
787
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
787
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
788 788
 					$ticket_datetimes[$tktid][] = $dttrow;
789 789
 			}
790 790
 		}
791 791
 
792
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
793
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
794
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
792
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
793
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
794
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
795 795
 
796 796
 		//sort $all_tickets by order
797
-		usort( $all_tickets, function( $a, $b ) {
797
+		usort($all_tickets, function($a, $b) {
798 798
 			$a_order = (int) $a->get('TKT_order');
799 799
 			$b_order = (int) $b->get('TKT_order');
800
-			if ( $a_order == $b_order ) {
800
+			if ($a_order == $b_order) {
801 801
 				return 0;
802 802
 			}
803
-			return ( $a_order < $b_order ) ? -1 : 1;
803
+			return ($a_order < $b_order) ? -1 : 1;
804 804
 		});
805 805
 
806 806
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
807 807
 		$dttrow = 1;
808
-		foreach ( $times as $time ) {
809
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
808
+		foreach ($times as $time) {
809
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
810 810
 			$dttrow++;
811 811
 		}
812 812
 
813 813
 		//then loop through all tickets for the ticket rows.
814 814
 		$tktrow = 1;
815
-		foreach ( $all_tickets as $ticket ) {
816
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
815
+		foreach ($all_tickets as $ticket) {
816
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
817 817
 			$tktrow++;
818 818
 		}
819 819
 
820 820
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
821
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
822
-		EEH_Template::display_template( $template, $main_template_args );
821
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
822
+		EEH_Template::display_template($template, $main_template_args);
823 823
 		return;
824 824
 	}
825 825
 
826 826
 
827 827
 
828
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
828
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
829 829
 
830 830
 		$dtt_display_template_args = array(
831
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
832
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
831
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
832
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
833 833
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
834 834
 			);
835
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
836
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
835
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
836
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
837 837
 	}
838 838
 
839 839
 
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 	 *
852 852
 	 * @return string Generated edit row.
853 853
 	 */
854
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
854
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
855 855
 
856 856
 		// if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true.
857 857
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -859,30 +859,30 @@  discard block
 block discarded – undo
859 859
 		$template_args = array(
860 860
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
861 861
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
862
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
862
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
863 863
 			'DTT_ID' => $default ? '' : $dtt->ID(),
864 864
 			'DTT_name' => $default ? '' : $dtt->name(),
865 865
 			'DTT_description' => $default ? '' : $dtt->description(),
866
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
867
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
868
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
866
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
867
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
868
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
869 869
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
870 870
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
871
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
872
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
871
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
872
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
873 873
 			);
874 874
 
875
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
875
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
876 876
 
877 877
 		//allow filtering of template args at this point.
878
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
878
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
879 879
 
880
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
881
-		return EEH_Template::display_template( $template, $template_args, TRUE );
880
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
881
+		return EEH_Template::display_template($template, $template_args, TRUE);
882 882
 	}
883 883
 
884 884
 
885
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
885
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
886 886
 
887 887
 		$template_args = array(
888 888
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -890,47 +890,47 @@  discard block
 block discarded – undo
890 890
 			'DTT_description' => $default ? '' : $dtt->description(),
891 891
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
892 892
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
893
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
893
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
894 894
 			'DTT_ID' => $default ? '' : $dtt->ID()
895 895
 			);
896 896
 
897 897
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
898
-		if ( !$default ) {
898
+		if ( ! $default) {
899 899
 			$tktrow = 1;
900
-			foreach ( $all_tickets as $ticket ) {
901
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
900
+			foreach ($all_tickets as $ticket) {
901
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
902 902
 				$tktrow++;
903 903
 			}
904 904
 		}
905 905
 
906 906
 		//filter template args at this point
907
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
907
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
908 908
 
909
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
910
-		return EEH_Template::display_template( $template, $template_args, TRUE );
909
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
910
+		return EEH_Template::display_template($template, $template_args, TRUE);
911 911
 	}
912 912
 
913 913
 
914 914
 
915
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
916
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
917
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
915
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
916
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
917
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
918 918
 
919
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
919
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
920 920
 		$template_args = array(
921 921
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
922
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
922
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
923 923
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
924 924
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
925
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
926
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
925
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
926
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
927 927
 			);
928 928
 
929 929
 		//filter template args
930
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
930
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
931 931
 
932
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
933
-		return EEH_Template::display_template( $template, $template_args, TRUE );
932
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
933
+		return EEH_Template::display_template($template, $template_args, TRUE);
934 934
 	}
935 935
 
936 936
 
@@ -952,32 +952,32 @@  discard block
 block discarded – undo
952 952
 	 *
953 953
 	 * @return [type] [description]
954 954
 	 */
955
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
955
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
956 956
 
957 957
 		//if $ticket is not an instance of EE_Ticket then force default to true.
958
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
958
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
959 959
 
960 960
 
961
-		$prices = !empty($ticket) && !$default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
961
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
962 962
 
963 963
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
964
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
964
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
965 965
 
966
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
966
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
967 967
 
968 968
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
969 969
 		$base_price = $default ? NULL :  $ticket->base_price();
970 970
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
971 971
 
972 972
 		//breaking out complicated condition for ticket_status
973
-		if ( $default ) {
974
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
973
+		if ($default) {
974
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
975 975
 		} else {
976
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
976
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
977 977
 		}
978 978
 
979 979
 		//breaking out complicated condition for TKT_taxable
980
-		if ( $default ) {
980
+		if ($default) {
981 981
 			$TKT_taxable = '';
982 982
 		} else {
983 983
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -992,19 +992,19 @@  discard block
 block discarded – undo
992 992
 			'edit_tkt_expanded' => '',
993 993
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
994 994
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
995
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
996
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
997
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
995
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
996
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
997
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
998 998
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
999 999
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1000 1000
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1001
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1002
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1003
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1004
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1005
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1001
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1002
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1003
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1004
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1005
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1006 1006
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1007
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1007
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1008 1008
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1009 1009
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1010 1010
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1013,99 +1013,99 @@  discard block
 block discarded – undo
1013 1013
 			'ticket_price_rows' => '',
1014 1014
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1015 1015
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1016
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1017
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1016
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1017
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1018 1018
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1019 1019
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1020 1020
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1021 1021
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1022
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1022
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1023 1023
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1024 1024
 			'TKT_taxable' => $TKT_taxable,
1025 1025
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1026 1026
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1027
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1027
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1028 1028
 			'TKT_subtotal_amount' => $ticket_subtotal,
1029
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1029
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1030 1030
 			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1031 1031
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1032 1032
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1033 1033
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1034 1034
 			);
1035 1035
 
1036
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1036
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1037 1037
 
1038 1038
 		//handle rows that should NOT be empty
1039
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1039
+		if (empty($template_args['TKT_start_date'])) {
1040 1040
 			//if empty then the start date will be now.
1041
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1042
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1041
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1042
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1043 1043
 		}
1044 1044
 
1045
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1045
+		if (empty($template_args['TKT_end_date'])) {
1046 1046
 
1047 1047
 			//get the earliest datetime (if present);
1048
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1048
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1049 1049
 
1050
-			if ( !empty( $earliest_dtt ) ) {
1051
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1050
+			if ( ! empty($earliest_dtt)) {
1051
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1052 1052
 			} else {
1053 1053
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1054
-				$template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
1054
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1055 1055
 			}
1056
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1056
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1057 1057
 		}
1058 1058
 
1059 1059
 		//generate ticket_datetime items
1060
-		if ( ! $default ) {
1060
+		if ( ! $default) {
1061 1061
 			$dttrow = 1;
1062
-			foreach ( $all_dtts as $dtt ) {
1063
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1062
+			foreach ($all_dtts as $dtt) {
1063
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1064 1064
 				$dttrow++;
1065 1065
 			}
1066 1066
 		}
1067 1067
 
1068 1068
 		$prcrow = 1;
1069
-		foreach ( $prices as $price ) {
1070
-			if ( $price->is_base_price() ) {
1069
+		foreach ($prices as $price) {
1070
+			if ($price->is_base_price()) {
1071 1071
 				$prcrow++;
1072 1072
 				continue;
1073 1073
 			}
1074
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1075
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1076
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1074
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1075
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1076
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1077 1077
 			$prcrow++;
1078 1078
 		}
1079 1079
 
1080 1080
 		//filter $template_args
1081
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
1081
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
1082 1082
 
1083
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1084
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1083
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1084
+		return EEH_Template::display_template($template, $template_args, TRUE);
1085 1085
 	}
1086 1086
 
1087 1087
 
1088 1088
 
1089 1089
 
1090 1090
 
1091
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1091
+	protected function _get_tax_rows($tktrow, $ticket) {
1092 1092
 		$tax_rows = '';
1093
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1093
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1094 1094
 		$template_args = array();
1095
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1096
-		foreach ( $taxes as $tax ) {
1097
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1095
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1096
+		foreach ($taxes as $tax) {
1097
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1098 1098
 			$template_args = array(
1099
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1099
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1100 1100
 				'tax_id' => $tax->ID(),
1101 1101
 				'tkt_row' => $tktrow,
1102 1102
 				'tax_label' => $tax->get('PRC_name'),
1103 1103
 				'tax_added' => $tax_added,
1104
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1104
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1105 1105
 				'tax_amount' => $tax->get('PRC_amount')
1106 1106
 				);
1107
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1108
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1107
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1108
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1109 1109
 		}
1110 1110
 
1111 1111
 
@@ -1113,81 +1113,81 @@  discard block
 block discarded – undo
1113 1113
 	}
1114 1114
 
1115 1115
 
1116
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1117
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1116
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1117
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1118 1118
 		return $subtotal * $tax->get('PRC_amount') / 100;
1119 1119
 	}
1120 1120
 
1121 1121
 
1122 1122
 
1123 1123
 
1124
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1125
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1124
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1125
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1126 1126
 		$template_args = array(
1127 1127
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1128 1128
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1129 1129
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1130
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
1130
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1131 1131
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1132 1132
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1133 1133
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1134 1134
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1135 1135
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1136
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1137
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1138
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1139
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1140
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1136
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1137
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1138
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1139
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1140
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1141 1141
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1142 1142
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1143
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1144
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1143
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1144
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1145 1145
 			);
1146 1146
 
1147
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
1147
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
1148 1148
 
1149
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1150
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1149
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1150
+		return EEH_Template::display_template($template, $template_args, TRUE);
1151 1151
 	}
1152 1152
 
1153 1153
 
1154
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1155
-		if ( $price->is_base_price() ) {
1156
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1154
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1155
+		if ($price->is_base_price()) {
1156
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1157 1157
 		} else {
1158
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1158
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1159 1159
 		}
1160 1160
 
1161 1161
 	}
1162 1162
 
1163 1163
 
1164
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1164
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1165 1165
 		$template_args = array(
1166 1166
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1167
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1168
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1167
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1168
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1169 1169
 				'PRT_name' => __('Price', 'event_espresso'),
1170 1170
 				'price_selected_operator' => '+',
1171 1171
 				'price_selected_is_percent' => 0
1172 1172
 			);
1173
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1173
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1174 1174
 
1175
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1175
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1176 1176
 
1177
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1177
+		return EEH_Template::display_template($template, $template_args, TRUE);
1178 1178
 	}
1179 1179
 
1180 1180
 
1181 1181
 
1182
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1183
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1184
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1185
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1186
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1187
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1182
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1183
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1184
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1185
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1186
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1187
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1188 1188
 		$price_option_spans = '';
1189 1189
 		//setup pricetypes for selector
1190
-		foreach ( $price_types as $price_type ) {
1190
+		foreach ($price_types as $price_type) {
1191 1191
 			$all_price_types[] = array(
1192 1192
 				'id' => $price_type->ID(),
1193 1193
 				'text' => $price_type->get('PRT_name'),
@@ -1199,50 +1199,50 @@  discard block
 block discarded – undo
1199 1199
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1200 1200
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1201 1201
 				);
1202
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1202
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1203 1203
 		}
1204 1204
 
1205
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1205
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1206 1206
 		$main_name = $select_name;
1207
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1207
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1208 1208
 
1209 1209
 		$template_args = array(
1210 1210
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1211
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1212
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1211
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1212
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1213 1213
 			'main_name' => $main_name,
1214 1214
 			'selected_price_type_id' => $selected_price_type_id,
1215 1215
 			'price_option_spans' => $price_option_spans,
1216
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1217
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1216
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1217
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1218 1218
 			'disabled' => $disabled
1219 1219
 			);
1220 1220
 
1221
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1221
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1222 1222
 
1223
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1223
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1224 1224
 
1225
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1225
+		return EEH_Template::display_template($template, $template_args, TRUE);
1226 1226
 	}
1227 1227
 
1228 1228
 
1229 1229
 
1230
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1231
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1232
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1233
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1230
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1231
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1232
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1233
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1234 1234
 		$template_args = array(
1235
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1235
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1236 1236
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1237
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1238
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1239
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1237
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1238
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1239
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1240 1240
 			'tkt_status_class' => '',
1241 1241
 			);
1242 1242
 
1243
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1244
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1245
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1243
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1244
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1245
+		return EEH_Template::display_template($template, $template_args, TRUE);
1246 1246
 	}
1247 1247
 
1248 1248
 
@@ -1250,53 +1250,53 @@  discard block
 block discarded – undo
1250 1250
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1251 1251
 		$template_args = array(
1252 1252
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1253
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1254
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1253
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1254
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1255 1255
 			'default_price_rows' => '',
1256 1256
 			'default_base_price_amount' => 0,
1257 1257
 			'default_base_price_name' => '',
1258 1258
 			'default_base_price_description' => '',
1259
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1260
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1259
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1260
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1261 1261
 			'existing_available_datetime_tickets_list' => '',
1262 1262
 			'existing_available_ticket_datetimes_list' => '',
1263
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1264
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1263
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1264
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1265 1265
 			);
1266 1266
 
1267 1267
 		$tktrow = 1;
1268
-		foreach ( $all_tickets as $ticket ) {
1269
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1268
+		foreach ($all_tickets as $ticket) {
1269
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1270 1270
 			$tktrow++;
1271 1271
 		}
1272 1272
 
1273 1273
 
1274 1274
 		$dttrow = 1;
1275
-		foreach ( $all_dtts as $dtt ) {
1276
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1275
+		foreach ($all_dtts as $dtt) {
1276
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1277 1277
 			$dttrow++;
1278 1278
 		}
1279 1279
 
1280 1280
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1281 1281
 		$prcrow = 1;
1282
-		foreach ( $default_prices as $price ) {
1283
-			if ( $price->is_base_price() ) {
1282
+		foreach ($default_prices as $price) {
1283
+			if ($price->is_base_price()) {
1284 1284
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1285 1285
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1286 1286
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1287 1287
 				$prcrow++;
1288 1288
 				continue;
1289 1289
 			}
1290
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1291
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1292
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1290
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1291
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1292
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1293 1293
 			$prcrow++;
1294 1294
 		}
1295 1295
 
1296
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1296
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1297 1297
 
1298
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1299
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1298
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1299
+		return EEH_Template::display_template($template, $template_args, TRUE);
1300 1300
 	}
1301 1301
 
1302 1302
 
Please login to merge, or discard this patch.
caffeinated/admin/new/venues/Venues_Admin_Page.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -944,7 +944,7 @@
 block discarded – undo
944 944
 	 * @access  private
945 945
 	 * @param  int $VNU_ID
946 946
 	 * @param  string $venue_status
947
-	 * @return void
947
+	 * @return boolean
948 948
 	 */
949 949
 	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
950 950
 		// grab venue id
Please login to merge, or discard this patch.
Spacing   +242 added lines, -242 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
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 	protected function _init_page_props() {
65
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
65
+		require_once(EE_MODELS.'EEM_Venue.model.php');
66 66
 		$this->page_slug = EE_VENUES_PG_SLUG;
67 67
 		$this->_admin_base_url = EE_VENUES_ADMIN_URL;
68
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN . 'new/venues';
68
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN.'new/venues';
69 69
 		$this->page_label = __('Event Venues', 'event_espresso');
70 70
 		$this->_cpt_model_names = array(
71 71
 			'create_new' => 'EEM_Venue',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				'edit' => __('Update Venue', 'event_espresso'),
109 109
 				'add_category' => __('Save New Category', 'event_espresso'),
110 110
 				'edit_category' => __('Update Category', 'event_espresso'),
111
-				'google_map_settings' => __( 'Update Settings', 'event_espresso' )
111
+				'google_map_settings' => __('Update Settings', 'event_espresso')
112 112
 				)
113 113
 		);
114 114
 	}
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	protected function _set_page_routes() {
121 121
 
122 122
 		//load formatter helper
123
-		EE_Registry::instance()->load_helper( 'Formatter' );
123
+		EE_Registry::instance()->load_helper('Formatter');
124 124
 		//load field generator helper
125
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
125
+		EE_Registry::instance()->load_helper('Form_Fields');
126 126
 
127 127
 		//is there a vnu_id in the request?
128
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
129
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
128
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
129
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
130 130
 
131 131
 		$this->_page_routes = array(
132 132
 			'default' => array(
@@ -144,27 +144,27 @@  discard block
 block discarded – undo
144 144
 				),
145 145
 			'trash_venue' => array(
146 146
 				'func' => '_trash_or_restore_venue',
147
-				'args' => array( 'venue_status' => 'trash' ),
147
+				'args' => array('venue_status' => 'trash'),
148 148
 				'noheader' => TRUE,
149 149
 				'capability' => 'ee_delete_venue',
150 150
 				'obj_id' => $vnu_id
151 151
 				),
152 152
 			'trash_venues' => array(
153 153
 				'func' => '_trash_or_restore_venues',
154
-				'args' => array( 'venue_status' => 'trash' ),
154
+				'args' => array('venue_status' => 'trash'),
155 155
 				'noheader' => TRUE,
156 156
 				'capability' => 'ee_delete_venues'
157 157
 				),
158 158
 			'restore_venue' => array(
159 159
 				'func' => '_trash_or_restore_venue',
160
-				'args' => array( 'venue_status' => 'draft' ),
160
+				'args' => array('venue_status' => 'draft'),
161 161
 				'noheader' => TRUE,
162 162
 				'capability' => 'ee_delete_venue',
163 163
 				'obj_id' => $vnu_id
164 164
 				),
165 165
 			'restore_venues' => array(
166 166
 				'func' => '_trash_or_restore_venues',
167
-				'args' => array( 'venue_status' => 'draft' ),
167
+				'args' => array('venue_status' => 'draft'),
168 168
 				'noheader' => TRUE,
169 169
 				'capability' => 'ee_delete_venues'
170 170
 				),
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 						'filename' => 'venues_overview_views_bulk_actions_search'
267 267
 					)
268 268
 				),
269
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
269
+				'help_tour' => array('Venues_Overview_Help_Tour'),
270 270
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
271 271
 				'require_nonce' => FALSE
272 272
 			),
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 						'filename' => 'venues_editor_other'
303 303
 					)
304 304
 				),
305
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
305
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
306 306
 				'metaboxes' => array('_venue_editor_metaboxes'),
307 307
 				'require_nonce' => FALSE
308 308
 				),
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 					'label' => __('Edit Venue', 'event_espresso'),
312 312
 					'order' => 5,
313 313
 					'persistent' => FALSE,
314
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
314
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
315 315
 				),
316 316
 				'help_tabs' => array(
317 317
 					'venues_editor_help_tab' => array(
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 						'filename' => 'venues_editor_other'
340 340
 					)
341 341
 				),
342
-				'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ),
342
+				'help_tour' => array('Venues_Edit_Venue_Help_Tour'),
343 343
 				'metaboxes' => array('_venue_editor_metaboxes'),
344 344
 				'require_nonce' => FALSE
345 345
 			),
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 					'label' => __('Google Maps'),
349 349
 					'order' => 40
350 350
 				),
351
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
351
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
352 352
 				'help_tabs' => array(
353 353
 					'general_settings_google_maps_help_tab' => array(
354 354
 						'title' => __('Google Maps', 'event_espresso'),
355 355
 						'filename' => 'general_settings_google_maps'
356 356
 					)
357 357
 				),
358
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
358
+				'help_tour' => array('Google_Maps_Help_Tour'),
359 359
 				'require_nonce' => FALSE
360 360
 			),
361 361
 			//venue category stuff
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 						'filename' => 'venues_add_category'
372 372
 					)
373 373
 				),
374
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
374
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
375 375
 				'require_nonce' => FALSE
376 376
 				),
377 377
 			'edit_category' => array(
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 					'label' => __('Edit Category', 'event_espresso'),
380 380
 					'order' => 15,
381 381
 					'persistent' => FALSE,
382
-					'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
382
+					'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
383 383
 					),
384 384
 				'metaboxes' => array('_publish_post_box'),
385 385
 				'help_tabs' => array(
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 						'filename' => 'venues_edit_category'
389 389
 					)
390 390
 				),
391
-				'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ),
391
+				'help_tour' => array('Venues_Edit_Category_Help_Tour'),
392 392
 				'require_nonce' => FALSE
393 393
 				),
394 394
 			'category_list' => array(
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 						'filename' => 'venues_categories_other'
416 416
 					)
417 417
 				),
418
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
418
+				'help_tour' => array('Venues_Categories_Help_Tour'),
419 419
 				'metaboxes' => $this->_default_espresso_metaboxes,
420 420
 				'require_nonce' => FALSE
421 421
 				)
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 
473 473
 
474 474
 	public function load_scripts_styles() {
475
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
475
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
476 476
 		wp_enqueue_style('ee-cat-admin');
477 477
 	}
478 478
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	public function load_scripts_styles_edit() {
496 496
 		//styles
497 497
 		wp_enqueue_style('espresso-ui-theme');
498
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
498
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
499 499
 		wp_enqueue_style('espresso_venues');
500 500
 	}
501 501
 
@@ -514,13 +514,13 @@  discard block
 block discarded – undo
514 514
 				)
515 515
 		);
516 516
 
517
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
517
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
518 518
 			$this->_views['all']['bulk_action'] = array(
519 519
 				'trash_venues' => __('Move to Trash', 'event_espresso')
520 520
 			);
521 521
 			$this->_views['trash'] = array(
522 522
 				'slug' => 'trash',
523
-				'label' => __( 'Trash', 'event_espresso' ),
523
+				'label' => __('Trash', 'event_espresso'),
524 524
 				'count' => 0,
525 525
 				'bulk_action' => array(
526 526
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
 
555 555
 	protected function _overview_list_table() {
556
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
556
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
557 557
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
558 558
 		$this->_search_btn_label = __('Venues', 'event_espresso');
559 559
 		$this->display_admin_list_table_page_with_sidebar();
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
568 568
 			'vnu_phone' => $this->_cpt_model_obj->phone()
569 569
 			);
570
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
571
-		EEH_Template::display_template( $template, $extra_rows );
570
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
571
+		EEH_Template::display_template($template, $extra_rows);
572 572
 	}
573 573
 
574 574
 
@@ -583,115 +583,115 @@  discard block
 block discarded – undo
583 583
 		$default_map_settings = new stdClass();
584 584
 		$default_map_settings->use_google_maps = TRUE;
585 585
 		// for event details pages (reg page)
586
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
587
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
588
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
589
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
590
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
591
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
592
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
586
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
587
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
588
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
589
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
590
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
591
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
592
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
593 593
 		// for event list pages
594
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
595
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
596
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
597
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
598
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
599
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
600
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
594
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
595
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
596
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
597
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
598
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
599
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
600
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
601 601
 
602 602
 		$this->_template_args['map_settings'] =
603
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
604
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
603
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
604
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
605 605
 				: $default_map_settings;
606 606
 
607
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
608
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
609
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE );
607
+		$this->_set_add_edit_form_tags('update_google_map_settings');
608
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
609
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE);
610 610
 		$this->display_admin_page_with_sidebar();
611 611
 	}
612 612
 
613 613
 	protected function _update_google_map_settings() {
614 614
 
615 615
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
616
-			isset( $this->_req_data['use_google_maps'] )
617
-				? absint( $this->_req_data['use_google_maps'] )
616
+			isset($this->_req_data['use_google_maps'])
617
+				? absint($this->_req_data['use_google_maps'])
618 618
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
619 619
 
620 620
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
621
-			isset( $this->_req_data['event_details_map_width'] )
622
-				? absint( $this->_req_data['event_details_map_width'] )
621
+			isset($this->_req_data['event_details_map_width'])
622
+				? absint($this->_req_data['event_details_map_width'])
623 623
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
624 624
 
625 625
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
626
-			isset( $this->_req_data['event_details_map_height'] )
627
-				? absint( $this->_req_data['event_details_map_height'] )
626
+			isset($this->_req_data['event_details_map_height'])
627
+				? absint($this->_req_data['event_details_map_height'])
628 628
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
629 629
 
630 630
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
631
-			isset( $this->_req_data['event_details_map_zoom'] )
632
-				? absint( $this->_req_data['event_details_map_zoom'] )
631
+			isset($this->_req_data['event_details_map_zoom'])
632
+				? absint($this->_req_data['event_details_map_zoom'])
633 633
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
634 634
 
635 635
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
636
-			isset( $this->_req_data['event_details_display_nav'] )
637
-				? absint( $this->_req_data['event_details_display_nav'] )
636
+			isset($this->_req_data['event_details_display_nav'])
637
+				? absint($this->_req_data['event_details_display_nav'])
638 638
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
639 639
 
640 640
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
641
-			isset( $this->_req_data['event_details_nav_size'] )
642
-				? absint( $this->_req_data['event_details_nav_size'] )
641
+			isset($this->_req_data['event_details_nav_size'])
642
+				? absint($this->_req_data['event_details_nav_size'])
643 643
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
644 644
 
645 645
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
646
-			isset( $this->_req_data['event_details_control_type'] )
647
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
646
+			isset($this->_req_data['event_details_control_type'])
647
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
648 648
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
649 649
 
650 650
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
651
-			isset( $this->_req_data['event_details_map_align'] )
652
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
651
+			isset($this->_req_data['event_details_map_align'])
652
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
653 653
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
654 654
 
655 655
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
656
-			isset( $this->_req_data['event_list_map_width'] )
657
-				? absint( $this->_req_data['event_list_map_width'] )
656
+			isset($this->_req_data['event_list_map_width'])
657
+				? absint($this->_req_data['event_list_map_width'])
658 658
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
659 659
 
660 660
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
661
-			isset( $this->_req_data['event_list_map_height'] )
662
-				? absint( $this->_req_data['event_list_map_height'] )
661
+			isset($this->_req_data['event_list_map_height'])
662
+				? absint($this->_req_data['event_list_map_height'])
663 663
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
664 664
 
665 665
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
666
-			isset( $this->_req_data['event_list_map_zoom'] )
667
-				? absint( $this->_req_data['event_list_map_zoom'] )
666
+			isset($this->_req_data['event_list_map_zoom'])
667
+				? absint($this->_req_data['event_list_map_zoom'])
668 668
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
669 669
 
670 670
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
671
-			isset( $this->_req_data['event_list_display_nav'] )
672
-				? absint( $this->_req_data['event_list_display_nav'] )
671
+			isset($this->_req_data['event_list_display_nav'])
672
+				? absint($this->_req_data['event_list_display_nav'])
673 673
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
674 674
 
675 675
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
676
-			isset( $this->_req_data['event_list_nav_size'] )
677
-				? absint( $this->_req_data['event_list_nav_size'] )
676
+			isset($this->_req_data['event_list_nav_size'])
677
+				? absint($this->_req_data['event_list_nav_size'])
678 678
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
679 679
 
680 680
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
681
-			isset( $this->_req_data['event_list_control_type'] )
682
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
681
+			isset($this->_req_data['event_list_control_type'])
682
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
683 683
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
684 684
 
685 685
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
686
-			isset( $this->_req_data['event_list_map_align'] )
687
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
686
+			isset($this->_req_data['event_list_map_align'])
687
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
688 688
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
689 689
 
690
-		EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings );
690
+		EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings);
691 691
 
692 692
 		$what = 'Google Map Settings';
693
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ );
694
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
693
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__);
694
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
695 695
 
696 696
 	}
697 697
 
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
 	protected function _venue_editor_metaboxes() {
701 701
 		$this->verify_cpt_object();
702 702
 
703
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
704
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
705
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
703
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
704
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
705
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
706 706
 
707 707
 	}
708 708
 
@@ -710,23 +710,23 @@  discard block
 block discarded – undo
710 710
 
711 711
 	public function venue_gmap_metabox() {
712 712
 		$template_args = array(
713
-			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ),
713
+			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()),
714 714
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
715 715
 			);
716
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
717
-		EEH_Template::display_template( $template, $template_args );
716
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
717
+		EEH_Template::display_template($template, $template_args);
718 718
 	}
719 719
 
720 720
 
721 721
 
722 722
 	public function venue_address_metabox() {
723 723
 
724
-		$template_args['_venue'] =$this->_cpt_model_obj;
724
+		$template_args['_venue'] = $this->_cpt_model_obj;
725 725
 
726 726
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
727 727
 			$QFI = new EE_Question_Form_Input(
728
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
729
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
728
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
729
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
730 730
 				array(
731 731
 					'input_name' =>  'sta_id',
732 732
 					'input_id' => 'sta_id',
@@ -738,8 +738,8 @@  discard block
 block discarded – undo
738 738
 		);
739 739
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
740 740
 			$QFI = new EE_Question_Form_Input(
741
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
742
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
741
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
742
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
743 743
 				array(
744 744
 					'input_name' =>  'cnt_iso',
745 745
 					'input_id' => 'cnt_iso',
@@ -750,8 +750,8 @@  discard block
 block discarded – undo
750 750
 			)
751 751
 		);
752 752
 
753
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
754
-		EEH_Template::display_template( $template, $template_args );
753
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
754
+		EEH_Template::display_template($template, $template_args);
755 755
 	}
756 756
 
757 757
 
@@ -763,8 +763,8 @@  discard block
 block discarded – undo
763 763
 		$template_args = array(
764 764
 			'_venue' => $this->_cpt_model_obj
765 765
 			);
766
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
767
-		EEH_Template::display_template( $template, $template_args );
766
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
767
+		EEH_Template::display_template($template, $template_args);
768 768
 	}
769 769
 
770 770
 
@@ -787,47 +787,47 @@  discard block
 block discarded – undo
787 787
 	 * @param  object $post    Post object (with "blessed" WP properties)
788 788
 	 * @return void
789 789
 	 */
790
-	protected function _insert_update_cpt_item( $post_id, $post ) {
791
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
790
+	protected function _insert_update_cpt_item($post_id, $post) {
791
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
792 792
 
793 793
 		$venue_values = array(
794
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
795
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
796
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
797
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
798
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
799
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
800
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
801
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : INF,
802
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
803
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
804
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
805
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
806
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
794
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
795
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
796
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
797
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
798
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
799
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
800
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
801
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : INF,
802
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
803
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
804
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
805
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
806
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
807 807
 			);
808 808
 
809 809
 		//update venue
810
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
810
+		$success = $this->_venue_model->update($venue_values, array($wheres));
811 811
 
812 812
 		//get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_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!
813
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
814
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
813
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
814
+		$venue = $this->_venue_model->get_one(array($get_one_where));
815 815
 
816 816
 		//notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use.  So this is just here for addons to more easily hook into venue saves.
817
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
817
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
818 818
 
819 819
 		$att_success = TRUE;
820 820
 
821
-		foreach ( $venue_update_callbacks as $v_callback ) {
822
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
823
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
821
+		foreach ($venue_update_callbacks as $v_callback) {
822
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
823
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
824 824
 		}
825 825
 
826 826
 		//any errors?
827
-		if ( $success && !$att_success ) {
828
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
829
-		} else if ( $success === FALSE ) {
830
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
827
+		if ($success && ! $att_success) {
828
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
829
+		} else if ($success === FALSE) {
830
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
831 831
 		}
832 832
 	}
833 833
 
@@ -835,9 +835,9 @@  discard block
 block discarded – undo
835 835
 
836 836
 
837 837
 
838
-	public function trash_cpt_item( $post_id ) {
838
+	public function trash_cpt_item($post_id) {
839 839
 		$this->_req_data['VNU_ID'] = $post_id;
840
-		$this->_trash_or_restore_venue( 'trash', FALSE );
840
+		$this->_trash_or_restore_venue('trash', FALSE);
841 841
 	}
842 842
 
843 843
 
@@ -845,18 +845,18 @@  discard block
 block discarded – undo
845 845
 
846 846
 
847 847
 
848
-	public function restore_cpt_item( $post_id ) {
848
+	public function restore_cpt_item($post_id) {
849 849
 		$this->_req_data['VNU_ID'] = $post_id;
850
-		$this->_trash_or_restore_venue( 'draft', FALSE );
850
+		$this->_trash_or_restore_venue('draft', FALSE);
851 851
 	}
852 852
 
853 853
 
854 854
 
855 855
 
856 856
 
857
-	public function delete_cpt_item( $post_id ) {
857
+	public function delete_cpt_item($post_id) {
858 858
 		$this->_req_data['VNU_ID'] = $post_id;
859
-		$this->_delete_venue( FALSE );
859
+		$this->_delete_venue(FALSE);
860 860
 	}
861 861
 
862 862
 
@@ -871,15 +871,15 @@  discard block
 block discarded – undo
871 871
 
872 872
 
873 873
 
874
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
875
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
874
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
875
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
876 876
 
877 877
 		//loop thru venues
878
-		if ( $VNU_ID ) {
878
+		if ($VNU_ID) {
879 879
 			//clean status
880
-			$venue_status = sanitize_key( $venue_status );
880
+			$venue_status = sanitize_key($venue_status);
881 881
 			// grab status
882
-			if (!empty($venue_status)) {
882
+			if ( ! empty($venue_status)) {
883 883
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
884 884
 			} else {
885 885
 				$success = FALSE;
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 		}
894 894
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
895 895
 
896
-		if ( $redirect_after )
896
+		if ($redirect_after)
897 897
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
898 898
 
899 899
 	}
@@ -902,11 +902,11 @@  discard block
 block discarded – undo
902 902
 
903 903
 
904 904
 
905
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
905
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
906 906
 		// clean status
907 907
 		$venue_status = sanitize_key($venue_status);
908 908
 		// grab status
909
-		if (!empty($venue_status)) {
909
+		if ( ! empty($venue_status)) {
910 910
 			$success = TRUE;
911 911
 			//determine the event id and set to array.
912 912
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -946,20 +946,20 @@  discard block
 block discarded – undo
946 946
 	 * @param  string $venue_status
947 947
 	 * @return void
948 948
 	 */
949
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
949
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
950 950
 		// grab venue id
951
-		if (! $VNU_ID) {
951
+		if ( ! $VNU_ID) {
952 952
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
953 953
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
954 954
 			return FALSE;
955 955
 		}
956 956
 
957
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
957
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
958 958
 
959 959
 		// clean status
960 960
 		$venue_status = sanitize_key($venue_status);
961 961
 		// grab status
962
-		if ( ! $venue_status ) {
962
+		if ( ! $venue_status) {
963 963
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
964 964
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
965 965
 			return FALSE;
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 				$hook = FALSE;
981 981
 		}
982 982
 		//use class to change status
983
-		$this->_cpt_model_obj->set_status( $venue_status );
983
+		$this->_cpt_model_obj->set_status($venue_status);
984 984
 		$success = $this->_cpt_model_obj->save();
985 985
 
986 986
 		if ($success === FALSE) {
@@ -999,21 +999,21 @@  discard block
 block discarded – undo
999 999
 	 * @param  bool $redirect_after
1000 1000
 	 * @return void
1001 1001
 	 */
1002
-	protected function _delete_venue( $redirect_after = true ) {
1002
+	protected function _delete_venue($redirect_after = true) {
1003 1003
 		//determine the venue id and set to array.
1004 1004
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1005
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1005
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1006 1006
 
1007 1007
 
1008 1008
 		// loop thru venues
1009 1009
 		if ($VNU_ID) {
1010
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1010
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1011 1011
 		} else {
1012 1012
 			$success = FALSE;
1013 1013
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1014 1014
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1015 1015
 		}
1016
-		if ( $redirect_after )
1016
+		if ($redirect_after)
1017 1017
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1018 1018
 	}
1019 1019
 
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
 	//todo: put in parent
1046 1046
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1047 1047
 		// grab event id
1048
-		if (!$VNU_ID = absint($VNU_ID)) {
1048
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1049 1049
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1050 1050
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1051 1051
 			return FALSE;
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1066 1066
 			return FALSE;
1067 1067
 		}
1068
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1068
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1069 1069
 		return TRUE;
1070 1070
 	}
1071 1071
 
@@ -1076,11 +1076,11 @@  discard block
 block discarded – undo
1076 1076
 	/* QUERIES */
1077 1077
 
1078 1078
 
1079
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1079
+	public function get_venues($per_page = 10, $count = FALSE) {
1080 1080
 
1081
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1081
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1082 1082
 
1083
-		switch ( $_orderby ) {
1083
+		switch ($_orderby) {
1084 1084
 			case 'id':
1085 1085
 				$orderby = 'VNU_ID';
1086 1086
 				break;
@@ -1098,43 +1098,43 @@  discard block
 block discarded – undo
1098 1098
 		}
1099 1099
 
1100 1100
 
1101
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1101
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1102 1102
 
1103
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1104
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1105
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1103
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1104
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1105
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1106 1106
 
1107 1107
 
1108
-		$offset = ($current_page-1)*$per_page;
1108
+		$offset = ($current_page - 1) * $per_page;
1109 1109
 		$limit = array($offset, $per_page);
1110 1110
 
1111
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1111
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1112 1112
 		$where = array();
1113 1113
 
1114 1114
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1115
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1115
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1116 1116
 			$where['status'] = $this->_req_data['status'];
1117 1117
 		}
1118 1118
 
1119
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1119
+		if (isset($this->_req_data['venue_status'])) {
1120 1120
 			$where['status'] = $this->_req_data['venue_status'];
1121 1121
 		}
1122 1122
 
1123 1123
 
1124
-		if ( $category ) {
1124
+		if ($category) {
1125 1125
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1126 1126
 			$where['Term_Taxonomy.term_id'] = $category;
1127 1127
 		}
1128 1128
 		
1129 1129
 
1130
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1131
-			$where['VNU_wp_user'] =  get_current_user_id();
1130
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1131
+			$where['VNU_wp_user'] = get_current_user_id();
1132 1132
 		} else {
1133
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1133
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1134 1134
 					$where['OR'] = array(
1135
-						'status*restrict_private' => array( '!=', 'private' ),
1135
+						'status*restrict_private' => array('!=', 'private'),
1136 1136
 						'AND'                     => array(
1137
-							'status*inclusive' => array( '=', 'private' ),
1137
+							'status*inclusive' => array('=', 'private'),
1138 1138
 							'VNU_wp_user'      => get_current_user_id()
1139 1139
 						)
1140 1140
 					);
@@ -1144,30 +1144,30 @@  discard block
 block discarded – undo
1144 1144
 
1145 1145
 
1146 1146
 
1147
-		if ( isset( $this->_req_data['s'] ) ) {
1148
-			$sstr = '%' . $this->_req_data['s'] . '%';
1147
+		if (isset($this->_req_data['s'])) {
1148
+			$sstr = '%'.$this->_req_data['s'].'%';
1149 1149
 			$where['OR'] = array(
1150
-				'VNU_name' => array('LIKE',$sstr ),
1151
-				'VNU_desc' => array('LIKE',$sstr ),
1152
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1153
-				'VNU_address' => array( 'LIKE', $sstr ),
1154
-				'VNU_address2' => array( 'LIKE', $sstr ),
1155
-				'VNU_city' => array( 'LIKE', $sstr ),
1156
-				'VNU_zip' => array( 'LIKE', $sstr ),
1157
-				'VNU_phone' => array( 'LIKE', $sstr ),
1158
-				'VNU_url' => array( 'LIKE', $sstr ),
1159
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1160
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1161
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1162
-				'Event.EVT_name' => array('LIKE', $sstr ),
1163
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1164
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1165
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1150
+				'VNU_name' => array('LIKE', $sstr),
1151
+				'VNU_desc' => array('LIKE', $sstr),
1152
+				'VNU_short_desc' => array('LIKE', $sstr),
1153
+				'VNU_address' => array('LIKE', $sstr),
1154
+				'VNU_address2' => array('LIKE', $sstr),
1155
+				'VNU_city' => array('LIKE', $sstr),
1156
+				'VNU_zip' => array('LIKE', $sstr),
1157
+				'VNU_phone' => array('LIKE', $sstr),
1158
+				'VNU_url' => array('LIKE', $sstr),
1159
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1160
+				'VNU_virtual_url' => array('LIKE', $sstr),
1161
+				'VNU_google_map_link' => array('LIKE', $sstr),
1162
+				'Event.EVT_name' => array('LIKE', $sstr),
1163
+				'Event.EVT_desc' => array('LIKE', $sstr),
1164
+				'Event.EVT_phone' => array('LIKE', $sstr),
1165
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1166 1166
 				);
1167 1167
 		}
1168 1168
 
1169 1169
 
1170
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1170
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1171 1171
 
1172 1172
 		return $venues;
1173 1173
 
@@ -1185,22 +1185,22 @@  discard block
 block discarded – undo
1185 1185
 	 * @return void
1186 1186
 	 */
1187 1187
 	private function _set_category_object() {
1188
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1188
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1189 1189
 			return; //already have the category object so get out.
1190 1190
 
1191 1191
 		//set default category object
1192 1192
 		$this->_set_empty_category_object();
1193 1193
 
1194 1194
 		//only set if we've got an id
1195
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1195
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1196 1196
 			return;
1197 1197
 		}
1198 1198
 
1199 1199
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1200
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1200
+		$term = get_term($category_id, 'espresso_venue_categories');
1201 1201
 
1202 1202
 
1203
-		if ( !empty( $term ) ) {
1203
+		if ( ! empty($term)) {
1204 1204
 			$this->_category->category_name = $term->name;
1205 1205
 			$this->_category->category_identifier = $term->slug;
1206 1206
 			$this->_category->category_desc = $term->description;
@@ -1214,14 +1214,14 @@  discard block
 block discarded – undo
1214 1214
 
1215 1215
 	private function _set_empty_category_object() {
1216 1216
 		$this->_category = new stdClass();
1217
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1217
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1218 1218
 		$this->_category->id = $this->_category->parent = 0;
1219 1219
 	}
1220 1220
 
1221 1221
 
1222 1222
 
1223 1223
 	protected function _category_list_table() {
1224
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1224
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1225 1225
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1226 1226
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1227 1227
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1231,21 +1231,21 @@  discard block
 block discarded – undo
1231 1231
 	protected function _category_details($view) {
1232 1232
 
1233 1233
 		//load formatter helper
1234
-		EE_Registry::instance()->load_helper( 'Formatter' );
1234
+		EE_Registry::instance()->load_helper('Formatter');
1235 1235
 		//load field generator helper
1236
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
1236
+		EE_Registry::instance()->load_helper('Form_Fields');
1237 1237
 
1238 1238
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
1239 1239
 		$this->_set_add_edit_form_tags($route);
1240 1240
 
1241 1241
 		$this->_set_category_object();
1242
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1242
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1243 1243
 
1244 1244
 		$delete_action = 'delete_category';
1245 1245
 
1246
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1246
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1247 1247
 
1248
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1248
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1249 1249
 
1250 1250
 		//take care of contents
1251 1251
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1259,25 +1259,25 @@  discard block
 block discarded – undo
1259 1259
 			'type' => 'wp_editor',
1260 1260
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1261 1261
 			'class' => 'my_editor_custom',
1262
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1262
+			'wpeditor_args' => array('media_buttons' => FALSE)
1263 1263
 		);
1264
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1264
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1265 1265
 
1266
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1266
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1267 1267
 
1268 1268
 		//setup category select for term parents.
1269 1269
 		$category_select_values[] = array(
1270 1270
 			'text' => __('No Parent', 'event_espresso'),
1271 1271
 			'id' => 0
1272 1272
 			);
1273
-		foreach ( $all_terms as $term ) {
1273
+		foreach ($all_terms as $term) {
1274 1274
 			$category_select_values[] = array(
1275 1275
 				'text' => $term->name,
1276 1276
 				'id' => $term->term_id
1277 1277
 				);
1278 1278
 		}
1279 1279
 
1280
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1280
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1281 1281
 		$template_args = array(
1282 1282
 			'category' => $this->_category,
1283 1283
 			'category_select' => $category_select,
@@ -1286,15 +1286,15 @@  discard block
 block discarded – undo
1286 1286
 			'disable' => '',
1287 1287
 			'disabled_message' =>FALSE
1288 1288
 			);
1289
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1290
-		return EEH_Template::display_template($template, $template_args, TRUE );
1289
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1290
+		return EEH_Template::display_template($template, $template_args, TRUE);
1291 1291
 	}
1292 1292
 
1293 1293
 
1294 1294
 	protected function _delete_categories() {
1295
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1295
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1296 1296
 
1297
-		foreach ( $cat_ids as $cat_id ) {
1297
+		foreach ($cat_ids as $cat_id) {
1298 1298
 			$this->_delete_category($cat_id);
1299 1299
 		}
1300 1300
 
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
 		$query_args = array(
1303 1303
 			'action' => 'category_list'
1304 1304
 			);
1305
-		$this->_redirect_after_action(0,'','',$query_args);
1305
+		$this->_redirect_after_action(0, '', '', $query_args);
1306 1306
 
1307 1307
 	}
1308 1308
 
@@ -1311,58 +1311,58 @@  discard block
 block discarded – undo
1311 1311
 
1312 1312
 
1313 1313
 	protected function _delete_category($cat_id) {
1314
-		$cat_id = absint( $cat_id );
1315
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1314
+		$cat_id = absint($cat_id);
1315
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1316 1316
 	}
1317 1317
 
1318 1318
 
1319 1319
 
1320 1320
 	protected function _insert_or_update_category($new_category) {
1321 1321
 
1322
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1322
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1323 1323
 		$success = 0; //we already have a success message so lets not send another.
1324
-		if ( $cat_id ) {
1324
+		if ($cat_id) {
1325 1325
 			$query_args = array(
1326 1326
 				'action'     => 'edit_category',
1327 1327
 				'EVT_CAT_ID' => $cat_id
1328 1328
 			);
1329 1329
 		} else {
1330
-			$query_args = array( 'action' => 'add_category' );
1330
+			$query_args = array('action' => 'add_category');
1331 1331
 		}
1332
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1332
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1333 1333
 
1334 1334
 	}
1335 1335
 
1336 1336
 
1337 1337
 
1338
-	private function _insert_category( $update = FALSE ) {
1338
+	private function _insert_category($update = FALSE) {
1339 1339
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1340
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1341
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1342
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1340
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1341
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1342
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1343 1343
 
1344
-		if ( empty( $category_name ) ) {
1345
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1346
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1344
+		if (empty($category_name)) {
1345
+			$msg = __('You must add a name for the category.', 'event_espresso');
1346
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1347 1347
 			return false;
1348 1348
 		}
1349 1349
 
1350 1350
 
1351
-		$term_args=array(
1351
+		$term_args = array(
1352 1352
 			'name'=>$category_name,
1353 1353
 			'description'=>$category_desc,
1354 1354
 			'parent'=>$category_parent
1355 1355
 		);
1356 1356
 
1357
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1357
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1358 1358
 
1359
-		if ( !is_array( $insert_ids ) ) {
1360
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1361
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1359
+		if ( ! is_array($insert_ids)) {
1360
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1361
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1362 1362
 		} else {
1363 1363
 			$cat_id = $insert_ids['term_id'];
1364
-			$msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name );
1365
-			EE_Error::add_success( $msg );
1364
+			$msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name);
1365
+			EE_Error::add_success($msg);
1366 1366
 		}
1367 1367
 
1368 1368
 		return $cat_id;
@@ -1382,12 +1382,12 @@  discard block
 block discarded – undo
1382 1382
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1383 1383
 			);
1384 1384
 
1385
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1385
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1386 1386
 
1387
-		EE_Registry::instance()->load_helper( 'File' );
1388
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1389
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1390
-			$EE_Export = EE_Export::instance( $this->_req_data );
1387
+		EE_Registry::instance()->load_helper('File');
1388
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1389
+			require_once(EE_CLASSES.'EE_Export.class.php');
1390
+			$EE_Export = EE_Export::instance($this->_req_data);
1391 1391
 			$EE_Export->export();
1392 1392
 		}
1393 1393
 
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 
1400 1400
 	protected function _import_categories() {
1401 1401
 
1402
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1402
+		require_once(EE_CLASSES.'EE_Import.class.php');
1403 1403
 		EE_Import::instance()->import();
1404 1404
 
1405 1405
 	}
@@ -1407,29 +1407,29 @@  discard block
 block discarded – undo
1407 1407
 
1408 1408
 
1409 1409
 
1410
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1410
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1411 1411
 
1412 1412
 		//testing term stuff
1413
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1414
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1415
-		$limit = ($current_page-1)*$per_page;
1416
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1417
-		if ( isset( $this->_req_data['s'] ) ) {
1418
-			$sstr = '%' . $this->_req_data['s'] . '%';
1413
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1414
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1415
+		$limit = ($current_page - 1) * $per_page;
1416
+		$where = array('taxonomy' => 'espresso_venue_categories');
1417
+		if (isset($this->_req_data['s'])) {
1418
+			$sstr = '%'.$this->_req_data['s'].'%';
1419 1419
 			$where['OR'] = array(
1420
-				'Term.name' => array( 'LIKE', $sstr),
1421
-				'description' => array( 'LIKE', $sstr )
1420
+				'Term.name' => array('LIKE', $sstr),
1421
+				'description' => array('LIKE', $sstr)
1422 1422
 				);
1423 1423
 		}
1424 1424
 
1425 1425
 		$query_params = array(
1426 1426
 			$where,
1427
-			'order_by' => array( $orderby => $order ),
1428
-			'limit' => $limit . ',' . $per_page,
1427
+			'order_by' => array($orderby => $order),
1428
+			'limit' => $limit.','.$per_page,
1429 1429
 			'force_join' => array('Term')
1430 1430
 			);
1431 1431
 
1432
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1432
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1433 1433
 
1434 1434
 		return $categories;
1435 1435
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 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
@@ -893,8 +894,9 @@  discard block
 block discarded – undo
893 894
 		}
894 895
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
895 896
 
896
-		if ( $redirect_after )
897
-			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
897
+		if ( $redirect_after ) {
898
+					$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
899
+		}
898 900
 
899 901
 	}
900 902
 
@@ -1013,8 +1015,9 @@  discard block
 block discarded – undo
1013 1015
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1014 1016
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1015 1017
 		}
1016
-		if ( $redirect_after )
1017
-			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1018
+		if ( $redirect_after ) {
1019
+					$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1020
+		}
1018 1021
 	}
1019 1022
 
1020 1023
 
@@ -1185,8 +1188,10 @@  discard block
 block discarded – undo
1185 1188
 	 * @return void
1186 1189
 	 */
1187 1190
 	private function _set_category_object() {
1188
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1189
-			return; //already have the category object so get out.
1191
+		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) {
1192
+					return;
1193
+		}
1194
+		//already have the category object so get out.
1190 1195
 
1191 1196
 		//set default category object
1192 1197
 		$this->_set_empty_category_object();
Please login to merge, or discard this patch.
caffeinated/brewing_regular.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 	/**
57 57
 	 * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths
58 58
 	 * @param array  $paths original helper paths array
59
-	 * @return array             new array of paths
59
+	 * @return string[]             new array of paths
60 60
 	 */
61 61
 	public function caf_helper_paths( $paths ) {
62 62
 		$paths[] = EE_CAF_CORE . 'helpers' . DS;
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -25,30 +25,30 @@  discard block
 block discarded – undo
25 25
  * ------------------------------------------------------------------------
26 26
  */
27 27
 // defined some new constants related to caffeinated folder
28
-define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' );
29
-define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS);
30
-define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS);
31
-define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS );
28
+define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/');
29
+define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS);
30
+define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS);
31
+define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS);
32 32
 class EE_Brewing_Regular extends EE_Base {
33 33
 
34 34
 	public function __construct() {
35
-		if ( defined( 'EE_CAFF_PATH' )) {
35
+		if (defined('EE_CAFF_PATH')) {
36 36
 			// activation
37
-			add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' ));
37
+			add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content'));
38 38
 			// load caff init
39
-			add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' ));
39
+			add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init'));
40 40
 			// make it so the PDF receipt doesn't show our shameless plug
41
-			add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' );
41
+			add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false');
42 42
 			// add caffeinated modules
43
-			add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' ));
43
+			add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register'));
44 44
 			// load caff scripts
45
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 );
45
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10);
46 46
 
47
-			add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 );
47
+			add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10);
48 48
 
49
-			add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) );
49
+			add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods'));
50 50
 			// caffeinated constructed
51
-			do_action( 'AHEE__EE_Brewing_Regular__construct__complete' );
51
+			do_action('AHEE__EE_Brewing_Regular__construct__complete');
52 52
 		}
53 53
 	}
54 54
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 * @param array  $paths original helper paths array
59 59
 	 * @return array             new array of paths
60 60
 	 */
61
-	public function caf_helper_paths( $paths ) {
62
-		$paths[] = EE_CAF_CORE . 'helpers' . DS;
61
+	public function caf_helper_paths($paths) {
62
+		$paths[] = EE_CAF_CORE.'helpers'.DS;
63 63
 		return $paths;
64 64
 	}
65 65
 
@@ -75,22 +75,22 @@  discard block
 block discarded – undo
75 75
 	 * Right now, we ASSUME the only price types in the system are default ones
76 76
 	 * @global type $wpdb
77 77
 	 */
78
-	function initialize_caf_db_content(){
78
+	function initialize_caf_db_content() {
79 79
 //		echo "initialize caf db content!";
80 80
 		global $wpdb;
81 81
 
82 82
 		//use same method of getting creator id as the version introducing the change
83
-		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id());
83
+		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id());
84 84
 
85 85
 		$price_type_table = $wpdb->prefix."esp_price_type";
86 86
 		$price_table = $wpdb->prefix."esp_price";
87 87
 
88 88
 		if ($wpdb->get_var("SHOW TABLES LIKE '$price_type_table'") == $price_type_table) {
89 89
 
90
-			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types
91
-			$tax_price_type_count = $wpdb->get_var( $SQL );
90
+			$SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types
91
+			$tax_price_type_count = $wpdb->get_var($SQL);
92 92
 
93
-			if ( $tax_price_type_count <= 1) {
93
+			if ($tax_price_type_count <= 1) {
94 94
 				$result = $wpdb->insert($price_type_table,
95 95
 						array(
96 96
 							'PRT_name'=>  __("Regional Tax", "event_espresso"),
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 							'PRT_wp_user' => $default_creator_id
102 102
 						),
103 103
 						array(
104
-							'%s',//PRT_name
105
-							'%d',//PBT_id
106
-							'%d',//PRT_is_percent
107
-							'%d',//PRT_order
108
-							'%d',//PRT_deleted
104
+							'%s', //PRT_name
105
+							'%d', //PBT_id
106
+							'%d', //PRT_is_percent
107
+							'%d', //PRT_order
108
+							'%d', //PRT_deleted
109 109
 							'%d', //PRT_wp_user
110 110
 						));
111 111
 				//federal tax
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 							'PRT_wp_user' => $default_creator_id,
120 120
 						),
121 121
 						array(
122
-							'%s',//PRT_name
123
-							'%d',//PBT_id
124
-							'%d',//PRT_is_percent
125
-							'%d',//PRT_order
126
-							'%d',//PRT_deleted
122
+							'%s', //PRT_name
123
+							'%d', //PBT_id
124
+							'%d', //PRT_is_percent
125
+							'%d', //PRT_order
126
+							'%d', //PRT_deleted
127 127
 							'%d' //PRT_wp_user
128 128
 						));
129
-				if( $result){
129
+				if ($result) {
130 130
 					$wpdb->insert($price_table,
131 131
 							array(
132 132
 								'PRT_ID'=>$wpdb->insert_id,
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 								'PRC_wp_user' => $default_creator_id
142 142
 							),
143 143
 							array(
144
-								'%d',//PRT_id
145
-								'%f',//PRC_amount
146
-								'%s',//PRC_name
147
-								'%s',//PRC_desc
148
-								'%d',//PRC_is_default
149
-								'%d',//PRC_overrides
150
-								'%d',//PRC_deleted
151
-								'%d',//PRC_order
152
-								'%d',//PRC_parent
144
+								'%d', //PRT_id
145
+								'%f', //PRC_amount
146
+								'%s', //PRC_name
147
+								'%s', //PRC_desc
148
+								'%d', //PRC_is_default
149
+								'%d', //PRC_overrides
150
+								'%d', //PRC_deleted
151
+								'%d', //PRC_order
152
+								'%d', //PRC_parent
153 153
 								'%d' //PRC_wp_user
154 154
 							));
155 155
 				}
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 	 *  	@param array $modules_to_register
170 170
 	 *  	@return array
171 171
 	 */
172
-	public function caffeinated_modules_to_register( $modules_to_register = array() ){
173
-		if ( is_readable( EE_CAFF_PATH . 'modules' )) {
174
-			$caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR );
175
-			if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) {
176
-				$modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register );
172
+	public function caffeinated_modules_to_register($modules_to_register = array()) {
173
+		if (is_readable(EE_CAFF_PATH.'modules')) {
174
+			$caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR);
175
+			if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) {
176
+				$modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register);
177 177
 			}
178 178
 		}
179 179
 		return $modules_to_register;
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 
182 182
 
183 183
 
184
-	public function caffeinated_init(){
184
+	public function caffeinated_init() {
185 185
 		// EE_Register_CPTs hooks
186
-		add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 );
187
-		add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 );
188
-		add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 );
189
-		EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE );
186
+		add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10);
187
+		add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10);
188
+		add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10);
189
+		EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE);
190 190
 		// caffeinated_init__complete hook
191
-		do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' );
191
+		do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete');
192 192
 	}
193 193
 
194 194
 
195 195
 
196
-	public function enqueue_caffeinated_scripts(){
196
+	public function enqueue_caffeinated_scripts() {
197 197
 		// sound of crickets...
198 198
 	}
199 199
 
@@ -202,23 +202,23 @@  discard block
 block discarded – undo
202 202
 	 * callbacks below here
203 203
 	 */
204 204
 
205
-	public function filter_taxonomies( $taxonomy_array ) {
205
+	public function filter_taxonomies($taxonomy_array) {
206 206
 		$taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE;
207 207
 		return $taxonomy_array;
208 208
 	}
209 209
 
210 210
 
211 211
 
212
-	public function filter_cpts( $cpt_array ) {
212
+	public function filter_cpts($cpt_array) {
213 213
 		$cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE;
214 214
 		return $cpt_array;
215 215
 	}
216 216
 
217 217
 
218
-	public function nav_metabox_items( $menuitems ) {
218
+	public function nav_metabox_items($menuitems) {
219 219
 		$menuitems[] = array(
220 220
 			'title' => __('Venue List', 'event_espresso'),
221
-			'url' => get_post_type_archive_link( 'espresso_venues' ),
221
+			'url' => get_post_type_archive_link('espresso_venues'),
222 222
 			'description' => __('Archive page for all venues.', 'event_espresso')
223 223
 			);
224 224
 		return $menuitems;
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 	 * @param array $payment_method_paths
230 230
 	 * @return array values are folder paths to payment method folders
231 231
 	 */
232
-	public function caf_payment_methods( $payment_method_paths ) {
233
-		$caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
234
-		$payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths );
232
+	public function caf_payment_methods($payment_method_paths) {
233
+		$caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
234
+		$payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths);
235 235
 		return $payment_method_paths;
236 236
 	}
237 237
 }
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
  * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE related to caffeinated (regular) use.  Before putting any code in here, First be certain that it isn't better to define and use the hook in a specific caffeinated/whatever class or file.
4 6
  */
Please login to merge, or discard this patch.
caffeinated/EE_Caf_Messages.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 	/**
73 73
 	 * This just allows us to add additional paths to the autoloader (EED_Messages::autoload_messages()) for the messages system.
74 74
 	 * @param  array  $dir_ref original array of paths
75
-	 * @return array           appended paths
75
+	 * @return string[]           appended paths
76 76
 	 */
77 77
 	public function messages_autoload_paths( $dir_ref ) {
78 78
 		$dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/';
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @since            4.3.2
16 16
  * @author          Darren Ethier
17 17
  */
18
-class EE_Caf_Messages  {
18
+class EE_Caf_Messages {
19 19
 
20 20
 
21 21
 	/**
@@ -34,36 +34,36 @@  discard block
 block discarded – undo
34 34
 	 * @return void
35 35
 	 */
36 36
 	private function _caf_hooks() {
37
-		add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array( $this, 'messages_autoload_paths'), 5 );
38
-		add_filter('FHEE__EE_Email_messenger__get_validator_config', array( $this, 'email_messenger_validator_config'), 5, 2 );
39
-		add_filter('FHEE__EE_Email_messenger__get_template_fields', array( $this, 'email_messenger_template_fields'), 5, 2 );
40
-		add_filter( 'FHEE__EE_Html_messenger__get_template_fields', array( $this, 'html_messenger_template_fields' ), 5, 2 );
41
-		add_filter( 'FHEE__EE_Html_messenger__get_validator_config', array( $this, 'html_messenger_validator_config' ), 5, 2 );
42
-		add_filter( 'FHEE__EE_Pdf_messenger__get_template_fields', array( $this, 'pdf_messenger_template_fields' ), 5, 2 );
43
-		add_filter( 'FHEE__EE_Pdf_messenger__get_validator_config', array( $this, 'pdf_messenger_validator_config' ), 5, 2 );
44
-		add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array( $this, 'new_default_templates'), 5, 7 );
45
-		add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array( $this, 'message_types_valid_shortcodes'), 5, 2 );
37
+		add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5);
38
+		add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), 5, 2);
39
+		add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, 2);
40
+		add_filter('FHEE__EE_Html_messenger__get_template_fields', array($this, 'html_messenger_template_fields'), 5, 2);
41
+		add_filter('FHEE__EE_Html_messenger__get_validator_config', array($this, 'html_messenger_validator_config'), 5, 2);
42
+		add_filter('FHEE__EE_Pdf_messenger__get_template_fields', array($this, 'pdf_messenger_template_fields'), 5, 2);
43
+		add_filter('FHEE__EE_Pdf_messenger__get_validator_config', array($this, 'pdf_messenger_validator_config'), 5, 2);
44
+		add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array($this, 'new_default_templates'), 5, 7);
45
+		add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, 2);
46 46
 
47 47
 		//shortcode parsers
48
-		add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array( $this, 'additional_attendee_shortcodes'), 5, 2 );
49
-		add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array( $this, 'additional_attendee_parser'), 5, 5 );
50
-		add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array( $this, 'additional_recipient_details_shortcodes'), 5, 2 );
51
-		add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array( $this, 'additional_recipient_details_parser'), 5, 5 );
52
-		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array( $this, 'additional_primary_registration_details_shortcodes'), 5, 2 );
53
-		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array( $this, 'additional_primary_registration_details_parser'), 5, 5 );
48
+		add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2);
49
+		add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5);
50
+		add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array($this, 'additional_recipient_details_shortcodes'), 5, 2);
51
+		add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array($this, 'additional_recipient_details_parser'), 5, 5);
52
+		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array($this, 'additional_primary_registration_details_shortcodes'), 5, 2);
53
+		add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array($this, 'additional_primary_registration_details_parser'), 5, 5);
54 54
 
55 55
 		/**
56 56
 		 * @since 4.2.0
57 57
 		 */
58
-		add_filter( 'FHEE__EE_Datetime_Shortcodes__shortcodes', array( $this, 'additional_datetime_shortcodes'), 10, 2 );
59
-		add_filter( 'FHEE__EE_Datetime_Shortcodes__parser_after', array( $this, 'additional_datetime_parser'), 10, 5 );
58
+		add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2);
59
+		add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5);
60 60
 
61 61
 		/**
62 62
 		 * @since 4.3.0
63 63
 		 */
64 64
 		//eat our own dog food!
65
-		add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_message_types' ) );
66
-		add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_shortcodes' ) );
65
+		add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types'));
66
+		add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes'));
67 67
 		do_action('EE_Brewing_Regular___messages_caf');
68 68
 	}
69 69
 
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 * @param  array  $dir_ref original array of paths
75 75
 	 * @return array           appended paths
76 76
 	 */
77
-	public function messages_autoload_paths( $dir_ref ) {
78
-		$dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/';
77
+	public function messages_autoload_paths($dir_ref) {
78
+		$dir_ref[] = EE_CAF_LIBRARIES.'shortcodes/';
79 79
 		return $dir_ref;
80 80
 	}
81 81
 
82 82
 
83 83
 
84
-	public function email_messenger_validator_config( $validator_config, EE_Email_messenger $messenger ) {
84
+	public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) {
85 85
 		$validator_config['attendee_list'] = array(
86 86
 				'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'),
87 87
 				'required' => array('[ATTENDEE_LIST]')
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 
97 97
 
98
-	public function html_messenger_validator_config( $validator_config, EE_Html_messenger $messenger ) {
98
+	public function html_messenger_validator_config($validator_config, EE_Html_messenger $messenger) {
99 99
 		$validator_config['attendee_list'] = array(
100 100
 			'shortcodes' => array('attendee', 'question_list'),
101 101
 			'required' => array('[ATTENDEE_LIST]')
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 
111 111
 
112
-	public function pdf_messenger_validator_config( $validator_config, EE_Pdf_messenger $messenger ) {
112
+	public function pdf_messenger_validator_config($validator_config, EE_Pdf_messenger $messenger) {
113 113
 		$validator_config['attendee_list'] = array(
114 114
 			'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'),
115 115
 			'required' => array('[ATTENDEE_LIST]')
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 
126 126
 
127
-	public function email_messenger_template_fields( $template_fields, EE_Email_messenger $messenger ) {
127
+	public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) {
128 128
 		$template_fields['extra']['content']['question_list'] = array(
129 129
 						'input' => 'textarea',
130 130
 						'label' => '[QUESTION_LIST]',
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 
142 142
 
143
-	public function html_messenger_template_fields( $template_fields, EE_Html_messenger $messenger ) {
143
+	public function html_messenger_template_fields($template_fields, EE_Html_messenger $messenger) {
144 144
 		$template_fields['extra']['content']['question_list'] = array(
145 145
 			'input' => 'textarea',
146 146
 			'label' => '[QUESTION_LIST]',
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
 
159 159
 
160
-	public function pdf_messenger_template_fields( $template_fields, EE_Pdf_messenger $messenger ) {
160
+	public function pdf_messenger_template_fields($template_fields, EE_Pdf_messenger $messenger) {
161 161
 		$template_fields['extra']['content']['question_list'] = array(
162 162
 			'input' => 'textarea',
163 163
 			'label' => '[QUESTION_LIST]',
@@ -174,39 +174,39 @@  discard block
 block discarded – undo
174 174
 
175 175
 
176 176
 
177
-	public function new_default_templates( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack  ) {
177
+	public function new_default_templates($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) {
178 178
 
179 179
 		//we're only modifying templates for the default template pack
180
-		if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default ) {
180
+		if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) {
181 181
 			return $contents;
182 182
 		}
183 183
 
184 184
 		//the template file name we're replacing contents for.
185
-		$template_file_prefix = $field . '_' . $context;
186
-		$msg_prefix = $messenger->name . '_' . $message_type->name . '_' ;
185
+		$template_file_prefix = $field.'_'.$context;
186
+		$msg_prefix = $messenger->name.'_'.$message_type->name.'_';
187 187
 
188
-		$base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/';
188
+		$base_path = EE_CAF_LIBRARIES.'messages/defaults/default/';
189 189
 
190
-		if ( $messenger->name == 'email' && $message_type->name == 'registration' ) {
190
+		if ($messenger->name == 'email' && $message_type->name == 'registration') {
191 191
 
192
-			switch ( $template_file_prefix ) {
192
+			switch ($template_file_prefix) {
193 193
 
194 194
 				case 'question_list_admin' :
195 195
 				case 'question_list_attendee' :
196 196
 				case 'question_list_primary_attendee' :
197
-					$path = $base_path . $msg_prefix . 'question_list.template.php';
198
-					$contents = EEH_Template::display_template( $path, array(), true );
197
+					$path = $base_path.$msg_prefix.'question_list.template.php';
198
+					$contents = EEH_Template::display_template($path, array(), true);
199 199
 					break;
200 200
 
201 201
 				case 'attendee_list_primary_attendee' :
202
-					$path = $base_path . $msg_prefix . 'attendee_list.template.php';
203
-					$contents = EEH_Template::display_template( $path, array(), true );
202
+					$path = $base_path.$msg_prefix.'attendee_list.template.php';
203
+					$contents = EEH_Template::display_template($path, array(), true);
204 204
 					break;
205 205
 
206 206
 				case 'attendee_list_admin' :
207
-					$path = $base_path . $msg_prefix . 'attendee_list_admin.template.php';
208
-					$contents = EEH_Template::display_template( $path,
209
-						array(), true );
207
+					$path = $base_path.$msg_prefix.'attendee_list_admin.template.php';
208
+					$contents = EEH_Template::display_template($path,
209
+						array(), true);
210 210
 					break;
211 211
 
212 212
 				case 'attendee_list_attendee' :
@@ -214,33 +214,33 @@  discard block
 block discarded – undo
214 214
 					break;
215 215
 
216 216
 				case 'event_list_attendee' :
217
-					$path = $base_path . $msg_prefix . 'event_list_attendee.template.php';
218
-					$contents = EEH_Template::display_template( $path, array(), true );
217
+					$path = $base_path.$msg_prefix.'event_list_attendee.template.php';
218
+					$contents = EEH_Template::display_template($path, array(), true);
219 219
 					break;
220 220
 			}
221
-		} elseif ( $messenger->name == 'email' && $message_type->name == 'newsletter' ) {
222
-			switch( $template_file_prefix ) {
221
+		} elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') {
222
+			switch ($template_file_prefix) {
223 223
 
224 224
 				case 'content_attendee' :
225
-					$path = $base_path . $msg_prefix . 'content.template.php';
226
-					$contents = EEH_Template::display_template( $path, array(), true );
225
+					$path = $base_path.$msg_prefix.'content.template.php';
226
+					$contents = EEH_Template::display_template($path, array(), true);
227 227
 					break;
228 228
 
229 229
 				case 'newsletter_content_attendee' :
230
-					$path = $base_path . $msg_prefix . 'newsletter_content.template.php';
231
-					$contents = EEH_Template::display_template( $path, array(), true );
230
+					$path = $base_path.$msg_prefix.'newsletter_content.template.php';
231
+					$contents = EEH_Template::display_template($path, array(), true);
232 232
 					break;
233 233
 
234 234
 				case 'newsletter_subject_attendee' :
235
-					$path = $base_path . $msg_prefix . 'subject.template.php';
236
-					$contents = EEH_Template::display_template( $path, array(), true );
235
+					$path = $base_path.$msg_prefix.'subject.template.php';
236
+					$contents = EEH_Template::display_template($path, array(), true);
237 237
 					break;
238 238
 			}
239
-		} elseif ( $messenger->name == 'html' && $message_type->name == 'receipt' ) {
240
-			switch  ( $template_file_prefix ) {
239
+		} elseif ($messenger->name == 'html' && $message_type->name == 'receipt') {
240
+			switch ($template_file_prefix) {
241 241
 				case 'attendee_list_purchaser' :
242
-					$path = $base_path . $msg_prefix . 'attendee_list.template.php';
243
-					$contents = EEH_Template::display_template( $path, array(), true );
242
+					$path = $base_path.$msg_prefix.'attendee_list.template.php';
243
+					$contents = EEH_Template::display_template($path, array(), true);
244 244
 					break;
245 245
 			}
246 246
 		}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 
253 253
 
254
-	public function message_types_valid_shortcodes( $valid_shortcodes, EE_Messages_Base $msg ) {
254
+	public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) {
255 255
 		//make sure question_list and question are ONLY added for the core message types.  Any other message types will have to explicitly set question_list as a valid shortcode.
256 256
 		$include_with = array(
257 257
 			'registration',
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 			'invoice',
269 269
 			'receipt'
270 270
 			);
271
-		if ( $msg instanceof EE_message_type && in_array( $msg->name, $include_with )) {
271
+		if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) {
272 272
 			$contexts = array_keys($msg->get_contexts());
273
-				foreach ( $contexts as $context ) {
273
+				foreach ($contexts as $context) {
274 274
 					$valid_shortcodes[$context][] = 'question_list';
275 275
 					$valid_shortcodes[$context][] = 'question';
276 276
 				}
@@ -282,35 +282,35 @@  discard block
 block discarded – undo
282 282
 
283 283
 
284 284
 
285
-	public function additional_attendee_shortcodes( $shortcodes, $shortcode_parser ) {
285
+	public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) {
286 286
 		$shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', 'event_espresso');
287 287
 		return $shortcodes;
288 288
 	}
289 289
 
290 290
 
291 291
 
292
-	public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
292
+	public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
293 293
 
294
-		if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) )
294
+		if (strpos($shortcode, '[ANSWER_*') === FALSE || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations))
295 295
 			return $parsed;
296 296
 
297 297
 		//let's get the question from the code.
298 298
 		$shortcode = str_replace('[ANSWER_*', '', $shortcode);
299
-		$shortcode = trim( str_replace(']', '', $shortcode) );
299
+		$shortcode = trim(str_replace(']', '', $shortcode));
300 300
 
301 301
 		$registration = $data instanceof EE_Registration ? $data : null;
302
-		$registration = ! $registration instanceof EE_Registration && is_array( $extra_data ) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration;
302
+		$registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration;
303 303
 
304 304
 		$aee = $data instanceof EE_Messages_Addressee ? $data : null;
305
-		$aee = ! $aee instanceof EE_Messages_Addressee && is_array( $extra_data ) && isset( $extra_data['data'] ) ? $extra_data['data'] : $aee;
305
+		$aee = ! $aee instanceof EE_Messages_Addressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee;
306 306
 
307
-		if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee ) {
307
+		if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) {
308 308
 			return $parsed;
309 309
 		}
310 310
 
311 311
 		//now let's figure out which question has this text.
312
-		foreach ( $aee->questions as $ansid => $question ) {
313
-			if ( $question instanceof EE_Question && $question->display_text() == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) {
312
+		foreach ($aee->questions as $ansid => $question) {
313
+			if ($question instanceof EE_Question && $question->display_text() == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid])) {
314 314
 				return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop');
315 315
 			}
316 316
 		}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @return array                   						array of shortcodes and
333 333
 	 *                                             			descriptions
334 334
 	 */
335
-	public function additional_datetime_shortcodes( $shortcodes, $shortcode_parser ) {
335
+	public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) {
336 336
 		$shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', 'event_espresso');
337 337
 		$shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', 'event_espresso');
338 338
 		$shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', 'event_espresso');
@@ -354,13 +354,13 @@  discard block
 block discarded – undo
354 354
 	 * @param  EE_Datetime_Shortcodes $shortcode_parser
355 355
 	 * @return string                   The new parsed string.
356 356
 	 */
357
-	public function additional_datetime_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
357
+	public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
358 358
 
359
-		if ( ! $data instanceof EE_Datetime ) {
359
+		if ( ! $data instanceof EE_Datetime) {
360 360
 			return ''; //get out because we can only parse with the datetime object.
361 361
 		}
362 362
 
363
-		switch ( $shortcode ) {
363
+		switch ($shortcode) {
364 364
 			case '[DTT_NAME]' :
365 365
 				return $data->name();
366 366
 				break;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 				return $data->description();
369 369
 				break;
370 370
 			case '[DTT_NAME_OR_DATES]' :
371
-				return $data->get_dtt_display_name( TRUE );
371
+				return $data->get_dtt_display_name(TRUE);
372 372
 				break;
373 373
 			default :
374 374
 				return $parsed;
@@ -380,40 +380,40 @@  discard block
 block discarded – undo
380 380
 
381 381
 
382 382
 
383
-	public function additional_recipient_details_shortcodes( $shortcodes, $shortcode_parser ) {
383
+	public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) {
384 384
 		$shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', 'event_espresso');
385 385
 		return $shortcodes;
386 386
 	}
387 387
 
388 388
 
389
-	public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
389
+	public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
390 390
 
391
-		if ( array($data) && ! isset( $data['data'] ) )
391
+		if (array($data) && ! isset($data['data']))
392 392
 			return $parsed;
393 393
 
394 394
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
395
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
395
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
396 396
 
397
-		if ( ! $recipient instanceof EE_Messages_Addressee )
397
+		if ( ! $recipient instanceof EE_Messages_Addressee)
398 398
 			return $parsed;
399 399
 
400
-		switch ( $shortcode ) {
400
+		switch ($shortcode) {
401 401
 			case '[RECIPIENT_QUESTION_LIST]' :
402 402
 				$att = $recipient->att_obj;
403 403
 				$registrations_on_attendee = $att instanceof EE_Attendee ? $recipient->attendees[$att->ID()]['reg_objs'] : array();
404
-				$registrations_on_attendee = empty( $registrations_on_attendee ) && $recipient->reg_obj instanceof EE_Registration ? array( $recipient->reg_obj ) : $registrations_on_attendee;
404
+				$registrations_on_attendee = empty($registrations_on_attendee) && $recipient->reg_obj instanceof EE_Registration ? array($recipient->reg_obj) : $registrations_on_attendee;
405 405
 				$answers = array();
406 406
 
407
-				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
407
+				$template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
408 408
 				$valid_shortcodes = array('question');
409 409
 
410 410
 				//if the context is main_content then get all answers for all registrations on this attendee
411
-				if ( $data['data'] instanceof EE_Messages_Addressee ) {
412
-					foreach ( $registrations_on_attendee as $reg ) {
413
-						if ( $reg instanceof EE_Registration ) {
414
-							$anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
415
-							foreach( $anss as $ans ) {
416
-								if ( $ans instanceof EE_Answer ) {
411
+				if ($data['data'] instanceof EE_Messages_Addressee) {
412
+					foreach ($registrations_on_attendee as $reg) {
413
+						if ($reg instanceof EE_Registration) {
414
+							$anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
415
+							foreach ($anss as $ans) {
416
+								if ($ans instanceof EE_Answer) {
417 417
 									$answers[$ans->ID()] = $ans;
418 418
 								}
419 419
 							}
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 				}
423 423
 
424 424
 				//if the context is the event list parser, then let's return just the answers for all registrations attached to the recipient for that event.
425
-				if ( $data['data'] instanceof EE_Event ) {
425
+				if ($data['data'] instanceof EE_Event) {
426 426
 					$event = $data['data'];
427
-					foreach( $registrations_on_attendee as $reg ) {
428
-						if ( $reg instanceof EE_Registration && $reg->event_ID() == $event->ID() ) {
429
-							$anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
430
-							foreach( $anss as $ans ) {
431
-								if ( $ans instanceof EE_Answer ) {
427
+					foreach ($registrations_on_attendee as $reg) {
428
+						if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) {
429
+							$anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array();
430
+							foreach ($anss as $ans) {
431
+								if ($ans instanceof EE_Answer) {
432 432
 									$answers[$ans->ID()] = $ans;
433 433
 								}
434 434
 							}
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
 
439 439
 				$question_list = '';
440 440
 				$shortcode_helper = $shortcode_parser->get_shortcode_helper();
441
-				foreach ( $answers as $answer ) {
442
-					if ( $answer instanceof EE_Answer ) {
441
+				foreach ($answers as $answer) {
442
+					if ($answer instanceof EE_Answer) {
443 443
 						$question = $answer->question();
444
-						if ( ! $question instanceof EE_Question || ( $question instanceof EE_Question && $question->admin_only() ) ) {
444
+						if ( ! $question instanceof EE_Question || ($question instanceof EE_Question && $question->admin_only())) {
445 445
 							continue;
446 446
 						}
447
-						$question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $extra_data);
447
+						$question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $extra_data);
448 448
 					}
449 449
 				}
450 450
 				return $question_list;
@@ -457,41 +457,41 @@  discard block
 block discarded – undo
457 457
 	}
458 458
 
459 459
 
460
-	public function additional_primary_registration_details_shortcodes( $shortcodes, $shortcode_parser ) {
460
+	public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) {
461 461
 		$shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', 'event_espresso');
462 462
 		return $shortcodes;
463 463
 	}
464 464
 
465 465
 
466
-	public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
467
-		if ( array($data) && ! isset( $data['data'] ) )
466
+	public function additional_primary_registration_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) {
467
+		if (array($data) && ! isset($data['data']))
468 468
 			return $parsed;
469 469
 
470 470
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
471
-		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
471
+		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
472 472
 
473
-		if ( ! $recipient instanceof EE_Messages_Addressee )
473
+		if ( ! $recipient instanceof EE_Messages_Addressee)
474 474
 			return $parsed;
475 475
 
476 476
 		$send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data;
477 477
 
478
-		switch ( $shortcode ) {
478
+		switch ($shortcode) {
479 479
 			case '[RECIPIENT_QUESTION_LIST]' :
480
-				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration )
480
+				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration)
481 481
 					return '';
482 482
 				$registration = $recipient->primary_reg_obj;
483
-				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
483
+				$template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
484 484
 				$valid_shortcodes = array('question');
485 485
 				$shortcode_helper = $shortcode_parser->get_shortcode_helper();
486 486
 				$answers = $recipient->registrations[$registration->ID()]['ans_objs'];
487 487
 				$question_list = '';
488
-				foreach ( $answers as $answer ) {
489
-					if ( $answer instanceof EE_Answer ) {
488
+				foreach ($answers as $answer) {
489
+					if ($answer instanceof EE_Answer) {
490 490
 						$question = $answer->question();
491
-						if ( $question instanceof EE_Question and $question->admin_only() ) {
491
+						if ($question instanceof EE_Question and $question->admin_only()) {
492 492
 							continue;
493 493
 						}
494
-						$question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $send_data);
494
+						$question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $send_data);
495 495
 					}
496 496
 				}
497 497
 				return $question_list;
@@ -517,67 +517,67 @@  discard block
 block discarded – undo
517 517
 		$setup_args = array(
518 518
 			'mtfilename' => 'EE_Newsletter_message_type.class.php',
519 519
 			'autoloadpaths' => array(
520
-				EE_CAF_LIBRARIES . 'messages/message_type/newsletter/'
520
+				EE_CAF_LIBRARIES.'messages/message_type/newsletter/'
521 521
 				),
522
-			'messengers_to_activate_with' => array( 'email' ),
523
-			'messengers_to_validate_with' => array( 'email' )
522
+			'messengers_to_activate_with' => array('email'),
523
+			'messengers_to_validate_with' => array('email')
524 524
 			);
525
-		EE_Register_Message_Type::register( 'newsletter', $setup_args );
525
+		EE_Register_Message_Type::register('newsletter', $setup_args);
526 526
 
527 527
 		//register payment reminder message type
528 528
 		$setup_args = array(
529 529
 			'mtfilename' => 'EE_Payment_Reminder_message_type.class.php',
530
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/' ),
531
-			'messengers_to_activate_with' => array( 'email' ),
532
-			'messengers_to_validate_with' => array( 'email' )
530
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_reminder/'),
531
+			'messengers_to_activate_with' => array('email'),
532
+			'messengers_to_validate_with' => array('email')
533 533
 			);
534
-		EE_Register_Message_Type::register( 'payment_reminder', $setup_args );
534
+		EE_Register_Message_Type::register('payment_reminder', $setup_args);
535 535
 
536 536
 		//register payment declined message type
537 537
 		$setup_args = array(
538 538
 			'mtfilename' => 'EE_Payment_Declined_message_type.class.php',
539
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/' ),
540
-			'messengers_to_activate_with' => array( 'email' ),
541
-			'messengers_to_validate_with' => array( 'email' )
539
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_declined/'),
540
+			'messengers_to_activate_with' => array('email'),
541
+			'messengers_to_validate_with' => array('email')
542 542
 			);
543
-		EE_Register_Message_Type::register( 'payment_declined', $setup_args );
543
+		EE_Register_Message_Type::register('payment_declined', $setup_args);
544 544
 
545 545
 		//register registration declined message type
546 546
 		$setup_args = array(
547 547
 			'mtfilename' => 'EE_Declined_Registration_message_type.class.php',
548
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/' ),
549
-			'messengers_to_activate_with' => array( 'email' ),
550
-			'messengers_to_validate_with' => array( 'email' )
548
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/declined_registration/'),
549
+			'messengers_to_activate_with' => array('email'),
550
+			'messengers_to_validate_with' => array('email')
551 551
 			);
552
-		EE_Register_Message_Type::register( 'declined_registration', $setup_args );
552
+		EE_Register_Message_Type::register('declined_registration', $setup_args);
553 553
 
554 554
 		//register registration cancelled message type
555 555
 		$setup_args = array(
556 556
 			'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php',
557
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/' ),
558
-			'messengers_to_activate_with' => array( 'email' ),
559
-			'messengers_to_validate_with' => array( 'email' )
557
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/cancelled_registration/'),
558
+			'messengers_to_activate_with' => array('email'),
559
+			'messengers_to_validate_with' => array('email')
560 560
 			);
561
-		EE_Register_Message_Type::register( 'cancelled_registration', $setup_args );
561
+		EE_Register_Message_Type::register('cancelled_registration', $setup_args);
562 562
 
563 563
 
564 564
 		//register payment failed message type
565 565
 		$setup_args = array(
566 566
 			'mtfilename' => 'EE_Payment_Failed_message_type.class.php',
567
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/' ),
568
-			'messengers_to_activate_with' => array( 'email' ),
569
-			'messengers_to_validate_with' => array( 'email' )
567
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_failed/'),
568
+			'messengers_to_activate_with' => array('email'),
569
+			'messengers_to_validate_with' => array('email')
570 570
 			);
571
-		EE_Register_Message_Type::register( 'payment_failed', $setup_args );
571
+		EE_Register_Message_Type::register('payment_failed', $setup_args);
572 572
 
573 573
 		//register payment declined message type
574 574
 		$setup_args = array(
575 575
 			'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php',
576
-			'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/' ),
577
-			'messengers_to_activate_with' => array( 'email' ),
578
-			'messengers_to_validate_with' => array( 'email' )
576
+			'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_cancelled/'),
577
+			'messengers_to_activate_with' => array('email'),
578
+			'messengers_to_validate_with' => array('email')
579 579
 			);
580
-		EE_Register_Message_Type::register( 'payment_cancelled', $setup_args );
580
+		EE_Register_Message_Type::register('payment_cancelled', $setup_args);
581 581
 	}
582 582
 
583 583
 
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 	public function register_caf_shortcodes() {
594 594
 		$setup_args = array(
595 595
 			'autoloadpaths' => array(
596
-				EE_CAF_LIBRARIES . 'shortcodes/'
596
+				EE_CAF_LIBRARIES.'shortcodes/'
597 597
 				),
598
-			'msgr_validator_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_validator_config' ),
599
-			'msgr_template_fields_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_template_fields' ),
600
-			'list_type_shortcodes' => array( '[NEWSLETTER_CONTENT]' )
598
+			'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'),
599
+			'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'),
600
+			'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]')
601 601
 			);
602
-		EE_Register_Messages_Shortcode_Library::register( 'newsletter', $setup_args );
602
+		EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args);
603 603
 	}
604 604
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.3.2
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Used to initialize all EE messages caffeinated functionality.
@@ -291,8 +293,9 @@  discard block
 block discarded – undo
291 293
 
292 294
 	public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
293 295
 
294
-		if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) )
295
-			return $parsed;
296
+		if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) {
297
+					return $parsed;
298
+		}
296 299
 
297 300
 		//let's get the question from the code.
298 301
 		$shortcode = str_replace('[ANSWER_*', '', $shortcode);
@@ -388,14 +391,16 @@  discard block
 block discarded – undo
388 391
 
389 392
 	public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
390 393
 
391
-		if ( array($data) && ! isset( $data['data'] ) )
392
-			return $parsed;
394
+		if ( array($data) && ! isset( $data['data'] ) ) {
395
+					return $parsed;
396
+		}
393 397
 
394 398
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
395 399
 		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
396 400
 
397
-		if ( ! $recipient instanceof EE_Messages_Addressee )
398
-			return $parsed;
401
+		if ( ! $recipient instanceof EE_Messages_Addressee ) {
402
+					return $parsed;
403
+		}
399 404
 
400 405
 		switch ( $shortcode ) {
401 406
 			case '[RECIPIENT_QUESTION_LIST]' :
@@ -464,21 +469,24 @@  discard block
 block discarded – undo
464 469
 
465 470
 
466 471
 	public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) {
467
-		if ( array($data) && ! isset( $data['data'] ) )
468
-			return $parsed;
472
+		if ( array($data) && ! isset( $data['data'] ) ) {
473
+					return $parsed;
474
+		}
469 475
 
470 476
 		$recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL;
471 477
 		$recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient;
472 478
 
473
-		if ( ! $recipient instanceof EE_Messages_Addressee )
474
-			return $parsed;
479
+		if ( ! $recipient instanceof EE_Messages_Addressee ) {
480
+					return $parsed;
481
+		}
475 482
 
476 483
 		$send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data;
477 484
 
478 485
 		switch ( $shortcode ) {
479 486
 			case '[RECIPIENT_QUESTION_LIST]' :
480
-				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration )
481
-					return '';
487
+				if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) {
488
+									return '';
489
+				}
482 490
 				$registration = $recipient->primary_reg_obj;
483 491
 				$template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list'];
484 492
 				$valid_shortcodes = array('question');
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
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
 	 *  @access 	public
110 110
 	 *  @param 	EE_Events_Archive_Config $CFG
111 111
 	 *  @param 	EE_Request_Handler $REQ
112
-	 *  @return 	void
112
+	 *  @return 	EE_Events_Archive_Config
113 113
 	 */
114 114
 	public static function update_template_settings( $CFG, $REQ ) {
115 115
 		$CFG->EED_Events_Archive = new EE_Events_Archive_Config();
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 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,9 +49,9 @@  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
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 );
54
-		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
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10);
54
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2);
55 55
 	}
56 56
 
57 57
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @param    WP $WP
65 65
 	 * @return    void
66 66
 	 */
67
-	public function run( $WP ) {
67
+	public function run($WP) {
68 68
 	}
69 69
 
70 70
 
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public static function template_settings_form() {
81 81
 		// grab general settings admin page and remove the existing hook callback
82
-		$gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' );
83
-		if ( $gen_set_admin instanceof General_Settings_Admin_Page ) {
84
-			remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 );
82
+		$gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings');
83
+		if ($gen_set_admin instanceof General_Settings_Admin_Page) {
84
+			remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100);
85 85
 		}
86 86
 		$template_settings = EE_Registry::instance()->CFG->template_settings;
87
-		$template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
88
-		$template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive );
87
+		$template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config();
88
+		$template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive);
89 89
 		$events_archive_settings = array(
90 90
 			'display_status_banner' => 0,
91 91
 			'display_description' => 1,
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 			'display_venue' => 0,
95 95
 			'display_expired_events' => 0
96 96
 		);
97
-		$events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive );
98
-		EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings );
97
+		$events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive);
98
+		EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings);
99 99
 	}
100 100
 
101 101
 
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 	 *  @param 	EE_Request_Handler $REQ
112 112
 	 *  @return 	void
113 113
 	 */
114
-	public static function update_template_settings( $CFG, $REQ ) {
114
+	public static function update_template_settings($CFG, $REQ) {
115 115
 		$CFG->EED_Events_Archive = new EE_Events_Archive_Config();
116 116
 		// unless we are resetting the config...
117
-		if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) {
118
-			$CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0;
119
-			$CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1;
120
-			$CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0;
121
-			$CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1;
122
-			$CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0;
123
-			$CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0;			}
117
+		if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) {
118
+			$CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0;
119
+			$CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1;
120
+			$CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0;
121
+			$CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1;
122
+			$CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0;
123
+			$CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; }
124 124
 		return $CFG;
125 125
 	}
126 126
 
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/recaptcha/EED_Recaptcha.module.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * 	process_recaptcha
288 288
 	 *
289 289
 	 * 	@access private
290
-	 * 	@return 	boolean
290
+	 * 	@return 	boolean|null
291 291
 	 */
292 292
 	private static function _get_recaptcha_response() {
293 293
 		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false );
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	 *
575 575
 	 * @access public
576 576
 	 * @param EE_Registration_Config $EE_Registration_Config
577
-	 * @return array
577
+	 * @return EE_Registration_Config
578 578
 	 */
579 579
 	public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) {
580 580
 		try {
Please login to merge, or discard this patch.
Spacing   +130 added lines, -131 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @return EED_Recaptcha
44 44
 	 */
45 45
 	public static function instance() {
46
-		return parent::get_instance( __CLASS__ );
46
+		return parent::get_instance(__CLASS__);
47 47
 	}
48 48
 
49 49
 
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public static function set_hooks() {
58 58
 		// use_captcha ?
59
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
59
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
60 60
 			EED_Recaptcha::set_definitions();
61 61
 			EED_Recaptcha::enqueue_styles_and_scripts();
62
-			add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 );
63
-			add_action( 'AHEE__before_spco_whats_next_buttons', array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 );
64
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
65
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
66
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
67
-			add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1 );
62
+			add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0);
63
+			add_action('AHEE__before_spco_whats_next_buttons', array('EED_Recaptcha', 'display_recaptcha'), 10, 0);
64
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
65
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
66
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
67
+			add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1);
68 68
 		}
69 69
 	}
70 70
 
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 	public static function set_hooks_admin() {
80 80
 		EED_Recaptcha::set_definitions();
81 81
 		// use_captcha ?
82
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
82
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
83 83
 			EED_Recaptcha::enqueue_styles_and_scripts();
84
-			add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
85
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 );
86
-			add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 );
84
+			add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10);
85
+			add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10);
86
+			add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1);
87 87
 		}
88 88
 		// admin settings
89
-		add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 );
90
-		add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 );
89
+		add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1);
90
+		add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1);
91 91
 	}
92 92
 
93 93
 
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 *  @return 	void
100 100
 	 */
101 101
 	public static function set_definitions() {
102
-		if ( is_user_logged_in() ) {
102
+		if (is_user_logged_in()) {
103 103
 			EED_Recaptcha::$_not_a_robot = true;
104 104
 		}
105
-		define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
106
-		define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ ));
105
+		define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
106
+		define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__));
107 107
 	}
108 108
 
109 109
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	public static function set_late_hooks() {
118 118
 		add_filter(
119 119
 			'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit',
120
-			array( 'EED_Recaptcha', 'not_a_robot' )
120
+			array('EED_Recaptcha', 'not_a_robot')
121 121
 		);
122 122
 	}
123 123
 
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 	 *  @return 	void
131 131
 	 */
132 132
 	public static function enqueue_styles_and_scripts() {
133
-		wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE );
134
-		wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE );
135
-		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' );
136
-		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' );
137
-		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' );
133
+		wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE);
134
+		wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE);
135
+		EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso');
136
+		EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso');
137
+		EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso');
138 138
 	}
139 139
 
140 140
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @access    public
146 146
 	 * @param \WP $WP
147 147
 	 */
148
-	public function run( $WP ) {
148
+	public function run($WP) {
149 149
 	}
150 150
 
151 151
 
@@ -155,8 +155,7 @@  discard block
 block discarded – undo
155 155
 	 *  @return boolean
156 156
 	 */
157 157
 	public static function not_a_robot() {
158
-		$not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot :
159
-			EED_Recaptcha::recaptcha_passed();
158
+		$not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed();
160 159
 		return $not_a_robot;
161 160
 	}
162 161
 
@@ -172,23 +171,23 @@  discard block
 block discarded – undo
172 171
 	 */
173 172
 	public static function display_recaptcha() {
174 173
 		// logged in means you have already passed a turing test of sorts
175
-		if ( is_user_logged_in() ) {
174
+		if (is_user_logged_in()) {
176 175
 			return;
177 176
 		}
178 177
 		// don't display if not using recaptcha or user is logged in
179
-		if ( EE_Registry::instance()->CFG->registration->use_captcha ) {
178
+		if (EE_Registry::instance()->CFG->registration->use_captcha) {
180 179
 			// only display if they have NOT passed the test yet
181
-			if ( ! EED_Recaptcha::$_not_a_robot ) {
182
-				EE_Registry::instance()->load_helper( 'Template' );
180
+			if ( ! EED_Recaptcha::$_not_a_robot) {
181
+				EE_Registry::instance()->load_helper('Template');
183 182
 				EEH_Template::display_template(
184
-					RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php',
183
+					RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php',
185 184
 					array(
186 185
 						'recaptcha_publickey' 	=> EE_Registry::instance()->CFG->registration->recaptcha_publickey,
187 186
 						'recaptcha_theme' 		=> EE_Registry::instance()->CFG->registration->recaptcha_theme,
188 187
 						'recaptcha_type' 			=> EE_Registry::instance()->CFG->registration->recaptcha_type
189 188
 					)
190 189
 				);
191
-				wp_enqueue_script( 'google_recaptcha' );
190
+				wp_enqueue_script('google_recaptcha');
192 191
 			}
193 192
 		}
194 193
 	}
@@ -219,17 +218,17 @@  discard block
 block discarded – undo
219 218
 	 */
220 219
 	public static function recaptcha_passed() {
221 220
 		// logged in means you have already passed a turing test of sorts
222
-		if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) {
221
+		if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) {
223 222
 			return TRUE;
224 223
 		}
225 224
 		// was test already passed?
226
-		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' );
227
-		$recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN );
225
+		$recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed');
226
+		$recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN);
228 227
 		// verify recaptcha
229 228
 		EED_Recaptcha::_get_recaptcha_response();
230
-		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) {
229
+		if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) {
231 230
 			$recaptcha_passed = EED_Recaptcha::_process_recaptcha_response();
232
-			EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed ));
231
+			EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed));
233 232
 			EE_Registry::instance()->SSN->update();
234 233
 		}
235 234
 		EED_Recaptcha::$_not_a_robot = $recaptcha_passed;
@@ -245,8 +244,8 @@  discard block
 block discarded – undo
245 244
 	 * @param array $recaptcha_response
246 245
 	 * @return boolean
247 246
 	 */
248
-	public static function recaptcha_response( $recaptcha_response = array() ) {
249
-		if ( EED_Recaptcha::_bypass_recaptcha() ) {
247
+	public static function recaptcha_response($recaptcha_response = array()) {
248
+		if (EED_Recaptcha::_bypass_recaptcha()) {
250 249
 			$recaptcha_response['bypass_recaptcha'] = TRUE;
251 250
 			$recaptcha_response['recaptcha_passed'] = TRUE;
252 251
 		} else {
@@ -266,16 +265,16 @@  discard block
 block discarded – undo
266 265
 	 */
267 266
 	private static function _bypass_recaptcha() {
268 267
 		// an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY
269
-		$bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() );
268
+		$bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array());
270 269
 		// does $bypass_request_params_array have any values ?
271
-		if ( empty( $bypass_request_params_array )) {
270
+		if (empty($bypass_request_params_array)) {
272 271
 			return FALSE;
273 272
 		}
274 273
 		// initially set bypass to TRUE
275 274
 		$bypass_recaptcha = TRUE;
276
-		foreach ( $bypass_request_params_array as $key => $value ) {
275
+		foreach ($bypass_request_params_array as $key => $value) {
277 276
 			// if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass
278
-			$bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE;
277
+			$bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE;
279 278
 		}
280 279
 		return $bypass_recaptcha;
281 280
 	}
@@ -290,7 +289,7 @@  discard block
 block discarded – undo
290 289
 	 * 	@return 	boolean
291 290
 	 */
292 291
 	private static function _get_recaptcha_response() {
293
-		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false );
292
+		EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false);
294 293
 	}
295 294
 
296 295
 
@@ -304,22 +303,22 @@  discard block
 block discarded – undo
304 303
 	 */
305 304
 	private static function _process_recaptcha_response() {
306 305
 		// verify library is loaded
307
-		if ( ! class_exists( 'ReCaptcha' )) {
308
-			require_once( RECAPTCHA_BASE_PATH . 'recaptchalib.php' );
306
+		if ( ! class_exists('ReCaptcha')) {
307
+			require_once(RECAPTCHA_BASE_PATH.'recaptchalib.php');
309 308
 		}
310 309
 		// The response from reCAPTCHA
311 310
 		EED_Recaptcha::_get_recaptcha_response();
312 311
 		$recaptcha_response = EED_Recaptcha::$_recaptcha_response;
313 312
 		// Was there a reCAPTCHA response?
314
-		if ( $recaptcha_response ) {
315
-			$reCaptcha = new ReCaptcha( EE_Registry::instance()->CFG->registration->recaptcha_privatekey );
313
+		if ($recaptcha_response) {
314
+			$reCaptcha = new ReCaptcha(EE_Registry::instance()->CFG->registration->recaptcha_privatekey);
316 315
 			$recaptcha_response = $reCaptcha->verifyResponse(
317 316
 				$_SERVER['REMOTE_ADDR'],
318 317
 				EED_Recaptcha::$_recaptcha_response
319 318
 			);
320 319
 		}
321 320
 		// sorry... it appears you can't read gibberish chicken scratches !!!
322
-		if ( $recaptcha_response instanceof ReCaptchaResponse && $recaptcha_response->success ) {
321
+		if ($recaptcha_response instanceof ReCaptchaResponse && $recaptcha_response->success) {
323 322
 			return TRUE;
324 323
 		}
325 324
 		return FALSE;
@@ -353,8 +352,8 @@  discard block
 block discarded – undo
353 352
 	 */
354 353
 	protected static function _recaptcha_settings_form() {
355 354
 
356
-		EE_Registry::instance()->load_helper( 'HTML' );
357
-		EE_Registry::instance()->load_helper( 'Template' );
355
+		EE_Registry::instance()->load_helper('HTML');
356
+		EE_Registry::instance()->load_helper('Template');
358 357
 
359 358
 		return new EE_Form_Section_Proper(
360 359
 			array(
@@ -364,12 +363,12 @@  discard block
 block discarded – undo
364 363
 				'subsections' 			=> apply_filters(
365 364
 					'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections',
366 365
 					array(
367
-						'main_settings_hdr' 				=> new EE_Form_Section_HTML( EEH_HTML::h3( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))),
366
+						'main_settings_hdr' 				=> new EE_Form_Section_HTML(EEH_HTML::h3(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))),
368 367
 						'main_settings' 						=> EED_Recaptcha::_recaptcha_main_settings(),
369
-						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML( EEH_HTML::h3( __( 'reCAPTCHA Appearance', 'event_espresso' ) )),
368
+						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML(EEH_HTML::h3(__('reCAPTCHA Appearance', 'event_espresso'))),
370 369
 						'appearance_settings' 			=> EED_Recaptcha::_recaptcha_appearance_settings(),
371 370
 						// 'recaptcha_example' 				=> new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ),
372
-						'required_fields_note' 			=> new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ))
371
+						'required_fields_note' 			=> new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text'))
373 372
 					)
374 373
 				)
375 374
 			)
@@ -396,28 +395,28 @@  discard block
 block discarded – undo
396 395
 					array(
397 396
 						'use_captcha' 				=> new EE_Yes_No_Input(
398 397
 							array(
399
-								'html_label_text'	 	=> __( 'Use reCAPTCHA', 'event_espresso' ),
398
+								'html_label_text'	 	=> __('Use reCAPTCHA', 'event_espresso'),
400 399
 								'html_help_text' 		=> sprintf(
401
-									__( 'reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ),
400
+									__('reCAPTCHA is a free service that  protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'),
402 401
 									'<a href="https://www.google.com/recaptcha/intro/index.html">',
403 402
 									'</a>'
404 403
 								),
405
-								'default' 								=> isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
404
+								'default' 								=> isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE,
406 405
 								'display_html_label_text' 	=> FALSE
407 406
 							)
408 407
 						),
409 408
 						'recaptcha_publickey' 		=> new EE_Text_Input(
410 409
 							array(
411
-								'html_label_text'	 	=> __( 'Site Key', 'event_espresso' ),
412
-								'html_help_text' 		=> __( 'The site key is used to display the widget on your site.', 'event_espresso' ),
413
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : ''
410
+								'html_label_text'	 	=> __('Site Key', 'event_espresso'),
411
+								'html_help_text' 		=> __('The site key is used to display the widget on your site.', 'event_espresso'),
412
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : ''
414 413
 							)
415 414
 						),
416 415
 						'recaptcha_privatekey' 		=> new EE_Text_Input(
417 416
 							array(
418
-								'html_label_text'	 	=> __( 'Secret Key', 'event_espresso' ),
419
-								'html_help_text' 		=> __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ),
420
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : ''
417
+								'html_label_text'	 	=> __('Secret Key', 'event_espresso'),
418
+								'html_help_text' 		=> __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'),
419
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : ''
421 420
 							)
422 421
 						)
423 422
 					)
@@ -449,81 +448,81 @@  discard block
 block discarded – undo
449 448
 					array(
450 449
 						'recaptcha_theme' 		=> new EE_Radio_Button_Input(
451 450
 							array(
452
-								'light' => __( 'Light', 'event_espresso' ),
453
-								'dark' => __( 'Dark', 'event_espresso' )
451
+								'light' => __('Light', 'event_espresso'),
452
+								'dark' => __('Dark', 'event_espresso')
454 453
 							),
455 454
 							array(
456
-								'html_label_text'	 	=> __( 'Theme', 'event_espresso' ),
457
-								'html_help_text' 		=> __( 'The color theme of the widget.', 'event_espresso' ),
458
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
455
+								'html_label_text'	 	=> __('Theme', 'event_espresso'),
456
+								'html_help_text' 		=> __('The color theme of the widget.', 'event_espresso'),
457
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light',
459 458
 								'display_html_label_text' => FALSE
460 459
 							)
461 460
 						),
462 461
 						'recaptcha_type' 		=> new EE_Radio_Button_Input(
463 462
 							array(
464
-								'image' => __( 'Image', 'event_espresso' ),
465
-								'audio' => __( 'Audio', 'event_espresso' )
463
+								'image' => __('Image', 'event_espresso'),
464
+								'audio' => __('Audio', 'event_espresso')
466 465
 							),
467 466
 							array(
468
-								'html_label_text'	 	=> __( 'Type', 'event_espresso' ),
469
-								'html_help_text' 		=> __( 'The type of CAPTCHA to serve.', 'event_espresso' ),
470
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
467
+								'html_label_text'	 	=> __('Type', 'event_espresso'),
468
+								'html_help_text' 		=> __('The type of CAPTCHA to serve.', 'event_espresso'),
469
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image',
471 470
 								'display_html_label_text' =>FALSE
472 471
 							)
473 472
 						),
474 473
 						'recaptcha_language' 		=> new EE_Select_Input(
475 474
 							array(
476
-								 'ar' 			=> __( 'Arabic', 'event_espresso' ),
477
-								 'bg' 		=> __( 'Bulgarian', 'event_espresso' ),
478
-								 'ca' 			=> __( 'Catalan', 'event_espresso' ),
479
-								 'zh-CN' 	=>  __( 'Chinese (Simplified)', 'event_espresso' ),
480
-								 'zh-TW' 	=>  __( 'Chinese (Traditional)	', 'event_espresso' ),
481
-								 'hr' 			=> __( 'Croatian', 'event_espresso' ),
482
-								 'cs' 			=> __( 'Czech', 'event_espresso' ),
483
-								 'da' 			=> __( 'Danish', 'event_espresso' ),
484
-								 'nl' 			=> __( 'Dutch', 'event_espresso' ),
485
-								 'en-GB' 	=>  __( 'English (UK)', 'event_espresso' ),
486
-								 'en' 			=> __( 'English (US)', 'event_espresso' ),
487
-								 'fil' 			=> __( 'Filipino', 'event_espresso' ),
488
-								 'fi' 			=> __( 'Finnish', 'event_espresso' ),
489
-								 'fr' 			=> __( 'French', 'event_espresso' ),
490
-								 'fr-CA' 	=>  __( 'French (Canadian)', 'event_espresso' ),
491
-								 'de' 			=> __( 'German', 'event_espresso' ),
492
-								 'de-AT' 	=>  __( 'German (Austria)', 'event_espresso' ),
493
-								 'de-CH' 	=>  __( 'German (Switzerland)', 'event_espresso' ),
494
-								 'el' 			=> __( 'Greek', 'event_espresso' ),
495
-								 'iw' 			=> __( 'Hebrew', 'event_espresso' ),
496
-								 'hi' 			=> __( 'Hindi', 'event_espresso' ),
497
-								 'hu' 		=> __( 'Hungarian', 'event_espresso' ),
498
-								 'id' 			=> __( 'Indonesian', 'event_espresso' ),
499
-								 'it' 			=> __( 'Italian', 'event_espresso' ),
500
-								 'ja' 			=> __( 'Japanese', 'event_espresso' ),
501
-								 'ko' 			=> __( 'Korean', 'event_espresso' ),
502
-								 'lv' 			=> __( 'Latvian', 'event_espresso' ),
503
-								 'lt' 			=> __( 'Lithuanian', 'event_espresso' ),
504
-								 'no' 		=> __( 'Norwegian', 'event_espresso' ),
505
-								 'fa' 			=> __( 'Persian', 'event_espresso' ),
506
-								 'pl' 			=> __( 'Polish', 'event_espresso' ),
507
-								 'pt' 			=> __( 'Portuguese', 'event_espresso' ),
508
-								 'pt-BR' 	=>  __( 'Portuguese (Brazil)', 'event_espresso' ),
509
-								 'pt-PT' 	=>  __( 'Portuguese (Portugal)', 'event_espresso' ),
510
-								 'ro' 			=> __( 'Romanian', 'event_espresso' ),
511
-								 'ru' 			=> __( 'Russian', 'event_espresso' ),
512
-								 'sr' 			=> __( 'Serbian', 'event_espresso' ),
513
-								 'sk' 			=> __( 'Slovak', 'event_espresso' ),
514
-								 'sl' 			=> __( 'Slovenian', 'event_espresso' ),
515
-								 'es' 			=> __( 'Spanish', 'event_espresso' ),
516
-								 'es-419' 	=>  __( 'Spanish (Latin America)', 'event_espresso' ),
517
-								 'sv' 			=> __( 'Swedish', 'event_espresso' ),
518
-								 'th' 			=> __( 'Thai', 'event_espresso' ),
519
-								 'tr' 			=> __( 'Turkish', 'event_espresso' ),
520
-								 'uk' 			=> __( 'Ukrainian', 'event_espresso' ),
521
-								 'vi' 			=> __( 'Vietnamese', 'event_espresso')
475
+								 'ar' 			=> __('Arabic', 'event_espresso'),
476
+								 'bg' 		=> __('Bulgarian', 'event_espresso'),
477
+								 'ca' 			=> __('Catalan', 'event_espresso'),
478
+								 'zh-CN' 	=>  __('Chinese (Simplified)', 'event_espresso'),
479
+								 'zh-TW' 	=>  __('Chinese (Traditional)	', 'event_espresso'),
480
+								 'hr' 			=> __('Croatian', 'event_espresso'),
481
+								 'cs' 			=> __('Czech', 'event_espresso'),
482
+								 'da' 			=> __('Danish', 'event_espresso'),
483
+								 'nl' 			=> __('Dutch', 'event_espresso'),
484
+								 'en-GB' 	=>  __('English (UK)', 'event_espresso'),
485
+								 'en' 			=> __('English (US)', 'event_espresso'),
486
+								 'fil' 			=> __('Filipino', 'event_espresso'),
487
+								 'fi' 			=> __('Finnish', 'event_espresso'),
488
+								 'fr' 			=> __('French', 'event_espresso'),
489
+								 'fr-CA' 	=>  __('French (Canadian)', 'event_espresso'),
490
+								 'de' 			=> __('German', 'event_espresso'),
491
+								 'de-AT' 	=>  __('German (Austria)', 'event_espresso'),
492
+								 'de-CH' 	=>  __('German (Switzerland)', 'event_espresso'),
493
+								 'el' 			=> __('Greek', 'event_espresso'),
494
+								 'iw' 			=> __('Hebrew', 'event_espresso'),
495
+								 'hi' 			=> __('Hindi', 'event_espresso'),
496
+								 'hu' 		=> __('Hungarian', 'event_espresso'),
497
+								 'id' 			=> __('Indonesian', 'event_espresso'),
498
+								 'it' 			=> __('Italian', 'event_espresso'),
499
+								 'ja' 			=> __('Japanese', 'event_espresso'),
500
+								 'ko' 			=> __('Korean', 'event_espresso'),
501
+								 'lv' 			=> __('Latvian', 'event_espresso'),
502
+								 'lt' 			=> __('Lithuanian', 'event_espresso'),
503
+								 'no' 		=> __('Norwegian', 'event_espresso'),
504
+								 'fa' 			=> __('Persian', 'event_espresso'),
505
+								 'pl' 			=> __('Polish', 'event_espresso'),
506
+								 'pt' 			=> __('Portuguese', 'event_espresso'),
507
+								 'pt-BR' 	=>  __('Portuguese (Brazil)', 'event_espresso'),
508
+								 'pt-PT' 	=>  __('Portuguese (Portugal)', 'event_espresso'),
509
+								 'ro' 			=> __('Romanian', 'event_espresso'),
510
+								 'ru' 			=> __('Russian', 'event_espresso'),
511
+								 'sr' 			=> __('Serbian', 'event_espresso'),
512
+								 'sk' 			=> __('Slovak', 'event_espresso'),
513
+								 'sl' 			=> __('Slovenian', 'event_espresso'),
514
+								 'es' 			=> __('Spanish', 'event_espresso'),
515
+								 'es-419' 	=>  __('Spanish (Latin America)', 'event_espresso'),
516
+								 'sv' 			=> __('Swedish', 'event_espresso'),
517
+								 'th' 			=> __('Thai', 'event_espresso'),
518
+								 'tr' 			=> __('Turkish', 'event_espresso'),
519
+								 'uk' 			=> __('Ukrainian', 'event_espresso'),
520
+								 'vi' 			=> __('Vietnamese', 'event_espresso')
522 521
 							),
523 522
 							array(
524
-								'html_label_text'	 	=> __( 'Language', 'event_espresso' ),
525
-								'html_help_text' 		=> __( 'Forces the widget to render in a specific language.', 'event_espresso' ),
526
-								'default' 					=> isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
523
+								'html_label_text'	 	=> __('Language', 'event_espresso'),
524
+								'html_help_text' 		=> __('Forces the widget to render in a specific language.', 'event_espresso'),
525
+								'default' 					=> isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en'
527 526
 							)
528 527
 						)
529 528
 					)
@@ -571,25 +570,25 @@  discard block
 block discarded – undo
571 570
 	 * @param EE_Registration_Config $EE_Registration_Config
572 571
 	 * @return array
573 572
 	 */
574
-	public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) {
573
+	public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) {
575 574
 		try {
576 575
 			$recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form();
577 576
 			// if not displaying a form, then check for form submission
578
-			if ( $recaptcha_settings_form->was_submitted() ) {
577
+			if ($recaptcha_settings_form->was_submitted()) {
579 578
 				// capture form data
580 579
 				$recaptcha_settings_form->receive_form_submission();
581 580
 				// validate form data
582
-				if ( $recaptcha_settings_form->is_valid() ) {
581
+				if ($recaptcha_settings_form->is_valid()) {
583 582
 					// grab validated data from form
584 583
 					$valid_data = $recaptcha_settings_form->valid_data();
585 584
 					// user proofing recaptcha:  If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message.
586 585
 					if (
587
-						apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config )
586
+						apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config)
588 587
 						&& $valid_data['main_settings']['use_captcha']
589
-						&& ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] )))
588
+						&& ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey'])))
590 589
 					) {
591 590
 						$valid_data['main_settings']['use_captcha'] = FALSE;
592
-						EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
591
+						EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
593 592
 					}
594 593
 					$EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha'];
595 594
 					$EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey'];
@@ -598,12 +597,12 @@  discard block
 block discarded – undo
598 597
 					$EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme'];
599 598
 					$EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language'];
600 599
 				} else {
601
-					if ( $recaptcha_settings_form->submission_error_message() != '' ) {
602
-						EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
600
+					if ($recaptcha_settings_form->submission_error_message() != '') {
601
+						EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
603 602
 					}
604 603
 				}
605 604
 			}
606
-		} catch( EE_Error $e ) {
605
+		} catch (EE_Error $e) {
607 606
 			$e->get_error();
608 607
 		}
609 608
 
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.
modules/ticket_selector_caff/EED_Ticket_Selector_Caff.module.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
 	 * @param EE_Template_Config $CFG
151 151
 	 * @param array             $REQ incoming request
152 152
 	 *
153
-	 * @return void
153
+	 * @return EE_Template_Config
154 154
 	 */
155 155
 	public static function update_template_settings( EE_Template_Config $CFG, $REQ ) {
156 156
 		if ( ! isset( $CFG->EED_Ticket_Selector ) ) {
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	 * @return EED_Ticket_Selector_Caff
17 17
 	 */
18 18
 	public static function instance() {
19
-		return parent::get_instance( __CLASS__ );
19
+		return parent::get_instance(__CLASS__);
20 20
 	}
21 21
 
22 22
 
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks_admin() {
40
-		define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
41
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 );
42
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 );
40
+		define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
41
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10);
42
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2);
43 43
 	}
44 44
 
45 45
 
46 46
 	//just required because of abstract declaration
47
-	public function run( $WP ) {
47
+	public function run($WP) {
48 48
 		$this->set_config();
49 49
 	}
50 50
 
51 51
 
52 52
 
53 53
 
54
-	protected function set_config(){
55
-		$this->set_config_section( 'template_settings' );
56
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
57
-		$this->set_config_name( 'EED_Ticket_Selector' );
54
+	protected function set_config() {
55
+		$this->set_config_section('template_settings');
56
+		$this->set_config_class('EE_Ticket_Selector_Config');
57
+		$this->set_config_name('EED_Ticket_Selector');
58 58
 	}
59 59
 
60 60
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 				'subsections' => apply_filters(
89 89
 					'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections',
90 90
 					array(
91
-						'appearance_settings_hdr' 				=> new EE_Form_Section_HTML( EEH_HTML::h3( __( 'Ticket Selector Template Settings', 'event_espresso' ))),
91
+						'appearance_settings_hdr' 				=> new EE_Form_Section_HTML(EEH_HTML::h3(__('Ticket Selector Template Settings', 'event_espresso'))),
92 92
 						'appearance_settings' 			=> EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings()
93 93
 					)
94 94
 				)
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 					'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections', array(
112 112
 						'show_ticket_details' => new EE_Yes_No_Input(
113 113
 							array(
114
-								'html_label_text' => __('Show Ticket Details?', 'event_espresso' ),
115
-								'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'),
116
-								'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true,
114
+								'html_label_text' => __('Show Ticket Details?', 'event_espresso'),
115
+								'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'),
116
+								'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true,
117 117
 								'display_html_label_text' => false
118 118
 								)
119 119
 							),
120 120
 						'show_ticket_sale_columns' => new EE_Yes_No_Input(
121 121
 							array(
122
-								'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ),
123
-								'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'),
124
-								'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true,
122
+								'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'),
123
+								'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'),
124
+								'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true,
125 125
 								'display_html_label_text' => false
126 126
 								)
127 127
 							),
128 128
 						'show_expired_tickets' => new EE_Yes_No_Input(
129 129
 							array(
130
-								'html_label_text' => __( 'Show Expired Tickets?', 'event_espresso' ),
131
-								'html_help_text' => __( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ),
132
-								'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true,
130
+								'html_label_text' => __('Show Expired Tickets?', 'event_espresso'),
131
+								'html_help_text' => __('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'),
132
+								'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true,
133 133
 								'display_html_label_text' => false
134 134
 							)
135 135
 						)
@@ -152,21 +152,21 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return void
154 154
 	 */
155
-	public static function update_template_settings( EE_Template_Config $CFG, $REQ ) {
156
-		if ( ! isset( $CFG->EED_Ticket_Selector ) ) {
155
+	public static function update_template_settings(EE_Template_Config $CFG, $REQ) {
156
+		if ( ! isset($CFG->EED_Ticket_Selector)) {
157 157
 			$CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
158 158
 		}
159 159
 		try {
160 160
 			$ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form();
161 161
 
162 162
 			//check for form submission
163
-			if ( $ticket_selector_form->was_submitted() ) {
163
+			if ($ticket_selector_form->was_submitted()) {
164 164
 
165 165
 				//capture form data
166 166
 				$ticket_selector_form->receive_form_submission();
167 167
 
168 168
 				//validate form data
169
-				if ( $ticket_selector_form->is_valid() ) {
169
+				if ($ticket_selector_form->is_valid()) {
170 170
 
171 171
 					//grab validated data from form
172 172
 					$valid_data = $ticket_selector_form->valid_data();
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
 					$CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details'];
177 177
 					$CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets'];
178 178
 				} else {
179
-					if ( $ticket_selector_form->submission_error_message() != '' ) {
180
-						EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
179
+					if ($ticket_selector_form->submission_error_message() != '') {
180
+						EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
181 181
 					}
182 182
 				}
183 183
 
184 184
 			}
185
-		} catch( EE_Error $e ) {
185
+		} catch (EE_Error $e) {
186 186
 			$e->get_error();
187 187
 		}
188 188
 
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
  *
4 6
  * EED_Ticket_Selector_Caff
Please login to merge, or discard this patch.