Completed
Branch BUG-10008-migration-stalling (f3f3da)
by
unknown
15:47
created
admin_pages/messages/Messages_Template_List_Table.class.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 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
 /**
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 	protected function _setup_data() {
44
-		$this->_data = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, FALSE);
45
-		$this->_all_data_count = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE );
44
+		$this->_data = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, FALSE);
45
+		$this->_all_data_count = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE);
46 46
 	}
47 47
 
48 48
 
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 
52 52
 	protected function _set_properties() {
53 53
 		$this->_wp_list_args = array(
54
-			'singular' => __('Message Template Group', 'event_espresso' ),
55
-			'plural' => __('Message Template', 'event_espresso' ),
54
+			'singular' => __('Message Template Group', 'event_espresso'),
55
+			'plural' => __('Message Template', 'event_espresso'),
56 56
 			'ajax' => TRUE, //for now,
57 57
 			'screen' => $this->get_admin_page()->get_current_screen()->id
58 58
 			);
59 59
 		$this->_columns = array(
60 60
 			//'cb' => '<input type="checkbox" />', //no deleting default (global) templates!
61 61
 			'message_type' => __('Message Type', 'event_espresso'),
62
-			'messenger' => __( 'Messenger', 'event_espresso'),
63
-			'description' => __( 'Description', 'event_espresso' ),
62
+			'messenger' => __('Messenger', 'event_espresso'),
63
+			'description' => __('Description', 'event_espresso'),
64 64
 			//'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place.
65 65
 			);
66 66
 
67 67
 		$this->_sortable_columns = array(
68
-			'messenger' => array( 'MTP_messenger' => TRUE ),
68
+			'messenger' => array('MTP_messenger' => TRUE),
69 69
 			//'message_type' => array( 'MTP_message_type' => FALSE )
70 70
 			);
71 71
 
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return string
86 86
 	 */
87
-	public function single_row( $item ) {
87
+	public function single_row($item) {
88 88
 		$message_type = $item->message_type_obj();
89 89
 		$messenger = $item->messenger_obj();
90 90
 
91
-		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) {
91
+		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
92 92
 			echo '';
93 93
 			return;
94 94
 		}
95 95
 
96
-		parent::single_row( $item );
96
+		parent::single_row($item);
97 97
 	}
98 98
 
99 99
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 		);
112 112
 
113 113
 		//set filters to select inputs if they aren't empty
114
-		foreach ( $select_inputs as $select_input ) {
115
-			if ( $select_input ) {
114
+		foreach ($select_inputs as $select_input) {
115
+			if ($select_input) {
116 116
 				$filters[] = $select_input;
117 117
 			}
118 118
 		}
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
 	 * we're just removing the search box for message templates, not needed.
124 124
 	 * @return string (empty);
125 125
 	 */
126
-	function search_box( $text, $input_id ) {
126
+	function search_box($text, $input_id) {
127 127
 		return '';
128 128
 	}
129 129
 
130 130
 
131 131
 	protected function _add_view_counts() {
132
-		foreach ( $this->_views as $view => $args )  {
133
-			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( $this->_per_page, $view, TRUE, TRUE );
132
+		foreach ($this->_views as $view => $args) {
133
+			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates($this->_per_page, $view, TRUE, TRUE);
134 134
 		}
135 135
 	}
136 136
 
137 137
 
138 138
 
139
-	public function column_cb( $item ) {
139
+	public function column_cb($item) {
140 140
 		return '';
141 141
 	}
142 142
 
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 
145 145
 
146 146
 
147
-	function column_description( $item ) {
148
-		return '<p>' . $item->message_type_obj()->description . '</p>';
147
+	function column_description($item) {
148
+		return '<p>'.$item->message_type_obj()->description.'</p>';
149 149
 	}
150 150
 
151 151
 
@@ -160,27 +160,27 @@  discard block
 block discarded – undo
160 160
 		$actions = array();
161 161
 
162 162
 		// edit link but only if item isn't trashed.
163
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) {
164
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL );
165
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
163
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) {
164
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL);
165
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
166 166
 		}
167 167
 
168
-		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] );
168
+		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']);
169 169
 
170 170
 		//we want to display the contexts in here so we need to set them up
171 171
 		$c_label = $item->context_label();
172 172
 		$c_configs = $item->contexts_config();
173 173
 		$ctxt = array();
174 174
 		$context_templates = $item->context_templates();
175
-		foreach ( $context_templates as $context => $template_fields ) {
176
-			$mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
177
-			$inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : '';
175
+		foreach ($context_templates as $context => $template_fields) {
176
+			$mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
177
+			$inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : '';
178 178
 			$context_title = ucwords($c_configs[$context]['label']);
179
-			$edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL );
180
-			$ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title;
179
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL);
180
+			$ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title;
181 181
 		}
182 182
 
183
-		$ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : '';
183
+		$ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : '';
184 184
 
185 185
 
186 186
 		//Return the name contents
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 										/* $1%s */ $name_link,
189 189
 										/* $2%s */ $item->GRP_ID(),
190 190
 										/* %4$s */ $ctx_content,
191
-										/* $3%s */ $this->row_actions( $actions )
191
+										/* $3%s */ $this->row_actions($actions)
192 192
 		);
193 193
 	}
194 194
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @return string       message_type name
199 199
 	 */
200 200
 	function column_message_type($item) {
201
-		return ucwords($item->message_type_obj()->label['singular'] );
201
+		return ucwords($item->message_type_obj()->label['singular']);
202 202
 	}
203 203
 
204 204
 
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
 			)
226 226
 		);
227 227
 
228
-		foreach ( $active_message_template_groups_grouped_by_messenger as $active_message_template_group ) {
229
-			if ( $active_message_template_group instanceof EE_Message_Template_Group ) {
228
+		foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) {
229
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
230 230
 				$messenger = $active_message_template_group->messenger_obj();
231 231
 				$messenger_label = $messenger instanceof EE_messenger
232 232
 					? $messenger->label['singular']
233 233
 					: $active_message_template_group->messenger();
234
-				$messenger_options[ $active_message_template_group->messenger() ] = ucwords( $messenger_label );
234
+				$messenger_options[$active_message_template_group->messenger()] = ucwords($messenger_label);
235 235
 			}
236 236
 		}
237
-		return $this->get_admin_page()->get_messengers_select_input( $messenger_options );
237
+		return $this->get_admin_page()->get_messengers_select_input($messenger_options);
238 238
 	}
