Completed
Branch BUG-9715-shortcode-resources (aae731)
by
unknown
73:19 queued 63:44
created
admin_pages/transactions/Transactions_Admin_Page_Init.core.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function __construct() {
34 34
 
35
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
36
-		if ( ! defined( 'TXN_PG_SLUG' ) ) {
37
-			define( 'TXN_PG_SLUG', 'espresso_transactions' );
38
-			define( 'TXN_PG_NAME', ucwords( str_replace( '_', '', TXN_PG_SLUG ) ) );
39
-			define( 'TXN_ADMIN', EE_ADMIN_PAGES . 'transactions' . DS );
40
-			define( 'TXN_ADMIN_URL', admin_url( 'admin.php?page=' . TXN_PG_SLUG ) );
41
-			define( 'TXN_ASSETS_PATH', TXN_ADMIN . 'assets' . DS );
42
-			define( 'TXN_ASSETS_URL', str_replace( '\\', '/', EE_ADMIN_PAGES_URL . 'transactions/assets' . DS ) );
43
-			define( 'TXN_TEMPLATE_PATH', TXN_ADMIN . 'templates' . DS );
44
-			define( 'TXN_TEMPLATE_URL', str_replace( '\\', '/', EE_ADMIN_PAGES_URL . 'transactions/templates' . DS ) );
35
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
36
+		if ( ! defined('TXN_PG_SLUG')) {
37
+			define('TXN_PG_SLUG', 'espresso_transactions');
38
+			define('TXN_PG_NAME', ucwords(str_replace('_', '', TXN_PG_SLUG)));
39
+			define('TXN_ADMIN', EE_ADMIN_PAGES.'transactions'.DS);
40
+			define('TXN_ADMIN_URL', admin_url('admin.php?page='.TXN_PG_SLUG));
41
+			define('TXN_ASSETS_PATH', TXN_ADMIN.'assets'.DS);
42
+			define('TXN_ASSETS_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/assets'.DS));
43
+			define('TXN_TEMPLATE_PATH', TXN_ADMIN.'templates'.DS);
44
+			define('TXN_TEMPLATE_URL', str_replace('\\', '/', EE_ADMIN_PAGES_URL.'transactions/templates'.DS));
45 45
 		}
46 46
 		parent::__construct();
47 47
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return void
64 64
 	 */
65 65
 	protected function _set_menu_map() {
66
-		$this->_menu_map = new EE_Admin_Page_Sub_Menu( array(
66
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(array(
67 67
 			'menu_group' => 'main',
68 68
 			'menu_order' => 50,
69 69
 			'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
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/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.
Spacing   +79 added lines, -79 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,43 +60,43 @@  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();
86 86
 
87 87
 		$this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
88
-		$this->_dtts_for_event = !empty($evt_id) ? $this->_evt->datetimes_ordered() : array();
88
+		$this->_dtts_for_event = ! empty($evt_id) ? $this->_evt->datetimes_ordered() : array();
89 89
 
90 90
 	}
91 91
 
92 92
 
93 93
 
94 94
 
95
-	protected function _get_row_class( $item ) {
96
-		$class = parent::_get_row_class( $item );
95
+	protected function _get_row_class($item) {
96
+		$class = parent::_get_row_class($item);
97 97
 		//add status class
98
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
99
-		if ( $this->_has_checkbox_column ) {
98
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
99
+		if ($this->_has_checkbox_column) {
100 100
 			$class .= ' has-checkbox-column';
101 101
 		}
102 102
 		return $class;
@@ -108,42 +108,42 @@  discard block
 block discarded – undo
108 108
 		$filters = $where = array();
109 109
 
110 110
 
111
-		if ( empty( $this->_dtts_for_event ) ) {
111
+		if (empty($this->_dtts_for_event)) {
112 112
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
113 113
 			//note possible capability restrictions
114
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) {
115
-				$where['status**'] =  array( '!=', 'private' );
114
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
115
+				$where['status**'] = array('!=', 'private');
116 116
 			}
117 117
 
118
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
119
-				$where['EVT_wp_user'] =  get_current_user_id();
118
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
119
+				$where['EVT_wp_user'] = get_current_user_id();
120 120
 			}
121 121
 
122
-			$events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) );
123
-			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
124
-			foreach ( $events as $evt ) {
122
+			$events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC')));
123
+			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso'));
124
+			foreach ($events as $evt) {
125 125
 				//any registrations for this event?
126
-				if ( ! $evt->get_count_of_all_registrations() )
126
+				if ( ! $evt->get_count_of_all_registrations())
127 127
 					continue;
128 128
 				$evts[] = array(
129 129
 					'id' => $evt->ID(),
130
-					'text' => $evt->get( 'EVT_name' ),
130
+					'text' => $evt->get('EVT_name'),
131 131
 					'class' => $evt->is_expired() ? 'ee-expired-event' : ''
132 132
 				);
133 133
 			}
134 134
 			$event_filter = '<div class="ee-event-filter">';
135
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts );
136
-			$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>';
135
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts);
136
+			$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>';
137 137
 			$event_filter .= '</div>';
138 138
 			$filters[] = $event_filter;
139 139
 
140 140
 		} else {
141 141
 			//DTT datetimes filter
142
-			$cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
142
+			$cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
143 143
 			$dtts = array();
144
-			foreach ( $this->_dtts_for_event as $dtt ) {
145
-				$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time();
146
-				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string );
144
+			foreach ($this->_dtts_for_event as $dtt) {
145
+				$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time();
146
+				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string);
147 147
 			}
148 148
 			$filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt);
149 149
 		}
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
 
165 165
 
166 166
 	protected function _get_total_event_attendees() {
167
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
168
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
167
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
168
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
169 169
 		$query_params = array();
170
-		if ($EVT_ID){
171
-			$query_params[0]['EVT_ID']=$EVT_ID;
170
+		if ($EVT_ID) {
171
+			$query_params[0]['EVT_ID'] = $EVT_ID;
172 172
 		}
173 173
 		//if DTT is included we do multiple datetimes.  Otherwise we just do primary datetime
174
-		if ( $DTT_ID ) {
174
+		if ($DTT_ID) {
175 175
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
176 176
 		}
177
-		$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
+		$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));
178 178
 
179
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
179
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
180 180
 
181 181
 		return EEM_Registration::instance()->count($query_params);
182 182
 	}
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 
188 188
 
189 189
 
190
-	function column__Reg_Status( EE_Registration $item ) {
191
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
190
+	function column__Reg_Status(EE_Registration $item) {
191
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
192 192
 	}
193 193
 
194 194
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 
198 198
 	function column_cb($item) {
199
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
199
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
200 200
 	}
201 201
 
202 202
 
@@ -209,18 +209,18 @@  discard block
 block discarded – undo
209 209
 	/**
210 210
 	 * 		column_REG_att_checked_in
211 211
 	*/
212
-	function column__REG_att_checked_in(EE_Registration $item){
212
+	function column__REG_att_checked_in(EE_Registration $item) {
213 213
 		$attendee = $item->attendee();
214 214
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
215
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
215
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
216 216
 		$checkinstatus = $item->check_in_status_for_datetime($DTT_ID);
217 217
 		$nonce = wp_create_nonce('checkin_nonce');
218
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
219
-		$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' : '';
218
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
219
+		$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' : '';
220 220
 
221
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
221
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
222 222
 
223
-		 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
+		 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;
224 224
 	}
225 225
 
226 226
 
@@ -229,43 +229,43 @@  discard block
 block discarded – undo
229 229
 
230 230
 	function column_ATT_name(EE_Registration $item) {
231 231
 		$attendee = $item->attendee();
232
-		if ( ! $attendee instanceof EE_Attendee ) {
232
+		if ( ! $attendee instanceof EE_Attendee) {
233 233
 			return __('No contact record for this registration.', 'event_espresso');
234 234
 		}
235 235
 
236 236
 		// edit attendee link
237
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
238
-		$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();
237
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
238
+		$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();
239 239
 		$name_link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	' : '';
240 240
 
241 241
 		//add group details
242
-		$name_link .= '&nbsp;' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size());
242
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
243 243
 
244 244
 		//add regcode
245
-		$link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL );
245
+		$link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL);
246 246
 		$name_link .= '<br>';
247
-		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() )
248
-			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>'
247
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID())
248
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>'
249 249
 			: $item->reg_code();
250 250
 
251 251
 		//status
252
-		$name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
252
+		$name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
253 253
 
254 254
 		$actions = array();
255
-		$DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
256
-		$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;
255
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
256
+		$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;
257 257
 
258
-		if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) {
259
-			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
260
-			$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>';
258
+		if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) {
259
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
260
+			$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>';
261 261
 		}
