Completed
Branch BUG-7537 (2c2d2f)
by
unknown
20:37 queued 10:27
created
4_8_0_stages/EE_DMS_4_8_0_event_subtotals.dmsstage.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -12,68 +12,68 @@  discard block
 block discarded – undo
12 12
  * @author				Mike Nelson
13 13
  *
14 14
  */
15
-class EE_DMS_4_8_0_event_subtotals extends EE_Data_Migration_Script_Stage_Table{
16
-	function __construct(){
15
+class EE_DMS_4_8_0_event_subtotals extends EE_Data_Migration_Script_Stage_Table {
16
+	function __construct() {
17 17
 		global $wpdb;
18
-		$this->_old_table = $wpdb->prefix . 'esp_line_item';
18
+		$this->_old_table = $wpdb->prefix.'esp_line_item';
19 19
 		$this->_extra_where_sql = ' WHERE LIN_type="sub-total" AND LIN_code="pre-tax-subtotal"';
20 20
 		$this->_pretty_name = __('Event Sub-total line items', 'event_espresso');
21 21
 		parent::__construct();
22 22
 	}
23
-	protected function _migrate_old_row( $line_item_row ) {
23
+	protected function _migrate_old_row($line_item_row) {
24 24
 		global $wpdb;
25 25
 		//what event is this line item for? this can be found by looking at its transaction's registration's EVT_ID
26
-		$event_id = $wpdb->get_var( $wpdb->prepare( 'SELECT EVT_ID FROM ' . $wpdb->prefix . 'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row[ 'TXN_ID' ] ) );
26
+		$event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM '.$wpdb->prefix.'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID']));
27 27
 		$new_line_item_data = array(
28
-					'LIN_code' => 'event-' . $event_id,
29
-					'TXN_ID' => $line_item_row[ 'TXN_ID' ],
30
-					'LIN_name' => __( 'Event', 'event_espresso' ),
31
-					'LIN_desc' => $line_item_row[ 'LIN_desc' ],
32
-					'LIN_unit_price' => $line_item_row[ 'LIN_unit_price' ],
33
-					'LIN_percent' => $line_item_row[ 'LIN_percent' ],
34
-					'LIN_is_taxable' => $line_item_row[ 'LIN_is_taxable' ],
35
-					'LIN_order' => $line_item_row[ 'LIN_order' ],
36
-					'LIN_total' => $line_item_row[ 'LIN_total' ],
37
-					'LIN_quantity' => $line_item_row[ 'LIN_quantity' ],
38
-					'LIN_parent' => $line_item_row[ 'LIN_ID'],
28
+					'LIN_code' => 'event-'.$event_id,
29
+					'TXN_ID' => $line_item_row['TXN_ID'],
30
+					'LIN_name' => __('Event', 'event_espresso'),
31
+					'LIN_desc' => $line_item_row['LIN_desc'],
32
+					'LIN_unit_price' => $line_item_row['LIN_unit_price'],
33
+					'LIN_percent' => $line_item_row['LIN_percent'],
34
+					'LIN_is_taxable' => $line_item_row['LIN_is_taxable'],
35
+					'LIN_order' => $line_item_row['LIN_order'],
36
+					'LIN_total' => $line_item_row['LIN_total'],
37
+					'LIN_quantity' => $line_item_row['LIN_quantity'],
38
+					'LIN_parent' => $line_item_row['LIN_ID'],
39 39
 					'LIN_type' => 'sub-total',
40 40
 					'OBJ_type' => 'Event',
41 41
 					'OBJ_ID' => $event_id,
42 42
 				);
43 43
 		$new_line_item_datatypes = array(
44
-					'%s',//LIN_code
45
-					'%d',//TXN_ID
46
-					'%s',//LIN_name
47
-					'%s',//LIN_desc
48
-					'%f',//LIN_unit_price
49
-					'%f',//LIN_percent
50
-					'%d',//LIN_is_taxable
51
-					'%d',//LIN_order
52
-					'%f',//LIN_total
53
-					'%d',//LIN_quantity
54
-					'%d',//LIN_parent
55
-					'%s',//LIN_type
56
-					'%s',//OBJ_type
57
-					'%d',//OBJ_ID
44
+					'%s', //LIN_code
45
+					'%d', //TXN_ID
46
+					'%s', //LIN_name
47
+					'%s', //LIN_desc
48
+					'%f', //LIN_unit_price
49
+					'%f', //LIN_percent
50
+					'%d', //LIN_is_taxable
51
+					'%d', //LIN_order
52
+					'%f', //LIN_total
53
+					'%d', //LIN_quantity
54
+					'%d', //LIN_parent
55
+					'%s', //LIN_type
56
+					'%s', //OBJ_type
57
+					'%d', //OBJ_ID
58 58
 				);
59 59
 		//insert the new event subtotal line item, pointing to this line item
60
-		$success = $wpdb->insert( $this->_old_table, $new_line_item_data, $new_line_item_datatypes );
61
-		if( ! $success ) {
62
-			$this->add_error( $this->_create_error_message_for_db_insertion( $this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes ) );
60
+		$success = $wpdb->insert($this->_old_table, $new_line_item_data, $new_line_item_datatypes);
61
+		if ( ! $success) {
62
+			$this->add_error($this->_create_error_message_for_db_insertion($this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes));
63 63
 		}
64 64
 		$new_line_item_id = $wpdb->insert_id;
65
-		$this->get_migration_script()->set_mapping($this->_old_table, $line_item_row[ 'LIN_ID' ], $this->_old_table, $new_line_item_id );
65
+		$this->get_migration_script()->set_mapping($this->_old_table, $line_item_row['LIN_ID'], $this->_old_table, $new_line_item_id);
66 66
 		$query = $wpdb->prepare(
67 67
 					"UPDATE {$this->_old_table} SET LIN_parent=%d WHERE LIN_parent = %d AND LIN_ID != %d LIMIT 100",
68 68
 					$new_line_item_id,
69
-					$line_item_row[ 'LIN_ID' ],
69
+					$line_item_row['LIN_ID'],
70 70
 					$new_line_item_id );
71
-		$success = $wpdb->query( $query );
72
-		if( $success === false ) {
71
+		$success = $wpdb->query($query);
72
+		if ($success === false) {
73 73
 			$this->add_error(
74
-					sprintf( __( 'Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso' ),
74
+					sprintf(__('Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso'),
75 75
 					$new_line_item_id,
76
-					$line_item_row[ 'LIN_ID' ],
76
+					$line_item_row['LIN_ID'],
77 77
 					$wpdb->last_error,
78 78
 					$query,
79 79
 					$success) );
Please login to merge, or discard this patch.
core/db_classes/EE_WP_User.class.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * EE_WP_User class
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	 * @param array $props_n_values
23 23
 	 * @return EE_WP_User|mixed
24 24
 	 */
25
-	public static function new_instance( $props_n_values = array() ) {
26
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
27
-		return $has_object ? $has_object : new self( $props_n_values );
25
+	public static function new_instance($props_n_values = array()) {
26
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
27
+		return $has_object ? $has_object : new self($props_n_values);
28 28
 	}
29 29
 
30 30
 
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @param array $props_n_values
34 34
 	 * @return EE_WP_User
35 35
 	 */
36
-	public static function new_instance_from_db( $props_n_values = array() ) {
37
-		return new self( $props_n_values, TRUE );
36
+	public static function new_instance_from_db($props_n_values = array()) {
37
+		return new self($props_n_values, TRUE);
38 38
 	}
39 39
 
40 40
 	/**
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @return WP_User
43 43
 	 */
44 44
 	public function wp_user_obj() {
45
-		if( ! $this->_wp_user_obj ) {
46
-			$this->_wp_user_obj = get_user_by('ID', $this->ID() );
45
+		if ( ! $this->_wp_user_obj) {
46
+			$this->_wp_user_obj = get_user_by('ID', $this->ID());
47 47
 		}
48 48
 		return $this->_wp_user_obj;
49 49
 	}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 						$_SERVER['REQUEST_URI']
70 70
 					)
71 71
 				),
72
-				get_edit_user_link( $this->ID() )
72
+				get_edit_user_link($this->ID())
73 73
 			)
74 74
 		);
75 75
 	}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @return string
88 88
 	 */
89 89
 	public function get_admin_overview_link() {
90
-		return admin_url( 'users.php' );
90
+		return admin_url('users.php');
91 91
 	}
92 92
 
93 93
 
Please login to merge, or discard this patch.
core/interfaces/EEI_Query_Filter.interface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @since      4.9.0
13 13
  * @author     Darren Ethier
14 14
  */
15
-interface EEI_Query_Filter  {
15
+interface EEI_Query_Filter {
16 16
 
17 17
 
18 18
 	/**
Please login to merge, or discard this patch.
core/libraries/line_item_filters/EE_Line_Item_Filter_Base.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Class EE_Line_Item_Filter_Base
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @param \EEI_Line_Item $line_item
25 25
 	 * @return \EEI_Line_Item
26 26
 	 */
27
-	public function process( EEI_Line_Item $line_item ) {
27
+	public function process(EEI_Line_Item $line_item) {
28 28
 		return $line_item;
29 29
 	}
30 30
 
Please login to merge, or discard this patch.
reg_steps/payment_options/payment_options_main.template.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@
 block discarded – undo
1 1
 
2 2
 	<h4 id="reg-page-totals-hdr" class="">
3
-		<span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count;?>
3
+		<span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count; ?>
4 4
 	</h4>
5 5
 
6 6
 	<div class="spco-payment-info-dv">
7 7
 		<table id="spco-payment-info-table">
8 8
 			<thead>
9 9
 				<tr>
10
-					<th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th>
11
-					<th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso');?></th>
12
-					<th scope="col" width="5%" class="jst-cntr"><?php _e( 'Qty', 'event_espresso' ); ?></th>
13
-					<th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso');?></th>
14
-					<?php	do_action( 'AHEE__registration_page_payment_options__payment_info_table_thead_row_end' ); ?>
10
+					<th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th>
11
+					<th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso'); ?></th>
12
+					<th scope="col" width="5%" class="jst-cntr"><?php _e('Qty', 'event_espresso'); ?></th>
13
+					<th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso'); ?></th>
14
+					<?php	do_action('AHEE__registration_page_payment_options__payment_info_table_thead_row_end'); ?>
15 15
 				</tr>
16 16
 			</thead>
17 17
 			<tbody>
18
-			<?php echo $transaction_details;?>
19
-			<?php	do_action( 'AHEE__registration_page_payment_options__payment_info_table_tbody_end' ); ?>
18
+			<?php echo $transaction_details; ?>
19
+			<?php	do_action('AHEE__registration_page_payment_options__payment_info_table_tbody_end'); ?>
20 20
 			</tbody>
21 21
 		</table>
22 22
 	</div>
23 23
 	<div class="clear-float"> </div>
24 24
 
25
-	<?php  echo $before_payment_options;  ?>
25
+	<?php  echo $before_payment_options; ?>
26 26
 
27 27
 	<div id="methods-of-payment">
28 28
 		<?php echo $payment_options; ?>
29
-		<a id="reg-page-select-other-method-of-payment-lnk" class="hidden smaller-text right" rel=""><?php echo apply_filters( 'FHEE__registration_page_payment_options__select_other_method_of_payment_lnk', __( 'select a different method of payment:', 'event_espresso' )); ?></a>
29
+		<a id="reg-page-select-other-method-of-payment-lnk" class="hidden smaller-text right" rel=""><?php echo apply_filters('FHEE__registration_page_payment_options__select_other_method_of_payment_lnk', __('select a different method of payment:', 'event_espresso')); ?></a>
30 30
 	</div>
31 31
 	<!-- end #methods-of-payment -->
32 32
 
33
-	<?php  echo $after_payment_options;  ?>
33
+	<?php  echo $after_payment_options; ?>
34 34
 
35
-	<?php  echo $default_hidden_inputs;  ?>
36
-	<?php  echo $extra_hidden_inputs;  ?>
35
+	<?php  echo $default_hidden_inputs; ?>
36
+	<?php  echo $extra_hidden_inputs; ?>
37 37
 
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_venues-details.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@
 block discarded – undo
1 1
 <?php //echo '<h1>' . __FILE__ . '</h1>'; ?>
2 2
 <?php global $post; ?>
3 3
 <div class="venue-content">
4
-<?php if ( apply_filters( 'FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE )): ?>
4
+<?php if (apply_filters('FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE)): ?>
5 5
 	<div class="entry-meta">
6
-		<span class="tags-links"><?php espresso_venue_categories( $post->ID, TRUE, TRUE ); ?></span>
6
+		<span class="tags-links"><?php espresso_venue_categories($post->ID, TRUE, TRUE); ?></span>
7 7
 		<?php
8
-			if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
8
+			if ( ! post_password_required() && (comments_open() || get_comments_number())) :
9 9
 		?>
10
-		<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'event_espresso' ), __( '1 Comment', 'event_espresso' ), __( '% Comments', 'event_espresso' ) ); ?></span>
10
+		<span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'event_espresso'), __('1 Comment', 'event_espresso'), __('% Comments', 'event_espresso')); ?></span>
11 11
 		<?php
12 12
 			endif;
13 13
 
14
-			edit_post_link( __( 'Edit', 'event_espresso' ), '<span class="edit-link">', '</span>' );
14
+			edit_post_link(__('Edit', 'event_espresso'), '<span class="edit-link">', '</span>');
15 15
 		?>
16 16
 	</div>
17 17
 <?php  endif; ?>
18 18
 	
19 19
 	<h3 class="event-venues-h3 ee-event-h3">
20
-		<?php _e( 'Details', 'event_espresso' ); ?>
20
+		<?php _e('Details', 'event_espresso'); ?>
21 21
 	</h3>
22 22
 
23
-	<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?>
23
+	<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?>
24 24
 	<p>
25
-		<span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?> </strong></span><?php echo $venue_phone; ?>
25
+		<span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?> </strong></span><?php echo $venue_phone; ?>
26 26
 	</p>
27 27
 	<?php endif; ?>
28
-	<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?>
28
+	<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?>
29 29
 	<p>
30
-		<span class="small-text"><strong><?php _e( 'Venue Website:', 'event_espresso' ); ?> </strong></span><?php echo $venue_website; ?>
30
+		<span class="small-text"><strong><?php _e('Venue Website:', 'event_espresso'); ?> </strong></span><?php echo $venue_website; ?>
31 31
 	</p>
32 32
 	<?php endif; ?>
33 33
 	<?php 
34
-	do_action( 'AHEE__content_espresso_venues_details_template__before_the_content', $post ); 
35
-	if ( is_archive() && has_excerpt( $post->ID )) {
34
+	do_action('AHEE__content_espresso_venues_details_template__before_the_content', $post); 
35
+	if (is_archive() && has_excerpt($post->ID)) {
36 36
 		the_excerpt();
37 37
 	} else {
38 38
 		the_content();
39 39
 	}
40
-	do_action( 'AHEE__content_espresso_venues_details_template__after_the_content', $post ); 
40
+	do_action('AHEE__content_espresso_venues_details_template__after_the_content', $post); 
41 41
 	?>
42 42
 </div>
43 43
 <!-- .venue-content -->
Please login to merge, or discard this patch.
core/db_classes/EE_Import.class.php 4 patches
Doc Comments   +29 added lines, -1 removed lines patch added patch discarded remove patch
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @param array         $csv_data_array - the array containing the csv data produced from EE_CSV::import_csv_to_model_data_array()
288 288
 	 * @param bool | string $model_name - an array containing the csv column names as keys with the corresponding db table fields they will be saved to
289
-	 * @return TRUE on success, FALSE on fail
289
+	 * @return boolean on success, FALSE on fail
290 290
 	 */
291 291
 	public function save_csv_data_array_to_db( $csv_data_array, $model_name = FALSE ) {
292 292
 
@@ -883,18 +883,46 @@  discard block
 block discarded – undo
883 883
 	public function get_total_general_errors(){
884 884
 		return count( $this->_general_errors );
885 885
 	}
886
+
887
+	/**
888
+	 * @param string $message
889
+	 */
886 890
 	protected function _add_update_success( $message ){
887 891
 		$this->_updates[] = $message;
888 892
 	}
893
+
894
+	/**
895
+	 * @param string $message
896
+	 */
889 897
 	protected function _add_insert_success( $message ){
890 898
 		$this->_inserts[] = $message;
891 899
 	}
900
+
901
+	/**
902
+	 * @param string $message
903
+	 * @param string $file
904
+	 * @param string $function
905
+	 * @param integer $line
906
+	 */
892 907
 	protected function _add_update_error( $message, $file, $function, $line ){
893 908
 		$this->_update_errors[] = array( $message, $file, $function, $line );
894 909
 	}
910
+
911
+	/**
912
+	 * @param string $message
913
+	 * @param string $file
914
+	 * @param string $function
915
+	 * @param integer $line
916
+	 */
895 917
 	protected function _add_insert_error( $message, $file, $function, $line ){
896 918
 		$this->_insert_errors[] = array( $message, $file, $function, $line );
897 919
 	}
920
+
921
+	/**
922
+	 * @param string $file
923
+	 * @param string $function
924
+	 * @param integer $line
925
+	 */
898 926
 	protected function _add_general_error( $message, $file, $function, $line ){
899 927
 		$this->_general_errors[] = array( $message, $file, $function, $line );
900 928
 	}
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -146,43 +146,43 @@  discard block
 block discarded – undo
146 146
 		if ( isset( $_REQUEST['import'] )) {
147 147
 			if( isset( $_POST['csv_submitted'] )) {
148 148
 
149
-			    switch ( $_FILES['file']['error'][0] ) {
150
-			        case UPLOAD_ERR_OK:
151
-			            $error_msg = FALSE;
152
-			            break;
153
-			        case UPLOAD_ERR_INI_SIZE:
154
-			            $error_msg = __("'The uploaded file exceeds the upload_max_filesize directive in php.ini.'", "event_espresso");
155
-			            break;
156
-			        case UPLOAD_ERR_FORM_SIZE:
157
-			            $error_msg = __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', "event_espresso");
158
-			            break;
159
-			        case UPLOAD_ERR_PARTIAL:
160
-			            $error_msg = __('The uploaded file was only partially uploaded.', "event_espresso");
161
-			            break;
162
-			        case UPLOAD_ERR_NO_FILE:
163
-			            $error_msg = __('No file was uploaded.', "event_espresso");
164
-			            break;
165
-			        case UPLOAD_ERR_NO_TMP_DIR:
166
-			            $error_msg = __('Missing a temporary folder.', "event_espresso");
167
-			            break;
168
-			        case UPLOAD_ERR_CANT_WRITE:
169
-			            $error_msg = __('Failed to write file to disk.', "event_espresso");
170
-			            break;
171
-			        case UPLOAD_ERR_EXTENSION:
172
-			            $error_msg = __('File upload stopped by extension.', "event_espresso");
173
-			            break;
174
-			        default:
175
-			            $error_msg = __('An unknown error occurred and the file could not be uploaded', "event_espresso");
176
-			            break;
177
-			    }
149
+				switch ( $_FILES['file']['error'][0] ) {
150
+					case UPLOAD_ERR_OK:
151
+						$error_msg = FALSE;
152
+						break;
153
+					case UPLOAD_ERR_INI_SIZE:
154
+						$error_msg = __("'The uploaded file exceeds the upload_max_filesize directive in php.ini.'", "event_espresso");
155
+						break;
156
+					case UPLOAD_ERR_FORM_SIZE:
157
+						$error_msg = __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', "event_espresso");
158
+						break;
159
+					case UPLOAD_ERR_PARTIAL:
160
+						$error_msg = __('The uploaded file was only partially uploaded.', "event_espresso");
161
+						break;
162
+					case UPLOAD_ERR_NO_FILE:
163
+						$error_msg = __('No file was uploaded.', "event_espresso");
164
+						break;
165
+					case UPLOAD_ERR_NO_TMP_DIR:
166
+						$error_msg = __('Missing a temporary folder.', "event_espresso");
167
+						break;
168
+					case UPLOAD_ERR_CANT_WRITE:
169
+						$error_msg = __('Failed to write file to disk.', "event_espresso");
170
+						break;
171
+					case UPLOAD_ERR_EXTENSION:
172
+						$error_msg = __('File upload stopped by extension.', "event_espresso");
173
+						break;
174
+					default:
175
+						$error_msg = __('An unknown error occurred and the file could not be uploaded', "event_espresso");
176
+						break;
177
+				}
178 178
 
179 179
 				if ( ! $error_msg ) {
180 180
 
181
-				    $filename	= $_FILES['file']['name'][0];
181
+					$filename	= $_FILES['file']['name'][0];
182 182
 					$file_ext 		= substr( strrchr( $filename, '.' ), 1 );
183
-				    //$file_type 	= $_FILES['file']['type'][0];
184
-				    $temp_file	= $_FILES['file']['tmp_name'][0];
185
-				    $filesize    	= $_FILES['file']['size'][0] / 1024;//convert from bytes to KB
183
+					//$file_type 	= $_FILES['file']['type'][0];
184
+					$temp_file	= $_FILES['file']['tmp_name'][0];
185
+					$filesize    	= $_FILES['file']['size'][0] / 1024;//convert from bytes to KB
186 186
 
187 187
 					if ( $file_ext=='csv' ) {
188 188
 
@@ -331,10 +331,10 @@  discard block
 block discarded – undo
331 331
 			unset($csv_data_array[EE_CSV::metadata_header]);
332 332
 		}
333 333
 		/**
334
-		* @var $old_db_to_new_db_mapping 2d array: top level keys being model names, bottom-level keys being the original key, and
335
-		* the value will be the newly-inserted ID.
336
-		* If we have already imported data from the same website via CSV, it should be kept in this wp option
337
-		*/
334
+		 * @var $old_db_to_new_db_mapping 2d array: top level keys being model names, bottom-level keys being the original key, and
335
+		 * the value will be the newly-inserted ID.
336
+		 * If we have already imported data from the same website via CSV, it should be kept in this wp option
337
+		 */
338 338
 	   $old_db_to_new_db_mapping = get_option('ee_id_mapping_from'.sanitize_title($old_site_url),array());
339 339
 	   if( $old_db_to_new_db_mapping){
340 340
 		   EE_Error::add_attention(
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 				foreach($model_object_data as $field){
436 436
 					if($field){
437 437
 						$row_is_completely_empty = false;
438
-                                                break;
438
+												break;
439 439
 					}
440 440
 				}
441 441
 				if($row_is_completely_empty){
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 
454 454
 
455 455
 				$model_object_data = $this->_replace_temp_ids_with_mappings( $model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b );
456
-                $model_object_data = $this->_prepare_data_for_use_in_db( $model_object_data, $model, $export_from_site_a_to_b );
456
+				$model_object_data = $this->_prepare_data_for_use_in_db( $model_object_data, $model, $export_from_site_a_to_b );
457 457
 //now we need to decide if we're going to add a new model object given the $model_object_data,
458 458
 				//or just update.
459 459
 				if($export_from_site_a_to_b){
Please login to merge, or discard this patch.
Spacing   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3 3
 /**
4 4
  * EE_Import class
5 5
  *
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function instance() {
71 71
 		// check if class object is instantiated
72
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Import )) {
72
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Import)) {
73 73
 			self::$_instance = new self();
74 74
 		}
75
-		add_filter( 'FHEE__EE_Import___replace_temp_ids_with_mappings__model_object_data__end', array( self::$_instance, 'handle_split_term_ids' ), 10, 2 );
75
+		add_filter('FHEE__EE_Import___replace_temp_ids_with_mappings__model_object_data__end', array(self::$_instance, 'handle_split_term_ids'), 10, 2);
76 76
 		return self::$_instance;
77 77
 	}
78 78
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * Resets the importer
81 81
 	 * @return EE_Import
82 82
 	 */
83
-	public static function reset(){
83
+	public static function reset() {
84 84
 		self::$_instance = null;
85 85
 		return self::instance();
86 86
 	}
@@ -99,27 +99,27 @@  discard block
 block discarded – undo
99 99
 	  *
100 100
 *@return string
101 101
 	  */
102
-	public function upload_form ( $title, $intro, $form_url, $action, $type  ) {
102
+	public function upload_form($title, $intro, $form_url, $action, $type) {
103 103
 
104
-		$form_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => $action ), $form_url );
104
+		$form_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => $action), $form_url);
105 105
 
106 106
 		ob_start();
107 107
 ?>
108 108
 	<div class="ee-upload-form-dv">
109
-		<h3><?php echo $title;?></h3>
110
-		<p><?php echo $intro;?></p>
109
+		<h3><?php echo $title; ?></h3>
110
+		<p><?php echo $intro; ?></p>
111 111
 
112 112
 		<form action="<?php echo $form_url?>" method="post" enctype="multipart/form-data">
113
-			<input type="hidden" name="csv_submitted" value="TRUE" id="<?php echo time();?>">
114
-			<input name="import" type="hidden" value="<?php echo $type;?>" />
113
+			<input type="hidden" name="csv_submitted" value="TRUE" id="<?php echo time(); ?>">
114
+			<input name="import" type="hidden" value="<?php echo $type; ?>" />
115 115
 			<input type="file" name="file[]" size="90" >
116
-			<input class="button-primary" type="submit" value="<?php _e( 'Upload File', 'event_espresso' );?>">
116
+			<input class="button-primary" type="submit" value="<?php _e('Upload File', 'event_espresso'); ?>">
117 117
 		</form>
118 118
 
119 119
 		<p class="ee-attention">
120
-			<b><?php _e( 'Attention', 'event_espresso' );?></b><br/>
121
-			<?php echo sprintf( __( 'Accepts .%s file types only.', 'event_espresso' ), $type ) ;?>
122
-			<?php echo __( 'Please only import CSV files exported from Event Espresso, or compatible 3rd-party software.', 'event_espresso' );?>
120
+			<b><?php _e('Attention', 'event_espresso'); ?></b><br/>
121
+			<?php echo sprintf(__('Accepts .%s file types only.', 'event_espresso'), $type); ?>
122
+			<?php echo __('Please only import CSV files exported from Event Espresso, or compatible 3rd-party software.', 'event_espresso'); ?>
123 123
 		</p>
124 124
 
125 125
 	</div>
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function import() {
142 142
 
143
-		require_once( EE_CLASSES . 'EE_CSV.class.php' );
143
+		require_once(EE_CLASSES.'EE_CSV.class.php');
144 144
 		$this->EE_CSV = EE_CSV::instance();
145 145
 		$success = true;
146
-		if ( isset( $_REQUEST['import'] )) {
147
-			if( isset( $_POST['csv_submitted'] )) {
146
+		if (isset($_REQUEST['import'])) {
147
+			if (isset($_POST['csv_submitted'])) {
148 148
 
149
-			    switch ( $_FILES['file']['error'][0] ) {
149
+			    switch ($_FILES['file']['error'][0]) {
150 150
 			        case UPLOAD_ERR_OK:
151 151
 			            $error_msg = FALSE;
152 152
 			            break;
@@ -176,29 +176,29 @@  discard block
 block discarded – undo
176 176
 			            break;
177 177
 			    }
178 178
 
179
-				if ( ! $error_msg ) {
179
+				if ( ! $error_msg) {
180 180
 
181
-				    $filename	= $_FILES['file']['name'][0];
182
-					$file_ext 		= substr( strrchr( $filename, '.' ), 1 );
181
+				    $filename = $_FILES['file']['name'][0];
182
+					$file_ext = substr(strrchr($filename, '.'), 1);
183 183
 				    //$file_type 	= $_FILES['file']['type'][0];
184
-				    $temp_file	= $_FILES['file']['tmp_name'][0];
185
-				    $filesize    	= $_FILES['file']['size'][0] / 1024;//convert from bytes to KB
184
+				    $temp_file = $_FILES['file']['tmp_name'][0];
185
+				    $filesize = $_FILES['file']['size'][0] / 1024; //convert from bytes to KB
186 186
 
187
-					if ( $file_ext=='csv' ) {
187
+					if ($file_ext == 'csv') {
188 188
 
189
-						$max_upload = $this->EE_CSV->get_max_upload_size();//max upload size in KB
190
-						if ( $filesize < $max_upload || true) {
189
+						$max_upload = $this->EE_CSV->get_max_upload_size(); //max upload size in KB
190
+						if ($filesize < $max_upload || true) {
191 191
 
192
-							$wp_upload_dir = str_replace( array( '\\', '/' ), DS, wp_upload_dir());
193
-							$path_to_file = $wp_upload_dir['basedir'] . DS . 'espresso' . DS . $filename;
192
+							$wp_upload_dir = str_replace(array('\\', '/'), DS, wp_upload_dir());
193
+							$path_to_file = $wp_upload_dir['basedir'].DS.'espresso'.DS.$filename;
194 194
 
195
-							if( move_uploaded_file( $temp_file, $path_to_file )) {
195
+							if (move_uploaded_file($temp_file, $path_to_file)) {
196 196
 								// convert csv to array
197
-								$this->csv_array = $this->EE_CSV->import_csv_to_model_data_array( $path_to_file );
197
+								$this->csv_array = $this->EE_CSV->import_csv_to_model_data_array($path_to_file);
198 198
 								// was data successfully stored in an array?
199
-								if ( is_array( $this->csv_array ) ) {
199
+								if (is_array($this->csv_array)) {
200 200
 									// save processed codes to db
201
-									if ( $this->save_csv_data_array_to_db( $this->csv_array, false ) ) {
201
+									if ($this->save_csv_data_array_to_db($this->csv_array, false)) {
202 202
 										$success = TRUE;
203 203
 									}
204 204
 								} else {
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 					}
246 246
 
247 247
 				} else {
248
-					$this->_add_general_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
248
+					$this->_add_general_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
249 249
 					$success = FALSE;
250 250
 				}
251 251
 
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
 	 * @param bool | string $model_name - an array containing the csv column names as keys with the corresponding db table fields they will be saved to
289 289
 	 * @return TRUE on success, FALSE on fail
290 290
 	 */
291
-	public function save_csv_data_array_to_db( $csv_data_array, $model_name = FALSE ) {
291
+	public function save_csv_data_array_to_db($csv_data_array, $model_name = FALSE) {
292 292
 
293 293
 		//whether to treat this import as if it's data from a different database or not
294 294
 		//ie, if it IS from a different database, ignore foreign keys
295 295
 		$export_from_site_a_to_b = true;
296 296
 		// first level of array is not table information but a table name was passed to the function
297 297
 		// array is only two levels deep, so let's fix that by adding a level, else the next steps will fail
298
-		if($model_name){
298
+		if ($model_name) {
299 299
 			$csv_data_array = array($csv_data_array);
300 300
 		}
301 301
 		//what models we want to update
@@ -309,14 +309,14 @@  discard block
 block discarded – undo
309 309
 		$old_site_url = site_url();
310 310
 
311 311
 		//handle metadata
312
-		if(isset($csv_data_array[EE_CSV::metadata_header]) ){
312
+		if (isset($csv_data_array[EE_CSV::metadata_header])) {
313 313
 			$this->_csv_import_metadata_row = array_shift($csv_data_array[EE_CSV::metadata_header]);
314 314
 			//ok so its metadata, dont try to save it to the db obviously...
315
-			if(isset($this->_csv_import_metadata_row['site_url']) && $this->_csv_import_metadata_row['site_url'] == site_url()){
316
-				EE_Error::add_attention( __("CSV Data appears to be from the same database, so attempting to update data", "event_espresso") );
315
+			if (isset($this->_csv_import_metadata_row['site_url']) && $this->_csv_import_metadata_row['site_url'] == site_url()) {
316
+				EE_Error::add_attention(__("CSV Data appears to be from the same database, so attempting to update data", "event_espresso"));
317 317
 				$export_from_site_a_to_b = false;
318
-			}else{
319
-				$old_site_url = isset( $this->_csv_import_metadata_row['site_url']) ? $this->_csv_import_metadata_row['site_url'] : $old_site_url;
318
+			} else {
319
+				$old_site_url = isset($this->_csv_import_metadata_row['site_url']) ? $this->_csv_import_metadata_row['site_url'] : $old_site_url;
320 320
 				EE_Error::add_attention(
321 321
 					sprintf(
322 322
 						__('CSV Data appears to be from a different database (%1$s instead of %2$s), so we assume IDs in the CSV data DO NOT correspond to IDs in this database', "event_espresso"),
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 					)
326 326
 				);
327 327
 			};
328
-			if( ! empty( $this->_csv_import_metadata_row['models_to_update'] )){
329
-				$models_to_update = explode(",", $this->_csv_import_metadata_row['models_to_update' ] );
328
+			if ( ! empty($this->_csv_import_metadata_row['models_to_update'])) {
329
+				$models_to_update = explode(",", $this->_csv_import_metadata_row['models_to_update']);
330 330
 			}
331 331
 			unset($csv_data_array[EE_CSV::metadata_header]);
332 332
 		}
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
 		* the value will be the newly-inserted ID.
336 336
 		* If we have already imported data from the same website via CSV, it should be kept in this wp option
337 337
 		*/
338
-	   $old_db_to_new_db_mapping = get_option('ee_id_mapping_from'.sanitize_title($old_site_url),array());
339
-	   if( $old_db_to_new_db_mapping){
338
+	   $old_db_to_new_db_mapping = get_option('ee_id_mapping_from'.sanitize_title($old_site_url), array());
339
+	   if ($old_db_to_new_db_mapping) {
340 340
 		   EE_Error::add_attention(
341 341
 			   sprintf(
342 342
 				   __('We noticed you have imported data via CSV from %1$s before. Because of this, IDs in your CSV have been mapped to their new IDs in %2$s', "event_espresso"),
@@ -345,23 +345,23 @@  discard block
 block discarded – undo
345 345
 			   )
346 346
 		   );
347 347
 	   }
348
-	   $old_db_to_new_db_mapping = $this->save_data_rows_to_db($csv_data_array, $export_from_site_a_to_b, $old_db_to_new_db_mapping, $models_to_update );
348
+	   $old_db_to_new_db_mapping = $this->save_data_rows_to_db($csv_data_array, $export_from_site_a_to_b, $old_db_to_new_db_mapping, $models_to_update);
349 349
 
350 350
 		//save the mapping from old db to new db in case they try re-importing the same data from the same website again
351
-		update_option('ee_id_mapping_from'.sanitize_title($old_site_url),$old_db_to_new_db_mapping);
351
+		update_option('ee_id_mapping_from'.sanitize_title($old_site_url), $old_db_to_new_db_mapping);
352 352
 
353 353
 
354 354
 		//lastly, we need to update the datetime and ticket sold amounts
355 355
 		//as those may have been affected by this
356
-		EEM_Datetime::instance()->update_sold( EEM_Datetime::instance()->get_all() );
356
+		EEM_Datetime::instance()->update_sold(EEM_Datetime::instance()->get_all());
357 357
 		EEM_Ticket::instance()->update_tickets_sold(EEM_Ticket::instance()->get_all());
358 358
 
359 359
 		// if there was at least one success and absolutely no errors
360
-		if (	! $this->get_total_general_errors() &&
361
-				! $this->get_total_insert_errors()  &&
360
+		if ( ! $this->get_total_general_errors() &&
361
+				! $this->get_total_insert_errors() &&
362 362
 				! $this->get_total_update_errors() &&
363 363
 				$this->get_total_inserts() &&
364
-				$this->get_total_updates() ) {
364
+				$this->get_total_updates()) {
365 365
 			return TRUE;
366 366
 		} else {
367 367
 			return FALSE;
@@ -401,23 +401,23 @@  discard block
 block discarded – undo
401 401
 	  * @return array updated $old_db_to_new_db_mapping
402 402
 	  * @throws \EE_Error
403 403
 	  */
404
-	public function save_data_rows_to_db( $csv_data_array, $export_from_site_a_to_b, $old_db_to_new_db_mapping, $models_to_update = NULL ) {
405
-		foreach ( $csv_data_array as $model_name_in_csv_data => $model_data_from_import ) {
404
+	public function save_data_rows_to_db($csv_data_array, $export_from_site_a_to_b, $old_db_to_new_db_mapping, $models_to_update = NULL) {
405
+		foreach ($csv_data_array as $model_name_in_csv_data => $model_data_from_import) {
406 406
 			//now check that assumption was correct. If
407
-			if ( EE_Registry::instance()->is_model_name($model_name_in_csv_data)) {
407
+			if (EE_Registry::instance()->is_model_name($model_name_in_csv_data)) {
408 408
 				$model_name = $model_name_in_csv_data;
409
-			}elseif( empty( $model_name_in_csv_data ) ) {
409
+			}elseif (empty($model_name_in_csv_data)) {
410 410
 				// no table info in the array and no table name passed to the function?? FAIL
411 411
 				$this->_add_general_error(
412
-					__('No table information was specified and/or found, therefore the import could not be completed','event_espresso'),
412
+					__('No table information was specified and/or found, therefore the import could not be completed', 'event_espresso'),
413 413
 					__FILE__, __FUNCTION__, __LINE__
414 414
 				);
415 415
 				return FALSE;
416
-			}else{
416
+			} else {
417 417
 				//what is this model name??
418 418
 				$this->_add_general_error(
419 419
 					sprintf(
420
-						__( 'The model "%1$s" is not recognized so its data cannot be imported', 'event_espresso' ),
420
+						__('The model "%1$s" is not recognized so its data cannot be imported', 'event_espresso'),
421 421
 						$model_name_in_csv_data
422 422
 					),
423 423
 					__FILE__, __FUNCTION__, __LINE__
@@ -429,77 +429,77 @@  discard block
 block discarded – undo
429 429
 			$model = EE_Registry::instance()->load_model($model_name);
430 430
 
431 431
 			//so without further ado, scanning all the data provided for primary keys and their inital values
432
-			foreach ( $model_data_from_import as $model_object_data ) {
432
+			foreach ($model_data_from_import as $model_object_data) {
433 433
 				//before we do ANYTHING, make sure the csv row wasn't just completely blank
434 434
 				$row_is_completely_empty = true;
435
-				foreach($model_object_data as $field){
436
-					if($field){
435
+				foreach ($model_object_data as $field) {
436
+					if ($field) {
437 437
 						$row_is_completely_empty = false;
438 438
                                                 break;
439 439
 					}
440 440
 				}
441
-				if($row_is_completely_empty){
441
+				if ($row_is_completely_empty) {
442 442
 					continue;
443 443
 				}
444 444
 				//make sure there is no data for fields we don't recognize
445
-				$model_object_data = array_intersect_key( $model_object_data, $model->field_settings() );
445
+				$model_object_data = array_intersect_key($model_object_data, $model->field_settings());
446 446
 				//find the PK in the row of data (or a combined key if
447 447
 				//there is no primary key)
448
-				if($model->has_primary_key_field()){
449
-					$id_in_csv =  $model_object_data[$model->primary_key_name()];
450
-				}else{
448
+				if ($model->has_primary_key_field()) {
449
+					$id_in_csv = $model_object_data[$model->primary_key_name()];
450
+				} else {
451 451
 					$id_in_csv = $model->get_index_primary_key_string($model_object_data);
452 452
 				}
453 453
 
454 454
 
455
-				$model_object_data = $this->_replace_temp_ids_with_mappings( $model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b );
456
-                $model_object_data = $this->_prepare_data_for_use_in_db( $model_object_data, $model, $export_from_site_a_to_b );
455
+				$model_object_data = $this->_replace_temp_ids_with_mappings($model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b);
456
+                $model_object_data = $this->_prepare_data_for_use_in_db($model_object_data, $model, $export_from_site_a_to_b);
457 457
 //now we need to decide if we're going to add a new model object given the $model_object_data,
458 458
 				//or just update.
459
-				if($export_from_site_a_to_b){
460
-					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_other_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
461
-				}else{//this is just a re-import
462
-					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_same_db( $id_in_csv, $model_object_data, $model );
459
+				if ($export_from_site_a_to_b) {
460
+					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_other_db($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
461
+				} else {//this is just a re-import
462
+					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_same_db($id_in_csv, $model_object_data, $model);
463 463
 				}
464
-				if( $what_to_do == self::do_nothing ) {
464
+				if ($what_to_do == self::do_nothing) {
465 465
 					continue;
466 466
 				}
467 467
 
468 468
 				//double-check we actually want to insert, if that's what we're planning
469 469
 				//based on whether this item would be unique in the DB or not
470
-				if( $what_to_do == self::do_insert ) {
470
+				if ($what_to_do == self::do_insert) {
471 471
 					//we're supposed to be inserting. But wait, will this thing
472 472
 					//be acceptable if inserted?
473
-					$conflicting = $model->get_one_conflicting( $model_object_data, false );
474
-					if($conflicting){
473
+					$conflicting = $model->get_one_conflicting($model_object_data, false);
474
+					if ($conflicting) {
475 475
 						//ok, this item would conflict if inserted. Just update the item that it conflicts with.
476 476
 						$what_to_do = self::do_update;
477 477
 						//and if this model has a primary key, remember its mapping
478
-						if($model->has_primary_key_field()){
478
+						if ($model->has_primary_key_field()) {
479 479
 							$old_db_to_new_db_mapping[$model_name][$id_in_csv] = $conflicting->ID();
480 480
 							$model_object_data[$model->primary_key_name()] = $conflicting->ID();
481
-						}else{
481
+						} else {
482 482
 							//we want to update this conflicting item, instead of inserting a conflicting item
483 483
 							//so we need to make sure they match entirely (its possible that they only conflicted on one field, but we need them to match on other fields
484 484
 							//for the WHERE conditions in the update). At the time of this comment, there were no models like this
485
-							foreach($model->get_combined_primary_key_fields() as $key_field){
485
+							foreach ($model->get_combined_primary_key_fields() as $key_field) {
486 486
 								$model_object_data[$key_field->get_name()] = $conflicting->get($key_field->get_name());
487 487
 							}
488 488
 						}
489 489
 					}
490 490
 				}
491
-				if( $what_to_do == self::do_insert ) {
492
-					$old_db_to_new_db_mapping = $this->_insert_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
493
-				}elseif( $what_to_do == self::do_update ) {
494
-					if( $models_to_update === null || in_array( $model_name_in_csv_data, $models_to_update ) ){
495
-						$old_db_to_new_db_mapping = $this->_update_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
496
-					}else{
491
+				if ($what_to_do == self::do_insert) {
492
+					$old_db_to_new_db_mapping = $this->_insert_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
493
+				}elseif ($what_to_do == self::do_update) {
494
+					if ($models_to_update === null || in_array($model_name_in_csv_data, $models_to_update)) {
495
+						$old_db_to_new_db_mapping = $this->_update_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
496
+					} else {
497 497
 						//we would have updated this, but the export data indicated we ought not
498 498
 					}
499
-				}else{
499
+				} else {
500 500
 					throw new EE_Error(
501 501
 						sprintf(
502
-							__( 'Programming error. We should be inserting or updating, but instead we are being told to "%1$s", which is invalid', 'event_espresso' ),
502
+							__('Programming error. We should be inserting or updating, but instead we are being told to "%1$s", which is invalid', 'event_espresso'),
503 503
 							$what_to_do
504 504
 						)
505 505
 					);
@@ -523,20 +523,20 @@  discard block
 block discarded – undo
523 523
 	 * @param array $old_db_to_new_db_mapping by reference so it can be modified
524 524
 	 * @return string one of the constants on this class that starts with do_*
525 525
 	 */
526
-	protected function _decide_whether_to_insert_or_update_given_data_from_other_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping ) {
526
+	protected function _decide_whether_to_insert_or_update_given_data_from_other_db($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping) {
527 527
 		$model_name = $model->get_this_model_name();
528 528
 		//if it's a site-to-site export-and-import, see if this model object's id
529 529
 		//in the old data that we know of
530 530
 
531
-		if( isset($old_db_to_new_db_mapping[$model_name][$id_in_csv]) ){
532
-			$what_to_do =  self::do_update;
533
-		}else{
534
-			$what_to_do =  self::do_insert;
531
+		if (isset($old_db_to_new_db_mapping[$model_name][$id_in_csv])) {
532
+			$what_to_do = self::do_update;
533
+		} else {
534
+			$what_to_do = self::do_insert;
535 535
 		}
536 536
 		//consider any exceptions, usually where there are other uniqueness constraints
537
-		if( $model instanceof EEM_Question_Group ) {
538
-			if( isset( $model_object_data[ 'QSG_system' ] ) &&
539
-					$model_object_data[ 'QSG_system' ] ) {
537
+		if ($model instanceof EEM_Question_Group) {
538
+			if (isset($model_object_data['QSG_system']) &&
539
+					$model_object_data['QSG_system']) {
540 540
 				$what_to_do = self::do_update;
541 541
 			}
542 542
 		}
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 	  * @throws \EE_Error
559 559
 	  * @internal param \type $old_db_to_new_db_mapping
560 560
 	  */
561
-	protected function _decide_whether_to_insert_or_update_given_data_from_same_db( $id_in_csv, $model_object_data, $model ) {
561
+	protected function _decide_whether_to_insert_or_update_given_data_from_same_db($id_in_csv, $model_object_data, $model) {
562 562
 		//in this case, check if this thing ACTUALLY exists in the database
563
-		if( $model->get_one_conflicting( $model_object_data ) ){
563
+		if ($model->get_one_conflicting($model_object_data)) {
564 564
 			return self::do_update;
565
-		}else{
565
+		} else {
566 566
 			return self::do_insert;
567 567
 		}
568 568
 	}
@@ -583,32 +583,32 @@  discard block
 block discarded – undo
583 583
 	 *
584 584
 *@return array updated model object data with temp IDs removed
585 585
 	 */
586
-	protected function _replace_temp_ids_with_mappings( $model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b ) {
586
+	protected function _replace_temp_ids_with_mappings($model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
587 587
 		//if this model object's primary key is in the mapping, replace it
588
-		if( $model->has_primary_key_field() &&
588
+		if ($model->has_primary_key_field() &&
589 589
 				$model->get_primary_key_field()->is_auto_increment() &&
590
-				isset( $old_db_to_new_db_mapping[ $model->get_this_model_name() ] ) &&
591
-				isset( $old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $model_object_data[ $model->primary_key_name() ] ] ) ) {
592
-			$model_object_data[ $model->primary_key_name() ] = $old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $model_object_data[ $model->primary_key_name() ] ];
590
+				isset($old_db_to_new_db_mapping[$model->get_this_model_name()]) &&
591
+				isset($old_db_to_new_db_mapping[$model->get_this_model_name()][$model_object_data[$model->primary_key_name()]])) {
592
+			$model_object_data[$model->primary_key_name()] = $old_db_to_new_db_mapping[$model->get_this_model_name()][$model_object_data[$model->primary_key_name()]];
593 593
 		}
594 594
 
595
-		try{
595
+		try {
596 596
 			$model_name_field = $model->get_field_containing_related_model_name();
597 597
 			//$models_pointed_to_by_model_name_field = $model_name_field->get_model_names_pointed_to();
598
-		}catch( EE_Error $e ){
598
+		} catch (EE_Error $e) {
599 599
 			$model_name_field = NULL;
600 600
 			//$models_pointed_to_by_model_name_field = array();
601 601
 		}
602
-		foreach( $model->field_settings( true )  as $field_obj ){
603
-			if( $field_obj instanceof EE_Foreign_Key_Int_Field ) {
602
+		foreach ($model->field_settings(true)  as $field_obj) {
603
+			if ($field_obj instanceof EE_Foreign_Key_Int_Field) {
604 604
 				$models_pointed_to = $field_obj->get_model_names_pointed_to();
605
-				foreach( $models_pointed_to as $model_pointed_to_by_fk ) {
605
+				foreach ($models_pointed_to as $model_pointed_to_by_fk) {
606 606
 
607
-					if( $model_name_field ){
608
-						$value_of_model_name_field = $model_object_data[ $model_name_field->get_name() ];
609
-						if( $value_of_model_name_field == $model_pointed_to_by_fk ) {
610
-							$model_object_data[ $field_obj->get_name() ] = $this->_find_mapping_in(
611
-								$model_object_data[ $field_obj->get_name() ],
607
+					if ($model_name_field) {
608
+						$value_of_model_name_field = $model_object_data[$model_name_field->get_name()];
609
+						if ($value_of_model_name_field == $model_pointed_to_by_fk) {
610
+							$model_object_data[$field_obj->get_name()] = $this->_find_mapping_in(
611
+								$model_object_data[$field_obj->get_name()],
612 612
 								$model_pointed_to_by_fk,
613 613
 								$old_db_to_new_db_mapping,
614 614
 								$export_from_site_a_to_b
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
 							//once we've found a mapping for this field no need to continue
617 617
 							break;
618 618
 						}
619
-					}else{
620
-						$model_object_data[ $field_obj->get_name() ] = $this->_find_mapping_in(
621
-							$model_object_data[ $field_obj->get_name() ],
619
+					} else {
620
+						$model_object_data[$field_obj->get_name()] = $this->_find_mapping_in(
621
+							$model_object_data[$field_obj->get_name()],
622 622
 							$model_pointed_to_by_fk,
623 623
 							$old_db_to_new_db_mapping,
624 624
 							$export_from_site_a_to_b
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 						break;
628 628
 					}
629 629
 				}
630
-			}else{
630
+			} else {
631 631
 				//it's a string foreign key (which we leave alone, because those are things
632 632
 				//like country names, which we'd really rather not make 2 USAs etc (we'd actually
633 633
 				//prefer to just update one)
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 			}
636 636
 		}
637 637
 		//allow for any other value replacement
638
-		return apply_filters( 'FHEE__EE_Import___replace_temp_ids_with_mappings__model_object_data__end', $model_object_data, $model );
638
+		return apply_filters('FHEE__EE_Import___replace_temp_ids_with_mappings__model_object_data__end', $model_object_data, $model);
639 639
 	}
640 640
 
641 641
 
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
 	  * @param boolean  $export_from_site_a_to_b
649 649
 	  * @return mixed|null|void
650 650
 	  */
651
-	 protected function _prepare_data_for_use_in_db( $original_data_row, $model, $export_from_site_a_to_b ) {
651
+	 protected function _prepare_data_for_use_in_db($original_data_row, $model, $export_from_site_a_to_b) {
652 652
 		 $altered_data_row = $original_data_row;
653
-		 switch ( $model->get_this_model_name() ) {
653
+		 switch ($model->get_this_model_name()) {
654 654
 			 case 'Message_Template_Group':
655 655
 				 if (
656
-					 isset( $original_data_row[ 'MTP_is_global' ] )
657
-					 && intval( $original_data_row[ 'MTP_is_global' ] ) == 1
656
+					 isset($original_data_row['MTP_is_global'])
657
+					 && intval($original_data_row['MTP_is_global']) == 1
658 658
 					 && apply_filters(
659 659
 						  'FHEE__EE_Import___prepare_data_for_use_in_db__tweak_global_message_template_groups',
660 660
 						  true,
@@ -664,34 +664,34 @@  discard block
 block discarded – undo
664 664
 					  )
665 665
 					  && ! $export_from_site_a_to_b
666 666
 				 ) {
667
-					 $altered_data_row[ 'MTP_is_global' ] = 0;
668
-					 $message_type = isset( $altered_data_row[ 'MTP_message_type' ] )
669
-						 ? $altered_data_row[ 'MTP_message_type' ]
670
-						 : __( 'Unknown', 'event_espresso' );
671
-					 $altered_data_row[ 'MTP_name' ] = sprintf(
672
-						 __( 'Global %1$s message template from %2$s', 'event_espresso' ),
667
+					 $altered_data_row['MTP_is_global'] = 0;
668
+					 $message_type = isset($altered_data_row['MTP_message_type'])
669
+						 ? $altered_data_row['MTP_message_type']
670
+						 : __('Unknown', 'event_espresso');
671
+					 $altered_data_row['MTP_name'] = sprintf(
672
+						 __('Global %1$s message template from %2$s', 'event_espresso'),
673 673
 						 $message_type,
674
-						 $this->_csv_import_metadata_row[ 'site_url' ]
674
+						 $this->_csv_import_metadata_row['site_url']
675 675
 					 );
676 676
 					 global $current_user;
677
-					 $altered_data_row[ 'MTP_description' ] = sprintf(
678
-						 __( 'Imported at %1$s by user %2$s', 'event_espresso' ),
679
-						 current_time( 'mysql' ),
677
+					 $altered_data_row['MTP_description'] = sprintf(
678
+						 __('Imported at %1$s by user %2$s', 'event_espresso'),
679
+						 current_time('mysql'),
680 680
 						 $current_user->user_nicename
681 681
 					 );
682 682
 				 }
683 683
 		 }
684
-		 foreach ( $model->field_settings() as $field_name => $field_obj ) {
685
-			 if ( $field_obj instanceof EE_Datetime_Field ) {
686
-				 $altered_data_row[ $field_name ] = $model->convert_datetime_for_query(
684
+		 foreach ($model->field_settings() as $field_name => $field_obj) {
685
+			 if ($field_obj instanceof EE_Datetime_Field) {
686
+				 $altered_data_row[$field_name] = $model->convert_datetime_for_query(
687 687
 					 $field_name,
688
-					 $original_data_row[ $field_name ],
688
+					 $original_data_row[$field_name],
689 689
 					 apply_filters(
690 690
 						 'FHEE__EE_Import___prepare_data_for_use_in_db__datetime_format_in_csv',
691 691
 						 'Y-m-d H:i:s'
692 692
 					 ),
693
-					 isset( $this->_csv_import_metadata_row[ 'timezone' ] )
694
-						 ? $this->_csv_import_metadata_row[ 'timezone' ]
693
+					 isset($this->_csv_import_metadata_row['timezone'])
694
+						 ? $this->_csv_import_metadata_row['timezone']
695 695
 						 : ''
696 696
 				 );
697 697
 			 }
@@ -713,14 +713,14 @@  discard block
 block discarded – undo
713 713
 	 * @param EEM_Base $model
714 714
 	 * @return array new model object data
715 715
 	 */
716
-	public function handle_split_term_ids( $model_object_data, $model ){
717
-		if( $model instanceof EEM_Term_Taxonomy &&
718
-				isset( $model_object_data['term_id'] ) &&
719
-				isset( $model_object_data[ 'taxonomy' ]) &&
720
-				apply_filters( 'FHEE__EE_Import__handle_split_term_ids__function_exists', function_exists( 'wp_get_split_term' ), $model_object_data ) ) {
721
-			$new_term_id = wp_get_split_term( $model_object_data[ 'term_id' ], $model_object_data[ 'taxonomy' ] );
722
-			if( $new_term_id ){
723
-				$model_object_data[ 'term_id' ] = $new_term_id;
716
+	public function handle_split_term_ids($model_object_data, $model) {
717
+		if ($model instanceof EEM_Term_Taxonomy &&
718
+				isset($model_object_data['term_id']) &&
719
+				isset($model_object_data['taxonomy']) &&
720
+				apply_filters('FHEE__EE_Import__handle_split_term_ids__function_exists', function_exists('wp_get_split_term'), $model_object_data)) {
721
+			$new_term_id = wp_get_split_term($model_object_data['term_id'], $model_object_data['taxonomy']);
722
+			if ($new_term_id) {
723
+				$model_object_data['term_id'] = $new_term_id;
724 724
 			}
725 725
 		}
726 726
 		return $model_object_data;
@@ -734,17 +734,17 @@  discard block
 block discarded – undo
734 734
 	 * @param bool $export_from_site_a_to_b
735 735
 	 * @return int
736 736
 	 */
737
-	protected function _find_mapping_in( $object_id, $model_name, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
738
-		if(	isset( $old_db_to_new_db_mapping[ $model_name ][ $object_id ] ) ){
739
-			return $old_db_to_new_db_mapping[ $model_name ][ $object_id ];
740
-		}elseif( $object_id == '0' || $object_id == '' ) {
737
+	protected function _find_mapping_in($object_id, $model_name, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
738
+		if (isset($old_db_to_new_db_mapping[$model_name][$object_id])) {
739
+			return $old_db_to_new_db_mapping[$model_name][$object_id];
740
+		}elseif ($object_id == '0' || $object_id == '') {
741 741
 			//leave as-is
742 742
 			return $object_id;
743
-		}elseif( $export_from_site_a_to_b ){
743
+		}elseif ($export_from_site_a_to_b) {
744 744
 			//we couldn't find a mapping for this, and it's from a different site,
745 745
 			//so blank it out
746 746
 			return null;
747
-		}elseif( ! $export_from_site_a_to_b ) {
747
+		}elseif ( ! $export_from_site_a_to_b) {
748 748
 			//we couldn't find a mapping for this, but it's from this DB anyway
749 749
 			//so let's just leave it as-is
750 750
 			return $object_id;
@@ -760,19 +760,19 @@  discard block
 block discarded – undo
760 760
 	 * @param array $old_db_to_new_db_mapping
761 761
 	 * @return array updated $old_db_to_new_db_mapping
762 762
 	 */
763
-	protected function _insert_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping ) {
763
+	protected function _insert_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping) {
764 764
 		//remove the primary key, if there is one (we don't want it for inserts OR updates)
765 765
 		//we'll put it back in if we need it
766
-		if($model->has_primary_key_field() && $model->get_primary_key_field()->is_auto_increment()){
766
+		if ($model->has_primary_key_field() && $model->get_primary_key_field()->is_auto_increment()) {
767 767
 			$effective_id = $model_object_data[$model->primary_key_name()];
768 768
 			unset($model_object_data[$model->primary_key_name()]);
769
-		}else{
770
-			$effective_id = $model->get_index_primary_key_string( $model_object_data );
769
+		} else {
770
+			$effective_id = $model->get_index_primary_key_string($model_object_data);
771 771
 		}
772 772
 		//the model takes care of validating the CSV's input
773
-		try{
773
+		try {
774 774
 			$new_id = $model->insert($model_object_data);
775
-			if( $new_id ){
775
+			if ($new_id) {
776 776
 				$old_db_to_new_db_mapping[$model->get_this_model_name()][$id_in_csv] = $new_id;
777 777
 				$this->_add_insert_success(
778 778
 					sprintf(
@@ -781,15 +781,15 @@  discard block
 block discarded – undo
781 781
 						$new_id
782 782
 					)
783 783
 				);
784
-			}else{
784
+			} else {
785 785
 				//put the ID used back in there for the error message
786
-				if($model->has_primary_key_field()){
786
+				if ($model->has_primary_key_field()) {
787 787
 					$model_object_data[$model->primary_key_name()] = $effective_id;
788 788
 				}
789 789
 				global $wpdb;
790 790
 				$this->_add_insert_error(
791 791
 					sprintf(
792
-						__('Could not insert new %1$s with ID in file %2$s because %3$s', "event_espresso" ),
792
+						__('Could not insert new %1$s with ID in file %2$s because %3$s', "event_espresso"),
793 793
 						$model->get_this_model_name(),
794 794
 						$id_in_csv,
795 795
 						$wpdb->last_error
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
 					__FILE__, __FUNCTION__, __LINE__
798 798
 				);
799 799
 			}
800
-		}catch(EE_Error $e){
801
-			if($model->has_primary_key_field()){
800
+		} catch (EE_Error $e) {
801
+			if ($model->has_primary_key_field()) {
802 802
 				$model_object_data[$model->primary_key_name()] = $effective_id;
803 803
 			}
804 804
 			$this->_add_insert_error(
@@ -822,29 +822,29 @@  discard block
 block discarded – undo
822 822
 	 * @param array $old_db_to_new_db_mapping
823 823
 	 * @return array updated $old_db_to_new_db_mapping
824 824
 	 */
825
-	protected function _update_from_data_array( $id_in_csv,  $original_model_object_data, $model, $old_db_to_new_db_mapping ) {
826
-		try{
825
+	protected function _update_from_data_array($id_in_csv, $original_model_object_data, $model, $old_db_to_new_db_mapping) {
826
+		try {
827 827
 			//let's keep two copies of the model object data:
828 828
 			//one for performing an update, one for everything else
829 829
 			$model_object_data_for_update = $original_model_object_data;
830
-			if ( $model->has_primary_key_field() ) {
830
+			if ($model->has_primary_key_field()) {
831 831
 				//wait- will this update cause a conflict with other data?
832
-				$conflicting = $model->get_one_conflicting( $original_model_object_data, false );
833
-				if ( $conflicting ) {
832
+				$conflicting = $model->get_one_conflicting($original_model_object_data, false);
833
+				if ($conflicting) {
834 834
 					//if so, just update the thing it would conflict with, dont cause a conflict
835 835
 					$pk_value = $conflicting->ID();
836 836
 				} else {
837
-					$pk_value = $model_object_data_for_update[ $model->primary_key_name() ];
837
+					$pk_value = $model_object_data_for_update[$model->primary_key_name()];
838 838
 				}
839
-				$conditions = array( $model->primary_key_name() => $pk_value );
839
+				$conditions = array($model->primary_key_name() => $pk_value);
840 840
 				//remove the primary key because we shouldn't use it for updating
841
-				unset( $model_object_data_for_update[ $model->primary_key_name() ] );
842
-			} elseif ( $model->get_combined_primary_key_fields() > 1 ) {
841
+				unset($model_object_data_for_update[$model->primary_key_name()]);
842
+			} elseif ($model->get_combined_primary_key_fields() > 1) {
843 843
 				$conditions = array();
844
-				foreach ( $model->get_combined_primary_key_fields() as $key_field ) {
845
-					$conditions[ $key_field->get_name() ] = $model_object_data_for_update[ $key_field->get_name() ];
844
+				foreach ($model->get_combined_primary_key_fields() as $key_field) {
845
+					$conditions[$key_field->get_name()] = $model_object_data_for_update[$key_field->get_name()];
846 846
 				}
847
-				$pk_value = $model->get_index_primary_key_string( $original_model_object_data );
847
+				$pk_value = $model->get_index_primary_key_string($original_model_object_data);
848 848
 			} else {
849 849
 				//this should just throw an exception, explaining that we dont have a primary key (or a combined key)
850 850
 				$model->primary_key_name();
@@ -855,8 +855,8 @@  discard block
 block discarded – undo
855 855
 				$conditions,
856 856
 				'default_where_conditions' => 'minimum'
857 857
 			);
858
-			$success = $model->update($model_object_data_for_update,$query_params);
859
-			if($success){
858
+			$success = $model->update($model_object_data_for_update, $query_params);
859
+			if ($success) {
860 860
 				$this->_add_update_success(
861 861
 					sprintf(
862 862
 						__('Successfully updated %1$s (with ID %2$s).', "event_espresso"),
@@ -868,10 +868,10 @@  discard block
 block discarded – undo
868 868
 				//because if we were going to insert something but it was going to conflict
869 869
 				//we would have last-minute decided to update. So we'd like to know what we updated
870 870
 				//and so we record what record ended up being updated using the mapping
871
-				$old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $id_in_csv ] = $pk_value;
872
-			}else{
871
+				$old_db_to_new_db_mapping[$model->get_this_model_name()][$id_in_csv] = $pk_value;
872
+			} else {
873 873
 				$matched_items = $model->get_all($query_params);
874
-				if( ! $matched_items){
874
+				if ( ! $matched_items) {
875 875
 					//no items were matched (so we shouldn't have updated)... but then we should have inserted? what the heck?
876 876
 					$this->_add_update_error(
877 877
 						sprintf(
@@ -886,15 +886,15 @@  discard block
 block discarded – undo
886 886
 					//wasn't an error, just didn't need updating
887 887
 				}
888 888
 			}
889
-		}catch(EE_Error $e){
889
+		} catch (EE_Error $e) {
890 890
 			$basic_message = sprintf(
891 891
 				__('Could not update %1$s with ID %2$s because %3$s', "event_espresso"),
892 892
 				$model->get_this_model_name(),
893 893
 				$pk_value,
894 894
 				$e->getMessage()
895 895
 			);
896
-			$debug_message = $basic_message . ' Stack trace: ' . $e->getTraceAsString();
897
-			$this->_add_general_error( "$basic_message | $debug_message", __FILE__, __FUNCTION__, __LINE__ );
896
+			$debug_message = $basic_message.' Stack trace: '.$e->getTraceAsString();
897
+			$this->_add_general_error("$basic_message | $debug_message", __FILE__, __FUNCTION__, __LINE__);
898 898
 		}
899 899
 		return $old_db_to_new_db_mapping;
900 900
 	}
@@ -903,52 +903,52 @@  discard block
 block discarded – undo
903 903
 	 * Gets the number of inserts performed since importer was instantiated or reset
904 904
 	 * @return int
905 905
 	 */
906
-	public function get_total_inserts(){
907
-		return count( $this->_inserts );
906
+	public function get_total_inserts() {
907
+		return count($this->_inserts);
908 908
 	}
909 909
 	/**
910 910
 	 *  Gets the number of insert errors since importer was instantiated or reset
911 911
 	 * @return int
912 912
 	 */
913
-	public function get_total_insert_errors(){
914
-		return count( $this->_insert_errors );
913
+	public function get_total_insert_errors() {
914
+		return count($this->_insert_errors);
915 915
 	}
916 916
 	/**
917 917
 	 *  Gets the number of updates performed since importer was instantiated or reset
918 918
 	 * @return int
919 919
 	 */
920
-	public function get_total_updates(){
921
-		return count( $this->_updates );
920
+	public function get_total_updates() {
921
+		return count($this->_updates);
922 922
 	}
923 923
 	/**
924 924
 	 *  Gets the number of update errors since importer was instantiated or reset
925 925
 	 * @return int
926 926
 	 */
927
-	public function get_total_update_errors(){
928
-		return count( $this->_update_errors );
927
+	public function get_total_update_errors() {
928
+		return count($this->_update_errors);
929 929
 	}
930 930
 
931 931
 	/**
932 932
 	 * Gets count of general errors during import
933 933
 	 * @return int
934 934
 	 */
935
-	public function get_total_general_errors(){
936
-		return count( $this->_general_errors );
935
+	public function get_total_general_errors() {
936
+		return count($this->_general_errors);
937 937
 	}
938
-	protected function _add_update_success( $message ){
938
+	protected function _add_update_success($message) {
939 939
 		$this->_updates[] = $message;
940 940
 	}
941
-	protected function _add_insert_success( $message ){
941
+	protected function _add_insert_success($message) {
942 942
 		$this->_inserts[] = $message;
943 943
 	}
944
-	protected function _add_update_error( $message, $file, $function, $line ){
945
-		$this->_update_errors[] = array( $message, $file, $function, $line );
944
+	protected function _add_update_error($message, $file, $function, $line) {
945
+		$this->_update_errors[] = array($message, $file, $function, $line);
946 946
 	}
947
-	protected function _add_insert_error( $message, $file, $function, $line ){
948
-		$this->_insert_errors[] = array( $message, $file, $function, $line );
947
+	protected function _add_insert_error($message, $file, $function, $line) {
948
+		$this->_insert_errors[] = array($message, $file, $function, $line);
949 949
 	}
950
-	protected function _add_general_error( $message, $file, $function, $line ){
951
-		$this->_general_errors[] = array( $message, $file, $function, $line );
950
+	protected function _add_general_error($message, $file, $function, $line) {
951
+		$this->_general_errors[] = array($message, $file, $function, $line);
952 952
 	}
953 953
 
954 954
 	/**
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 	 * happened.
959 959
 	 * @return array
960 960
 	 */
961
-	public function get_update_errors(){
961
+	public function get_update_errors() {
962 962
 		return $this->_update_errors;
963 963
 	}
964 964
 	/**
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 	 * happened.
969 969
 	 * @return array
970 970
 	 */
971
-	public function get_insert_errors(){
971
+	public function get_insert_errors() {
972 972
 		return $this->_insert_errors;
973 973
 	}
974 974
 	/**
@@ -978,21 +978,21 @@  discard block
 block discarded – undo
978 978
 	 * happened.
979 979
 	 * @return array
980 980
 	 */
981
-	public function get_general_errors(){
981
+	public function get_general_errors() {
982 982
 		return $this->_general_errors;
983 983
 	}
984 984
 	/**
985 985
 	 * Gets a simple array where each item in the array is a string describing what was inserted
986 986
 	 * @return array
987 987
 	 */
988
-	public function get_inserts(){
988
+	public function get_inserts() {
989 989
 		return $this->_inserts;
990 990
 	}
991 991
 	/**
992 992
 	 * Gets a simple array where each item in the array is a string describing what was updated
993 993
 	 * @return array
994 994
 	 */
995
-	public function get_updates(){
995
+	public function get_updates() {
996 996
 		return $this->_updates;
997 997
 	}
998 998
 	/**
@@ -1000,40 +1000,40 @@  discard block
 block discarded – undo
1000 1000
 	 * normal EE_Error success and error messages.
1001 1001
 	 * @return boolean there were no errors and we successfully did something
1002 1002
 	 */
1003
-	public function report_successes_and_errors(){
1003
+	public function report_successes_and_errors() {
1004 1004
 		$success = false;
1005 1005
 		$error = false;
1006
-		if ( $this->get_total_updates() ) {
1007
-			EE_Error::add_success( sprintf(__("%s existing records in the database were updated.", "event_espresso"),$this->get_total_updates()));
1006
+		if ($this->get_total_updates()) {
1007
+			EE_Error::add_success(sprintf(__("%s existing records in the database were updated.", "event_espresso"), $this->get_total_updates()));
1008 1008
 			$success = true;
1009 1009
 		}
1010
-		if ( $this->get_total_inserts() ) {
1011
-			EE_Error::add_success(sprintf(__("%s new records were added to the database.", "event_espresso"),$this->get_total_inserts()));
1010
+		if ($this->get_total_inserts()) {
1011
+			EE_Error::add_success(sprintf(__("%s new records were added to the database.", "event_espresso"), $this->get_total_inserts()));
1012 1012
 			$success = true;
1013 1013
 		}
1014 1014
 
1015
-		if ( $this->get_total_update_errors()) {
1016
-			EE_Error::add_error(sprintf(__("'One or more errors occurred, and a total of %s existing records in the database were <strong>not</strong> updated.'", "event_espresso"),$this->get_total_update_errors() ), __FILE__, __FUNCTION__, __LINE__ );
1015
+		if ($this->get_total_update_errors()) {
1016
+			EE_Error::add_error(sprintf(__("'One or more errors occurred, and a total of %s existing records in the database were <strong>not</strong> updated.'", "event_espresso"), $this->get_total_update_errors()), __FILE__, __FUNCTION__, __LINE__);
1017 1017
 			$error = true;
1018 1018
 		}
1019
-		if ( $this->get_total_insert_errors() ) {
1020
-			EE_Error::add_error(sprintf(__("One or more errors occurred, and a total of %s new records were <strong>not</strong> added to the database.'", "event_espresso"),$this->get_total_insert_errors() ), __FILE__, __FUNCTION__, __LINE__ );
1019
+		if ($this->get_total_insert_errors()) {
1020
+			EE_Error::add_error(sprintf(__("One or more errors occurred, and a total of %s new records were <strong>not</strong> added to the database.'", "event_espresso"), $this->get_total_insert_errors()), __FILE__, __FUNCTION__, __LINE__);
1021 1021
 			$error = true;
1022 1022
 		}
1023
-		foreach( $this->_general_errors as $message_data ){
1024
-			EE_Error::add_error( $message_data[0], $message_data[1], $message_data[2], $message_data[3]);
1023
+		foreach ($this->_general_errors as $message_data) {
1024
+			EE_Error::add_error($message_data[0], $message_data[1], $message_data[2], $message_data[3]);
1025 1025
 		}
1026
-		foreach( $this->_inserts as $insert ){
1027
-			EE_Error::add_success( $insert );
1026
+		foreach ($this->_inserts as $insert) {
1027
+			EE_Error::add_success($insert);
1028 1028
 		}
1029
-		foreach( $this->_updates as $update ){
1030
-			EE_Error::add_success( $update );
1029
+		foreach ($this->_updates as $update) {
1030
+			EE_Error::add_success($update);
1031 1031
 		}
1032
-		foreach( $this->_insert_errors as $message_data ){
1033
-			EE_Error::add_error( $message_data[0], $message_data[1], $message_data[2], $message_data[3]);
1032
+		foreach ($this->_insert_errors as $message_data) {
1033
+			EE_Error::add_error($message_data[0], $message_data[1], $message_data[2], $message_data[3]);
1034 1034
 		}
1035
-		foreach( $this->_update_errors as $message_data ){
1036
-			EE_Error::add_error( $message_data[0], $message_data[1], $message_data[2], $message_data[3]);
1035
+		foreach ($this->_update_errors as $message_data) {
1036
+			EE_Error::add_error($message_data[0], $message_data[1], $message_data[2], $message_data[3]);
1037 1037
 		}
1038 1038
 		return $success && ! $error;
1039 1039
 	}
Please login to merge, or discard this patch.
Braces   +25 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
3 5
 /**
4 6
  * EE_Import class
@@ -315,7 +317,7 @@  discard block
 block discarded – undo
315 317
 			if(isset($this->_csv_import_metadata_row['site_url']) && $this->_csv_import_metadata_row['site_url'] == site_url()){
316 318
 				EE_Error::add_attention( __("CSV Data appears to be from the same database, so attempting to update data", "event_espresso") );
317 319
 				$export_from_site_a_to_b = false;
318
-			}else{
320
+			} else{
319 321
 				$old_site_url = isset( $this->_csv_import_metadata_row['site_url']) ? $this->_csv_import_metadata_row['site_url'] : $old_site_url;
320 322
 				EE_Error::add_attention(
321 323
 					sprintf(
@@ -406,14 +408,14 @@  discard block
 block discarded – undo
406 408
 			//now check that assumption was correct. If
407 409
 			if ( EE_Registry::instance()->is_model_name($model_name_in_csv_data)) {
408 410
 				$model_name = $model_name_in_csv_data;
409
-			}elseif( empty( $model_name_in_csv_data ) ) {
411
+			} elseif( empty( $model_name_in_csv_data ) ) {
410 412
 				// no table info in the array and no table name passed to the function?? FAIL
411 413
 				$this->_add_general_error(
412 414
 					__('No table information was specified and/or found, therefore the import could not be completed','event_espresso'),
413 415
 					__FILE__, __FUNCTION__, __LINE__
414 416
 				);
415 417
 				return FALSE;
416
-			}else{
418
+			} else{
417 419
 				//what is this model name??
418 420
 				$this->_add_general_error(
419 421
 					sprintf(
@@ -447,7 +449,7 @@  discard block
 block discarded – undo
447 449
 				//there is no primary key)
448 450
 				if($model->has_primary_key_field()){
449 451
 					$id_in_csv =  $model_object_data[$model->primary_key_name()];
450
-				}else{
452
+				} else{
451 453
 					$id_in_csv = $model->get_index_primary_key_string($model_object_data);
452 454
 				}
453 455
 
@@ -458,7 +460,7 @@  discard block
 block discarded – undo
458 460
 				//or just update.
459 461
 				if($export_from_site_a_to_b){
460 462
 					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_other_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
461
-				}else{//this is just a re-import
463
+				} else{//this is just a re-import
462 464
 					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_same_db( $id_in_csv, $model_object_data, $model );
463 465
 				}
464 466
 				if( $what_to_do == self::do_nothing ) {
@@ -478,7 +480,7 @@  discard block
 block discarded – undo
478 480
 						if($model->has_primary_key_field()){
479 481
 							$old_db_to_new_db_mapping[$model_name][$id_in_csv] = $conflicting->ID();
480 482
 							$model_object_data[$model->primary_key_name()] = $conflicting->ID();
481
-						}else{
483
+						} else{
482 484
 							//we want to update this conflicting item, instead of inserting a conflicting item
483 485
 							//so we need to make sure they match entirely (its possible that they only conflicted on one field, but we need them to match on other fields
484 486
 							//for the WHERE conditions in the update). At the time of this comment, there were no models like this
@@ -490,13 +492,13 @@  discard block
 block discarded – undo
490 492
 				}
491 493
 				if( $what_to_do == self::do_insert ) {
492 494
 					$old_db_to_new_db_mapping = $this->_insert_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
493
-				}elseif( $what_to_do == self::do_update ) {
495
+				} elseif( $what_to_do == self::do_update ) {
494 496
 					if( $models_to_update === null || in_array( $model_name_in_csv_data, $models_to_update ) ){
495 497
 						$old_db_to_new_db_mapping = $this->_update_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
496
-					}else{
498
+					} else{
497 499
 						//we would have updated this, but the export data indicated we ought not
498 500
 					}
499
-				}else{
501
+				} else{
500 502
 					throw new EE_Error(
501 503
 						sprintf(
502 504
 							__( 'Programming error. We should be inserting or updating, but instead we are being told to "%1$s", which is invalid', 'event_espresso' ),
@@ -530,7 +532,7 @@  discard block
 block discarded – undo
530 532
 
531 533
 		if( isset($old_db_to_new_db_mapping[$model_name][$id_in_csv]) ){
532 534
 			$what_to_do =  self::do_update;
533
-		}else{
535
+		} else{
534 536
 			$what_to_do =  self::do_insert;
535 537
 		}
536 538
 		//consider any exceptions, usually where there are other uniqueness constraints
@@ -562,7 +564,7 @@  discard block
 block discarded – undo
562 564
 		//in this case, check if this thing ACTUALLY exists in the database
563 565
 		if( $model->get_one_conflicting( $model_object_data ) ){
564 566
 			return self::do_update;
565
-		}else{
567
+		} else{
566 568
 			return self::do_insert;
567 569
 		}
568 570
 	}
@@ -595,7 +597,7 @@  discard block
 block discarded – undo
595 597
 		try{
596 598
 			$model_name_field = $model->get_field_containing_related_model_name();
597 599
 			//$models_pointed_to_by_model_name_field = $model_name_field->get_model_names_pointed_to();
598
-		}catch( EE_Error $e ){
600
+		} catch( EE_Error $e ){
599 601
 			$model_name_field = NULL;
600 602
 			//$models_pointed_to_by_model_name_field = array();
601 603
 		}
@@ -616,7 +618,7 @@  discard block
 block discarded – undo
616 618
 							//once we've found a mapping for this field no need to continue
617 619
 							break;
618 620
 						}
619
-					}else{
621
+					} else{
620 622
 						$model_object_data[ $field_obj->get_name() ] = $this->_find_mapping_in(
621 623
 							$model_object_data[ $field_obj->get_name() ],
622 624
 							$model_pointed_to_by_fk,
@@ -627,7 +629,7 @@  discard block
 block discarded – undo
627 629
 						break;
628 630
 					}
629 631
 				}
630
-			}else{
632
+			} else{
631 633
 				//it's a string foreign key (which we leave alone, because those are things
632 634
 				//like country names, which we'd really rather not make 2 USAs etc (we'd actually
633 635
 				//prefer to just update one)
@@ -737,14 +739,14 @@  discard block
 block discarded – undo
737 739
 	protected function _find_mapping_in( $object_id, $model_name, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
738 740
 		if(	isset( $old_db_to_new_db_mapping[ $model_name ][ $object_id ] ) ){
739 741
 			return $old_db_to_new_db_mapping[ $model_name ][ $object_id ];
740
-		}elseif( $object_id == '0' || $object_id == '' ) {
742
+		} elseif( $object_id == '0' || $object_id == '' ) {
741 743
 			//leave as-is
742 744
 			return $object_id;
743
-		}elseif( $export_from_site_a_to_b ){
745
+		} elseif( $export_from_site_a_to_b ){
744 746
 			//we couldn't find a mapping for this, and it's from a different site,
745 747
 			//so blank it out
746 748
 			return null;
747
-		}elseif( ! $export_from_site_a_to_b ) {
749
+		} elseif( ! $export_from_site_a_to_b ) {
748 750
 			//we couldn't find a mapping for this, but it's from this DB anyway
749 751
 			//so let's just leave it as-is
750 752
 			return $object_id;
@@ -766,7 +768,7 @@  discard block
 block discarded – undo
766 768
 		if($model->has_primary_key_field() && $model->get_primary_key_field()->is_auto_increment()){
767 769
 			$effective_id = $model_object_data[$model->primary_key_name()];
768 770
 			unset($model_object_data[$model->primary_key_name()]);
769
-		}else{
771
+		} else{
770 772
 			$effective_id = $model->get_index_primary_key_string( $model_object_data );
771 773
 		}
772 774
 		//the model takes care of validating the CSV's input
@@ -781,7 +783,7 @@  discard block
 block discarded – undo
781 783
 						$new_id
782 784
 					)
783 785
 				);
784
-			}else{
786
+			} else{
785 787
 				//put the ID used back in there for the error message
786 788
 				if($model->has_primary_key_field()){
787 789
 					$model_object_data[$model->primary_key_name()] = $effective_id;
@@ -797,7 +799,7 @@  discard block
 block discarded – undo
797 799
 					__FILE__, __FUNCTION__, __LINE__
798 800
 				);
799 801
 			}
800
-		}catch(EE_Error $e){
802
+		} catch(EE_Error $e){
801 803
 			if($model->has_primary_key_field()){
802 804
 				$model_object_data[$model->primary_key_name()] = $effective_id;
803 805
 			}
@@ -869,7 +871,7 @@  discard block
 block discarded – undo
869 871
 				//we would have last-minute decided to update. So we'd like to know what we updated
870 872
 				//and so we record what record ended up being updated using the mapping
871 873
 				$old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $id_in_csv ] = $pk_value;
872
-			}else{
874
+			} else{
873 875
 				$matched_items = $model->get_all($query_params);
874 876
 				if( ! $matched_items){
875 877
 					//no items were matched (so we shouldn't have updated)... but then we should have inserted? what the heck?
@@ -886,7 +888,7 @@  discard block
 block discarded – undo
886 888
 					//wasn't an error, just didn't need updating
887 889
 				}
888 890
 			}
889
-		}catch(EE_Error $e){
891
+		} catch(EE_Error $e){
890 892
 			$basic_message = sprintf(
891 893
 				__('Could not update %1$s with ID %2$s because %3$s', "event_espresso"),
892 894
 				$model->get_this_model_name(),
Please login to merge, or discard this patch.
core/db_models/EEM_Price_Type.model.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
 	 * 		instantiate a new price type object with blank/empty properties
130 130
 	 *
131 131
 	 * 		@access		public
132
-	 * 		@return		mixed		array on success, FALSE on fail
132
+	 * 		@return		EE_Price_Type		array on success, FALSE on fail
133 133
 	 */
134 134
 	public function get_new_price_type() {
135 135
 		return EE_Price_Type::new_instance();
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 	public $type = NULL;
34 34
 
35 35
 	/**
36
-	*	Price Base types
37
-	*
38
-	*	@access	private
39
-	*	@var array
40
-	*/
36
+	 *	Price Base types
37
+	 *
38
+	 *	@access	private
39
+	 *	@var array
40
+	 */
41 41
 	public $base_types = null;
42 42
 
43 43
 	/**
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
  *
153 153
  * @param array $query_params
154 154
  * @param boolean $allow_blocking if TRUE, matched objects will only be deleted if there is no related model info
155
-	 * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects
156
-	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
155
+ * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects
156
+ * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
157 157
  * @return boolean
158 158
  */
159 159
 	public function delete_permanently($query_params = array(), $allow_blocking = true) {
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Price_Type.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Price_Type.class.php');
26 26
 
27 27
 
28 28
 class EEM_Price_Type extends EEM_Soft_Delete_Base {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * values are text-representations of the base type.
46 46
 	 * @return array
47 47
 	 */
48
-	public function get_base_types(){
48
+	public function get_base_types() {
49 49
 		return $this->base_types;
50 50
 	}
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param int $base_type_int
55 55
 	 * @return string
56 56
 	 */
57
-	public function get_base_type_name($base_type_int){
57
+	public function get_base_type_name($base_type_int) {
58 58
 		return $this->base_types[$base_type_int];
59 59
 	}
60 60
 
@@ -83,27 +83,27 @@  discard block
 block discarded – undo
83 83
 	 * @access protected
84 84
 	 * @param null $timezone
85 85
 	 */
86
-	protected function __construct( $timezone = NULL ) {
86
+	protected function __construct($timezone = NULL) {
87 87
 		$this->base_types = array(
88
-			EEM_Price_Type::base_type_base_price => __('Price','event_espresso'),
89
-			EEM_Price_Type::base_type_discount => __('Discount','event_espresso'),
90
-			EEM_Price_Type::base_type_surcharge => __('Surcharge','event_espresso'),
91
-			EEM_Price_Type::base_type_tax => __('Tax','event_espresso') );
92
-		$this->singular_item = __('Price Type','event_espresso');
93
-		$this->plural_item = __('Price Types','event_espresso');
88
+			EEM_Price_Type::base_type_base_price => __('Price', 'event_espresso'),
89
+			EEM_Price_Type::base_type_discount => __('Discount', 'event_espresso'),
90
+			EEM_Price_Type::base_type_surcharge => __('Surcharge', 'event_espresso'),
91
+			EEM_Price_Type::base_type_tax => __('Tax', 'event_espresso') );
92
+		$this->singular_item = __('Price Type', 'event_espresso');
93
+		$this->plural_item = __('Price Types', 'event_espresso');
94 94
 
95 95
 		$this->_tables = array(
96
-			'Price_Type'=>new EE_Primary_Table('esp_price_type','PRT_ID')
96
+			'Price_Type'=>new EE_Primary_Table('esp_price_type', 'PRT_ID')
97 97
 		);
98 98
 		$this->_fields = array(
99 99
 			'Price_Type'=>array(
100
-				'PRT_ID'=>new EE_Primary_Key_Int_Field('PRT_ID', __('Price Type ID','event_espresso')),
101
-				'PRT_name'=>new EE_Plain_Text_Field('PRT_name', __('Price Type Name','event_espresso'), false, ''),
102
-				'PBT_ID'=>new EE_Enum_Integer_Field('PBT_ID', __('Price Base type ID, 1 = Price , 2 = Discount , 3 = Surcharge , 4 = Tax','event_espresso'), false, EEM_Price_Type::base_type_base_price, $this->base_types),
103
-				'PRT_is_percent'=>new EE_Boolean_Field('PRT_is_percent', __('Flag indicating price is a percentage','event_espresso'), false, false),
104
-				'PRT_order'=>new EE_Integer_Field('PRT_order', __('Order in which price should be applied. ','event_espresso'), false, 0),
105
-				'PRT_deleted'=>new EE_Trashed_Flag_Field('PRT_deleted', __('Flag indicating price type has been trashed','event_espresso'), false, false),
106
-				'PRT_wp_user' => new EE_WP_User_Field('PRT_wp_user', __('Price Type Creator ID', 'event_espresso'), FALSE ),
100
+				'PRT_ID'=>new EE_Primary_Key_Int_Field('PRT_ID', __('Price Type ID', 'event_espresso')),
101
+				'PRT_name'=>new EE_Plain_Text_Field('PRT_name', __('Price Type Name', 'event_espresso'), false, ''),
102
+				'PBT_ID'=>new EE_Enum_Integer_Field('PBT_ID', __('Price Base type ID, 1 = Price , 2 = Discount , 3 = Surcharge , 4 = Tax', 'event_espresso'), false, EEM_Price_Type::base_type_base_price, $this->base_types),
103
+				'PRT_is_percent'=>new EE_Boolean_Field('PRT_is_percent', __('Flag indicating price is a percentage', 'event_espresso'), false, false),
104
+				'PRT_order'=>new EE_Integer_Field('PRT_order', __('Order in which price should be applied. ', 'event_espresso'), false, 0),
105
+				'PRT_deleted'=>new EE_Trashed_Flag_Field('PRT_deleted', __('Flag indicating price type has been trashed', 'event_espresso'), false, false),
106
+				'PRT_wp_user' => new EE_WP_User_Field('PRT_wp_user', __('Price Type Creator ID', 'event_espresso'), FALSE),
107 107
 			)
108 108
 		);
109 109
 		$this->_model_relations = array(
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 			'WP_User' => new EE_Belongs_To_Relation(),
112 112
 		);
113 113
 		$this->_indexes = array(
114
-			'name' => new EE_Unique_Index( array( 'PRT_name' ) )
114
+			'name' => new EE_Unique_Index(array('PRT_name'))
115 115
 		);
116 116
 
117 117
 		//this model is generally available for reading
118
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
118
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
119 119
 		//all price types are "default" in terms of capability names
120 120
 		$this->_caps_slug = 'default_price_types';
121
-		parent::__construct( $timezone );
121
+		parent::__construct($timezone);
122 122
 
123 123
 	}
124 124
 
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 		$ID = $query_params[0][$this->get_primary_key_field()->get_name()];
165 165
 
166 166
 		//check if any prices use this price type
167
-		$prc_query_params = array(array('PRT_ID'=>array('IN',$would_be_deleted_price_type_ids)));
168
-		if ( $prices = $this->get_all_related($ID,'Price',$prc_query_params)) {
167
+		$prc_query_params = array(array('PRT_ID'=>array('IN', $would_be_deleted_price_type_ids)));
168
+		if ($prices = $this->get_all_related($ID, 'Price', $prc_query_params)) {
169 169
 			$prices_names_and_ids = array();
170
-			foreach($prices as $price){
170
+			foreach ($prices as $price) {
171 171
 				/* @var $price EE_Price */
172 172
 				$prices_names_and_ids[] = $price->name()."(".$price->ID().")";
173 173
 			}
174
-			$msg = sprintf(__('The Price Type(s) could not be deleted because there are existing Prices that currently use this Price Type.  If you still wish to delete this Price Type, then either delete those Prices or change them to use other Price Types.The prices are: %s', 'event_espresso'),implode(",",$prices_names_and_ids));
175
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
174
+			$msg = sprintf(__('The Price Type(s) could not be deleted because there are existing Prices that currently use this Price Type.  If you still wish to delete this Price Type, then either delete those Prices or change them to use other Price Types.The prices are: %s', 'event_espresso'), implode(",", $prices_names_and_ids));
175
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
176 176
 			return FALSE;
177 177
 		}
178 178
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
admin_pages/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.
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.
Spacing   +238 added lines, -238 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_ADMIN_PAGES . 'venues';
68
+		$this->_admin_base_path = EE_ADMIN_PAGES.'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
 	}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 		//load field generator helper
124 124
 
125 125
 		//is there a vnu_id in the request?
126
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
127
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
126
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
127
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
128 128
 
129 129
 		$this->_page_routes = array(
130 130
 			'default' => array(
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 				),
143 143
 			'trash_venue' => array(
144 144
 				'func' => '_trash_or_restore_venue',
145
-				'args' => array( 'venue_status' => 'trash' ),
145
+				'args' => array('venue_status' => 'trash'),
146 146
 				'noheader' => TRUE,
147 147
 				'capability' => 'ee_delete_venue',
148 148
 				'obj_id' => $vnu_id
149 149
 				),
150 150
 			'trash_venues' => array(
151 151
 				'func' => '_trash_or_restore_venues',
152
-				'args' => array( 'venue_status' => 'trash' ),
152
+				'args' => array('venue_status' => 'trash'),
153 153
 				'noheader' => TRUE,
154 154
 				'capability' => 'ee_delete_venues'
155 155
 				),
156 156
 			'restore_venue' => array(
157 157
 				'func' => '_trash_or_restore_venue',
158
-				'args' => array( 'venue_status' => 'draft' ),
158
+				'args' => array('venue_status' => 'draft'),
159 159
 				'noheader' => TRUE,
160 160
 				'capability' => 'ee_delete_venue',
161 161
 				'obj_id' => $vnu_id
162 162
 				),
163 163
 			'restore_venues' => array(
164 164
 				'func' => '_trash_or_restore_venues',
165
-				'args' => array( 'venue_status' => 'draft' ),
165
+				'args' => array('venue_status' => 'draft'),
166 166
 				'noheader' => TRUE,
167 167
 				'capability' => 'ee_delete_venues'
168 168
 				),
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 						'filename' => 'venues_overview_views_bulk_actions_search'
265 265
 					)
266 266
 				),
267
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
267
+				'help_tour' => array('Venues_Overview_Help_Tour'),
268 268
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
269 269
 				'require_nonce' => FALSE
270 270
 			),
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 						'filename' => 'venues_editor_other'
301 301
 					)
302 302
 				),
303
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
303
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
304 304
 				'metaboxes' => array('_venue_editor_metaboxes'),
305 305
 				'require_nonce' => FALSE
306 306
 				),
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 					'label' => __('Edit Venue', 'event_espresso'),
310 310
 					'order' => 5,
311 311
 					'persistent' => FALSE,
312
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
312
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
313 313
 				),
314 314
 				'help_tabs' => array(
315 315
 					'venues_editor_help_tab' => array(
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 					'label' => __('Google Maps'),
347 347
 					'order' => 40
348 348
 				),
349
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
349
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
350 350
 				'help_tabs' => array(
351 351
 					'general_settings_google_maps_help_tab' => array(
352 352
 						'title' => __('Google Maps', 'event_espresso'),
353 353
 						'filename' => 'general_settings_google_maps'
354 354
 					)
355 355
 				),
356
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
356
+				'help_tour' => array('Google_Maps_Help_Tour'),
357 357
 				'require_nonce' => FALSE
358 358
 			),
359 359
 			//venue category stuff
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 						'filename' => 'venues_add_category'
370 370
 					)
371 371
 				),
372
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
372
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
373 373
 				'require_nonce' => FALSE
374 374
 				),
375 375
 			'edit_category' => array(
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 					'label' => __('Edit Category', 'event_espresso'),
378 378
 					'order' => 15,
379 379
 					'persistent' => FALSE,
380
-					'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
380
+					'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
381 381
 					),
382 382
 				'metaboxes' => array('_publish_post_box'),
383 383
 				'help_tabs' => array(
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'venues_categories_other'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
416
+				'help_tour' => array('Venues_Categories_Help_Tour'),
417 417
 				'metaboxes' => $this->_default_espresso_metaboxes,
418 418
 				'require_nonce' => FALSE
419 419
 				)
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 
472 472
 	public function load_scripts_styles() {
473
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
473
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
474 474
 		wp_enqueue_style('ee-cat-admin');
475 475
 	}
476 476
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	public function load_scripts_styles_edit() {
494 494
 		//styles
495 495
 		wp_enqueue_style('espresso-ui-theme');
496
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
496
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
497 497
 		wp_enqueue_style('espresso_venues');
498 498
 	}
499 499
 
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 				)
513 513
 		);
514 514
 
515
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
515
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
516 516
 			$this->_views['all']['bulk_action'] = array(
517 517
 				'trash_venues' => __('Move to Trash', 'event_espresso')
518 518
 			);
519 519
 			$this->_views['trash'] = array(
520 520
 				'slug' => 'trash',
521
-				'label' => __( 'Trash', 'event_espresso' ),
521
+				'label' => __('Trash', 'event_espresso'),
522 522
 				'count' => 0,
523 523
 				'bulk_action' => array(
524 524
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 
552 552
 
553 553
 	protected function _overview_list_table() {
554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
555
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' );
554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
555
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button');
556 556
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
557 557
 		$this->_search_btn_label = __('Venues', 'event_espresso');
558 558
 		$this->display_admin_list_table_page_with_sidebar();
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
567 567
 			'vnu_phone' => $this->_cpt_model_obj->phone()
568 568
 			);
569
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
570
-		EEH_Template::display_template( $template, $extra_rows );
569
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
570
+		EEH_Template::display_template($template, $extra_rows);
571 571
 	}
572 572
 
573 573
 
@@ -583,31 +583,31 @@  discard block
 block discarded – undo
583 583
 		$default_map_settings->use_google_maps = TRUE;
584 584
 		$default_map_settings->google_map_api_key = '';
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 );
607
+		$this->_set_add_edit_form_tags('update_google_map_settings');
608
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
609 609
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
610
-			EE_VENUES_TEMPLATE_PATH . 'google_map.template.php',
610
+			EE_VENUES_TEMPLATE_PATH.'google_map.template.php',
611 611
 			$this->_template_args,
612 612
 			true
613 613
 		);
@@ -617,83 +617,83 @@  discard block
 block discarded – undo
617 617
 	protected function _update_google_map_settings() {
618 618
 
619 619
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
620
-			isset( $this->_req_data['use_google_maps'] )
621
-				? absint( $this->_req_data['use_google_maps'] )
620
+			isset($this->_req_data['use_google_maps'])
621
+				? absint($this->_req_data['use_google_maps'])
622 622
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
623 623
 
624 624
 		EE_Registry::instance()->CFG->map_settings->google_map_api_key =
625
-			isset( $this->_req_data['google_map_api_key'] )
626
-				? sanitize_text_field( $this->_req_data['google_map_api_key'] )
625
+			isset($this->_req_data['google_map_api_key'])
626
+				? sanitize_text_field($this->_req_data['google_map_api_key'])
627 627
 				: EE_Registry::instance()->CFG->map_settings->google_map_api_key;
628 628
 
629 629
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
630
-			isset( $this->_req_data['event_details_map_width'] )
631
-				? absint( $this->_req_data['event_details_map_width'] )
630
+			isset($this->_req_data['event_details_map_width'])
631
+				? absint($this->_req_data['event_details_map_width'])
632 632
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
633 633
 
634 634
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
635
-			isset( $this->_req_data['event_details_map_height'] )
636
-				? absint( $this->_req_data['event_details_map_height'] )
635
+			isset($this->_req_data['event_details_map_height'])
636
+				? absint($this->_req_data['event_details_map_height'])
637 637
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
638 638
 
639 639
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
640
-			isset( $this->_req_data['event_details_map_zoom'] )
641
-				? absint( $this->_req_data['event_details_map_zoom'] )
640
+			isset($this->_req_data['event_details_map_zoom'])
641
+				? absint($this->_req_data['event_details_map_zoom'])
642 642
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
643 643
 
644 644
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
645
-			isset( $this->_req_data['event_details_display_nav'] )
646
-				? absint( $this->_req_data['event_details_display_nav'] )
645
+			isset($this->_req_data['event_details_display_nav'])
646
+				? absint($this->_req_data['event_details_display_nav'])
647 647
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
648 648
 
649 649
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
650
-			isset( $this->_req_data['event_details_nav_size'] )
651
-				? absint( $this->_req_data['event_details_nav_size'] )
650
+			isset($this->_req_data['event_details_nav_size'])
651
+				? absint($this->_req_data['event_details_nav_size'])
652 652
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
653 653
 
654 654
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
655
-			isset( $this->_req_data['event_details_control_type'] )
656
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
655
+			isset($this->_req_data['event_details_control_type'])
656
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
657 657
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
658 658
 
659 659
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
660
-			isset( $this->_req_data['event_details_map_align'] )
661
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
660
+			isset($this->_req_data['event_details_map_align'])
661
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
662 662
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
663 663
 
664 664
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
665
-			isset( $this->_req_data['event_list_map_width'] )
666
-				? absint( $this->_req_data['event_list_map_width'] )
665
+			isset($this->_req_data['event_list_map_width'])
666
+				? absint($this->_req_data['event_list_map_width'])
667 667
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
668 668
 
669 669
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
670
-			isset( $this->_req_data['event_list_map_height'] )
671
-				? absint( $this->_req_data['event_list_map_height'] )
670
+			isset($this->_req_data['event_list_map_height'])
671
+				? absint($this->_req_data['event_list_map_height'])
672 672
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
673 673
 
674 674
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
675
-			isset( $this->_req_data['event_list_map_zoom'] )
676
-				? absint( $this->_req_data['event_list_map_zoom'] )
675
+			isset($this->_req_data['event_list_map_zoom'])
676
+				? absint($this->_req_data['event_list_map_zoom'])
677 677
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
678 678
 
679 679
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
680
-			isset( $this->_req_data['event_list_display_nav'] )
681
-				? absint( $this->_req_data['event_list_display_nav'] )
680
+			isset($this->_req_data['event_list_display_nav'])
681
+				? absint($this->_req_data['event_list_display_nav'])
682 682
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
683 683
 
684 684
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
685
-			isset( $this->_req_data['event_list_nav_size'] )
686
-				? absint( $this->_req_data['event_list_nav_size'] )
685
+			isset($this->_req_data['event_list_nav_size'])
686
+				? absint($this->_req_data['event_list_nav_size'])
687 687
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
688 688
 
689 689
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
690
-			isset( $this->_req_data['event_list_control_type'] )
691
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
690
+			isset($this->_req_data['event_list_control_type'])
691
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
692 692
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
693 693
 
694 694
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
695
-			isset( $this->_req_data['event_list_map_align'] )
696
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
695
+			isset($this->_req_data['event_list_map_align'])
696
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
697 697
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
698 698
 
699 699
 		EE_Registry::instance()->CFG->map_settings = apply_filters(
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 			EE_Registry::instance()->CFG->map_settings,
708 708
 			__FILE__, __FUNCTION__, __LINE__
709 709
 		);
710
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
710
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
711 711
 
712 712
 	}
713 713
 
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 	protected function _venue_editor_metaboxes() {
717 717
 		$this->verify_cpt_object();
718 718
 
719
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
720
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
721
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
719
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
720
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
721
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
722 722
 
723 723
 	}
724 724
 
@@ -726,23 +726,23 @@  discard block
 block discarded – undo
726 726
 
727 727
 	public function venue_gmap_metabox() {
728 728
 		$template_args = array(
729
-			'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() ),
729
+			'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()),
730 730
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
731 731
 			);
732
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
733
-		EEH_Template::display_template( $template, $template_args );
732
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
733
+		EEH_Template::display_template($template, $template_args);
734 734
 	}
735 735
 
736 736
 
737 737
 
738 738
 	public function venue_address_metabox() {
739 739
 
740
-		$template_args['_venue'] =$this->_cpt_model_obj;
740
+		$template_args['_venue'] = $this->_cpt_model_obj;
741 741
 
742 742
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
743 743
 			$QFI = new EE_Question_Form_Input(
744
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
745
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
744
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
745
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
746 746
 				array(
747 747
 					'input_name' =>  'sta_id',
748 748
 					'input_id' => 'sta_id',
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
 		);
755 755
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
756 756
 			$QFI = new EE_Question_Form_Input(
757
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
758
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
757
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
758
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
759 759
 				array(
760 760
 					'input_name' =>  'cnt_iso',
761 761
 					'input_id' => 'cnt_iso',
@@ -766,8 +766,8 @@  discard block
 block discarded – undo
766 766
 			)
767 767
 		);
768 768
 
769
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
770
-		EEH_Template::display_template( $template, $template_args );
769
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
770
+		EEH_Template::display_template($template, $template_args);
771 771
 	}
772 772
 
773 773
 
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 		$template_args = array(
780 780
 			'_venue' => $this->_cpt_model_obj
781 781
 			);
782
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
783
-		EEH_Template::display_template( $template, $template_args );
782
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
783
+		EEH_Template::display_template($template, $template_args);
784 784
 	}
785 785
 
786 786
 
@@ -803,52 +803,52 @@  discard block
 block discarded – undo
803 803
 	 * @param  object $post    Post object (with "blessed" WP properties)
804 804
 	 * @return void
805 805
 	 */
806
-	protected function _insert_update_cpt_item( $post_id, $post ) {
806
+	protected function _insert_update_cpt_item($post_id, $post) {
807 807
 
808
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
809
-			return;// get out we're not processing the saving of venues.
808
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
809
+			return; // get out we're not processing the saving of venues.
810 810
 		}
811 811
 
812
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
812
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
813 813
 
814 814
 		$venue_values = array(
815
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
816
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
817
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
818
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
819
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
820
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
821
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
822
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
823
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
824
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
825
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
826
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
827
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
815
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
816
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
817
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
818
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
819
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
820
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
821
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
822
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
823
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
824
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
825
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
826
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
827
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
828 828
 			);
829 829
 
830 830
 		//update venue
831
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
831
+		$success = $this->_venue_model->update($venue_values, array($wheres));
832 832
 
833 833
 		//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!
834
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
835
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
834
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
835
+		$venue = $this->_venue_model->get_one(array($get_one_where));
836 836
 
837 837
 		//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.
838
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
838
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
839 839
 
840 840
 		$att_success = TRUE;
841 841
 
842
-		foreach ( $venue_update_callbacks as $v_callback ) {
843
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
844
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
842
+		foreach ($venue_update_callbacks as $v_callback) {
843
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
844
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
845 845
 		}
846 846
 
847 847
 		//any errors?
848
-		if ( $success && !$att_success ) {
849
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
850
-		} else if ( $success === FALSE ) {
851
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ($success && ! $att_success) {
849
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850
+		} else if ($success === FALSE) {
851
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
852 852
 		}
853 853
 	}
854 854
 
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
 
857 857
 
858 858
 
859
-	public function trash_cpt_item( $post_id ) {
859
+	public function trash_cpt_item($post_id) {
860 860
 		$this->_req_data['VNU_ID'] = $post_id;
861
-		$this->_trash_or_restore_venue( 'trash', FALSE );
861
+		$this->_trash_or_restore_venue('trash', FALSE);
862 862
 	}
863 863
 
864 864
 
@@ -866,18 +866,18 @@  discard block
 block discarded – undo
866 866
 
867 867
 
868 868
 
869
-	public function restore_cpt_item( $post_id ) {
869
+	public function restore_cpt_item($post_id) {
870 870
 		$this->_req_data['VNU_ID'] = $post_id;
871
-		$this->_trash_or_restore_venue( 'draft', FALSE );
871
+		$this->_trash_or_restore_venue('draft', FALSE);
872 872
 	}
873 873
 
874 874
 
875 875
 
876 876
 
877 877
 
878
-	public function delete_cpt_item( $post_id ) {
878
+	public function delete_cpt_item($post_id) {
879 879
 		$this->_req_data['VNU_ID'] = $post_id;
880
-		$this->_delete_venue( FALSE );
880
+		$this->_delete_venue(FALSE);
881 881
 	}
882 882
 
883 883
 
@@ -892,15 +892,15 @@  discard block
 block discarded – undo
892 892
 
893 893
 
894 894
 
895
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
896
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
895
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
896
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
897 897
 
898 898
 		//loop thru venues
899
-		if ( $VNU_ID ) {
899
+		if ($VNU_ID) {
900 900
 			//clean status
901
-			$venue_status = sanitize_key( $venue_status );
901
+			$venue_status = sanitize_key($venue_status);
902 902
 			// grab status
903
-			if (!empty($venue_status)) {
903
+			if ( ! empty($venue_status)) {
904 904
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
905 905
 			} else {
906 906
 				$success = FALSE;
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 		}
915 915
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
916 916
 
917
-		if ( $redirect_after )
917
+		if ($redirect_after)
918 918
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
919 919
 
920 920
 	}
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
 
924 924
 
925 925
 
926
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
926
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
927 927
 		// clean status
928 928
 		$venue_status = sanitize_key($venue_status);
929 929
 		// grab status
930
-		if (!empty($venue_status)) {
930
+		if ( ! empty($venue_status)) {
931 931
 			$success = TRUE;
932 932
 			//determine the event id and set to array.
933 933
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -967,20 +967,20 @@  discard block
 block discarded – undo
967 967
 	 * @param  string $venue_status
968 968
 	 * @return void
969 969
 	 */
970
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
970
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
971 971
 		// grab venue id
972
-		if (! $VNU_ID) {
972
+		if ( ! $VNU_ID) {
973 973
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
974 974
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
975 975
 			return FALSE;
976 976
 		}
977 977
 
978
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
978
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
979 979
 
980 980
 		// clean status
981 981
 		$venue_status = sanitize_key($venue_status);
982 982
 		// grab status
983
-		if ( ! $venue_status ) {
983
+		if ( ! $venue_status) {
984 984
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
985 985
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
986 986
 			return FALSE;
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 				$hook = FALSE;
1002 1002
 		}
1003 1003
 		//use class to change status
1004
-		$this->_cpt_model_obj->set_status( $venue_status );
1004
+		$this->_cpt_model_obj->set_status($venue_status);
1005 1005
 		$success = $this->_cpt_model_obj->save();
1006 1006
 
1007 1007
 		if ($success === FALSE) {
@@ -1020,21 +1020,21 @@  discard block
 block discarded – undo
1020 1020
 	 * @param  bool $redirect_after
1021 1021
 	 * @return void
1022 1022
 	 */
1023
-	protected function _delete_venue( $redirect_after = true ) {
1023
+	protected function _delete_venue($redirect_after = true) {
1024 1024
 		//determine the venue id and set to array.
1025 1025
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1026
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1026
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1027 1027
 
1028 1028
 
1029 1029
 		// loop thru venues
1030 1030
 		if ($VNU_ID) {
1031
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1031
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1032 1032
 		} else {
1033 1033
 			$success = FALSE;
1034 1034
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1035 1035
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1036 1036
 		}
1037
-		if ( $redirect_after )
1037
+		if ($redirect_after)
1038 1038
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1039 1039
 	}
1040 1040
 
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 	//todo: put in parent
1067 1067
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1068 1068
 		// grab event id
1069
-		if (!$VNU_ID = absint($VNU_ID)) {
1069
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1070 1070
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1071 1071
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1072 1072
 			return FALSE;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1087 1087
 			return FALSE;
1088 1088
 		}
1089
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1089
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1090 1090
 		return TRUE;
1091 1091
 	}
1092 1092
 
@@ -1097,11 +1097,11 @@  discard block
 block discarded – undo
1097 1097
 	/* QUERIES */
1098 1098
 
1099 1099
 
1100
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1100
+	public function get_venues($per_page = 10, $count = FALSE) {
1101 1101
 
1102
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1102
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1103 1103
 
1104
-		switch ( $_orderby ) {
1104
+		switch ($_orderby) {
1105 1105
 			case 'id':
1106 1106
 				$orderby = 'VNU_ID';
1107 1107
 				break;
@@ -1119,43 +1119,43 @@  discard block
 block discarded – undo
1119 1119
 		}
1120 1120
 
1121 1121
 
1122
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1122
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1123 1123
 
1124
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1125
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1126
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1124
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1125
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1126
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1127 1127
 
1128 1128
 
1129
-		$offset = ($current_page-1)*$per_page;
1129
+		$offset = ($current_page - 1) * $per_page;
1130 1130
 		$limit = array($offset, $per_page);
1131 1131
 
1132
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1132
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1133 1133
 		$where = array();
1134 1134
 
1135 1135
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1136
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1136
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1137 1137
 			$where['status'] = $this->_req_data['status'];
1138 1138
 		}
1139 1139
 
1140
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1140
+		if (isset($this->_req_data['venue_status'])) {
1141 1141
 			$where['status'] = $this->_req_data['venue_status'];
1142 1142
 		}
1143 1143
 
1144 1144
 
1145
-		if ( $category ) {
1145
+		if ($category) {
1146 1146
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1147 1147
 			$where['Term_Taxonomy.term_id'] = $category;
1148 1148
 		}
1149 1149
 
1150 1150
 
1151
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1152
-			$where['VNU_wp_user'] =  get_current_user_id();
1151
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1152
+			$where['VNU_wp_user'] = get_current_user_id();
1153 1153
 		} else {
1154
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1154
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1155 1155
 					$where['OR'] = array(
1156
-						'status*restrict_private' => array( '!=', 'private' ),
1156
+						'status*restrict_private' => array('!=', 'private'),
1157 1157
 						'AND'                     => array(
1158
-							'status*inclusive' => array( '=', 'private' ),
1158
+							'status*inclusive' => array('=', 'private'),
1159 1159
 							'VNU_wp_user'      => get_current_user_id()
1160 1160
 						)
1161 1161
 					);
@@ -1165,30 +1165,30 @@  discard block
 block discarded – undo
1165 1165
 
1166 1166
 
1167 1167
 
1168
-		if ( isset( $this->_req_data['s'] ) ) {
1169
-			$sstr = '%' . $this->_req_data['s'] . '%';
1168
+		if (isset($this->_req_data['s'])) {
1169
+			$sstr = '%'.$this->_req_data['s'].'%';
1170 1170
 			$where['OR'] = array(
1171
-				'VNU_name' => array('LIKE',$sstr ),
1172
-				'VNU_desc' => array('LIKE',$sstr ),
1173
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1174
-				'VNU_address' => array( 'LIKE', $sstr ),
1175
-				'VNU_address2' => array( 'LIKE', $sstr ),
1176
-				'VNU_city' => array( 'LIKE', $sstr ),
1177
-				'VNU_zip' => array( 'LIKE', $sstr ),
1178
-				'VNU_phone' => array( 'LIKE', $sstr ),
1179
-				'VNU_url' => array( 'LIKE', $sstr ),
1180
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1181
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1182
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1183
-				'Event.EVT_name' => array('LIKE', $sstr ),
1184
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1185
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1186
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1171
+				'VNU_name' => array('LIKE', $sstr),
1172
+				'VNU_desc' => array('LIKE', $sstr),
1173
+				'VNU_short_desc' => array('LIKE', $sstr),
1174
+				'VNU_address' => array('LIKE', $sstr),
1175
+				'VNU_address2' => array('LIKE', $sstr),
1176
+				'VNU_city' => array('LIKE', $sstr),
1177
+				'VNU_zip' => array('LIKE', $sstr),
1178
+				'VNU_phone' => array('LIKE', $sstr),
1179
+				'VNU_url' => array('LIKE', $sstr),
1180
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1181
+				'VNU_virtual_url' => array('LIKE', $sstr),
1182
+				'VNU_google_map_link' => array('LIKE', $sstr),
1183
+				'Event.EVT_name' => array('LIKE', $sstr),
1184
+				'Event.EVT_desc' => array('LIKE', $sstr),
1185
+				'Event.EVT_phone' => array('LIKE', $sstr),
1186
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1187 1187
 				);
1188 1188
 		}
1189 1189
 
1190 1190
 
1191
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1191
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1192 1192
 
1193 1193
 		return $venues;
1194 1194
 
@@ -1206,22 +1206,22 @@  discard block
 block discarded – undo
1206 1206
 	 * @return void
1207 1207
 	 */
1208 1208
 	private function _set_category_object() {
1209
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1209
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1210 1210
 			return; //already have the category object so get out.
1211 1211
 
1212 1212
 		//set default category object
1213 1213
 		$this->_set_empty_category_object();
1214 1214
 
1215 1215
 		//only set if we've got an id
1216
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1216
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1217 1217
 			return;
1218 1218
 		}
1219 1219
 
1220 1220
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1221
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1221
+		$term = get_term($category_id, 'espresso_venue_categories');
1222 1222
 
1223 1223
 
1224
-		if ( !empty( $term ) ) {
1224
+		if ( ! empty($term)) {
1225 1225
 			$this->_category->category_name = $term->name;
1226 1226
 			$this->_category->category_identifier = $term->slug;
1227 1227
 			$this->_category->category_desc = $term->description;
@@ -1235,14 +1235,14 @@  discard block
 block discarded – undo
1235 1235
 
1236 1236
 	private function _set_empty_category_object() {
1237 1237
 		$this->_category = new stdClass();
1238
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1238
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1239 1239
 		$this->_category->id = $this->_category->parent = 0;
1240 1240
 	}
1241 1241
 
1242 1242
 
1243 1243
 
1244 1244
 	protected function _category_list_table() {
1245
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1245
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1246 1246
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1247 1247
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1248 1248
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1258,13 +1258,13 @@  discard block
 block discarded – undo
1258 1258
 		$this->_set_add_edit_form_tags($route);
1259 1259
 
1260 1260
 		$this->_set_category_object();
1261
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1261
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1262 1262
 
1263 1263
 		$delete_action = 'delete_category';
1264 1264
 
1265
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1265
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1266 1266
 
1267
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1267
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1268 1268
 
1269 1269
 		//take care of contents
1270 1270
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1278,25 +1278,25 @@  discard block
 block discarded – undo
1278 1278
 			'type' => 'wp_editor',
1279 1279
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1280 1280
 			'class' => 'my_editor_custom',
1281
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1281
+			'wpeditor_args' => array('media_buttons' => FALSE)
1282 1282
 		);
1283
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1283
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1284 1284
 
1285
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1285
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1286 1286
 
1287 1287
 		//setup category select for term parents.
1288 1288
 		$category_select_values[] = array(
1289 1289
 			'text' => __('No Parent', 'event_espresso'),
1290 1290
 			'id' => 0
1291 1291
 			);
1292
-		foreach ( $all_terms as $term ) {
1292
+		foreach ($all_terms as $term) {
1293 1293
 			$category_select_values[] = array(
1294 1294
 				'text' => $term->name,
1295 1295
 				'id' => $term->term_id
1296 1296
 				);
1297 1297
 		}
1298 1298
 
1299
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1299
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1300 1300
 		$template_args = array(
1301 1301
 			'category' => $this->_category,
1302 1302
 			'category_select' => $category_select,
@@ -1305,15 +1305,15 @@  discard block
 block discarded – undo
1305 1305
 			'disable' => '',
1306 1306
 			'disabled_message' =>FALSE
1307 1307
 			);
1308
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1309
-		return EEH_Template::display_template($template, $template_args, TRUE );
1308
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1309
+		return EEH_Template::display_template($template, $template_args, TRUE);
1310 1310
 	}
1311 1311
 
1312 1312
 
1313 1313
 	protected function _delete_categories() {
1314
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1314
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1315 1315
 
1316
-		foreach ( $cat_ids as $cat_id ) {
1316
+		foreach ($cat_ids as $cat_id) {
1317 1317
 			$this->_delete_category($cat_id);
1318 1318
 		}
1319 1319
 
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 		$query_args = array(
1322 1322
 			'action' => 'category_list'
1323 1323
 			);
1324
-		$this->_redirect_after_action(0,'','',$query_args);
1324
+		$this->_redirect_after_action(0, '', '', $query_args);
1325 1325
 
1326 1326
 	}
1327 1327
 
@@ -1330,58 +1330,58 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
 
1332 1332
 	protected function _delete_category($cat_id) {
1333
-		$cat_id = absint( $cat_id );
1334
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1333
+		$cat_id = absint($cat_id);
1334
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1335 1335
 	}
1336 1336
 
1337 1337
 
1338 1338
 
1339 1339
 	protected function _insert_or_update_category($new_category) {
1340 1340
 
1341
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1341
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1342 1342
 		$success = 0; //we already have a success message so lets not send another.
1343
-		if ( $cat_id ) {
1343
+		if ($cat_id) {
1344 1344
 			$query_args = array(
1345 1345
 				'action'     => 'edit_category',
1346 1346
 				'VEN_CAT_ID' => $cat_id
1347 1347
 			);
1348 1348
 		} else {
1349
-			$query_args = array( 'action' => 'add_category' );
1349
+			$query_args = array('action' => 'add_category');
1350 1350
 		}
1351
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1351
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1352 1352
 
1353 1353
 	}
1354 1354
 
1355 1355
 
1356 1356
 
1357
-	private function _insert_category( $update = FALSE ) {
1357
+	private function _insert_category($update = FALSE) {
1358 1358
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1359
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1360
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1361
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1359
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1360
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1361
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1362 1362
 
1363
-		if ( empty( $category_name ) ) {
1364
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1365
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1363
+		if (empty($category_name)) {
1364
+			$msg = __('You must add a name for the category.', 'event_espresso');
1365
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1366 1366
 			return false;
1367 1367
 		}
1368 1368
 
1369 1369
 
1370
-		$term_args=array(
1370
+		$term_args = array(
1371 1371
 			'name'=>$category_name,
1372 1372
 			'description'=>$category_desc,
1373 1373
 			'parent'=>$category_parent
1374 1374
 		);
1375 1375
 
1376
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1376
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1377 1377
 
1378
-		if ( !is_array( $insert_ids ) ) {
1379
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1380
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1378
+		if ( ! is_array($insert_ids)) {
1379
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1380
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1381 1381
 		} else {
1382 1382
 			$cat_id = $insert_ids['term_id'];
1383
-			$msg = sprintf ( __('The category %s was successfully created', 'event_espresso'), $category_name );
1384
-			EE_Error::add_success( $msg );
1383
+			$msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name);
1384
+			EE_Error::add_success($msg);
1385 1385
 		}
1386 1386
 
1387 1387
 		return $cat_id;
@@ -1401,11 +1401,11 @@  discard block
 block discarded – undo
1401 1401
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1402 1402
 			);
1403 1403
 
1404
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1404
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1405 1405
 
1406
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1407
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1408
-			$EE_Export = EE_Export::instance( $this->_req_data );
1406
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1407
+			require_once(EE_CLASSES.'EE_Export.class.php');
1408
+			$EE_Export = EE_Export::instance($this->_req_data);
1409 1409
 			$EE_Export->export();
1410 1410
 		}
1411 1411
 
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 
1418 1418
 	protected function _import_categories() {
1419 1419
 
1420
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1420
+		require_once(EE_CLASSES.'EE_Import.class.php');
1421 1421
 		EE_Import::instance()->import();
1422 1422
 
1423 1423
 	}
@@ -1425,29 +1425,29 @@  discard block
 block discarded – undo
1425 1425
 
1426 1426
 
1427 1427
 
1428
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1428
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1429 1429
 
1430 1430
 		//testing term stuff
1431
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1432
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1433
-		$limit = ($current_page-1)*$per_page;
1434
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1435
-		if ( isset( $this->_req_data['s'] ) ) {
1436
-			$sstr = '%' . $this->_req_data['s'] . '%';
1431
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1432
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1433
+		$limit = ($current_page - 1) * $per_page;
1434
+		$where = array('taxonomy' => 'espresso_venue_categories');
1435
+		if (isset($this->_req_data['s'])) {
1436
+			$sstr = '%'.$this->_req_data['s'].'%';
1437 1437
 			$where['OR'] = array(
1438
-				'Term.name' => array( 'LIKE', $sstr),
1439
-				'description' => array( 'LIKE', $sstr )
1438
+				'Term.name' => array('LIKE', $sstr),
1439
+				'description' => array('LIKE', $sstr)
1440 1440
 				);
1441 1441
 		}
1442 1442
 
1443 1443
 		$query_params = array(
1444 1444
 			$where,
1445
-			'order_by' => array( $orderby => $order ),
1446
-			'limit' => $limit . ',' . $per_page,
1445
+			'order_by' => array($orderby => $order),
1446
+			'limit' => $limit.','.$per_page,
1447 1447
 			'force_join' => array('Term')
1448 1448
 			);
1449 1449
 
1450
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1450
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1451 1451
 
1452 1452
 		return $categories;
1453 1453
 	}
Please login to merge, or discard this patch.