239 239
 
240 240
 
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
 			)
255 255
 		);
256 256
 
257
-		foreach ( $active_message_template_groups_grouped_by_message_type as $active_message_template_group ) {
258
-			if ( $active_message_template_group instanceof EE_Message_Template_Group ) {
257
+		foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) {
258
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
259 259
 				$message_type = $active_message_template_group->message_type_obj();
260 260
 				$message_type_label = $message_type instanceof EE_message_type
261 261
 					? $message_type->label['singular']
262 262
 					: $active_message_template_group->message_type();
263
-				$message_type_options[ $active_message_template_group->message_type() ] = ucwords( $message_type_label );
263
+				$message_type_options[$active_message_template_group->message_type()] = ucwords($message_type_label);
264 264
 			}
265 265
 		}
266
-		return $this->get_admin_page()->get_message_types_select_input( $message_type_options );
266
+		return $this->get_admin_page()->get_message_types_select_input($message_type_options);
267 267
 	}
268 268
 
269 269
 }
Please login to merge, or discard this patch.
admin_pages/registrations/qtips/Registration_List_Table_Tips.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 	private function _registration_trash_message() {
95
-		return '<p>' . __('This lock-icon means that this registration cannot be trashed.  Registrations that belong to a transaction that has payments cannot be trashed.  If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('This lock-icon means that this registration cannot be trashed.  Registrations that belong to a transaction that has payments cannot be trashed.  If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @param  EEM_Registration constant $status What status is set (by class)
105 105
 	 * @return string         The status legend with the related status highlighted
106 106
 	 */
107
-	private function _registration_status_legend( $status ) {
107
+	private function _registration_status_legend($status) {
108 108
 
109 109
 		$status_array = array(
110 110
 			'approved_status' => EEM_Registration::status_id_approved,
@@ -114,6 +114,6 @@  discard block
 block discarded – undo
114 114
 			'cancelled_status' => EEM_Registration::status_id_cancelled
115 115
 			);
116 116
 
117
-		return EEH_Template::status_legend( $status_array, $status );
117
+		return EEH_Template::status_legend($status_array, $status);
118 118
 	}
119 119
 }
120 120
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/transactions/qtips/Transactions_List_Table_Tips.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param  EEM_Transaction constant $status What status is set (by class)
84 84
 	 * @return string         The status legend with the related status highlighted
85 85
 	 */
86
-	private function _transaction_status_legend( $status ) {
86
+	private function _transaction_status_legend($status) {
87 87
 
88 88
 		$status_array = array(
89 89
 			'overpaid' => EEM_Transaction::overpaid_status_code,
@@ -92,6 +92,6 @@  discard block
 block discarded – undo
92 92
 			'failed' => EEM_Transaction::failed_status_code,
93 93
 		);
94 94
 
95
-		return EEH_Template::status_legend( $status_array, $status );
95
+		return EEH_Template::status_legend($status_array, $status);
96 96
 	}
97 97
 }
98 98
\ No newline at end of file
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
 	/**
204 204
 	 * 		column_REG_att_checked_in
205
-	*/
205
+	 */
206 206
 	function column__REG_att_checked_in(EE_Registration $item){
207 207
 		$attendee = $item->attendee();
208 208
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
 	/**
290 290
 	 * 		column_REG_final_price
291
-	*/
291
+	 */
292 292
 	function column__REG_final_price(EE_Registration $item){
293 293
 		return '<span class="reg-pad-rght">' .  ' ' . $item->pretty_final_price() . '</span>';
294 294
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
 	/**
301 301
 	 * 		column_TXN_paid
302
-	*/
302
+	 */
303 303
 	function column_TXN_paid(EE_Registration $item){
304 304
 
305 305
 		if ( $item->count() == 1 ) {
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
 	/**
328 328
 	 * 		column_TXN_total
329
-	*/
329
+	 */
330 330
 	function column_TXN_total(EE_Registration $item){
331 331
 		$txn = $item->transaction();
332 332
 		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 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
 
3 5
 
4 6
 class EE_Event_Registrations_List_Table extends EE_Admin_List_Table {
@@ -126,8 +128,9 @@  discard block
 block discarded – undo
126 128
 			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
127 129
 			foreach ( $events as $evt ) {
128 130
 				//any registrations for this event?
129
-				if ( ! $evt->get_count_of_all_registrations() )
130
-					continue;
131
+				if ( ! $evt->get_count_of_all_registrations() ) {
132
+									continue;
133
+				}
131 134
 				$evts[] = array( 'id' => $evt->ID(), 'text' => $evt->get('EVT_name') );
132 135
 			}
133 136
 			$filters[] = EEH_Form_Fields::select_input( 'event_id', $evts );
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 
18 18
 
19
-	public function __construct( $admin_page ) {
19
+	public function __construct($admin_page) {
20 20
 		parent::__construct($admin_page);
21 21
 		$this->_status = $this->_admin_page->get_registration_status_array();
22 22
 	}
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 	protected function _setup_data() {
28
-		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE );
29
-		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE, TRUE);
28
+		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE);
29
+		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE);
30 30
 	}
31 31
 
32 32
 
33 33
 
34 34
 
35 35
 	protected function _set_properties() {
36
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
36
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
37 37
 
38 38
 		$this->_wp_list_args = array(
39 39
 			'singular' => __('registrant', 'event_espresso'),
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$columns = array();
46 46
 		//$columns['_Reg_Status'] = '';
47
-		if ( !empty( $evt_id ) ) {
47
+		if ( ! empty($evt_id)) {
48 48
 			$columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text
49 49
 			$this->_has_checkbox_column = true;
50 50
 		}
@@ -60,26 +60,26 @@  discard block
 block discarded – undo
60 60
 				'TXN_total' => __('Total', 'event_espresso')
61 61
 			);
62 62
 
63
-		$this->_columns = array_merge( $columns, $this->_columns);
63
+		$this->_columns = array_merge($columns, $this->_columns);
64 64
 
65 65
 		$this->_primary_column = '_REG_att_checked_in';
66 66
 
67
-		if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id )  ) {
67
+		if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) {
68 68
 			$this->_bottom_buttons = array(
69 69
 				'report'=> array(
70 70
 					'route' => 'registrations_report',
71 71
 					'extra_request' => 
72 72
 						array( 
73 73
 							'EVT_ID'=> $evt_id, 
74
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
74
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
75 75
 				)
76 76
 			);
77 77
 		}
78 78
 
79 79
 		$this->_sortable_columns = array(
80 80
 			 //true means its already sorted
81
-			'ATT_name' => array( 'ATT_name' => TRUE ),
82
-			'Event' => array( 'Event.EVT.Name' => FALSE )
81
+			'ATT_name' => array('ATT_name' => TRUE),
82
+			'Event' => array('Event.EVT.Name' => FALSE)
83 83
 		);
84 84
 
85 85
 		$this->_hidden_columns = array();
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 
92 92
 
93 93
 
94
-	protected function _get_row_class( $item ) {
95
-		$class = parent::_get_row_class( $item );
94
+	protected function _get_row_class($item) {
95
+		$class = parent::_get_row_class($item);
96 96
 		//add status class
97
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
98
-		if ( $this->_has_checkbox_column ) {
97
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
98
+		if ($this->_has_checkbox_column) {
99 99
 			$class .= ' has-checkbox-column';
100 100
 		}
101 101
 		return $class;
@@ -107,42 +107,42 @@  discard block
 block discarded – undo
107 107
 		$filters = $where = array();
108 108
 
109 109
 
110
-		if ( empty( $this->_dtts_for_event ) ) {
110
+		if (empty($this->_dtts_for_event)) {
111 111
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
112 112
 			//note possible capability restrictions
113
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) {
114
-				$where['status**'] =  array( '!=', 'private' );
113
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
114
+				$where['status**'] = array('!=', 'private');
115 115
 			}
116 116
 
117
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
118
-				$where['EVT_wp_user'] =  get_current_user_id();
117
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
118
+				$where['EVT_wp_user'] = get_current_user_id();
119 119
 			}
120 120
 
121
-			$events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) );
122
-			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
123
-			foreach ( $events as $evt ) {
121
+			$events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC')));
122
+			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso'));
123
+			foreach ($events as $evt) {
124 124
 				//any registrations for this event?
125
-				if ( ! $evt->get_count_of_all_registrations() )
125
+				if ( ! $evt->get_count_of_all_registrations())
126 126
 					continue;
127 127
 				$evts[] = array(
128 128
 					'id' => $evt->ID(),
129
-					'text' => $evt->get( 'EVT_name' ),
129
+					'text' => $evt->get('EVT_name'),
130 130
 					'class' => $evt->is_expired() ? 'ee-expired-event' : ''
131 131
 				);
132 132
 			}
133 133
 			$event_filter = '<div class="ee-event-filter">';
134
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts );
135
-			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>';
134
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts);
135
+			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>';
136 136
 			$event_filter .= '</div>';
137 137
 			$filters[] = $event_filter;
138 138
 
139 139
 		} else {
140 140
 			//DTT datetimes filter
141
-			$cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
141
+			$cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
142 142
 			$dtts = array();
143
-			foreach ( $this->_dtts_for_event as $dtt ) {
144
-				$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time();
145
-				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string );
143
+			foreach ($this->_dtts_for_event as $dtt) {
144
+				$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time();
145
+				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string);
146 146
 			}
147 147
 			$filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt);
148 148
 		}
@@ -163,19 +163,19 @@  discard block
 block discarded – undo
163 163
 
164 164
 
165 165
 	protected function _get_total_event_attendees() {
166
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
167
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
166
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
167
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
168 168
 		$query_params = array();
169
-		if ($EVT_ID){
170
-			$query_params[0]['EVT_ID']=$EVT_ID;
169
+		if ($EVT_ID) {
170
+			$query_params[0]['EVT_ID'] = $EVT_ID;
171 171
 		}
172 172
 		//if DTT is included we do multiple datetimes.  Otherwise we just do primary datetime
173
-		if ( $DTT_ID ) {
173
+		if ($DTT_ID) {
174 174
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
175 175
 		}
176
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
176
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
177 177
 
178
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
178
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
179 179
 
180 180
 		return EEM_Registration::instance()->count($query_params);
181 181
 	}
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 
187 187
 
188 188
 
189
-	function column__Reg_Status( EE_Registration $item ) {
190
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
189
+	function column__Reg_Status(EE_Registration $item) {
190
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
191 191
 	}
192 192
 
193 193
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 
197 197
 	function column_cb($item) {
198
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
198
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
199 199
 	}
200 200
 
201 201
 
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
 	/**
209 209
 	 * 		column_REG_att_checked_in
210 210
 	*/
211
-	function column__REG_att_checked_in(EE_Registration $item){
211
+	function column__REG_att_checked_in(EE_Registration $item) {
212 212
 		$attendee = $item->attendee();
213 213
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
214
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
214
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
215 215
 		$checkinstatus = $item->check_in_status_for_datetime($DTT_ID);
216 216
 		$nonce = wp_create_nonce('checkin_nonce');
217
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
218
-		$toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : '';
217
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
218
+		$toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : '';
219 219
 
220
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
220
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
221 221
 
222
-		 return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content;
222
+		 return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content;
223 223
 	}
224 224
 
225 225
 
@@ -228,45 +228,45 @@  discard block
 block discarded – undo
228 228
 
229 229
 	function column_ATT_name(EE_Registration $item) {
230 230
 		$attendee = $item->attendee();
231
-		if ( ! $attendee instanceof EE_Attendee ) {
231
+		if ( ! $attendee instanceof EE_Attendee) {
232 232
 			return __('No contact record for this registration.', 'event_espresso');
233 233
 		}
234 234
 
235 235
 		// edit attendee link
236
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
237
-		$name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ?  '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name();
236
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
237
+		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name();
238 238
 		$name_link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	' : '';
239 239
 
240 240
 		//add group details
241
-		$name_link .= '&nbsp;' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size());
241
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
242 242
 
243 243
 		//add regcode
244
-		$link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL );
244
+		$link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL);
245 245
 		$name_link .= '<br>';
246
-		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() )
247
-			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>'
246
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID())
247
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>'
248 248
 			: $item->reg_code();
249 249
 
250 250
 		//status
251
-		$name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
251
+		$name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
252 252
 
253 253
 		$actions = array();
254
-		$DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
255
-		$DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID;
254
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
255
+		$DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID;
256 256
 
257
-		if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) {
258
-			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
259
-			$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>';
257
+		if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) {
258
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
259
+			$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>';
260 260
 		}
261 261
 
262 262
 
263 263
 
264
-		return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link;
264
+		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link;
265 265
 	}
266 266
 
267 267
 
268 268
 
269
-	function column_ATT_email( EE_Registration $item ) {
269
+	function column_ATT_email(EE_Registration $item) {
270 270
 		$attendee = $item->attendee();
271 271
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
272 272
 		return $item->get_first_related('Attendee')->email();
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
 	function column_Event(EE_Registration $item) {
280 280
 		try {
281 281
 			$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
282
-			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL );
283
-			$event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ?  '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name();
284
-		} catch( \EventEspresso\core\exceptions\EntityNotFoundException $e ) {
285
-			$event_label = esc_html__( 'Unknown', 'event_espresso' );
282
+			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL);
283
+			$event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name();
284
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
285
+			$event_label = esc_html__('Unknown', 'event_espresso');
286 286
 		}
287 287
 
288 288
 		return $event_label;
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
 
294 294
 
295
-	function column_PRC_name(EE_Registration $item){
295
+	function column_PRC_name(EE_Registration $item) {
296 296
 		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
297 297
 	}
298 298
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	/**
305 305
 	 * 		column_REG_final_price
306 306
 	*/
307
-	function column__REG_final_price(EE_Registration $item){
308
-		return '<span class="reg-pad-rght">' .  ' ' . $item->pretty_final_price() . '</span>';
307
+	function column__REG_final_price(EE_Registration $item) {
308
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
309 309
 	}
310 310
 
311 311
 
@@ -315,20 +315,20 @@  discard block
 block discarded – undo
315 315
 	/**
316 316
 	 * 		column_TXN_paid
317 317
 	*/
318
-	function column_TXN_paid(EE_Registration $item){
318
+	function column_TXN_paid(EE_Registration $item) {
319 319
 
320
-		if ( $item->count() == 1 ) {
320
+		if ($item->count() == 1) {
321 321
 
322
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
322
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
323 323
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
324 324
 			} else {
325
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
326
-				return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '
325
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
326
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
327 327
 				<span class="reg-pad-rght">
328
-					<a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">
329
-						' . $item->transaction()->pretty_paid(). '
328
+					<a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">
329
+						' . $item->transaction()->pretty_paid().'
330 330
 					</a>
331
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
331
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
332 332
 			}
333 333
 		} else {
334 334
 			return '<span class="reg-pad-rght"></span>';
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
 	/**
343 343
 	 * 		column_TXN_total
344 344
 	*/
345
-	function column_TXN_total(EE_Registration $item){
345
+	function column_TXN_total(EE_Registration $item) {
346 346
 		$txn = $item->transaction();
347
-		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
348
-		if ( $item->get('REG_count') == 1 ) {
347
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
348
+		if ($item->get('REG_count') == 1) {
349 349
 			$line_total_obj = $txn->total_line_item();
350 350
 			$txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso');
351
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total  .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
351
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
352 352
 		} else {
353 353
 			return '<span class="reg-pad-rght"></span>';
354 354
 		}
Please login to merge, or discard this patch.
core/EE_Cart.core.php 3 patches
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
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
3 5
 /**
4 6
  * Event Espresso
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 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
  * Event Espresso
5 5
  *
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
 	  * @param EE_Session $session
68 68
 	  * @return \EE_Cart
69 69
 	  */
70
-	 public static function instance( EE_Line_Item $grand_total = null, EE_Session $session = null ) {
71
-		if ( ! empty( $grand_total ) ){
72
-			self::$_instance = new self( $grand_total, $session );
70
+	 public static function instance(EE_Line_Item $grand_total = null, EE_Session $session = null) {
71
+		if ( ! empty($grand_total)) {
72
+			self::$_instance = new self($grand_total, $session);
73 73
 		}
74 74
 		// or maybe retrieve an existing one ?
75
-		if ( ! self::$_instance instanceof EE_Cart ) {
75
+		if ( ! self::$_instance instanceof EE_Cart) {
76 76
 			// try getting the cart out of the session
77 77
 			$saved_cart = $session instanceof EE_Session ? $session->cart() : null;
78
-			self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self( $grand_total, $session );
79
-			unset( $saved_cart );
78
+			self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session);
79
+			unset($saved_cart);
80 80
 		}
81 81
 		// verify that cart is ok and grand total line item exists
82
-		if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item ) {
83
-			self::$_instance = new self( $grand_total, $session );
82
+		if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) {
83
+			self::$_instance = new self($grand_total, $session);
84 84
 		}
85 85
 		self::$_instance->get_grand_total();
86 86
 		 // once everything is all said and done, save the cart to the EE_Session
87
-		add_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 );
87
+		add_action('shutdown', array(self::$_instance, 'save_cart'), 90);
88 88
 		return self::$_instance;
89 89
 	}
90 90
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	  * @param EE_Session $session
99 99
 	  * @return \EE_Cart
100 100
 	  */
101
-	 private function __construct( EE_Line_Item $grand_total = null, EE_Session $session = null ) {
102
-		 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
103
-		 $this->set_session( $session );
104
-		 if ( $grand_total instanceof EE_Line_Item ) {
105
-			 $this->set_grand_total_line_item( $grand_total );
101
+	 private function __construct(EE_Line_Item $grand_total = null, EE_Session $session = null) {
102
+		 do_action('AHEE_log', __FILE__, __FUNCTION__, '');
103
+		 $this->set_session($session);
104
+		 if ($grand_total instanceof EE_Line_Item) {
105
+			 $this->set_grand_total_line_item($grand_total);
106 106
 		 }
107 107
 	 }
108 108
 
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 	  * @param EE_Session $session
115 115
 	  * @return EE_Cart
116 116
 	  */
117
-	 public static function reset( EE_Line_Item $grand_total = null, EE_Session $session = null ) {
118
-		 remove_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 );
119
-		 if ( $session instanceof EE_Session ) {
117
+	 public static function reset(EE_Line_Item $grand_total = null, EE_Session $session = null) {
118
+		 remove_action('shutdown', array(self::$_instance, 'save_cart'), 90);
119
+		 if ($session instanceof EE_Session) {
120 120
 			 $session->reset_cart();
121 121
 		 }
122 122
 		 self::$_instance = null;
123
-		 return self::instance( $grand_total, $session );
123
+		 return self::instance($grand_total, $session);
124 124
 	 }
125 125
 
126 126
 
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 /**
129 129
 	  * @param EE_Session $session
130 130
 	  */
131
-	 public function set_session( EE_Session $session = null ) {
132
-		 $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core( 'Session' );
131
+	 public function set_session(EE_Session $session = null) {
132
+		 $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core('Session');
133 133
 	 }
134 134
 
135 135
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	  *  know the grand total line item on it
140 140
 	  * @param EE_Line_Item $line_item
141 141
 	  */
142
-	 public function set_grand_total_line_item( EE_Line_Item $line_item ) {
142
+	 public function set_grand_total_line_item(EE_Line_Item $line_item) {
143 143
 		 $this->_grand_total = $line_item;
144 144
 	 }
145 145
 
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 	  * @param EE_Session $session
153 153
 	  * @return \EE_Cart
154 154
 	  */
155
-	public static function get_cart_from_txn( EE_Transaction $transaction, EE_Session $session = null ) {
155
+	public static function get_cart_from_txn(EE_Transaction $transaction, EE_Session $session = null) {
156 156
 		$grand_total = $transaction->total_line_item();
157 157
 		$grand_total->get_items();
158 158
 		$grand_total->tax_descendants();
159
-		return EE_Cart::instance( $grand_total, $session );
159
+		return EE_Cart::instance($grand_total, $session);
160 160
 	}
161 161
 
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * Creates the total line item, and ensures it has its 'tickets' and 'taxes' sub-items
166 166
 	 * @return EE_Line_Item
167 167
 	 */
168
-	private function _create_grand_total(){
168
+	private function _create_grand_total() {
169 169
 		$this->_grand_total = EEH_Line_Item::create_total_line_item();
170 170
 		return $this->_grand_total;
171 171
 	}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 *	@return \EE_Line_Item[]
179 179
 	 */
180 180
 	public function get_tickets() {
181
-		return EEH_Line_Item::get_ticket_line_items( $this->_grand_total );
181
+		return EEH_Line_Item::get_ticket_line_items($this->_grand_total);
182 182
 	}
183 183
 
184 184
 
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function all_ticket_quantity_count() {
193 193
 		$tickets = $this->get_tickets();
194
-		if ( empty( $tickets )) {
194
+		if (empty($tickets)) {
195 195
 			return 0;
196 196
 		}
197 197
 		$count = 0;
198
-		foreach ( $tickets as $ticket ) {
198
+		foreach ($tickets as $ticket) {
199 199
 			$count = $count + $ticket->get('LIN_quantity');
200 200
 		}
201 201
 		return $count;
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 *  Gets all the tax line items
208 208
 	 * @return \EE_Line_Item[]
209 209
 	 */
210
-	public function get_taxes(){
211
-		return EEH_Line_Item::get_taxes_subtotal( $this->_grand_total )->children();
210
+	public function get_taxes() {
211
+		return EEH_Line_Item::get_taxes_subtotal($this->_grand_total)->children();
212 212
 	}
213 213
 
214 214
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * Gets the total line item (which is a parent of all other line items) on this cart
218 218
 	 * @return EE_Line_Item
219 219
 	 */
220
-	public function get_grand_total(){
220
+	public function get_grand_total() {
221 221
 		return $this->_grand_total instanceof EE_Line_Item ? $this->_grand_total : $this->_create_grand_total();
222 222
 	}
223 223
 
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 	 *	@param int $qty
231 231
 	 *	@return TRUE on success, FALSE on fail
232 232
 	 */
233
-	public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) {
234
-		EEH_Line_Item::add_ticket_purchase( $this->get_grand_total(), $ticket, $qty );
233
+	public function add_ticket_to_cart(EE_Ticket $ticket, $qty = 1) {
234
+		EEH_Line_Item::add_ticket_purchase($this->get_grand_total(), $ticket, $qty);
235 235
 		return $this->save_cart() ? TRUE : FALSE;
236 236
 	}
237 237
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 *	@return float
255 255
 	 */
256 256
 	public function get_applied_taxes() {
257
-		return EEH_Line_Item::ensure_taxes_applied( $this->_grand_total );
257
+		return EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
258 258
 	}
259 259
 
260 260
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 *	@return float
266 266
 	 */
267 267
 	public function get_cart_grand_total() {
268
-		EEH_Line_Item::ensure_taxes_applied( $this->_grand_total );
268
+		EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
269 269
 		return $this->get_grand_total()->total();
270 270
 	}
271 271
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function recalculate_all_cart_totals() {
280 280
 		$pre_tax_total = $this->get_cart_total_before_tax();
281
-		$taxes_total = EEH_Line_Item::ensure_taxes_applied( $this->_grand_total );
282
-		$this->_grand_total->set_total( $pre_tax_total + $taxes_total );
281
+		$taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
282
+		$this->_grand_total->set_total($pre_tax_total + $taxes_total);
283 283
 		$this->_grand_total->save_this_and_descendants_to_txn();
284 284
 		return $this->get_grand_total()->total();
285 285
 	}
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	 *	@param array|bool|string $line_item_codes
293 293
 	 *	@return int on success, FALSE on fail
294 294
 	 */
295
-	public function delete_items( $line_item_codes = FALSE ) {
296
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
297
-		return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes );
295
+	public function delete_items($line_item_codes = FALSE) {
296
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
297
+		return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes);
298 298
 	}
299 299
 
300 300
 
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
 	 *	@return bool
306 306
 	 */
307 307
 	public function empty_cart() {
308
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
308
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
309 309
 		$this->_grand_total = $this->_create_grand_total();
310
-		return $this->save_cart( TRUE );
310
+		return $this->save_cart(TRUE);
311 311
 	}
312 312
 
313 313
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 	 *	@return bool
319 319
 	 */
320 320
 	public function delete_cart() {
321
-		$deleted = EEH_Line_Item::delete_all_child_items( $this->_grand_total );
322
-		if ( $deleted ) {
321
+		$deleted = EEH_Line_Item::delete_all_child_items($this->_grand_total);
322
+		if ($deleted) {
323 323
 			$deleted += $this->_grand_total->delete();
324 324
 			$this->_grand_total = null;
325 325
 		}
@@ -334,17 +334,17 @@  discard block
 block discarded – undo
334 334
 	  * @param bool $apply_taxes
335 335
 	  * @return TRUE on success, FALSE on fail
336 336
 	  */
337
-	public function save_cart( $apply_taxes = TRUE ) {
338
-		if ( $apply_taxes && $this->_grand_total instanceof EE_Line_Item ) {
339
-			EEH_Line_Item::ensure_taxes_applied( $this->_grand_total );
337
+	public function save_cart($apply_taxes = TRUE) {
338
+		if ($apply_taxes && $this->_grand_total instanceof EE_Line_Item) {
339
+			EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
340 340
 			//make sure we don't cache the transaction because it can get stale
341
-			if( $this->_grand_total->get_one_from_cache( 'Transaction' ) instanceof EE_Transaction &&
342
-				$this->_grand_total->get_one_from_cache( 'Transaction' )->ID()) {
343
-				$this->_grand_total->clear_cache( 'Transaction', null, true );
341
+			if ($this->_grand_total->get_one_from_cache('Transaction') instanceof EE_Transaction &&
342
+				$this->_grand_total->get_one_from_cache('Transaction')->ID()) {
343
+				$this->_grand_total->clear_cache('Transaction', null, true);
344 344
 			}
345 345
 		}
346
-		if ( $this->_session instanceof EE_Session ) {
347
-			return $this->_session->set_cart( $this );
346
+		if ($this->_session instanceof EE_Session) {
347
+			return $this->_session->set_cart($this);
348 348
 		} else {
349 349
 			return false;
350 350
 		}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 *	@access public
229 229
 	 *	@param EE_Ticket $ticket
230 230
 	 *	@param int $qty
231
-	 *	@return TRUE on success, FALSE on fail
231
+	 *	@return boolean on success, FALSE on fail
232 232
 	 */
233 233
 	public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) {
234 234
 		EEH_Line_Item::add_ticket_purchase( $this->get_grand_total(), $ticket, $qty );
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	  * @save cart to session
333 333
 	  * @access public
334 334
 	  * @param bool $apply_taxes
335
-	  * @return TRUE on success, FALSE on fail
335
+	  * @return boolean on success, FALSE on fail
336 336
 	  */
337 337
 	public function save_cart( $apply_taxes = TRUE ) {
338 338
 		if ( $apply_taxes && $this->_grand_total instanceof EE_Line_Item ) {
Please login to merge, or discard this patch.
core/admin/templates/admin_details_legend.template.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,25 +2,25 @@
 block discarded – undo
2 2
 //this displays any legends with an array of $items that are indexed by id for each item and each item itself is an array of 'icon' and 'desc'.
3 3
 
4 4
 //figure out the columns based on the count of items (we want a max of 6 items per column).
5
-$per_col = isset( $per_column ) ? $per_column : 5;
5
+$per_col = isset($per_column) ? $per_column : 5;
6 6
 $count = 1;
7 7
 ?>
8 8
 <div class="ee-list-table-legend-container">
9 9
 	<h4><?php _e('Legend', 'event_espresso'); ?></h4>
10 10
 	<dl class="alignleft ee-list-table-legend">
11
-		<?php foreach ( $items as $item => $details ) : ?>
12
-			<?php if ( $per_col < $count ) : ?>
11
+		<?php foreach ($items as $item => $details) : ?>
12
+			<?php if ($per_col < $count) : ?>
13 13
 				</dl>
14 14
 				<dl class="alignleft ee-list-table-legend">
15 15
 			<?php $count = 1; endif; ?>
16 16
 			<dt id="ee-legend-item-<?php echo $item; ?>">
17
-				<?php $class = ! empty( $details['class'] ) ? $details['class'] : 'ee-legend-img-container'; ?>
18
-				<?php if ( strpos( $details[ 'class' ], '<span' ) !== false ) {
17
+				<?php $class = ! empty($details['class']) ? $details['class'] : 'ee-legend-img-container'; ?>
18
+				<?php if (strpos($details['class'], '<span') !== false) {
19 19
 					echo $class;
20 20
 				} else { ?>
21 21
 				<span class="<?php echo $class; ?>">
22
-					<?php if ( ! empty( $details[ 'icon' ] ) ) : ?>
23
-						<img src="<?php echo $details[ 'icon' ]; ?>" class="ee-legend-icon" alt="<?php echo esc_attr( $details[ 'desc' ] ); ?>"/>
22
+					<?php if ( ! empty($details['icon'])) : ?>
23
+						<img src="<?php echo $details['icon']; ?>" class="ee-legend-icon" alt="<?php echo esc_attr($details['desc']); ?>"/>
24 24
 					<?php endif; ?>
25 25
 				</span>
26 26
 				<?php } ?>
Please login to merge, or discard this patch.
data_migration_scripts/4_1_0_stages/EE_DMS_4_1_0_questions.dmsstage.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -55,21 +55,21 @@  discard block
 block discarded – undo
55 55
 					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false)
56 56
 				)
57 57
  */
58
-class EE_DMS_4_1_0_questions extends EE_Data_Migration_Script_Stage{
58
+class EE_DMS_4_1_0_questions extends EE_Data_Migration_Script_Stage {
59 59
 	private $_old_table;
60 60
 	private $_new_table;
61 61
 	private $_option_table;
62
-	function _migration_step($num_items=50){
62
+	function _migration_step($num_items = 50) {
63 63
 		global $wpdb;
64 64
 		$start_at_record = $this->count_records_migrated();
65
-		$rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d",$start_at_record,$num_items),ARRAY_A);
65
+		$rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A);
66 66
 		$items_actually_migrated = 0;
67
-		foreach($rows as $question_row){
67
+		foreach ($rows as $question_row) {
68 68
 			$new_id = $this->_insert_new_question($question_row);
69 69
 			$this->get_migration_script()->set_mapping($this->_old_table, $question_row['id'], $this->_new_table, $new_id);
70 70
 			$items_actually_migrated++;
71 71
 		}
72
-		if($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()){
72
+		if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) {
73 73
 			$this->set_completed();
74 74
 		}
75 75
 		return $items_actually_migrated;
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 		$this->_option_table = $wpdb->prefix."esp_question_option";
88 88
 		parent::__construct();
89 89
 	}
90
-	private function _insert_new_question($old_question){
90
+	private function _insert_new_question($old_question) {
91 91
 		global $wpdb;
92 92
 		//if this pretends to be a 'system' question, check if we already have a
93 93
 		//system question for that string. If so, pretend THAT new question
94 94
 		//is what we just isnerted
95
-		if($old_question['system_name']){
96
-			$id_of_new_system_question = intval($wpdb->get_var($wpdb->prepare("SELECT QST_ID FROM {$this->_new_table} WHERE QST_system = %s",$old_question['system_name'])));
97
-			if($id_of_new_system_question){
95
+		if ($old_question['system_name']) {
96
+			$id_of_new_system_question = intval($wpdb->get_var($wpdb->prepare("SELECT QST_ID FROM {$this->_new_table} WHERE QST_system = %s", $old_question['system_name'])));
97
+			if ($id_of_new_system_question) {
98 98
 				return $id_of_new_system_question;
99 99
 			}
100 100
 			//ok so this must be the first one. Carry on.
@@ -113,27 +113,27 @@  discard block
 block discarded – undo
113 113
 			'QST_deleted'=>false
114 114
 		);
115 115
 		$datatypes = array(
116
-			'%s',//QST_display_text
117
-			'%s',//QST-admin_label
118
-			'%s',//QST_system
119
-			'%s',//QST_type
120
-			'%d',//QST_required
121
-			'%s',//QST_required_text
122
-			'%d',//QST_order
123
-			'%d',//QST_admin_only
124
-			'%d',//QST_wp_user
125
-			'%d',//QST_deleted
116
+			'%s', //QST_display_text
117
+			'%s', //QST-admin_label
118
+			'%s', //QST_system
119
+			'%s', //QST_type
120
+			'%d', //QST_required
121
+			'%s', //QST_required_text
122
+			'%d', //QST_order
123
+			'%d', //QST_admin_only
124
+			'%d', //QST_wp_user
125
+			'%d', //QST_deleted
126 126
 		);
127
-		$success = $wpdb->insert($this->_new_table,$cols_n_values,$datatypes);
128
-		if ( ! $success){
127
+		$success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes);
128
+		if ( ! $success) {
129 129
 			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_question, $this->_new_table, $cols_n_values, $datatypes));
130 130
 			return 0;
131 131
 		}
132 132
 		$new_id = $wpdb->insert_id;
133 133
 		//now take care of posisbly adding question options
134
-		if(in_array($old_question['question_type'],array('DROPDOWN','SINGLE','MULTIPLE'))){
135
-			$options = explode(",",$old_question['response']);
136
-			foreach($options as $option){
134
+		if (in_array($old_question['question_type'], array('DROPDOWN', 'SINGLE', 'MULTIPLE'))) {
135
+			$options = explode(",", $old_question['response']);
136
+			foreach ($options as $option) {
137 137
 				$this->_insert_question_option($option, $new_id);
138 138
 			}
139 139
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param int $question_id
147 147
 	 * @return int
148 148
 	 */
149
-	private function _insert_question_option($option,$question_id){
149
+	private function _insert_question_option($option, $question_id) {
150 150
 		$option = trim($option);
151 151
 		global $wpdb;
152 152
 		$cols_n_values = array(
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 			'QSO_value'=>$option,
155 155
 			'QSO_deleted'=>false
156 156
 		);
157
-		$datatypes= array(
158
-			'%d',//QST_ID
159
-			'%s',//QSO_value
160
-			'%d',//QSO_deleted
157
+		$datatypes = array(
158
+			'%d', //QST_ID
159
+			'%s', //QSO_value
160
+			'%d', //QSO_deleted
161 161
 		);
162
-		$success = $wpdb->insert($this->_option_table,$cols_n_values,$datatypes);
163
-		if ( ! $success ){
164
-			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option,'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes));
162
+		$success = $wpdb->insert($this->_option_table, $cols_n_values, $datatypes);
163
+		if ( ! $success) {
164
+			$this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option, 'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes));
165 165
 			return 0;
166 166
 		}
167 167
 		return $wpdb->insert_id;
Please login to merge, or discard this patch.
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/data_migration_scripts/EE_DMS_Core_4_9_0.dms.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 //(all other times it gets resurrected from a wordpress option)
9 9
 $stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*');
10 10
 $class_to_filepath = array();
11
-foreach($stages as $filepath){
11
+foreach ($stages as $filepath) {
12 12
 	$matches = array();
13
-	preg_match('~4_9_0_stages/(.*).dmsstage.php~',$filepath,$matches);
13
+	preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
14 14
 	$class_to_filepath[$matches[1]] = $filepath;
15 15
 }
16 16
 //give addons a chance to autoload their stages too
17
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages',$class_to_filepath);
17
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath);
18 18
 EEH_Autoloader::register_autoloader($class_to_filepath);
19 19
 
20 20
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @since                4.6.0
31 31
  *
32 32
  */
33
-class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base{
33
+class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base {
34 34
 
35 35
 	/**
36 36
 	 * return EE_DMS_Core_4_9_0
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function can_migrate_from_version($version_array) {
56 56
 		$version_string = $version_array['Core'];
57
-		if( $version_string <= '4.9.0' && $version_string >= '4.8.0' ){
57
+		if ($version_string <= '4.9.0' && $version_string >= '4.8.0') {
58 58
 //			echo "$version_string can be migrated from";
59 59
 			return true;
60
-		} elseif( ! $version_string ){
60
+		} elseif ( ! $version_string) {
61 61
 //			echo "no version string provided: $version_string";
62 62
 			//no version string provided... this must be pre 4.3
63
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
64
-		}else{
63
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
64
+		} else {
65 65
 //			echo "$version_string doesnt apply";
66 66
 			return false;
67 67
 		}
@@ -82,18 +82,18 @@  discard block
 block discarded – undo
82 82
 	 * @return bool
83 83
 	 */
84 84
 	public function schema_changes_before_migration() {
85
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
86
-		$now_in_mysql = current_time( 'mysql', true );
85
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
86
+		$now_in_mysql = current_time('mysql', true);
87 87
 
88
-		$table_name='esp_answer';
89
-		$sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
88
+		$table_name = 'esp_answer';
89
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
90 90
 					REG_ID int(10) unsigned NOT NULL,
91 91
 					QST_ID int(10) unsigned NOT NULL,
92 92
 					ANS_value text NOT NULL,
93 93
 					PRIMARY KEY  (ANS_ID),
94 94
 					KEY REG_ID (REG_ID),
95 95
 					KEY QST_ID (QST_ID)";
96
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
96
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
97 97
 
98 98
 		$table_name = 'esp_attendee_meta';
99 99
 		$sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 				KEY ATT_fname (ATT_fname)";
116 116
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
117 117
 
118
-		$table_name='esp_checkin';
118
+		$table_name = 'esp_checkin';
119 119
 		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
120 120
 				REG_ID int(10) unsigned NOT NULL,
121 121
 				DTT_ID int(10) unsigned NOT NULL,
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 				CNT_is_EU tinyint(1) DEFAULT '0',
144 144
 				CNT_active tinyint(1) DEFAULT '0',
145 145
 				PRIMARY KEY  (CNT_ISO)";
146
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
146
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
147 147
 
148 148
 		$table_name = 'esp_currency';
149 149
 		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
154 154
 				CUR_active tinyint(1) DEFAULT '0',
155 155
 				PRIMARY KEY  (CUR_code)";
156
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
156
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
157 157
 
158 158
 
159 159
 		$table_name = 'esp_currency_payment_method';
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 				KEY DTT_EVT_start (DTT_EVT_start),
182 182
 				KEY EVT_ID (EVT_ID),
183 183
 				KEY DTT_is_primary (DTT_is_primary)";
184
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
184
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
185 185
 		
186 186
 		$table_name = "esp_datetime_ticket";
187 187
 		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				PRIMARY KEY  (EMT_ID),
200 200
 				KEY EVT_ID (EVT_ID),
201 201
 				KEY GRP_ID (GRP_ID)";
202
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
202
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
203 203
 
204 204
 		$table_name = 'esp_event_meta';
205 205
 		$sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 				EVT_donations tinyint(1) NULL,
218 218
 				PRIMARY KEY  (EVTM_ID),
219 219
 				KEY EVT_ID (EVT_ID)";
220
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
220
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
221 221
 
222
-		$table_name='esp_event_question_group';
222
+		$table_name = 'esp_event_question_group';
223 223
 		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
224 224
 				EVT_ID bigint(20) unsigned NOT NULL,
225 225
 				QSG_ID int(10) unsigned NOT NULL,
@@ -227,17 +227,17 @@  discard block
 block discarded – undo
227 227
 				PRIMARY KEY  (EQG_ID),
228 228
 				KEY EVT_ID (EVT_ID),
229 229
 				KEY QSG_ID (QSG_ID)";
230
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
230
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
231 231
 
232
-		$table_name='esp_event_venue';
232
+		$table_name = 'esp_event_venue';
233 233
 		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
234 234
 				EVT_ID bigint(20) unsigned NOT NULL,
235 235
 				VNU_ID bigint(20) unsigned NOT NULL,
236 236
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
237 237
 				PRIMARY KEY  (EVV_ID)";
238
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
238
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
239 239
 
240
-		$table_name='esp_extra_meta';
240
+		$table_name = 'esp_extra_meta';
241 241
 		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
242 242
 				OBJ_ID int(11) DEFAULT NULL,
243 243
 				EXM_type varchar(45) DEFAULT NULL,
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 				EXM_value text,
246 246
 				PRIMARY KEY  (EXM_ID),
247 247
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
248
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
248
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
249 249
 
250 250
 		$table_name = 'esp_extra_join';
251 251
 		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
259 259
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
260 260
 
261
-		$table_name='esp_line_item';
261
+		$table_name = 'esp_line_item';
262 262
 		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
263 263
 				LIN_code varchar(245) NOT NULL DEFAULT '',
264 264
 				TXN_ID int(11) DEFAULT NULL,
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 				PRIMARY KEY  (LIN_ID),
279 279
 				KEY LIN_code (LIN_code(191)),
280 280
 				KEY TXN_ID (TXN_ID)";
281
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB' );
281
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
282 282
 
283 283
 		$table_name = 'esp_log';
284 284
 		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 				KEY STS_ID (STS_ID),
328 328
 				KEY MSG_created (MSG_created),
329 329
 				KEY MSG_modified (MSG_modified)";
330
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
330
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
331 331
 		
332 332
 		$table_name = 'esp_message_template';
333 333
 		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 				MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
353 353
 				PRIMARY KEY  (GRP_ID),
354 354
 				KEY MTP_user_id (MTP_user_id)";
355
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
355
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
356 356
 
357 357
 		$table_name = 'esp_payment';
358 358
 		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 				PRIMARY KEY  (TTM_ID)";
411 411
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
412 412
 
413
-		$table_name='esp_question';
413
+		$table_name = 'esp_question';
414 414
 		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
415 415
 				QST_display_text text NOT NULL,
416 416
 				QST_admin_label varchar(255) NOT NULL,
@@ -425,9 +425,9 @@  discard block
 block discarded – undo
425 425
 				QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
426 426
 				PRIMARY KEY  (QST_ID),
427 427
 				KEY QST_order (QST_order)';
428
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
428
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
429 429
 
430
-		$table_name='esp_question_group_question';
430
+		$table_name = 'esp_question_group_question';
431 431
 		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
432 432
 				QSG_ID int(10) unsigned NOT NULL,
433 433
 				QST_ID int(10) unsigned NOT NULL,
@@ -435,9 +435,9 @@  discard block
 block discarded – undo
435 435
 				PRIMARY KEY  (QGQ_ID),
436 436
 				KEY QST_ID (QST_ID),
437 437
 				KEY QSG_ID_order (QSG_ID,QGQ_order)";
438
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
438
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
439 439
 
440
-		$table_name='esp_question_option';
440
+		$table_name = 'esp_question_option';
441 441
 		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
442 442
 				QSO_value varchar(255) NOT NULL,
443 443
 				QSO_desc text NOT NULL,
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 				PRIMARY KEY  (QSO_ID),
449 449
 				KEY QST_ID (QST_ID),
450 450
 				KEY QSO_order (QSO_order)";
451
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
451
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
452 452
 
453 453
 		$table_name = 'esp_registration';
454 454
 		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 				PRC_parent int(10) unsigned DEFAULT 0,
562 562
 				PRIMARY KEY  (PRC_ID),
563 563
 				KEY PRT_ID (PRT_ID)";
564
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
564
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
565 565
 
566 566
 		$table_name = "esp_price_type";
567 567
 		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 				TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
599 599
 				PRIMARY KEY  (TKT_ID),
600 600
 				KEY TKT_start_date (TKT_start_date)";
601
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
601
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
602 602
 
603 603
 		$table_name = 'esp_question_group';
604 604
 		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 				PRIMARY KEY  (QSG_ID),
615 615
 				UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
616 616
 				KEY QSG_order (QSG_order)';
617
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
617
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
618 618
 
619 619
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
620 620
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -648,5 +648,5 @@  discard block
 block discarded – undo
648 648
 		return true;
649 649
 	}
650 650
 
651
-	public function migration_page_hooks(){}
651
+	public function migration_page_hooks() {}
652 652
 }
653 653
\ No newline at end of file
Please login to merge, or discard this patch.