262 262
 
263
-		return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link;
263
+		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link;
264 264
 	}
265 265
 
266 266
 
267 267
 
268
-	function column_ATT_email( EE_Registration $item ) {
268
+	function column_ATT_email(EE_Registration $item) {
269 269
 		$attendee = $item->attendee();
270 270
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
271 271
 		return $item->get_first_related('Attendee')->email();
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 
278 278
 	function column_Event(EE_Registration $item) {
279 279
 		$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
280
-		$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL );
281
-		$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();
280
+		$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL);
281
+		$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();
282 282
 		return $event_label;
283 283
 	}
284 284
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
 
288 288
 
289
-	function column_PRC_name(EE_Registration $item){
289
+	function column_PRC_name(EE_Registration $item) {
290 290
 		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
291 291
 	}
292 292
 
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
 	/**
299 299
 	 * 		column_REG_final_price
300 300
 	*/
301
-	function column__REG_final_price(EE_Registration $item){
302
-		return '<span class="reg-pad-rght">' .  ' ' . $item->pretty_final_price() . '</span>';
301
+	function column__REG_final_price(EE_Registration $item) {
302
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
303 303
 	}
304 304
 
305 305
 
@@ -309,20 +309,20 @@  discard block
 block discarded – undo
309 309
 	/**
310 310
 	 * 		column_TXN_paid
311 311
 	*/
312
-	function column_TXN_paid(EE_Registration $item){
312
+	function column_TXN_paid(EE_Registration $item) {
313 313
 
314
-		if ( $item->count() == 1 ) {
314
+		if ($item->count() == 1) {
315 315
 
316
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
316
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
317 317
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
318 318
 			} else {
319
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
320
-				return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '
319
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
320
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
321 321
 				<span class="reg-pad-rght">
322
-					<a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">
323
-						' . $item->transaction()->pretty_paid(). '
322
+					<a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">
323
+						' . $item->transaction()->pretty_paid().'
324 324
 					</a>
325
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
325
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
326 326
 			}
327 327
 		} else {
328 328
 			return '<span class="reg-pad-rght"></span>';
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
 	/**
337 337
 	 * 		column_TXN_total
338 338
 	*/
339
-	function column_TXN_total(EE_Registration $item){
339
+	function column_TXN_total(EE_Registration $item) {
340 340
 		$txn = $item->transaction();
341
-		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
342
-		if ( $item->get('REG_count') == 1 ) {
341
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
342
+		if ($item->get('REG_count') == 1) {
343 343
 			$line_total_obj = $txn->total_line_item();
344 344
 			$txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso');
345
-			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>';
345
+			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>';
346 346
 		} else {
347 347
 			return '<span class="reg-pad-rght"></span>';
348 348
 		}
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 {
@@ -123,8 +125,9 @@  discard block
 block discarded – undo
123 125
 			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
124 126
 			foreach ( $events as $evt ) {
125 127
 				//any registrations for this event?
126
-				if ( ! $evt->get_count_of_all_registrations() )
127
-					continue;
128
+				if ( ! $evt->get_count_of_all_registrations() ) {
129
+									continue;
130
+				}
128 131
 				$evts[] = array(
129 132
 					'id' => $evt->ID(),
130 133
 					'text' => $evt->get( 'EVT_name' ),
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/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.
core/libraries/messages/EE_Messages_Generator.lib.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this
465 465
 		//context is turned off) EXCEPT if we're previewing
466 466
 		if ( empty( $templates['to'][ $context ] )
467
-		     && ! $this->_generation_queue->get_queue()->is_preview()
468
-		     && ! $this->_current_messenger->allow_empty_to_field() ) {
467
+			 && ! $this->_generation_queue->get_queue()->is_preview()
468
+			 && ! $this->_current_messenger->allow_empty_to_field() ) {
469 469
 			//we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field.
470 470
 			return false;
471 471
 		}
@@ -583,9 +583,9 @@  discard block
 block discarded – undo
583 583
 		 * Check if there is any generation data, but only if this is not for a preview.
584 584
 		 */
585 585
 		if ( ! $this->_generation_queue->get_queue()->get_generation_data()
586
-		     && (
587
-			     ! $this->_generation_queue->get_queue()->is_preview()
588
-			     && $this->_generation_queue->get_queue()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
586
+			 && (
587
+				 ! $this->_generation_queue->get_queue()->is_preview()
588
+				 && $this->_generation_queue->get_queue()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
589 589
 		) {
590 590
 			$this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' );
591 591
 		}
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  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')) { exit('No direct script access allowed'); }
2 2
 
3 3
 /**
4 4
  * This class is used for generating EE_Message objects with given info.
@@ -116,17 +116,17 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return EE_Messages_Queue  The new queue for holding generated EE_Message objects.
118 118
 	 */
119
-	public function generate( $save = true ) {
119
+	public function generate($save = true) {
120 120
 		//iterate through the messages in the queue, generate, and add to new queue.
121 121
 		$this->_generation_queue->get_queue()->rewind();
122
-		while ( $this->_generation_queue->get_queue()->valid() ) {
122
+		while ($this->_generation_queue->get_queue()->valid()) {
123 123
 			//reset "current" properties
124 124
 			$this->_reset_current_properties();
125 125
 
126 126
 			/** @type EE_Message $msg */
127 127
 			$msg = $this->_generation_queue->get_queue()->current();
128 128
 
129
-			if ( $this->_verify() ) {
129
+			if ($this->_verify()) {
130 130
 				//let's get generating!
131 131
 				$this->_generate();
132 132
 			}
@@ -138,26 +138,26 @@  discard block
 block discarded – undo
138 138
 			$this->_generation_queue->get_queue()->next();
139 139
 			$next_msg = $this->_generation_queue->get_queue()->current();
140 140
 			//restore pointer to current item
141
-			$this->_generation_queue->get_queue()->set_current( $msg );
141
+			$this->_generation_queue->get_queue()->set_current($msg);
142 142
 
143 143
 			//if there are error messages then let's set the status and the error message.
144
-			if ( $this->_error_msg ) {
144
+			if ($this->_error_msg) {
145 145
 				//if the status is already debug only, then let's leave it at that.
146
-				if ( $msg->STS_ID() !== EEM_Message::status_debug_only ) {
147
-					$msg->set_STS_ID( EEM_Message::status_failed );
146
+				if ($msg->STS_ID() !== EEM_Message::status_debug_only) {
147
+					$msg->set_STS_ID(EEM_Message::status_failed);
148 148
 				}
149 149
 				$msg->set_error_message(
150
-					__( 'Message failed to generate for the following reasons: ' )
150
+					__('Message failed to generate for the following reasons: ')
151 151
 					. "\n"
152
-					. implode( "\n", $this->_error_msg )
152
+					. implode("\n", $this->_error_msg)
153 153
 				);
154
-				$msg->set_modified( time() );
154
+				$msg->set_modified(time());
155 155
 			} else {
156 156
 				//remove from db
157 157
 				$this->_generation_queue->get_queue()->delete();
158 158
 			}
159 159
 			//next item
160
-			$this->_generation_queue->get_queue()->set_current( $next_msg );
160
+			$this->_generation_queue->get_queue()->set_current($next_msg);
161 161
 		}
162 162
 
163 163
 		//generation queue is ALWAYS saved to record any errors in the generation process.
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		 * so a EE_Extra_Meta entry could be created and attached to the EE_Message.  In those cases the save flag is
171 171
 		 * irrelevant.
172 172
 		 */
173
-		if ( $save ) {
173
+		if ($save) {
174 174
 			$this->_ready_queue->save();
175 175
 		}
176 176
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	protected function _reset_current_properties() {
189 189
 		$this->_verified = false;
190 190
 		//make sure any _data value in the current message type is reset
191
-		if ( $this->_current_message_type instanceof EE_message_type ) {
191
+		if ($this->_current_message_type instanceof EE_message_type) {
192 192
 			$this->_current_message_type->reset_data();
193 193
 		}
194 194
 		$this->_current_messenger = $this->_current_message_type = $this->_current_data_handler = null;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	protected function _generate() {
209 209
 		//double check verification has run and that everything is ready to work with (saves us having to validate everything again).
210
-		if ( ! $this->_verified ) {
210
+		if ( ! $this->_verified) {
211 211
 			return false; //get out because we don't have a valid setup to work with.
212 212
 		}
213 213
 
@@ -217,34 +217,34 @@  discard block
 block discarded – undo
217 217
 				$this->_current_data_handler,
218 218
 				$this->_generation_queue->get_queue()->current()->context()
219 219
 			);
220
-		} catch ( EE_Error $e ) {
220
+		} catch (EE_Error $e) {
221 221
 			$this->_error_msg[] = $e->getMessage();
222 222
 			return false;
223 223
 		}
224 224
 
225 225
 
226 226
 		//if no addressees then get out because there is nothing to generation (possible bad data).
227
-		if ( ! $this->_valid_addressees( $addressees ) ) {
228
-			$this->_generation_queue->get_queue()->current()->set_STS_ID( EEM_Message::status_debug_only );
229
-			$this->_error_msg[] = __( 'This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects.  There were no attendees prepared by the data handler.
230
-			  Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso' );
227
+		if ( ! $this->_valid_addressees($addressees)) {
228
+			$this->_generation_queue->get_queue()->current()->set_STS_ID(EEM_Message::status_debug_only);
229
+			$this->_error_msg[] = __('This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects.  There were no attendees prepared by the data handler.
230
+			  Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso');
231 231
 			return false;
232 232
 		}
233 233
 
234 234
 		$message_template_group = $this->_get_message_template_group();
235 235
 
236 236
 		//in the unlikely event there is no EE_Message_Template_Group available, get out!
237
-		if ( ! $message_template_group instanceof EE_Message_Template_Group ) {
238
-			$this->_error_msg[] = __( 'Unable to get the Message Templates for the Message being generated.  No message template group accessible.', 'event_espresso' );
237
+		if ( ! $message_template_group instanceof EE_Message_Template_Group) {
238
+			$this->_error_msg[] = __('Unable to get the Message Templates for the Message being generated.  No message template group accessible.', 'event_espresso');
239 239
 			return false;
240 240
 		}
241 241
 
242 242
 		//get formatted templates for using to parse and setup EE_Message objects.
243
-		$templates = $this->_get_templates( $message_template_group );
243
+		$templates = $this->_get_templates($message_template_group);
244 244
 
245 245
 
246 246
 		//setup new EE_Message objects (and add to _ready_queue)
247
-		return $this->_assemble_messages( $addressees, $templates, $message_template_group );
247
+		return $this->_assemble_messages($addressees, $templates, $message_template_group);
248 248
 	}
249 249
 
250 250
 
@@ -262,17 +262,17 @@  discard block
 block discarded – undo
262 262
 		//so let's use that.
263 263
 		$GRP_ID = $this->_generation_queue->get_queue()->current()->GRP_ID();
264 264
 
265
-		if ( $GRP_ID ) {
265
+		if ($GRP_ID) {
266 266
 			//attempt to retrieve from repo first
267
-			$GRP = $this->_template_collection->get_by_ID( $GRP_ID );
268
-			if ( $GRP instanceof EE_Message_Template_Group ) {
269
-				return $GRP;  //got it!
267
+			$GRP = $this->_template_collection->get_by_ID($GRP_ID);
268
+			if ($GRP instanceof EE_Message_Template_Group) {
269
+				return $GRP; //got it!
270 270
 			}
271 271
 
272 272
 			//nope don't have it yet.  Get from DB then add to repo
273
-			$GRP = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
274
-			if ( $GRP instanceof EE_Message_Template_Group ) {
275
-				$this->_template_collection->add( $GRP );
273
+			$GRP = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
274
+			if ($GRP instanceof EE_Message_Template_Group) {
275
+				$this->_template_collection->add($GRP);
276 276
 			}
277 277
 			return $GRP;
278 278
 		}
@@ -291,41 +291,41 @@  discard block
 block discarded – undo
291 291
 		//in vanilla EE we're assuming there's only one event.
292 292
 		//However, if there are multiple events then we'll just use the default templates instead of different
293 293
 		// templates per event (which could create problems).
294
-		if ( count( $this->_current_data_handler->events ) === 1 ) {
295
-			foreach ( $this->_current_data_handler->events as $event ) {
294
+		if (count($this->_current_data_handler->events) === 1) {
295
+			foreach ($this->_current_data_handler->events as $event) {
296 296
 				$EVT_ID = $event['ID'];
297 297
 			}
298 298
 		}
299 299
 
300 300
 		//before going any further, let's see if its in the queue
301
-		$GRP = $this->_template_collection->get_by_key( $this->_template_collection->get_key( $this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID ) );
301
+		$GRP = $this->_template_collection->get_by_key($this->_template_collection->get_key($this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID));
302 302
 
303
-		if ( $GRP instanceof EE_Message_Template_Group ) {
303
+		if ($GRP instanceof EE_Message_Template_Group) {
304 304
 			return $GRP;
305 305
 		}
306 306
 
307 307
 		//nope still no GRP?
308 308
 		//first we get the global template in case it has an override set.
309
-		$global_template_qa = array_merge( array( 'MTP_is_global' => true ), $template_qa );
310
-		$global_GRP = EEM_Message_Template_Group::instance()->get_one( array( $global_template_qa ) );
309
+		$global_template_qa = array_merge(array('MTP_is_global' => true), $template_qa);
310
+		$global_GRP = EEM_Message_Template_Group::instance()->get_one(array($global_template_qa));
311 311
 
312 312
 		//if this is an override, then we just return it.
313
-		if ( $global_GRP instanceof EE_Message_Template_Group && $global_GRP->get( 'MTP_is_override' ) ) {
314
-			$this->_template_collection->add( $global_GRP, $EVT_ID );
313
+		if ($global_GRP instanceof EE_Message_Template_Group && $global_GRP->get('MTP_is_override')) {
314
+			$this->_template_collection->add($global_GRP, $EVT_ID);
315 315
 			return $global_GRP;
316 316
 		}
317 317
 
318 318
 		//STILL here? Okay that means we want to see if there is event specific group and if there is we return it,
319 319
 		//otherwise we return the global group we retrieved.
320
-		if ( $EVT_ID ) {
320
+		if ($EVT_ID) {
321 321
 			$template_qa['Event.EVT_ID'] = $EVT_ID;
322 322
 		}
323 323
 
324
-		$GRP = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) );
324
+		$GRP = EEM_Message_Template_Group::instance()->get_one(array($template_qa));
325 325
 		$GRP = $GRP instanceof EE_Message_Template_Group ? $GRP : $global_GRP;
326 326
 
327
-		if ( $GRP instanceof EE_Message_Template_Group ) {
328
-			$this->_template_collection->add( $GRP, $EVT_ID );
327
+		if ($GRP instanceof EE_Message_Template_Group) {
328
+			$this->_template_collection->add($GRP, $EVT_ID);
329 329
 			return $GRP;
330 330
 		}
331 331
 
@@ -349,15 +349,15 @@  discard block
 block discarded – undo
349 349
 	 *                      )
350 350
 	 *                  )
351 351
 	 */
352
-	protected function _get_templates( EE_Message_Template_Group $message_template_group ) {
352
+	protected function _get_templates(EE_Message_Template_Group $message_template_group) {
353 353
 		$templates = array();
354 354
 		$context_templates = $message_template_group->context_templates();
355
-		foreach ( $context_templates as $context => $template_fields ) {
356
-			foreach ( $template_fields as $template_field => $template_obj ) {
357
-				if ( ! $template_obj instanceof EE_Message_Template ) {
355
+		foreach ($context_templates as $context => $template_fields) {
356
+			foreach ($template_fields as $template_field => $template_obj) {
357
+				if ( ! $template_obj instanceof EE_Message_Template) {
358 358
 					continue;
359 359
 				}
360
-				$templates[ $template_field ][ $context ] = $template_obj->get( 'MTP_content' );
360
+				$templates[$template_field][$context] = $template_obj->get('MTP_content');
361 361
 			}
362 362
 		}
363 363
 		return $templates;
@@ -379,20 +379,20 @@  discard block
 block discarded – undo
379 379
 	 *                get added to the queue with EEM_Message::status_idle, unsuccessfully generated messages will get added
380 380
 	 *                to the queue as EEM_Message::status_failed.  Very rarely should "false" be returned from this method.
381 381
 	 */
382
-	protected function _assemble_messages( $addressees, $templates, EE_Message_Template_Group $message_template_group ) {
382
+	protected function _assemble_messages($addressees, $templates, EE_Message_Template_Group $message_template_group) {
383 383
 
384 384
 		//if templates are empty then get out because we can't generate anything.
385
-		if ( ! $templates ) {
385
+		if ( ! $templates) {
386 386
 			return false;
387 387
 		}
388 388
 
389 389
 		//We use this as the counter for generated messages because don't forget we may be executing this inside of a
390 390
 		//generation_queue.  So _ready_queue may have generated EE_Message objects already.
391 391
 		$generated_count = 0;
392
-		foreach ( $addressees as $context => $recipients ) {
393
-			foreach ( $recipients as $recipient ) {
394
-				$message = $this->_setup_message_object( $context, $recipient, $templates, $message_template_group );
395
-				if ( $message instanceof EE_Message ) {
392
+		foreach ($addressees as $context => $recipients) {
393
+			foreach ($recipients as $recipient) {
394
+				$message = $this->_setup_message_object($context, $recipient, $templates, $message_template_group);
395
+				if ($message instanceof EE_Message) {
396 396
 					$this->_ready_queue->add(
397 397
 						$message,
398 398
 						array(),
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	) {
428 428
 		//stuff we already know
429 429
 		$transaction_id = $recipient->txn instanceof EE_Transaction ? $recipient->txn->ID() : 0;
430
-		$transaction_id = empty( $transaction_id ) && $this->_current_data_handler->txn instanceof EE_Transaction
430
+		$transaction_id = empty($transaction_id) && $this->_current_data_handler->txn instanceof EE_Transaction
431 431
 			? $this->_current_data_handler->txn->ID()
432 432
 			: $transaction_id;
433 433
 		$message_fields = array(
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
 		//recipient id and type should be on the EE_Messages_Addressee object but if this is empty, let's try to grab the
442 442
 		//info from the att_obj found in the EE_Messages_Addressee object.
443
-		if ( empty( $recipient->recipient_id ) || empty( $recipient->recipient_type ) ) {
443
+		if (empty($recipient->recipient_id) || empty($recipient->recipient_type)) {
444 444
 			$message_fields['MSG_recipient_ID'] = $recipient->att_obj instanceof EE_Attendee
445 445
 				? $recipient->att_obj->ID()
446 446
 				: 0;
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 			$message_fields['MSG_recipient_ID'] = $recipient->recipient_id;
450 450
 			$message_fields['MSG_recipient_type'] = $recipient->recipient_type;
451 451
 		}
452
-		$message = EE_Message_Factory::create( $message_fields );
452
+		$message = EE_Message_Factory::create($message_fields);
453 453
 
454 454
 		//grab valid shortcodes for shortcode parser
455 455
 		$mt_shortcodes = $this->_current_message_type->get_valid_shortcodes();
@@ -457,43 +457,43 @@  discard block
 block discarded – undo
457 457
 
458 458
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this
459 459
 		//context is turned off) EXCEPT if we're previewing
460
-		if ( empty( $templates['to'][ $context ] )
460
+		if (empty($templates['to'][$context])
461 461
 		     && ! $this->_generation_queue->get_queue()->is_preview()
462
-		     && ! $this->_current_messenger->allow_empty_to_field() ) {
462
+		     && ! $this->_current_messenger->allow_empty_to_field()) {
463 463
 			//we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field.
464 464
 			return false;
465 465
 		}
466 466
 		$error_msg = array();
467
-		foreach ( $templates as $field => $field_context ) {
467
+		foreach ($templates as $field => $field_context) {
468 468
 			$error_msg = array();
469 469
 			//let's setup the valid shortcodes for the incoming context.
470
-			$valid_shortcodes = $mt_shortcodes[ $context ];
470
+			$valid_shortcodes = $mt_shortcodes[$context];
471 471
 			//merge in valid shortcodes for the field.
472
-			$shortcodes = isset($m_shortcodes[ $field ]) ? $m_shortcodes[ $field ] : $valid_shortcodes;
473
-			if ( isset( $templates[ $field ][ $context ] ) ) {
472
+			$shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes;
473
+			if (isset($templates[$field][$context])) {
474 474
 				//prefix field.
475
-				$column_name = 'MSG_' . $field;
475
+				$column_name = 'MSG_'.$field;
476 476
 				try {
477 477
 					$content = $this->_shortcode_parser->parse_message_template(
478
-						$templates[ $field ][ $context ],
478
+						$templates[$field][$context],
479 479
 						$recipient,
480 480
 						$shortcodes,
481 481
 						$this->_current_message_type,
482 482
 						$this->_current_messenger,
483 483
 						$message );
484
-					$message->set_field_or_extra_meta( $column_name, $content );
485
-				} catch ( EE_Error $e ) {
486
-					$error_msg[] = sprintf( __( 'There was a problem generating the content for the field %s: %s', 'event_espresso' ), $field, $e->getMessage() );
487
-					$message->set_STS_ID( EEM_Message::status_failed );
484
+					$message->set_field_or_extra_meta($column_name, $content);
485
+				} catch (EE_Error $e) {
486
+					$error_msg[] = sprintf(__('There was a problem generating the content for the field %s: %s', 'event_espresso'), $field, $e->getMessage());
487
+					$message->set_STS_ID(EEM_Message::status_failed);
488 488
 				}
489 489
 			}
490 490
 		}
491 491
 
492
-		if ( $message->STS_ID() === EEM_Message::status_failed ) {
493
-			$error_msg = __( 'There were problems generating this message:', 'event_espresso' ) . "\n" . implode( "\n", $error_msg );
494
-			$message->set_error_message( $error_msg );
492
+		if ($message->STS_ID() === EEM_Message::status_failed) {
493
+			$error_msg = __('There were problems generating this message:', 'event_espresso')."\n".implode("\n", $error_msg);
494
+			$message->set_error_message($error_msg);
495 495
 		} else {
496
-			$message->set_STS_ID( EEM_Message::status_idle );
496
+			$message->set_STS_ID(EEM_Message::status_idle);
497 497
 		}
498 498
 		return $message;
499 499
 	}
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 	 * @param array $addressees  Keys correspond to contexts for the message type and values are EE_Messages_Addressee[]
528 528
 	 * @return bool
529 529
 	 */
530
-	protected function _valid_addressees( $addressees ) {
531
-		if ( ! $addressees || ! is_array( $addressees ) ) {
530
+	protected function _valid_addressees($addressees) {
531
+		if ( ! $addressees || ! is_array($addressees)) {
532 532
 			return false;
533 533
 		}
534 534
 
535
-		foreach( $addressees as $addressee_array ) {
536
-			foreach ( $addressee_array as $addressee ) {
537
-				if ( ! $addressee instanceof EE_Messages_Addressee ) {
535
+		foreach ($addressees as $addressee_array) {
536
+			foreach ($addressee_array as $addressee) {
537
+				if ( ! $addressee instanceof EE_Messages_Addressee) {
538 538
 					return false;
539 539
 				}
540 540
 			}
@@ -555,19 +555,19 @@  discard block
 block discarded – undo
555 555
 	protected function _validate_messenger_and_message_type() {
556 556
 
557 557
 		//first are there any existing error messages?  If so then return.
558
-		if ( $this->_error_msg ) {
558
+		if ($this->_error_msg) {
559 559
 			return false;
560 560
 		}
561 561
 		/** @type EE_Message $message */
562 562
 		$message = $this->_generation_queue->get_queue()->current();
563 563
 		try {
564
-			$this->_current_messenger = $message->valid_messenger( true ) ? $message->messenger_object() : null;
565
-		} catch ( Exception $e ) {
564
+			$this->_current_messenger = $message->valid_messenger(true) ? $message->messenger_object() : null;
565
+		} catch (Exception $e) {
566 566
 			$this->_error_msg[] = $e->getMessage();
567 567
 		}
568 568
 		try {
569
-			$this->_current_message_type = $message->valid_message_type( true ) ? $message->message_type_object() : null;
570
-		} catch ( Exception $e ) {
569
+			$this->_current_message_type = $message->valid_message_type(true) ? $message->message_type_object() : null;
570
+		} catch (Exception $e) {
571 571
 			$this->_error_msg[] = $e->getMessage();
572 572
 		}
573 573
 
@@ -579,10 +579,10 @@  discard block
 block discarded – undo
579 579
 			     ! $this->_generation_queue->get_queue()->is_preview()
580 580
 			     && $this->_generation_queue->get_queue()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
581 581
 		) {
582
-			$this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' );
582
+			$this->_error_msg[] = __('There is no generation data for this message. Unable to generate.');
583 583
 		}
584 584
 
585
-		return empty( $this->_error_msg );
585
+		return empty($this->_error_msg);
586 586
 	}
587 587
 
588 588
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 
600 600
 		//First, are there any existing error messages?  If so, return because if there were errors elsewhere this can't
601 601
 		//be used anyways.
602
-		if ( $this->_error_msg ) {
602
+		if ($this->_error_msg) {
603 603
 			return false;
604 604
 		}
605 605
 
@@ -608,29 +608,29 @@  discard block
 block discarded – undo
608 608
 		/** @type EE_Messages_incoming_data $data_handler_class_name - well not really... just the class name actually */
609 609
 		$data_handler_class_name = $this->_generation_queue->get_queue()->get_data_handler()
610 610
 			? $this->_generation_queue->get_queue()->get_data_handler()
611
-			: 'EE_Messages_' .  $this->_current_message_type->get_data_handler( $generation_data ) . '_incoming_data';
611
+			: 'EE_Messages_'.$this->_current_message_type->get_data_handler($generation_data).'_incoming_data';
612 612
 
613 613
 		//If this EE_Message is for a preview, then let's switch out to the preview data handler.
614
-		if ( $this->_generation_queue->get_queue()->is_preview() ) {
615
-			$data_handler_class_name  = 'EE_Messages_Preview_incoming_data';
614
+		if ($this->_generation_queue->get_queue()->is_preview()) {
615
+			$data_handler_class_name = 'EE_Messages_Preview_incoming_data';
616 616
 		}
617 617
 
618 618
 		//First get the class name for the data handler (and also verifies it exists.
619
-		if ( ! class_exists( $data_handler_class_name ) ) {
619
+		if ( ! class_exists($data_handler_class_name)) {
620 620
 			$this->_error_msg[] = sprintf(
621
-				__( 'The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes.  Looking for %s.', 'event_espresso' ),
621
+				__('The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes.  Looking for %s.', 'event_espresso'),
622 622
 				$data_handler_class_name
623 623
 			);
624 624
 			return false;
625 625
 		}
626 626
 
627 627
 		//convert generation_data for data_handler_instantiation.
628
-		$generation_data = $data_handler_class_name::convert_data_from_persistent_storage( $generation_data );
628
+		$generation_data = $data_handler_class_name::convert_data_from_persistent_storage($generation_data);
629 629
 
630 630
 		//note, this may set error messages as well.
631
-		$this->_set_data_handler( $generation_data, $data_handler_class_name );
631
+		$this->_set_data_handler($generation_data, $data_handler_class_name);
632 632
 
633
-		return empty( $this->_error_msg );
633
+		return empty($this->_error_msg);
634 634
 	}
635 635
 
636 636
 
@@ -647,16 +647,16 @@  discard block
 block discarded – undo
647 647
 	 *
648 648
 	 * @return void.
649 649
 	 */
650
-	protected function _set_data_handler( $generating_data, $data_handler_class_name ) {
650
+	protected function _set_data_handler($generating_data, $data_handler_class_name) {
651 651
 		//valid classname for the data handler.  Now let's setup the key for the data handler repository to see if there
652 652
 		//is already a ready data handler in the repository.
653
-		$this->_current_data_handler = $this->_data_handler_collection->get_by_key( $this->_data_handler_collection->get_key( $data_handler_class_name, $generating_data ) );
654
-		if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data ) {
653
+		$this->_current_data_handler = $this->_data_handler_collection->get_by_key($this->_data_handler_collection->get_key($data_handler_class_name, $generating_data));
654
+		if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data) {
655 655
 			//no saved data_handler in the repo so let's set one up and add it to the repo.
656 656
 			try {
657
-				$this->_current_data_handler = new $data_handler_class_name( $generating_data );
658
-				$this->_data_handler_collection->add( $this->_current_data_handler, $generating_data );
659
-			} catch( EE_Error $e ) {
657
+				$this->_current_data_handler = new $data_handler_class_name($generating_data);
658
+				$this->_data_handler_collection->add($this->_current_data_handler, $generating_data);
659
+			} catch (EE_Error $e) {
660 660
 				$this->_error_msg[] = $e->get_error();
661 661
 			}
662 662
 		}
@@ -676,13 +676,13 @@  discard block
 block discarded – undo
676 676
 	 * @param bool                   $preview Indicate whether this is being used for a preview or not.
677 677
 	 * @return mixed Prepped data for persisting to the queue.  false is returned if unable to prep data.
678 678
 	 */
679
-	protected function _prepare_data_for_queue( EE_Message_To_Generate $message_to_generate, $preview ) {
679
+	protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) {
680 680
 		/** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */
681
-		$data_handler = $message_to_generate->get_data_handler_class_name( $preview );
682
-		if ( ! $message_to_generate->valid() ) {
681
+		$data_handler = $message_to_generate->get_data_handler_class_name($preview);
682
+		if ( ! $message_to_generate->valid()) {
683 683
 			return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid.
684 684
 		}
685
-		return $data_handler::convert_data_for_persistent_storage( $message_to_generate->data() );
685
+		return $data_handler::convert_data_for_persistent_storage($message_to_generate->data());
686 686
 	}
687 687
 
688 688
 
@@ -695,26 +695,26 @@  discard block
 block discarded – undo
695 695
 	 * @param EE_Message_To_Generate $message_to_generate
696 696
 	 * @param bool                   $test_send Whether this is just a test send or not.  Typically used for previews.
697 697
 	 */
698
-	public function create_and_add_message_to_queue( EE_Message_To_Generate $message_to_generate, $test_send = false ) {
698
+	public function create_and_add_message_to_queue(EE_Message_To_Generate $message_to_generate, $test_send = false) {
699 699
 		//prep data
700
-		$data = $this->_prepare_data_for_queue( $message_to_generate, $message_to_generate->preview() );
700
+		$data = $this->_prepare_data_for_queue($message_to_generate, $message_to_generate->preview());
701 701
 
702 702
 		$message = $message_to_generate->get_EE_Message();
703 703
 
704 704
 		//is there a GRP_ID in the request?
705
-		if ( $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID' ) ) {
706
-			$message->set_GRP_ID( $GRP_ID );
705
+		if ($GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID')) {
706
+			$message->set_GRP_ID($GRP_ID);
707 707
 		}
708 708
 
709
-		if ( $data === false ) {
710
-			$message->set_STS_ID( EEM_Message::status_failed );
711
-			$message->set_error_message( __( 'Unable to prepare data for persistence to the database.', 'event_espresso' ) );
709
+		if ($data === false) {
710
+			$message->set_STS_ID(EEM_Message::status_failed);
711
+			$message->set_error_message(__('Unable to prepare data for persistence to the database.', 'event_espresso'));
712 712
 		} else {
713 713
 			//make sure that the data handler is cached on the message as well
714 714
 			$data['data_handler_class_name'] = $message_to_generate->get_data_handler_class_name();
715 715
 		}
716 716
 
717
-		$this->_generation_queue->add( $message, $data, $message_to_generate->preview(), $test_send );
717
+		$this->_generation_queue->add($message, $data, $message_to_generate->preview(), $test_send);
718 718
 	}
719 719
 
720 720
 
Please login to merge, or discard this patch.