@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | * @param \EE_Admin_Page $admin_page |
58 | 58 | * @return EE_Registrations_List_Table |
59 | 59 | */ |
60 | - function __construct( $admin_page ){ |
|
60 | + function __construct($admin_page) { |
|
61 | 61 | |
62 | - if ( ! empty( $_GET['event_id'] ) ) { |
|
62 | + if ( ! empty($_GET['event_id'])) { |
|
63 | 63 | $extra_query_args = array(); |
64 | - foreach ( $admin_page->get_views() as $key => $view_details ) { |
|
65 | - $extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] ); |
|
64 | + foreach ($admin_page->get_views() as $key => $view_details) { |
|
65 | + $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']); |
|
66 | 66 | } |
67 | - $this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args ); |
|
67 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | parent::__construct($admin_page); |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | protected function _setup_data() { |
83 | - $this->_data = $this->_admin_page->get_registrations( $this->_per_page ); |
|
84 | - $this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE ); |
|
83 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
84 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -100,45 +100,45 @@ discard block |
||
100 | 100 | ); |
101 | 101 | |
102 | 102 | |
103 | - if ( isset( $_GET['event_id'] )) { |
|
103 | + if (isset($_GET['event_id'])) { |
|
104 | 104 | $this->_columns = array( |
105 | 105 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
106 | - '_REG_ID' => __( 'ID', 'event_espresso' ), |
|
107 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
106 | + '_REG_ID' => __('ID', 'event_espresso'), |
|
107 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
108 | 108 | 'ATT_email' => __('Email', 'event_espresso'), |
109 | - '_REG_date' => __( 'Reg Date', 'event_espresso' ), |
|
110 | - 'PRC_amount' => __( 'TKT Price', 'event_espresso' ), |
|
111 | - '_REG_final_price' => __( 'Final Price', 'event_espresso' ), |
|
112 | - 'TXN_total' => __( 'Total Txn', 'event_espresso' ), |
|
109 | + '_REG_date' => __('Reg Date', 'event_espresso'), |
|
110 | + 'PRC_amount' => __('TKT Price', 'event_espresso'), |
|
111 | + '_REG_final_price' => __('Final Price', 'event_espresso'), |
|
112 | + 'TXN_total' => __('Total Txn', 'event_espresso'), |
|
113 | 113 | 'TXN_paid' => __('Paid', 'event_espresso'), |
114 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
114 | + 'actions' => __('Actions', 'event_espresso') |
|
115 | 115 | ); |
116 | 116 | $this->_bottom_buttons = array( |
117 | 117 | 'report'=> array( |
118 | 118 | 'route' => 'registrations_report', |
119 | 119 | 'extra_request' => |
120 | 120 | array( |
121 | - 'EVT_ID'=> isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null, |
|
122 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
121 | + 'EVT_ID'=> isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null, |
|
122 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
123 | 123 | ), |
124 | 124 | ); |
125 | 125 | } else { |
126 | 126 | $this->_columns = array( |
127 | 127 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
128 | - '_REG_ID' => __( 'ID', 'event_espresso' ), |
|
129 | - 'ATT_fname' => __( 'Name', 'event_espresso' ), |
|
130 | - '_REG_date' => __( 'TXN Date', 'event_espresso' ), |
|
131 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
132 | - 'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ), |
|
133 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
134 | - '_REG_paid' => __( 'Paid', 'event_espresso' ), |
|
135 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
128 | + '_REG_ID' => __('ID', 'event_espresso'), |
|
129 | + 'ATT_fname' => __('Name', 'event_espresso'), |
|
130 | + '_REG_date' => __('TXN Date', 'event_espresso'), |
|
131 | + 'event_name' => __('Event', 'event_espresso'), |
|
132 | + 'DTT_EVT_start' => __('Event Date', 'event_espresso'), |
|
133 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
134 | + '_REG_paid' => __('Paid', 'event_espresso'), |
|
135 | + 'actions' => __('Actions', 'event_espresso') |
|
136 | 136 | ); |
137 | 137 | $this->_bottom_buttons = array( |
138 | 138 | 'report_all'=> array( |
139 | 139 | 'route' => 'registrations_report', |
140 | 140 | 'extra_request' => array( |
141 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ) ) |
|
141 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
142 | 142 | ), |
143 | 143 | ); |
144 | 144 | } |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | $this->_primary_column = '_REG_ID'; |
147 | 147 | |
148 | 148 | $this->_sortable_columns = array( |
149 | - '_REG_date' => array( '_REG_date' => TRUE ), //true means its already sorted |
|
150 | - 'ATT_fname' => array( 'ATT_fname' => FALSE ), |
|
151 | - 'event_name' => array( 'event_name' => FALSE ), |
|
152 | - 'DTT_EVT_start' => array( 'DTT_EVT_start' => FALSE ), |
|
153 | - '_REG_ID' => array( '_REG_ID' => FALSE ), |
|
149 | + '_REG_date' => array('_REG_date' => TRUE), //true means its already sorted |
|
150 | + 'ATT_fname' => array('ATT_fname' => FALSE), |
|
151 | + 'event_name' => array('event_name' => FALSE), |
|
152 | + 'DTT_EVT_start' => array('DTT_EVT_start' => FALSE), |
|
153 | + '_REG_ID' => array('_REG_ID' => FALSE), |
|
154 | 154 | ); |
155 | 155 | |
156 | 156 | $this->_hidden_columns = array(); |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | |
160 | 160 | |
161 | 161 | |
162 | - protected function _get_row_class( $item ) { |
|
163 | - $class = parent::_get_row_class( $item ); |
|
162 | + protected function _get_row_class($item) { |
|
163 | + $class = parent::_get_row_class($item); |
|
164 | 164 | //add status class |
165 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
166 | - if ( $this->_has_checkbox_column ) { |
|
165 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
166 | + if ($this->_has_checkbox_column) { |
|
167 | 167 | $class .= ' has-checkbox-column'; |
168 | 168 | } |
169 | 169 | return $class; |
@@ -176,15 +176,15 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param EE_Registration $registration |
178 | 178 | */ |
179 | - protected function _set_related_details( EE_Registration $registration ) { |
|
179 | + protected function _set_related_details(EE_Registration $registration) { |
|
180 | 180 | |
181 | - $transaction = $registration->get_first_related( 'Transaction' ); |
|
181 | + $transaction = $registration->get_first_related('Transaction'); |
|
182 | 182 | $status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code; |
183 | 183 | $this->_transaction_details = array( |
184 | 184 | 'transaction' => $transaction, |
185 | 185 | 'status' => $status, |
186 | 186 | 'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0, |
187 | - 'title_attr' => sprintf( __('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) ) |
|
187 | + 'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence')) |
|
188 | 188 | ); |
189 | 189 | |
190 | 190 | $event = $registration->event(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | 'event' => $event, |
194 | 194 | 'status' => $status, |
195 | 195 | 'id' => $event instanceof EE_Event ? $event->ID() : 0, |
196 | - 'title_attr' => sprintf( __('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) ) |
|
196 | + 'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence')) |
|
197 | 197 | ); |
198 | 198 | } |
199 | 199 | |
@@ -209,24 +209,24 @@ discard block |
||
209 | 209 | |
210 | 210 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
211 | 211 | |
212 | - $cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : ''; |
|
213 | - $cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
214 | - $reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : ''; |
|
212 | + $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
|
213 | + $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
214 | + $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : ''; |
|
215 | 215 | |
216 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category ); |
|
217 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category ); |
|
216 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
217 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
218 | 218 | |
219 | 219 | $status = array(); |
220 | - $status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') ); |
|
221 | - foreach ( $this->_status as $key => $value ) { |
|
222 | - $status[] = array( 'id' => $key, 'text' => $value ); |
|
220 | + $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso')); |
|
221 | + foreach ($this->_status as $key => $value) { |
|
222 | + $status[] = array('id' => $key, 'text' => $value); |
|
223 | 223 | } |
224 | - if ( $this->_view != 'incomplete' ) { |
|
225 | - $filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset( $this->_req_data['_reg_status'] ) ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) : '' ); |
|
224 | + if ($this->_view != 'incomplete') { |
|
225 | + $filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) : ''); |
|
226 | 226 | } |
227 | 227 | |
228 | - if ( isset( $this->_req_data['event_id'] ) ) { |
|
229 | - $filters[] = EEH_Form_Fields::hidden_input( 'event_id', $this->_req_data['event_id'], 'reg_event_id' ); |
|
228 | + if (isset($this->_req_data['event_id'])) { |
|
229 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | return $filters; |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | $this->_views['all']['count'] = $this->_total_registrations(); |
244 | 244 | $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
245 | 245 | $this->_views['today']['count'] = $this->_total_registrations_today(); |
246 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) { |
|
247 | - $this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' ); |
|
248 | - $this->_views['trash']['count'] = $this->_total_registrations( 'trash' ); |
|
246 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) { |
|
247 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
248 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -257,23 +257,23 @@ discard block |
||
257 | 257 | * @param string $view |
258 | 258 | * @return int |
259 | 259 | */ |
260 | - protected function _total_registrations( $view = '' ){ |
|
260 | + protected function _total_registrations($view = '') { |
|
261 | 261 | $_where = array(); |
262 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
263 | - if( $EVT_ID ) { |
|
262 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
263 | + if ($EVT_ID) { |
|
264 | 264 | $_where['EVT_ID'] = $EVT_ID; |
265 | 265 | } |
266 | - switch ( $view ) { |
|
266 | + switch ($view) { |
|
267 | 267 | case 'trash' : |
268 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
268 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
269 | 269 | break; |
270 | 270 | case 'incomplete' : |
271 | 271 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
272 | 272 | break; |
273 | 273 | default : |
274 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
274 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
275 | 275 | } |
276 | - return EEM_Registration::instance()->count( array( $_where )); |
|
276 | + return EEM_Registration::instance()->count(array($_where)); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -283,24 +283,24 @@ discard block |
||
283 | 283 | * @access protected |
284 | 284 | * @return int |
285 | 285 | */ |
286 | - protected function _total_registrations_this_month(){ |
|
287 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
288 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
286 | + protected function _total_registrations_this_month() { |
|
287 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
288 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
289 | 289 | $this_year_r = date('Y', current_time('timestamp')); |
290 | 290 | $time_start = ' 00:00:00'; |
291 | 291 | $time_end = ' 23:59:59'; |
292 | 292 | $this_month_r = date('m', current_time('timestamp')); |
293 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
293 | + $days_this_month = date('t', current_time('timestamp')); |
|
294 | 294 | //setup date query. |
295 | - $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ); |
|
296 | - $end_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ); |
|
297 | - $_where['REG_date']= array('BETWEEN', |
|
295 | + $beginning_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'); |
|
296 | + $end_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s'); |
|
297 | + $_where['REG_date'] = array('BETWEEN', |
|
298 | 298 | array( |
299 | 299 | $beginning_string, |
300 | 300 | $end_string |
301 | 301 | )); |
302 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
303 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
302 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
303 | + return EEM_Registration::instance()->count(array($_where)); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -310,20 +310,20 @@ discard block |
||
310 | 310 | * @access protected |
311 | 311 | * @return int |
312 | 312 | */ |
313 | - protected function _total_registrations_today(){ |
|
313 | + protected function _total_registrations_today() { |
|
314 | 314 | |
315 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
316 | - $_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array(); |
|
315 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
316 | + $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array(); |
|
317 | 317 | $current_date = date('Y-m-d', current_time('timestamp')); |
318 | 318 | $time_start = ' 00:00:00'; |
319 | 319 | $time_end = ' 23:59:59'; |
320 | - $_where['REG_date']= array('BETWEEN', |
|
320 | + $_where['REG_date'] = array('BETWEEN', |
|
321 | 321 | array( |
322 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ), |
|
323 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' ) |
|
322 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'), |
|
323 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s') |
|
324 | 324 | )); |
325 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
326 | - return EEM_Registration::instance()->count(array( $_where ) ); |
|
325 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
326 | + return EEM_Registration::instance()->count(array($_where)); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | * @param \EE_Registration $item |
336 | 336 | * @return string |
337 | 337 | */ |
338 | - function column_cb($item){ |
|
338 | + function column_cb($item) { |
|
339 | 339 | /** checkbox/lock **/ |
340 | - $transaction = $item->get_first_related( 'Transaction' ); |
|
341 | - $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0; |
|
342 | - return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ); |
|
340 | + $transaction = $item->get_first_related('Transaction'); |
|
341 | + $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0; |
|
342 | + return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()).'<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | * @param \EE_Registration $item |
352 | 352 | * @return string |
353 | 353 | */ |
354 | - function column__REG_ID(EE_Registration $item){ |
|
354 | + function column__REG_ID(EE_Registration $item) { |
|
355 | 355 | $attendee = $item->attendee(); |
356 | 356 | $content = $item->ID(); |
357 | 357 | $content .= '<div class="show-on-mobile-view-only">'; |
358 | 358 | $content .= '<br>'; |
359 | 359 | $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
360 | - $content .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
361 | - $content .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
360 | + $content .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
361 | + $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
362 | 362 | $content .= '</div>'; |
363 | 363 | return $content; |
364 | 364 | } |
@@ -372,12 +372,12 @@ discard block |
||
372 | 372 | * @param \EE_Registration $item |
373 | 373 | * @return string |
374 | 374 | */ |
375 | - function column__REG_date(EE_Registration $item){ |
|
375 | + function column__REG_date(EE_Registration $item) { |
|
376 | 376 | $this->_set_related_details($item); |
377 | 377 | //Build row actions |
378 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
379 | - $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' ); |
|
380 | - $view_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $this->_transaction_details['status'], false, 'sentence' ) . '</span>'; |
|
378 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL); |
|
379 | + $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date'); |
|
380 | + $view_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence').'</span>'; |
|
381 | 381 | return $view_link; |
382 | 382 | } |
383 | 383 | |
@@ -390,18 +390,18 @@ discard block |
||
390 | 390 | * @param \EE_Registration $item |
391 | 391 | * @return string |
392 | 392 | */ |
393 | - function column_event_name(EE_Registration $item){ |
|
394 | - $this->_set_related_details( $item ); |
|
393 | + function column_event_name(EE_Registration $item) { |
|
394 | + $this->_set_related_details($item); |
|
395 | 395 | // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62 |
396 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL ); |
|
396 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL); |
|
397 | 397 | $event_name = $item->event_name(); |
398 | 398 | $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso'); |
399 | - $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ; |
|
399 | + $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'); |
|
400 | 400 | |
401 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL ); |
|
402 | - $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' . __( 'View Registrations', 'event_espresso' ) . '</a>'; |
|
401 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL); |
|
402 | + $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>'; |
|
403 | 403 | |
404 | - return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) ); |
|
404 | + return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
@@ -413,18 +413,18 @@ discard block |
||
413 | 413 | * @param \EE_Registration $item |
414 | 414 | * @return string |
415 | 415 | */ |
416 | - function column_DTT_EVT_start(EE_Registration $item){ |
|
416 | + function column_DTT_EVT_start(EE_Registration $item) { |
|
417 | 417 | $datetime_strings = array(); |
418 | - $ticket = $item->ticket( TRUE ); |
|
419 | - if ( $ticket instanceof EE_Ticket ) { |
|
418 | + $ticket = $item->ticket(TRUE); |
|
419 | + if ($ticket instanceof EE_Ticket) { |
|
420 | 420 | $remove_defaults = array('default_where_conditions' => 'none'); |
421 | 421 | $datetimes = $ticket->datetimes($remove_defaults); |
422 | - foreach($datetimes as $datetime){ |
|
423 | - $datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' ); |
|
422 | + foreach ($datetimes as $datetime) { |
|
423 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start'); |
|
424 | 424 | } |
425 | - return implode("<br />",$datetime_strings); |
|
425 | + return implode("<br />", $datetime_strings); |
|
426 | 426 | } else { |
427 | - return __( 'There is no ticket on this registration', 'event_espresso' ); |
|
427 | + return __('There is no ticket on this registration', 'event_espresso'); |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
@@ -437,45 +437,45 @@ discard block |
||
437 | 437 | * @param \EE_Registration $item |
438 | 438 | * @return string |
439 | 439 | */ |
440 | - function column_ATT_fname(EE_Registration $item){ |
|
440 | + function column_ATT_fname(EE_Registration $item) { |
|
441 | 441 | $attendee = $item->attendee(); |
442 | 442 | |
443 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
443 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
444 | 444 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
445 | - $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name; |
|
445 | + $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name; |
|
446 | 446 | $link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; |
447 | 447 | |
448 | 448 | $t = $item->get_first_related('Transaction'); |
449 | 449 | $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; |
450 | 450 | |
451 | 451 | //append group count to name |
452 | - $link .= ' ' . sprintf(__( '(%1$s / %2$s)', 'event_espresso' ), $item->count(), $item->group_size()); |
|
452 | + $link .= ' '.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
453 | 453 | |
454 | 454 | //append reg_code |
455 | - $link .= '<br>' . sprintf( __( 'Reg Code: %s', 'event_espresso' ), $item->get('REG_code') ); |
|
455 | + $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); |
|
456 | 456 | |
457 | 457 | //reg status text for accessibility |
458 | - $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
458 | + $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
459 | 459 | |
460 | 460 | //trash/restore/delete actions |
461 | 461 | $actions = array(); |
462 | - if ( $this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) { |
|
463 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
464 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>'; |
|
465 | - } elseif ( $this->_view == 'trash' ) { |
|
462 | + if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { |
|
463 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
464 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
465 | + } elseif ($this->_view == 'trash') { |
|
466 | 466 | // restore registration link |
467 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) { |
|
468 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
469 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
467 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { |
|
468 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
469 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
470 | 470 | } |
471 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) { |
|
472 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
471 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { |
|
472 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
473 | 473 | |
474 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
474 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
478 | - return sprintf('%1$s %2$s', $link, $this->row_actions($actions) ); |
|
478 | + return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * @param \EE_Registration $item |
488 | 488 | * @return string |
489 | 489 | */ |
490 | - function column_ATT_email( EE_Registration $item ) { |
|
490 | + function column_ATT_email(EE_Registration $item) { |
|
491 | 491 | $attendee = $item->get_first_related('Attendee'); |
492 | 492 | return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email(); |
493 | 493 | } |
@@ -501,8 +501,8 @@ discard block |
||
501 | 501 | * @param \EE_Registration $item |
502 | 502 | * @return string |
503 | 503 | */ |
504 | - function column__REG_count(EE_Registration $item){ |
|
505 | - return sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size()); |
|
504 | + function column__REG_count(EE_Registration $item) { |
|
505 | + return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size()); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | |
@@ -514,16 +514,16 @@ discard block |
||
514 | 514 | * @param \EE_Registration $item |
515 | 515 | * @return string |
516 | 516 | */ |
517 | - function column_PRC_amount(EE_Registration $item){ |
|
517 | + function column_PRC_amount(EE_Registration $item) { |
|
518 | 518 | $ticket = $item->ticket(); |
519 | 519 | |
520 | - $content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : ''; |
|
520 | + $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : ''; |
|
521 | 521 | |
522 | - if ( $item->final_price() > 0 ) { |
|
523 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
522 | + if ($item->final_price() > 0) { |
|
523 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
524 | 524 | } else { |
525 | 525 | // free event |
526 | - $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
526 | + $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>'; |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | return $content; |
@@ -539,11 +539,11 @@ discard block |
||
539 | 539 | * @param \EE_Registration $item |
540 | 540 | * @return string |
541 | 541 | */ |
542 | - function column__REG_final_price(EE_Registration $item){ |
|
542 | + function column__REG_final_price(EE_Registration $item) { |
|
543 | 543 | $ticket = $item->ticket(); |
544 | - $content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />'; |
|
544 | + $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />'; |
|
545 | 545 | |
546 | - $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>'; |
|
546 | + $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>'; |
|
547 | 547 | return $content; |
548 | 548 | |
549 | 549 | } |
@@ -557,13 +557,13 @@ discard block |
||
557 | 557 | * @param \EE_Registration $item |
558 | 558 | * @return string |
559 | 559 | */ |
560 | - function column__REG_paid(EE_Registration $item){ |
|
560 | + function column__REG_paid(EE_Registration $item) { |
|
561 | 561 | $payment_method = $item->payment_method(); |
562 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
562 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
563 | 563 | |
564 | - $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>'; |
|
565 | - if ( $item->paid() > 0 ) { |
|
566 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
564 | + $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>'; |
|
565 | + if ($item->paid() > 0) { |
|
566 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
567 | 567 | } |
568 | 568 | return $content; |
569 | 569 | } |
@@ -577,11 +577,11 @@ discard block |
||
577 | 577 | * @param \EE_Registration $item |
578 | 578 | * @return string |
579 | 579 | */ |
580 | - function column_TXN_total(EE_Registration $item){ |
|
581 | - if($item->transaction()){ |
|
582 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
583 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>'; |
|
584 | - }else{ |
|
580 | + function column_TXN_total(EE_Registration $item) { |
|
581 | + if ($item->transaction()) { |
|
582 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
583 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>'; |
|
584 | + } else { |
|
585 | 585 | return __("None", "event_espresso"); |
586 | 586 | } |
587 | 587 | } |
@@ -595,15 +595,15 @@ discard block |
||
595 | 595 | * @param \EE_Registration $item |
596 | 596 | * @return string |
597 | 597 | */ |
598 | - function column_TXN_paid(EE_Registration $item){ |
|
598 | + function column_TXN_paid(EE_Registration $item) { |
|
599 | 599 | |
600 | - if ( $item->count() == 1 ) { |
|
600 | + if ($item->count() == 1) { |
|
601 | 601 | $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance(); |
602 | - if ( $transaction->paid() >= $transaction->total() ) { |
|
602 | + if ($transaction->paid() >= $transaction->total()) { |
|
603 | 603 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
604 | 604 | } else { |
605 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
606 | - return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
605 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
606 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
607 | 607 | } |
608 | 608 | } |
609 | 609 | |
@@ -623,44 +623,44 @@ discard block |
||
623 | 623 | function column_actions(EE_Registration $item) { |
624 | 624 | $attendee = $item->attendee(); |
625 | 625 | $ticket = $item->ticket(); |
626 | - $this->_set_related_details( $item ); |
|
626 | + $this->_set_related_details($item); |
|
627 | 627 | |
628 | 628 | //Build row actions |
629 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
630 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL ); |
|
629 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
630 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL); |
|
631 | 631 | |
632 | 632 | // page=attendees&event_admin_reports=resend_email®istration_id=43653465634&event_id=2&form_action=resend_email |
633 | 633 | //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID ); |
634 | - $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true ); |
|
634 | + $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true); |
|
635 | 635 | |
636 | 636 | |
637 | 637 | //Build row actions |
638 | - $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? ' |
|
638 | + $view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? ' |
|
639 | 639 | <li> |
640 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
640 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
641 | 641 | <div class="dashicons dashicons-clipboard"></div> |
642 | 642 | </a> |
643 | 643 | </li>' : ''; |
644 | 644 | |
645 | - $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) && $attendee instanceof EE_Attendee ?' |
|
645 | + $edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? ' |
|
646 | 646 | <li> |
647 | - <a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text"> |
|
647 | + <a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text"> |
|
648 | 648 | <div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div> |
649 | 649 | </a> |
650 | 650 | </li>' : ''; |
651 | 651 | |
652 | - $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? ' |
|
652 | + $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? ' |
|
653 | 653 | <li> |
654 | - <a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
654 | + <a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text"> |
|
655 | 655 | <div class="dashicons dashicons-email-alt"></div> |
656 | 656 | </a> |
657 | 657 | </li>' : ''; |
658 | 658 | |
659 | 659 | // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb |
660 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL ); |
|
661 | - $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? ' |
|
660 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL); |
|
661 | + $view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? ' |
|
662 | 662 | <li> |
663 | - <a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_txn_lnk_url.'" title="' . $this->_transaction_details['title_attr'] . '" class="tiny-text"> |
|
663 | + <a class="ee-status-color-' . $this->_transaction_details['status'].'" href="'.$view_txn_lnk_url.'" title="'.$this->_transaction_details['title_attr'].'" class="tiny-text"> |
|
664 | 664 | <div class="dashicons dashicons-cart"></div> |
665 | 665 | </a> |
666 | 666 | </li>' : ''; |
@@ -668,10 +668,10 @@ discard block |
||
668 | 668 | //invoice link |
669 | 669 | $dl_invoice_lnk_url = $item->invoice_url(); |
670 | 670 | //only show invoice link if message type is active. |
671 | - if ( $item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
671 | + if ($item->is_primary_registrant() && $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
672 | 672 | $dl_invoice_lnk = ' |
673 | 673 | <li> |
674 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
674 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
675 | 675 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
676 | 676 | </a> |
677 | 677 | </li>'; |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | $dl_invoice_lnk = ''; |
680 | 680 | } |
681 | 681 | |
682 | - return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk . $dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul' ); |
|
682 | + return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk.$dl_invoice_lnk, $item, 'ul', 'reg-overview-actions-ul'); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | } |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Registrations_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
61 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' )); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | + add_action('wp_loaded', array($this, 'wp_loaded')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | public function wp_loaded() { |
67 | 67 | // when adding a new registration... |
68 | - if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) { |
|
68 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') { |
|
69 | 69 | EE_System::do_not_cache(); |
70 | 70 | if ( |
71 | - ! isset( $this->_req_data[ 'processing_registration' ] ) |
|
72 | - || absint( $this->_req_data[ 'processing_registration' ] ) !== 1 |
|
71 | + ! isset($this->_req_data['processing_registration']) |
|
72 | + || absint($this->_req_data['processing_registration']) !== 1 |
|
73 | 73 | ) { |
74 | 74 | // and it's NOT the attendee information reg step |
75 | 75 | // force cookie expiration by setting time to last week |
76 | - setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' ); |
|
76 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
77 | 77 | // and update the global |
78 | - $_COOKIE[ 'ee_registration_added' ] = 0; |
|
78 | + $_COOKIE['ee_registration_added'] = 0; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | 'trash' => 'post.php' |
110 | 110 | ); |
111 | 111 | |
112 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
112 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
113 | 113 | //add filters so that the comment urls don't take users to a confusing 404 page |
114 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
114 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - public function clear_comment_link( $link, $comment, $args ) { |
|
118 | + public function clear_comment_link($link, $comment, $args) { |
|
119 | 119 | //gotta make sure this only happens on this route |
120 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
121 | - if ( $post_type == 'espresso_attendees' ) |
|
120 | + $post_type = get_post_type($comment->comment_post_ID); |
|
121 | + if ($post_type == 'espresso_attendees') |
|
122 | 122 | return '#commentsdiv'; |
123 | 123 | return $link; |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function _ajax_hooks() { |
128 | 128 | //todo: all hooks for registrations ajax goes in here |
129 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
129 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
142 | 142 | 'edit' => __('Edit Contact', 'event_espresso'), |
143 | 143 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
144 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
145 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
144 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
145 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
146 | 146 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
147 | 147 | ), |
148 | 148 | 'publishbox' => array( |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
172 | 172 | |
173 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
173 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
176 | 176 | |
177 | 177 | $this->_page_routes = array( |
178 | 178 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | 'restore_registrations' => array( |
207 | 207 | 'func' => '_trash_or_restore_registrations', |
208 | - 'args' => array( 'trash' => FALSE ), |
|
208 | + 'args' => array('trash' => FALSE), |
|
209 | 209 | 'noheader' => TRUE, |
210 | 210 | 'capability' => 'ee_delete_registrations' |
211 | 211 | ), |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | 440 | ), |
441 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
441 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
444 | 444 | 'require_nonce' => FALSE |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | 'nav' => array( |
449 | 449 | 'label' => __('REG Details', 'event_espresso'), |
450 | 450 | 'order' => 15, |
451 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
451 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
452 | 452 | 'persistent' => FALSE |
453 | 453 | ), |
454 | 454 | 'help_tabs' => array( |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | 'filename' => 'registrations_details_registrant_details' |
470 | 470 | ) |
471 | 471 | ), |
472 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
473 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
472 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
473 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
474 | 474 | 'require_nonce' => FALSE |
475 | 475 | ), |
476 | 476 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | 'order' => 15, |
495 | 495 | 'persistent' => FALSE |
496 | 496 | ), |
497 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
497 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
498 | 498 | 'require_nonce' => FALSE |
499 | 499 | ), |
500 | 500 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | 'label' => __('Edit Contact', 'event_espresso'), |
504 | 504 | 'order' => 15, |
505 | 505 | 'persistent' => FALSE, |
506 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
506 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
507 | 507 | ), |
508 | 508 | 'metaboxes' => array('attendee_editor_metaboxes'), |
509 | 509 | 'require_nonce' => FALSE |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | 'filename' => 'registrations_contact_list_other' |
534 | 534 | ) |
535 | 535 | ), |
536 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
536 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
537 | 537 | 'metaboxes' => array(), |
538 | 538 | 'require_nonce' => FALSE |
539 | 539 | ), |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | protected function _add_screen_options() {} |
553 | 553 | protected function _add_feature_pointers() {} |
554 | 554 | public function admin_init() { |
555 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
555 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
556 | 556 | } |
557 | 557 | public function admin_notices() {} |
558 | 558 | public function admin_footer_scripts() {} |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @return void |
571 | 571 | */ |
572 | 572 | private function _get_registration_status_array() { |
573 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
573 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | public function load_scripts_styles() { |
594 | 594 | //style |
595 | 595 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
596 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
596 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
597 | 597 | wp_enqueue_style('espresso_reg'); |
598 | 598 | |
599 | 599 | //script |
600 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
600 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
601 | 601 | wp_enqueue_script('espresso_reg'); |
602 | 602 | } |
603 | 603 | |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | public function load_scripts_styles_edit_attendee() { |
607 | 607 | //stuff to only show up on our attendee edit details page. |
608 | 608 | $attendee_details_translations = array( |
609 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
609 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
610 | 610 | ); |
611 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
611 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
612 | 612 | wp_enqueue_script('jquery-validate'); |
613 | 613 | } |
614 | 614 | |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | //styles |
618 | 618 | wp_enqueue_style('espresso-ui-theme'); |
619 | 619 | //scripts |
620 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
621 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
620 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
621 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | public function load_scripts_styles_contact_list() { |
630 | 630 | wp_deregister_style('espresso_reg'); |
631 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
631 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
632 | 632 | wp_enqueue_style('espresso_att'); |
633 | 633 | } |
634 | 634 | |
@@ -637,9 +637,9 @@ discard block |
||
637 | 637 | |
638 | 638 | |
639 | 639 | public function load_scripts_styles_new_registration() { |
640 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
640 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
641 | 641 | wp_enqueue_script('ee-spco-for-admin'); |
642 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
642 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
643 | 643 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
644 | 644 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
645 | 645 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -678,23 +678,23 @@ discard block |
||
678 | 678 | |
679 | 679 | /** setup reg status bulk actions **/ |
680 | 680 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
681 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
681 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
682 | 682 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
683 | 683 | } |
684 | 684 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
685 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
685 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
686 | 686 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
687 | 687 | } |
688 | 688 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
689 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
689 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
690 | 690 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
691 | 691 | } |
692 | 692 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
693 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
693 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
694 | 694 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
695 | 695 | } |
696 | 696 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
697 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
697 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
698 | 698 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
699 | 699 | } |
700 | 700 | |
@@ -703,29 +703,29 @@ discard block |
||
703 | 703 | 'slug' => 'all', |
704 | 704 | 'label' => __('View All Registrations', 'event_espresso'), |
705 | 705 | 'count' => 0, |
706 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
706 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
707 | 707 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
708 | - ) ) |
|
708 | + )) |
|
709 | 709 | ), |
710 | 710 | 'month' => array( |
711 | 711 | 'slug' => 'month', |
712 | 712 | 'label' => __('This Month', 'event_espresso'), |
713 | 713 | 'count' => 0, |
714 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
714 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
715 | 715 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
716 | 716 | )) |
717 | 717 | ), |
718 | 718 | 'today' => array( |
719 | 719 | 'slug' => 'today', |
720 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
720 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
721 | 721 | 'count' => 0, |
722 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
722 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
723 | 723 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
724 | 724 | )) |
725 | 725 | ) |
726 | 726 | ); |
727 | 727 | |
728 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
728 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
729 | 729 | $this->_views['incomplete'] = array( |
730 | 730 | 'slug' => 'incomplete', |
731 | 731 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | ) |
762 | 762 | ); |
763 | 763 | |
764 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
764 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
765 | 765 | $this->_views['trash'] = array( |
766 | 766 | 'slug' => 'trash', |
767 | 767 | 'label' => __('Trash', 'event_espresso'), |
@@ -800,42 +800,42 @@ discard block |
||
800 | 800 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
801 | 801 | ), |
802 | 802 | ); |
803 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
803 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
804 | 804 | $fc_items['resend_registration'] = array( |
805 | 805 | 'class' => 'dashicons dashicons-email-alt', |
806 | 806 | 'desc' => __('Resend Registration Details', 'event_espresso') |
807 | 807 | ); |
808 | 808 | } else { |
809 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
809 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | $sc_items = array( |
813 | 813 | 'approved_status' => array( |
814 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
815 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
814 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
815 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
816 | 816 | ), |
817 | 817 | 'pending_status' => array( |
818 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
819 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
818 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
819 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
820 | 820 | ), |
821 | 821 | 'incomplete_status' => array( |
822 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
823 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
822 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
823 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
824 | 824 | ), |
825 | 825 | 'not_approved' => array( |
826 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
827 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
826 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
827 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
828 | 828 | ), |
829 | 829 | 'declined_status' => array( |
830 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
831 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
830 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
831 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
832 | 832 | ), |
833 | 833 | 'cancelled_status' => array( |
834 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
835 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
834 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
835 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
836 | 836 | ) |
837 | 837 | ); |
838 | - return array_merge( $fc_items, $sc_items ); |
|
838 | + return array_merge($fc_items, $sc_items); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | |
@@ -848,15 +848,15 @@ discard block |
||
848 | 848 | |
849 | 849 | |
850 | 850 | protected function _registrations_overview_list_table() { |
851 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
852 | - if ( $EVT_ID ) { |
|
853 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
854 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
851 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
852 | + if ($EVT_ID) { |
|
853 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
854 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
855 | 855 | } |
856 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
857 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
856 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
857 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
858 | 858 | } |
859 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
859 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
860 | 860 | $this->display_admin_list_table_page_with_no_sidebar(); |
861 | 861 | } |
862 | 862 | |
@@ -871,19 +871,19 @@ discard block |
||
871 | 871 | */ |
872 | 872 | private function _set_registration_object() { |
873 | 873 | //get out if we've already set the object |
874 | - if ( is_object( $this->_registration )) { |
|
874 | + if (is_object($this->_registration)) { |
|
875 | 875 | return TRUE; |
876 | 876 | } |
877 | 877 | |
878 | 878 | $REG = EEM_Registration::instance(); |
879 | 879 | |
880 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
880 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
881 | 881 | |
882 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
882 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
883 | 883 | return TRUE; |
884 | 884 | else { |
885 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
886 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
885 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
886 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
887 | 887 | $this->_registration = NULL; |
888 | 888 | return FALSE; |
889 | 889 | } |
@@ -901,24 +901,24 @@ discard block |
||
901 | 901 | * @throws \EE_Error |
902 | 902 | * @return mixed (int|array) int = count || array of registration objects |
903 | 903 | */ |
904 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
905 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
906 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
907 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
908 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
909 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
910 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
904 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
905 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
906 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
907 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
908 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
909 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
910 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
911 | 911 | $start_date = FALSE; |
912 | 912 | $end_date = FALSE; |
913 | 913 | $_where = array(); |
914 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
915 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
914 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
915 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
916 | 916 | |
917 | 917 | //set orderby |
918 | 918 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
919 | 919 | |
920 | 920 | |
921 | - switch ( $this->_req_data['orderby'] ) { |
|
921 | + switch ($this->_req_data['orderby']) { |
|
922 | 922 | case '_REG_ID': |
923 | 923 | $orderby = 'REG_ID'; |
924 | 924 | break; |
@@ -938,26 +938,26 @@ discard block |
||
938 | 938 | $orderby = 'REG_date'; |
939 | 939 | } |
940 | 940 | |
941 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
942 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
943 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
941 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
942 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
943 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
944 | 944 | |
945 | 945 | |
946 | - $offset = ($current_page-1)*$per_page; |
|
947 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
946 | + $offset = ($current_page - 1) * $per_page; |
|
947 | + $limit = $count ? NULL : array($offset, $per_page); |
|
948 | 948 | |
949 | - if($EVT_ID){ |
|
950 | - $_where['EVT_ID']=$EVT_ID; |
|
949 | + if ($EVT_ID) { |
|
950 | + $_where['EVT_ID'] = $EVT_ID; |
|
951 | 951 | } |
952 | - if($CAT_ID){ |
|
952 | + if ($CAT_ID) { |
|
953 | 953 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
954 | 954 | } |
955 | - if ( $incomplete ) { |
|
955 | + if ($incomplete) { |
|
956 | 956 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
957 | 957 | } else if ( ! $trash) { |
958 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
958 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
959 | 959 | } |
960 | - if($reg_status){ |
|
960 | + if ($reg_status) { |
|
961 | 961 | $_where['STS_ID'] = $reg_status; |
962 | 962 | } |
963 | 963 | |
@@ -969,105 +969,105 @@ discard block |
||
969 | 969 | $time_start = ' 00:00:00'; |
970 | 970 | $time_end = ' 23:59:59'; |
971 | 971 | |
972 | - if($today_a || $today ){ |
|
972 | + if ($today_a || $today) { |
|
973 | 973 | $curdate = date('Y-m-d', current_time('timestamp')); |
974 | - $_where['REG_date']= array('BETWEEN', |
|
974 | + $_where['REG_date'] = array('BETWEEN', |
|
975 | 975 | array( |
976 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
977 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
976 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
977 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
978 | 978 | )); |
979 | - }elseif($this_month_a || $this_month){ |
|
979 | + }elseif ($this_month_a || $this_month) { |
|
980 | 980 | $this_month_r = date('m', current_time('timestamp')); |
981 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
982 | - $_where['REG_date']= array('BETWEEN', |
|
981 | + $days_this_month = date('t', current_time('timestamp')); |
|
982 | + $_where['REG_date'] = array('BETWEEN', |
|
983 | 983 | array( |
984 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
985 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
984 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
985 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
986 | 986 | )); |
987 | - }elseif($month_range){ |
|
987 | + }elseif ($month_range) { |
|
988 | 988 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
989 | - $month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : ''; |
|
990 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
991 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
992 | - $_where['REG_date']= array('BETWEEN', |
|
993 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
994 | - }elseif($start_date && $end_date){ |
|
989 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : ''; |
|
990 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
991 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
992 | + $_where['REG_date'] = array('BETWEEN', |
|
993 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
994 | + }elseif ($start_date && $end_date) { |
|
995 | 995 | throw new EE_Error("not yet supported"); |
996 | - }elseif($start_date){ |
|
996 | + }elseif ($start_date) { |
|
997 | 997 | throw new EE_Error("not yet supported"); |
998 | - }elseif($end_date){ |
|
998 | + }elseif ($end_date) { |
|
999 | 999 | throw new EE_Error("not yet supported"); |
1000 | 1000 | } |
1001 | 1001 | |
1002 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
1003 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1002 | + if ( ! empty($this->_req_data['s'])) { |
|
1003 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1004 | 1004 | $_where['OR'] = array( |
1005 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1006 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1007 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1008 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
1009 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1010 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1011 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1012 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1013 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1014 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1015 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1016 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1017 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1018 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1019 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1020 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1021 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1022 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
1005 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1006 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1007 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1008 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
1009 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1010 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1011 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1012 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1013 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1014 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1015 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1016 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1017 | + 'REG_code' => array('LIKE', $sstr), |
|
1018 | + 'REG_count' => array('LIKE', $sstr), |
|
1019 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1020 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1021 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1022 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
1023 | 1023 | ); |
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | //capability checks |
1027 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
1027 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
1028 | 1028 | $_where['AND'] = array( |
1029 | 1029 | 'Event.EVT_wp_user' => get_current_user_id() |
1030 | 1030 | ); |
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | |
1034 | - if( $count ){ |
|
1035 | - if ( $trash ) { |
|
1036 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1037 | - } else if ( $incomplete ) { |
|
1038 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1034 | + if ($count) { |
|
1035 | + if ($trash) { |
|
1036 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1037 | + } else if ($incomplete) { |
|
1038 | + return EEM_Registration::instance()->count(array($_where)); |
|
1039 | 1039 | } else { |
1040 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1040 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1041 | 1041 | } |
1042 | 1042 | } else { |
1043 | 1043 | //make sure we remove default where conditions cause all registrations matching query are returned |
1044 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1045 | - if ( $per_page !== -1 ) { |
|
1044 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1045 | + if ($per_page !== -1) { |
|
1046 | 1046 | $query_params['limit'] = $limit; |
1047 | 1047 | } |
1048 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1048 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1049 | 1049 | |
1050 | 1050 | |
1051 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1051 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1052 | 1052 | $first_registration = $registrations[0]; |
1053 | 1053 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1054 | 1054 | $event_name = $first_registration->event_obj()->name(); |
1055 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1055 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1056 | 1056 | // edit event link |
1057 | - if ( $event_name != '' ) { |
|
1058 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1059 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1060 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1057 | + if ($event_name != '') { |
|
1058 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1059 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1060 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1061 | 1061 | } |
1062 | 1062 | |
1063 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1064 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1063 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1064 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1065 | 1065 | |
1066 | 1066 | $this->_template_args['before_admin_page_content'] = ' |
1067 | 1067 | <div id="admin-page-header"> |
1068 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1069 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1070 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1068 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1069 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1070 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1071 | 1071 | </div> |
1072 | 1072 | '; |
1073 | 1073 | |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | |
1106 | 1106 | $this->_set_registration_object(); |
1107 | 1107 | |
1108 | - if ( is_object( $this->_registration )) { |
|
1108 | + if (is_object($this->_registration)) { |
|
1109 | 1109 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1110 | 1110 | $this->_session = $transaction->session_data(); |
1111 | 1111 | |
@@ -1113,10 +1113,10 @@ discard block |
||
1113 | 1113 | |
1114 | 1114 | |
1115 | 1115 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1116 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1116 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1117 | 1117 | |
1118 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y','g:i:s a') ; |
|
1119 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1118 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); |
|
1119 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1120 | 1120 | |
1121 | 1121 | $this->_template_args['grand_total'] = $transaction->total(); |
1122 | 1122 | |
@@ -1124,19 +1124,19 @@ discard block |
||
1124 | 1124 | // link back to overview |
1125 | 1125 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1126 | 1126 | $this->_template_args['registration'] = $this->_registration; |
1127 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1128 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1129 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1127 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1128 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1129 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1130 | 1130 | |
1131 | 1131 | //next and previous links |
1132 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1133 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1134 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1135 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1132 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1133 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1134 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1135 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1136 | 1136 | |
1137 | 1137 | // grab header |
1138 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1139 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1138 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1139 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1140 | 1140 | |
1141 | 1141 | } else { |
1142 | 1142 | |
@@ -1155,17 +1155,17 @@ discard block |
||
1155 | 1155 | |
1156 | 1156 | |
1157 | 1157 | protected function _registration_details_metaboxes() { |
1158 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1158 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1159 | 1159 | $this->_set_registration_object(); |
1160 | 1160 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1161 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1162 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1163 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1164 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1161 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1162 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1163 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1164 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1165 | 1165 | } |
1166 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1167 | - if ( $this->_registration->group_size() > 1 ) { |
|
1168 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1166 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1167 | + if ($this->_registration->group_size() > 1) { |
|
1168 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1169 | 1169 | } |
1170 | 1170 | } |
1171 | 1171 | |
@@ -1186,23 +1186,23 @@ discard block |
||
1186 | 1186 | |
1187 | 1187 | //let's get an array of all possible buttons that we can just reference |
1188 | 1188 | $status_buttons = $this->_get_reg_status_buttons(); |
1189 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1190 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1189 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1190 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1191 | 1191 | $template_args['attendee'] = $this->_registration->attendee(); |
1192 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1193 | - if ( $this->_set_registration_object() ) { |
|
1192 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1193 | + if ($this->_set_registration_object()) { |
|
1194 | 1194 | $current_status = $this->_registration->status_ID(); |
1195 | - unset( $status_buttons[$current_status] ); |
|
1196 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1197 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1195 | + unset($status_buttons[$current_status]); |
|
1196 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1197 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1198 | 1198 | } |
1199 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1199 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1200 | 1200 | } |
1201 | 1201 | $template_args['form_url'] = REG_ADMIN_URL; |
1202 | 1202 | $template_args['REG_ID'] = $this->_registration->ID(); |
1203 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1203 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1204 | 1204 | |
1205 | - EEH_Template::display_template( $template, $template_args ); |
|
1205 | + EEH_Template::display_template($template, $template_args); |
|
1206 | 1206 | |
1207 | 1207 | } |
1208 | 1208 | |
@@ -1216,11 +1216,11 @@ discard block |
||
1216 | 1216 | private function _get_reg_status_buttons() { |
1217 | 1217 | |
1218 | 1218 | $buttons = array( |
1219 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1220 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1221 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1222 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1223 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1219 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1220 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1221 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1222 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1223 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1224 | 1224 | ); |
1225 | 1225 | return $buttons; |
1226 | 1226 | } |
@@ -1234,13 +1234,13 @@ discard block |
||
1234 | 1234 | * |
1235 | 1235 | * @return array (array with reg_id(s) updated and whether update was successful. |
1236 | 1236 | */ |
1237 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1238 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1237 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1238 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1239 | 1239 | |
1240 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1240 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1241 | 1241 | |
1242 | 1242 | //notify? |
1243 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1243 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1244 | 1244 | $this->_process_resend_registration(); |
1245 | 1245 | } |
1246 | 1246 | |
@@ -1258,19 +1258,19 @@ discard block |
||
1258 | 1258 | * @param bool $status |
1259 | 1259 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1260 | 1260 | */ |
1261 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1261 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1262 | 1262 | $success = true; |
1263 | 1263 | // set default status if none is passed |
1264 | 1264 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1265 | 1265 | |
1266 | 1266 | //typecast and sanitize reg_id |
1267 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1267 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1268 | 1268 | |
1269 | 1269 | //loop through REG_ID's and change status |
1270 | - foreach ( $reg_ids as $r_id ) { |
|
1271 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1272 | - if ( $registration instanceof EE_Registration ) { |
|
1273 | - $registration->set_status( $status ); |
|
1270 | + foreach ($reg_ids as $r_id) { |
|
1271 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1272 | + if ($registration instanceof EE_Registration) { |
|
1273 | + $registration->set_status($status); |
|
1274 | 1274 | $result = $registration->save(); |
1275 | 1275 | |
1276 | 1276 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | $this->_req_data['_REG_ID'] = $reg_ids; |
1283 | 1283 | |
1284 | 1284 | //return $success and processed registrations |
1285 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1285 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1286 | 1286 | } |
1287 | 1287 | |
1288 | 1288 | |
@@ -1294,37 +1294,37 @@ discard block |
||
1294 | 1294 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1295 | 1295 | * @return void |
1296 | 1296 | */ |
1297 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1297 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1298 | 1298 | |
1299 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1299 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1300 | 1300 | |
1301 | 1301 | |
1302 | - $success = isset( $result['success'] ) && $result['success']; |
|
1302 | + $success = isset($result['success']) && $result['success']; |
|
1303 | 1303 | |
1304 | 1304 | //setup success message |
1305 | - if ( $success ) { |
|
1306 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1307 | - EE_Error::add_success( $msg ); |
|
1305 | + if ($success) { |
|
1306 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1307 | + EE_Error::add_success($msg); |
|
1308 | 1308 | } else { |
1309 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1309 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1310 | 1310 | } |
1311 | 1311 | |
1312 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1312 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1313 | 1313 | //unset nonces |
1314 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1315 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1316 | - unset( $this->_req_data[$ref] ); |
|
1314 | + foreach ($this->_req_data as $ref => $value) { |
|
1315 | + if (strpos($ref, 'nonce') !== false) { |
|
1316 | + unset($this->_req_data[$ref]); |
|
1317 | 1317 | continue; |
1318 | 1318 | } |
1319 | 1319 | |
1320 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1320 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1321 | 1321 | $this->_req_data[$ref] = $value; |
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | //merge request vars so that the reloaded list table contains any existing filter query params |
1325 | - $route = array_merge( $this->_req_data, $route ); |
|
1325 | + $route = array_merge($this->_req_data, $route); |
|
1326 | 1326 | |
1327 | - $this->_redirect_after_action( false, '', '', $route, true ); |
|
1327 | + $this->_redirect_after_action(false, '', '', $route, true); |
|
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | |
@@ -1336,29 +1336,29 @@ discard block |
||
1336 | 1336 | protected function _change_reg_status() { |
1337 | 1337 | $this->_req_data['return'] = 'view_registration'; |
1338 | 1338 | //set notify based on whether the send notifications toggle is set or not |
1339 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1340 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1339 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1340 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1341 | 1341 | |
1342 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1343 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1344 | - $this->approve_registration( $notify ); |
|
1342 | + switch ($this->_req_data['_reg_status_id']) { |
|
1343 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1344 | + $this->approve_registration($notify); |
|
1345 | 1345 | break; |
1346 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1347 | - $this->pending_registration( $notify ); |
|
1346 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1347 | + $this->pending_registration($notify); |
|
1348 | 1348 | break; |
1349 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1350 | - $this->not_approve_registration( $notify ); |
|
1349 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1350 | + $this->not_approve_registration($notify); |
|
1351 | 1351 | break; |
1352 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1353 | - $this->decline_registration( $notify ); |
|
1352 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1353 | + $this->decline_registration($notify); |
|
1354 | 1354 | break; |
1355 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1356 | - $this->cancel_registration( $notify ); |
|
1355 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1356 | + $this->cancel_registration($notify); |
|
1357 | 1357 | break; |
1358 | 1358 | default : |
1359 | 1359 | $result['success'] = false; |
1360 | - unset( $this->_req_data['return'] ); |
|
1361 | - $this->_reg_status_change_return( '', false ); |
|
1360 | + unset($this->_req_data['return']); |
|
1361 | + $this->_reg_status_change_return('', false); |
|
1362 | 1362 | break; |
1363 | 1363 | } |
1364 | 1364 | } |
@@ -1371,8 +1371,8 @@ discard block |
||
1371 | 1371 | * @param bool $notify whether or not to notify the registrant about their approval. |
1372 | 1372 | * @return void |
1373 | 1373 | */ |
1374 | - protected function approve_registration( $notify = false ) { |
|
1375 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1374 | + protected function approve_registration($notify = false) { |
|
1375 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 | |
@@ -1384,8 +1384,8 @@ discard block |
||
1384 | 1384 | * @param bool $notify whether or not to notify the registrant about their approval. |
1385 | 1385 | * @return void |
1386 | 1386 | */ |
1387 | - protected function decline_registration( $notify = false ) { |
|
1388 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1387 | + protected function decline_registration($notify = false) { |
|
1388 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1389 | 1389 | } |
1390 | 1390 | |
1391 | 1391 | |
@@ -1397,8 +1397,8 @@ discard block |
||
1397 | 1397 | * @param bool $notify whether or not to notify the registrant about their approval. |
1398 | 1398 | * @return void |
1399 | 1399 | */ |
1400 | - protected function cancel_registration( $notify = false ) { |
|
1401 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1400 | + protected function cancel_registration($notify = false) { |
|
1401 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1402 | 1402 | } |
1403 | 1403 | |
1404 | 1404 | |
@@ -1411,8 +1411,8 @@ discard block |
||
1411 | 1411 | * @param bool $notify whether or not to notify the registrant about their approval. |
1412 | 1412 | * @return void |
1413 | 1413 | */ |
1414 | - protected function not_approve_registration( $notify = false ) { |
|
1415 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1414 | + protected function not_approve_registration($notify = false) { |
|
1415 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | |
@@ -1423,8 +1423,8 @@ discard block |
||
1423 | 1423 | * @param bool $notify whether or not to notify the registrant about their approval. |
1424 | 1424 | * @return void |
1425 | 1425 | */ |
1426 | - protected function pending_registration( $notify = false ) { |
|
1427 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1426 | + protected function pending_registration($notify = false) { |
|
1427 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | |
@@ -1438,75 +1438,75 @@ discard block |
||
1438 | 1438 | public function _reg_details_meta_box() { |
1439 | 1439 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1440 | 1440 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1441 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1441 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1442 | 1442 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1443 | 1443 | $this->_session = $transaction->session_data(); |
1444 | 1444 | |
1445 | 1445 | $filters = new EE_Line_Item_Filter_Collection(); |
1446 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1447 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1448 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1446 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1447 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1448 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1449 | 1449 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1450 | 1450 | |
1451 | 1451 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1452 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1453 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1452 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1453 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1454 | 1454 | |
1455 | 1455 | |
1456 | 1456 | $attendee = $this->_registration->attendee(); |
1457 | 1457 | |
1458 | 1458 | |
1459 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1460 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1459 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1460 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1461 | 1461 | |
1462 | 1462 | |
1463 | 1463 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1464 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1464 | + $payment = $transaction->get_first_related('Payment'); |
|
1465 | 1465 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1466 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1466 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1467 | 1467 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1468 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1468 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1469 | 1469 | $reg_details = array( |
1470 | 1470 | 'payment_method' => $payment_method->name(), |
1471 | 1471 | 'response_msg' => $payment->gateway_response(), |
1472 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1472 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1473 | 1473 | 'registration_session' => $this->_registration->session_ID(), |
1474 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1475 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1474 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1475 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1476 | 1476 | ); |
1477 | 1477 | |
1478 | 1478 | |
1479 | - if ( isset( $reg_details['registration_id'] )) { |
|
1479 | + if (isset($reg_details['registration_id'])) { |
|
1480 | 1480 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1481 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1481 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1482 | 1482 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1483 | 1483 | } |
1484 | 1484 | |
1485 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1485 | + if (isset($reg_details['payment_method'])) { |
|
1486 | 1486 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1487 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1487 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1488 | 1488 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1489 | 1489 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1490 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1490 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1491 | 1491 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1492 | 1492 | } |
1493 | 1493 | |
1494 | 1494 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1495 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1495 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1496 | 1496 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1497 | 1497 | |
1498 | 1498 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1499 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1499 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1500 | 1500 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1501 | 1501 | |
1502 | 1502 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1503 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1503 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1504 | 1504 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1505 | 1505 | |
1506 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1506 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1507 | 1507 | |
1508 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1509 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1508 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1509 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1510 | 1510 | |
1511 | 1511 | } |
1512 | 1512 | |
@@ -1520,14 +1520,14 @@ discard block |
||
1520 | 1520 | */ |
1521 | 1521 | public function _reg_questions_meta_box() { |
1522 | 1522 | //allow someone to override this method entirely |
1523 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1524 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1525 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1523 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1524 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1525 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1526 | 1526 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1527 | 1527 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1528 | 1528 | |
1529 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1530 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1529 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1530 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1531 | 1531 | } |
1532 | 1532 | } |
1533 | 1533 | |
@@ -1541,12 +1541,12 @@ discard block |
||
1541 | 1541 | * @param string $output |
1542 | 1542 | * @return string |
1543 | 1543 | */ |
1544 | - public function form_before_question_group( $output ) { |
|
1544 | + public function form_before_question_group($output) { |
|
1545 | 1545 | EE_Error::doing_it_wrong( |
1546 | - __CLASS__ . '::' . __FUNCTION__, |
|
1547 | - __( 'This method would have been protected but was used on a filter callback' |
|
1546 | + __CLASS__.'::'.__FUNCTION__, |
|
1547 | + __('This method would have been protected but was used on a filter callback' |
|
1548 | 1548 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1549 | - 'event_espresso' ), |
|
1549 | + 'event_espresso'), |
|
1550 | 1550 | '4.8.32.rc.000' |
1551 | 1551 | ); |
1552 | 1552 | return ' |
@@ -1565,20 +1565,20 @@ discard block |
||
1565 | 1565 | * @param string $output |
1566 | 1566 | * @return string |
1567 | 1567 | */ |
1568 | - public function form_after_question_group( $output ) { |
|
1568 | + public function form_after_question_group($output) { |
|
1569 | 1569 | EE_Error::doing_it_wrong( |
1570 | - __CLASS__ . '::' . __FUNCTION__, |
|
1571 | - __( 'This method would have been protected but was used on a filter callback' |
|
1570 | + __CLASS__.'::'.__FUNCTION__, |
|
1571 | + __('This method would have been protected but was used on a filter callback' |
|
1572 | 1572 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1573 | - 'event_espresso' ), |
|
1573 | + 'event_espresso'), |
|
1574 | 1574 | '4.8.32.rc.000' |
1575 | 1575 | ); |
1576 | 1576 | return ' |
1577 | 1577 | <tr class="hide-if-no-js"> |
1578 | 1578 | <th> </th> |
1579 | 1579 | <td class="reg-admin-edit-attendee-question-td"> |
1580 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1581 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1580 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1581 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1582 | 1582 | <div class="dashicons dashicons-edit"></div> |
1583 | 1583 | </a> |
1584 | 1584 | </td> |
@@ -1598,18 +1598,18 @@ discard block |
||
1598 | 1598 | * @param string $label |
1599 | 1599 | * @return string |
1600 | 1600 | */ |
1601 | - public function form_form_field_label_wrap( $label ) { |
|
1601 | + public function form_form_field_label_wrap($label) { |
|
1602 | 1602 | EE_Error::doing_it_wrong( |
1603 | - __CLASS__ . '::' . __FUNCTION__, |
|
1604 | - __( 'This method would have been protected but was used on a filter callback' |
|
1603 | + __CLASS__.'::'.__FUNCTION__, |
|
1604 | + __('This method would have been protected but was used on a filter callback' |
|
1605 | 1605 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1606 | - 'event_espresso' ), |
|
1606 | + 'event_espresso'), |
|
1607 | 1607 | '4.8.32.rc.000' |
1608 | 1608 | ); |
1609 | 1609 | return ' |
1610 | 1610 | <tr> |
1611 | 1611 | <th> |
1612 | - ' . $label . ' |
|
1612 | + ' . $label.' |
|
1613 | 1613 | </th>'; |
1614 | 1614 | } |
1615 | 1615 | |
@@ -1623,17 +1623,17 @@ discard block |
||
1623 | 1623 | * @param string $input |
1624 | 1624 | * @return string |
1625 | 1625 | */ |
1626 | - public function form_form_field_input__wrap( $input ) { |
|
1626 | + public function form_form_field_input__wrap($input) { |
|
1627 | 1627 | EE_Error::doing_it_wrong( |
1628 | - __CLASS__ . '::' . __FUNCTION__, |
|
1629 | - __( 'This method would have been protected but was used on a filter callback' |
|
1628 | + __CLASS__.'::'.__FUNCTION__, |
|
1629 | + __('This method would have been protected but was used on a filter callback' |
|
1630 | 1630 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1631 | - 'event_espresso' ), |
|
1631 | + 'event_espresso'), |
|
1632 | 1632 | '4.8.32.rc.000' |
1633 | 1633 | ); |
1634 | 1634 | return ' |
1635 | 1635 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1636 | - ' . $input . ' |
|
1636 | + ' . $input.' |
|
1637 | 1637 | </td> |
1638 | 1638 | </tr>'; |
1639 | 1639 | } |
@@ -1647,14 +1647,14 @@ discard block |
||
1647 | 1647 | * @return void |
1648 | 1648 | */ |
1649 | 1649 | protected function _update_attendee_registration_form() { |
1650 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1651 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1652 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1653 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1654 | - if( $success ) { |
|
1650 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1651 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1652 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1653 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1654 | + if ($success) { |
|
1655 | 1655 | $what = __('Registration Form', 'event_espresso'); |
1656 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1657 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1656 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1657 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1658 | 1658 | } |
1659 | 1659 | } |
1660 | 1660 | } |
@@ -1665,11 +1665,11 @@ discard block |
||
1665 | 1665 | * @param int $REG_ID |
1666 | 1666 | * @return EE_Registration_Custom_Questions_Form |
1667 | 1667 | */ |
1668 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1669 | - if( ! $this->_reg_custom_questions_form ) { |
|
1670 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1671 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1672 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1668 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1669 | + if ( ! $this->_reg_custom_questions_form) { |
|
1670 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1671 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1672 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1673 | 1673 | } |
1674 | 1674 | return $this->_reg_custom_questions_form; |
1675 | 1675 | } |
@@ -1682,17 +1682,17 @@ discard block |
||
1682 | 1682 | * @param bool $REG_ID |
1683 | 1683 | * @return bool |
1684 | 1684 | */ |
1685 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1685 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1686 | 1686 | |
1687 | 1687 | if ( ! $REG_ID) { |
1688 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1688 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1689 | 1689 | } |
1690 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1691 | - $form->receive_form_submission( $this->_req_data ); |
|
1690 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1691 | + $form->receive_form_submission($this->_req_data); |
|
1692 | 1692 | $success = false; |
1693 | - if( $form->is_valid() ) { |
|
1694 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1695 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1693 | + if ($form->is_valid()) { |
|
1694 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1695 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1696 | 1696 | $where_conditions = array( |
1697 | 1697 | 'QST_ID' => $question_id, |
1698 | 1698 | 'REG_ID' => $REG_ID |
@@ -1700,19 +1700,19 @@ discard block |
||
1700 | 1700 | $possibly_new_values = array( |
1701 | 1701 | 'ANS_value' => $input->normalized_value() |
1702 | 1702 | ); |
1703 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1704 | - if( $answer instanceof EE_Answer ) { |
|
1705 | - $success = $answer->save( $possibly_new_values ); |
|
1703 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1704 | + if ($answer instanceof EE_Answer) { |
|
1705 | + $success = $answer->save($possibly_new_values); |
|
1706 | 1706 | } else { |
1707 | 1707 | //insert it then |
1708 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1709 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1708 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1709 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1710 | 1710 | $success = $answer->save(); |
1711 | 1711 | } |
1712 | 1712 | } |
1713 | 1713 | } |
1714 | 1714 | } else { |
1715 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1715 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1716 | 1716 | } |
1717 | 1717 | return $success; |
1718 | 1718 | } |
@@ -1730,29 +1730,29 @@ discard block |
||
1730 | 1730 | $registrations = $REG->get_all(array( |
1731 | 1731 | array( |
1732 | 1732 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1733 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1733 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1734 | 1734 | ), |
1735 | 1735 | 'force_join'=>array('Attendee'))); |
1736 | 1736 | |
1737 | 1737 | $this->_template_args['attendees'] = array(); |
1738 | 1738 | $this->_template_args['attendee_notice'] = ''; |
1739 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1740 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1739 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1740 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1741 | 1741 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1742 | 1742 | } else { |
1743 | 1743 | |
1744 | 1744 | $att_nmbr = 1; |
1745 | - foreach ( $registrations as $registration ) { |
|
1745 | + foreach ($registrations as $registration) { |
|
1746 | 1746 | /* @var $registration EE_Registration */ |
1747 | 1747 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1748 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1749 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1750 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1751 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1748 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1749 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1750 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1751 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1752 | 1752 | |
1753 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1753 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1754 | 1754 | |
1755 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1755 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1756 | 1756 | |
1757 | 1757 | $att_nmbr++; |
1758 | 1758 | } |
@@ -1764,8 +1764,8 @@ discard block |
||
1764 | 1764 | |
1765 | 1765 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1766 | 1766 | } |
1767 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1768 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1767 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1768 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1769 | 1769 | |
1770 | 1770 | } |
1771 | 1771 | |
@@ -1786,11 +1786,11 @@ discard block |
||
1786 | 1786 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1787 | 1787 | |
1788 | 1788 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1789 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1789 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1790 | 1790 | $primary_registration = $this->_registration->get_primary_registration(); |
1791 | 1791 | $primary_attendee = $primary_registration->attendee(); |
1792 | 1792 | |
1793 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1793 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1794 | 1794 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1795 | 1795 | $primary_registration = NULL; |
1796 | 1796 | } |
@@ -1799,27 +1799,27 @@ discard block |
||
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1802 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1803 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1804 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1802 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1803 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1804 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1805 | 1805 | $this->_template_args['phone'] = $attendee->phone(); |
1806 | 1806 | |
1807 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1807 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1808 | 1808 | |
1809 | 1809 | |
1810 | 1810 | //edit link |
1811 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1812 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1811 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1812 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1813 | 1813 | |
1814 | 1814 | //create link |
1815 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1815 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1816 | 1816 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1817 | 1817 | |
1818 | 1818 | $this->_template_args['att_check'] = $att_check; |
1819 | 1819 | |
1820 | 1820 | |
1821 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1822 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1821 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1822 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1823 | 1823 | } |
1824 | 1824 | |
1825 | 1825 | |
@@ -1832,7 +1832,7 @@ discard block |
||
1832 | 1832 | * @access protected |
1833 | 1833 | * @return void |
1834 | 1834 | */ |
1835 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1835 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1836 | 1836 | $REGM = EEM_Registration::instance(); |
1837 | 1837 | |
1838 | 1838 | $success = 1; |
@@ -1842,26 +1842,26 @@ discard block |
||
1842 | 1842 | $dtts = array(); |
1843 | 1843 | |
1844 | 1844 | //if empty _REG_ID then get out because there's nothing to do |
1845 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1845 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1846 | 1846 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1847 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1848 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1847 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1848 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1849 | 1849 | } |
1850 | 1850 | |
1851 | 1851 | //Checkboxes |
1852 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1852 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1853 | 1853 | // if array has more than one element than success message should be plural |
1854 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1854 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1855 | 1855 | // cycle thru checkboxes |
1856 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1856 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1857 | 1857 | |
1858 | 1858 | $REG = $REGM->get_one_by_ID($REG_ID); |
1859 | 1859 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1860 | - if ( $payment_count > 0 ) { |
|
1861 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1860 | + if ($payment_count > 0) { |
|
1861 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1862 | 1862 | $error = 1; |
1863 | 1863 | $success = 0; |
1864 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1864 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1865 | 1865 | continue; //can't trash this registration because it has payments. |
1866 | 1866 | } |
1867 | 1867 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1870,7 +1870,7 @@ discard block |
||
1870 | 1870 | $dtts = array_merge($dtts, $dtt); |
1871 | 1871 | |
1872 | 1872 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1873 | - if ( !$updated ) { |
|
1873 | + if ( ! $updated) { |
|
1874 | 1874 | $success = 0; |
1875 | 1875 | } else { |
1876 | 1876 | $success = 2; |
@@ -1885,7 +1885,7 @@ discard block |
||
1885 | 1885 | $tickets[$ticket->ID()] = $ticket; |
1886 | 1886 | $dtts = $ticket->get_many_related('Datetime'); |
1887 | 1887 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1888 | - if ( ! $updated ) { |
|
1888 | + if ( ! $updated) { |
|
1889 | 1889 | $success = 0; |
1890 | 1890 | } |
1891 | 1891 | |
@@ -1895,10 +1895,10 @@ discard block |
||
1895 | 1895 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1896 | 1896 | EEM_Datetime::instance()->update_sold($dtts); |
1897 | 1897 | |
1898 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1899 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1898 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1899 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1900 | 1900 | $overwrite_msgs = $error ? TRUE : FALSE; |
1901 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1901 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1902 | 1902 | } |
1903 | 1903 | |
1904 | 1904 | |
@@ -1922,16 +1922,16 @@ discard block |
||
1922 | 1922 | $success = 1; |
1923 | 1923 | |
1924 | 1924 | //Checkboxes |
1925 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1925 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1926 | 1926 | // if array has more than one element than success message should be plural |
1927 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1927 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1928 | 1928 | // cycle thru checkboxes |
1929 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1929 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1930 | 1930 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1931 | - if ( ! $REG instanceof EE_Registration ) |
|
1931 | + if ( ! $REG instanceof EE_Registration) |
|
1932 | 1932 | continue; |
1933 | 1933 | $deleted = $this->_delete_registration($REG); |
1934 | - if ( !$deleted ) { |
|
1934 | + if ( ! $deleted) { |
|
1935 | 1935 | $success = 0; |
1936 | 1936 | } |
1937 | 1937 | } |
@@ -1941,15 +1941,15 @@ discard block |
||
1941 | 1941 | $REG_ID = $this->_req_data['_REG_ID']; |
1942 | 1942 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1943 | 1943 | $deleted = $this->_delete_registration($REG); |
1944 | - if ( ! $deleted ) { |
|
1944 | + if ( ! $deleted) { |
|
1945 | 1945 | $success = 0; |
1946 | 1946 | } |
1947 | 1947 | |
1948 | 1948 | } |
1949 | 1949 | |
1950 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1951 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1952 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1950 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1951 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1952 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1953 | 1953 | } |
1954 | 1954 | |
1955 | 1955 | |
@@ -1961,31 +1961,31 @@ discard block |
||
1961 | 1961 | * @param EE_Registration $REG registration to be deleted permenantly |
1962 | 1962 | * @return boolean true = successful deletion, false = fail. |
1963 | 1963 | */ |
1964 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1964 | + protected function _delete_registration(EE_Registration $REG) { |
|
1965 | 1965 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1966 | 1966 | $TXN = $REG->get_first_related('Transaction'); |
1967 | 1967 | $REGS = $TXN->get_many_related('Registration'); |
1968 | 1968 | |
1969 | 1969 | $all_trashed = TRUE; |
1970 | - foreach ( $REGS as $registration ) { |
|
1971 | - if ( ! $registration->get('REG_deleted') ) |
|
1970 | + foreach ($REGS as $registration) { |
|
1971 | + if ( ! $registration->get('REG_deleted')) |
|
1972 | 1972 | $all_trashed = FALSE; |
1973 | 1973 | } |
1974 | 1974 | |
1975 | - if ( ! $all_trashed ) { |
|
1976 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1975 | + if ( ! $all_trashed) { |
|
1976 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1977 | 1977 | return false; |
1978 | 1978 | } |
1979 | 1979 | |
1980 | 1980 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1981 | - foreach ( $REGS as $registration ) { |
|
1981 | + foreach ($REGS as $registration) { |
|
1982 | 1982 | |
1983 | 1983 | //delete related answers |
1984 | 1984 | $registration->delete_related_permanently('Answer'); |
1985 | 1985 | |
1986 | 1986 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1987 | 1987 | $attendee = $registration->get_first_related('Attendee'); |
1988 | - if ( $attendee instanceof EE_Attendee ) { |
|
1988 | + if ($attendee instanceof EE_Attendee) { |
|
1989 | 1989 | $registration->_remove_relation_to($attendee, 'Attendee'); |
1990 | 1990 | } |
1991 | 1991 | |
@@ -1995,7 +1995,7 @@ discard block |
||
1995 | 1995 | //now delete permanently the checkins related to this registration. |
1996 | 1996 | $registration->delete_related_permanently('Checkin'); |
1997 | 1997 | |
1998 | - if ( $registration->ID() === $REG->ID() ) |
|
1998 | + if ($registration->ID() === $REG->ID()) |
|
1999 | 1999 | continue; //we don't want to delete permanently the existing registration just yet. |
2000 | 2000 | |
2001 | 2001 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2028,35 +2028,35 @@ discard block |
||
2028 | 2028 | * @return void |
2029 | 2029 | */ |
2030 | 2030 | public function new_registration() { |
2031 | - if ( ! $this->_set_reg_event() ) { |
|
2032 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2031 | + if ( ! $this->_set_reg_event()) { |
|
2032 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2033 | 2033 | } |
2034 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2034 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2035 | 2035 | // gotta start with a clean slate if we're not coming here via ajax |
2036 | 2036 | if ( |
2037 | - ! defined('DOING_AJAX' ) |
|
2038 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2037 | + ! defined('DOING_AJAX') |
|
2038 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2039 | 2039 | ) { |
2040 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2040 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2041 | 2041 | } |
2042 | 2042 | |
2043 | - $this->_template_args['event_name'] = '' ; |
|
2043 | + $this->_template_args['event_name'] = ''; |
|
2044 | 2044 | // event name |
2045 | - if ( $this->_reg_event ) { |
|
2045 | + if ($this->_reg_event) { |
|
2046 | 2046 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2047 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2048 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2049 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2047 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2048 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2049 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2050 | 2050 | } |
2051 | 2051 | |
2052 | 2052 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2053 | 2053 | |
2054 | - if ( defined('DOING_AJAX' ) ) { |
|
2054 | + if (defined('DOING_AJAX')) { |
|
2055 | 2055 | $this->_return_json(); |
2056 | 2056 | } |
2057 | 2057 | // grab header |
2058 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2059 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2058 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2059 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2060 | 2060 | |
2061 | 2061 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2062 | 2062 | // the details template wrapper |
@@ -2073,7 +2073,7 @@ discard block |
||
2073 | 2073 | * @return string html |
2074 | 2074 | */ |
2075 | 2075 | protected function _get_registration_step_content() { |
2076 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2076 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2077 | 2077 | $warning_msg = sprintf( |
2078 | 2078 | __( |
2079 | 2079 | '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
@@ -2089,7 +2089,7 @@ discard block |
||
2089 | 2089 | '</b>' |
2090 | 2090 | ); |
2091 | 2091 | return ' |
2092 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2092 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2093 | 2093 | <script > |
2094 | 2094 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2095 | 2095 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2124,16 +2124,16 @@ discard block |
||
2124 | 2124 | $cart = EE_Registry::instance()->SSN->cart(); |
2125 | 2125 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2126 | 2126 | |
2127 | - switch ( $step ) { |
|
2127 | + switch ($step) { |
|
2128 | 2128 | case 'ticket' : |
2129 | 2129 | $hidden_fields['processing_registration']['value'] = 1; |
2130 | 2130 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2131 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2131 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2132 | 2132 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2133 | 2133 | $template_args['show_notification_toggle'] = FALSE; |
2134 | 2134 | break; |
2135 | 2135 | case 'questions' : |
2136 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2136 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2137 | 2137 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2138 | 2138 | //in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run. |
2139 | 2139 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2142,10 +2142,10 @@ discard block |
||
2142 | 2142 | break; |
2143 | 2143 | } |
2144 | 2144 | |
2145 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2145 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2146 | 2146 | |
2147 | 2147 | return EEH_Template::display_template( |
2148 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2148 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2149 | 2149 | ); |
2150 | 2150 | } |
2151 | 2151 | |
@@ -2160,11 +2160,11 @@ discard block |
||
2160 | 2160 | * @return boolean |
2161 | 2161 | */ |
2162 | 2162 | private function _set_reg_event() { |
2163 | - if ( is_object( $this->_reg_event )) { |
|
2163 | + if (is_object($this->_reg_event)) { |
|
2164 | 2164 | return TRUE; |
2165 | 2165 | } |
2166 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2167 | - if ( ! $EVT_ID ) { |
|
2166 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2167 | + if ( ! $EVT_ID) { |
|
2168 | 2168 | return FALSE; |
2169 | 2169 | } |
2170 | 2170 | |
@@ -2185,82 +2185,82 @@ discard block |
||
2185 | 2185 | public function process_reg_step() { |
2186 | 2186 | EE_System::do_not_cache(); |
2187 | 2187 | $this->_set_reg_event(); |
2188 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2188 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2189 | 2189 | |
2190 | 2190 | //what step are we on? |
2191 | 2191 | $cart = EE_Registry::instance()->SSN->cart(); |
2192 | 2192 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2193 | 2193 | |
2194 | 2194 | //if doing ajax then we need to verify the nonce |
2195 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2196 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2197 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2195 | + if (defined('DOING_AJAX')) { |
|
2196 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2197 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2198 | 2198 | } |
2199 | 2199 | |
2200 | - switch ( $step ) { |
|
2200 | + switch ($step) { |
|
2201 | 2201 | |
2202 | 2202 | case 'ticket' : |
2203 | 2203 | //process ticket selection |
2204 | 2204 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2205 | - if ( $success ) { |
|
2206 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2205 | + if ($success) { |
|
2206 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2207 | 2207 | } else { |
2208 | 2208 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2209 | 2209 | } |
2210 | - if ( defined('DOING_AJAX') ) { |
|
2210 | + if (defined('DOING_AJAX')) { |
|
2211 | 2211 | $this->new_registration(); //display next step |
2212 | 2212 | } else { |
2213 | 2213 | $query_args['action'] = 'new_registration'; |
2214 | 2214 | $query_args['processing_registration'] = 1; |
2215 | 2215 | $query_args['event_id'] = $this->_reg_event->ID(); |
2216 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2216 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2217 | 2217 | } |
2218 | 2218 | break; |
2219 | 2219 | |
2220 | 2220 | case 'questions' : |
2221 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2222 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2221 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2222 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2223 | 2223 | } |
2224 | 2224 | //process registration |
2225 | 2225 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2226 | - if ( $cart instanceof EE_Cart ) { |
|
2226 | + if ($cart instanceof EE_Cart) { |
|
2227 | 2227 | $grand_total = $cart->get_cart_grand_total(); |
2228 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2228 | + if ($grand_total instanceof EE_Line_Item) { |
|
2229 | 2229 | $grand_total->save_this_and_descendants_to_txn(); |
2230 | 2230 | } |
2231 | 2231 | } |
2232 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2232 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2233 | 2233 | $query_args = array( |
2234 | 2234 | 'action' => 'new_registration', |
2235 | 2235 | 'processing_registration' => 2, |
2236 | 2236 | 'event_id' => $this->_reg_event->ID() |
2237 | 2237 | ); |
2238 | 2238 | |
2239 | - if ( defined('DOING_AJAX' )) { |
|
2239 | + if (defined('DOING_AJAX')) { |
|
2240 | 2240 | //display registration form again because there are errors (maybe validation?) |
2241 | 2241 | $this->new_registration(); |
2242 | 2242 | return; |
2243 | 2243 | } else { |
2244 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2244 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2245 | 2245 | return; |
2246 | 2246 | } |
2247 | 2247 | } |
2248 | 2248 | /** @type EE_Transaction_Payments $transaction_payments */ |
2249 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2249 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2250 | 2250 | // maybe update status, and make sure to save transaction if not done already |
2251 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2251 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2252 | 2252 | $transaction->save(); |
2253 | 2253 | } |
2254 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2254 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2255 | 2255 | $this->_req_data = array(); |
2256 | 2256 | $query_args = array( |
2257 | 2257 | 'action' => 'redirect_to_txn', |
2258 | 2258 | 'TXN_ID' => $transaction->ID(), |
2259 | 2259 | 'EVT_ID' => $this->_reg_event->ID(), |
2260 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2260 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2261 | 2261 | 'redirect_from' => 'new_registration' |
2262 | 2262 | ); |
2263 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2263 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2264 | 2264 | break; |
2265 | 2265 | } |
2266 | 2266 | |
@@ -2277,21 +2277,21 @@ discard block |
||
2277 | 2277 | */ |
2278 | 2278 | public function redirect_to_txn() { |
2279 | 2279 | EE_System::do_not_cache(); |
2280 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2280 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2281 | 2281 | $query_args = array( |
2282 | 2282 | 'action' => 'view_transaction', |
2283 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2283 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2284 | 2284 | 'page' => 'espresso_transactions' |
2285 | 2285 | ); |
2286 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2287 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2288 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2289 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2286 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2287 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2288 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2289 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2290 | 2290 | } |
2291 | 2291 | EE_Error::add_success( |
2292 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2292 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2293 | 2293 | ); |
2294 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2294 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2295 | 2295 | } |
2296 | 2296 | |
2297 | 2297 | |
@@ -2302,7 +2302,7 @@ discard block |
||
2302 | 2302 | * @return void |
2303 | 2303 | */ |
2304 | 2304 | protected function _attendee_contact_list_table() { |
2305 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2305 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2306 | 2306 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2307 | 2307 | $this->display_admin_list_table_page_with_no_sidebar(); |
2308 | 2308 | } |
@@ -2317,10 +2317,10 @@ discard block |
||
2317 | 2317 | * @access public |
2318 | 2318 | * @return array |
2319 | 2319 | */ |
2320 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2320 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2321 | 2321 | |
2322 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2323 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2322 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2323 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2324 | 2324 | $ATT_MDL = EEM_Attendee::instance(); |
2325 | 2325 | |
2326 | 2326 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2348,47 +2348,47 @@ discard block |
||
2348 | 2348 | $orderby = 'ATT_lname'; |
2349 | 2349 | } |
2350 | 2350 | |
2351 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2351 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2352 | 2352 | |
2353 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2354 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2355 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2353 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2354 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2355 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2356 | 2356 | |
2357 | 2357 | $_where = array(); |
2358 | 2358 | |
2359 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2360 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2359 | + if (isset($this->_req_data['s'])) { |
|
2360 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2361 | 2361 | $_where['OR'] = array( |
2362 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2363 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2364 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2365 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2366 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2367 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2368 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2369 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2370 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2371 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2372 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2373 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2374 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2375 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2376 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2377 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2378 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2362 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2363 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2364 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2365 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2366 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2367 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2368 | + 'ATT_email' => array('LIKE', $sstr), |
|
2369 | + 'ATT_address' => array('LIKE', $sstr), |
|
2370 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2371 | + 'ATT_city' => array('LIKE', $sstr), |
|
2372 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2373 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2374 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2375 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2376 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2377 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2378 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2379 | 2379 | ); |
2380 | 2380 | } |
2381 | 2381 | |
2382 | 2382 | |
2383 | - $offset = ($current_page-1)*$per_page; |
|
2384 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2383 | + $offset = ($current_page - 1) * $per_page; |
|
2384 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2385 | 2385 | |
2386 | - if ( $trash ) { |
|
2387 | - $_where['status'] = array( '!=', 'publish' ); |
|
2388 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2386 | + if ($trash) { |
|
2387 | + $_where['status'] = array('!=', 'publish'); |
|
2388 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2389 | 2389 | } else { |
2390 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2391 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2390 | + $_where['status'] = array('IN', array('publish')); |
|
2391 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2392 | 2392 | } |
2393 | 2393 | |
2394 | 2394 | return $all_attendees; |
@@ -2405,10 +2405,10 @@ discard block |
||
2405 | 2405 | */ |
2406 | 2406 | protected function _resend_registration() { |
2407 | 2407 | $this->_process_resend_registration(); |
2408 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2408 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2409 | 2409 | 'action' => 'default' |
2410 | 2410 | ); |
2411 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2411 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2412 | 2412 | } |
2413 | 2413 | |
2414 | 2414 | |
@@ -2416,26 +2416,26 @@ discard block |
||
2416 | 2416 | |
2417 | 2417 | |
2418 | 2418 | |
2419 | - public function _registrations_report(){ |
|
2420 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2421 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2419 | + public function _registrations_report() { |
|
2420 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2421 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2422 | 2422 | array( |
2423 | 2423 | 'page' => 'espresso_batch', |
2424 | 2424 | 'batch' => 'file', |
2425 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2426 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2427 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2428 | - )) ); |
|
2425 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2426 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2427 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2428 | + ))); |
|
2429 | 2429 | } else { |
2430 | 2430 | $new_request_args = array( |
2431 | 2431 | 'export' => 'report', |
2432 | 2432 | 'action' => 'registrations_report_for_event', |
2433 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2433 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2434 | 2434 | ); |
2435 | 2435 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2436 | 2436 | |
2437 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2438 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2437 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2438 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2439 | 2439 | $EE_Export = EE_Export::instance($this->_req_data); |
2440 | 2440 | $EE_Export->export(); |
2441 | 2441 | } |
@@ -2444,26 +2444,26 @@ discard block |
||
2444 | 2444 | |
2445 | 2445 | |
2446 | 2446 | |
2447 | - public function _contact_list_export(){ |
|
2448 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2449 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2447 | + public function _contact_list_export() { |
|
2448 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2449 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2450 | 2450 | $EE_Export = EE_Export::instance($this->_req_data); |
2451 | 2451 | $EE_Export->export_attendees(); |
2452 | 2452 | } |
2453 | 2453 | } |
2454 | 2454 | |
2455 | - public function _contact_list_report(){ |
|
2456 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2457 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2455 | + public function _contact_list_report() { |
|
2456 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2457 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2458 | 2458 | array( |
2459 | 2459 | 'page' => 'espresso_batch', |
2460 | 2460 | 'batch' => 'file', |
2461 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2462 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2463 | - )) ); |
|
2461 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2462 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2463 | + ))); |
|
2464 | 2464 | } else { |
2465 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2466 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2465 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2466 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2467 | 2467 | $EE_Export = EE_Export::instance($this->_req_data); |
2468 | 2468 | $EE_Export->report_attendees(); |
2469 | 2469 | } |
@@ -2483,73 +2483,73 @@ discard block |
||
2483 | 2483 | * @return void |
2484 | 2484 | */ |
2485 | 2485 | protected function _duplicate_attendee() { |
2486 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2486 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2487 | 2487 | //verify we have necessary info |
2488 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2489 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2490 | - $query_args = array( 'action' => $action ); |
|
2488 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2489 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2490 | + $query_args = array('action' => $action); |
|
2491 | 2491 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2492 | 2492 | } |
2493 | 2493 | |
2494 | 2494 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2495 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2495 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2496 | 2496 | $attendee = $registration->attendee(); |
2497 | 2497 | |
2498 | 2498 | //remove relation of existing attendee on registration |
2499 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2499 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2500 | 2500 | //new attendee |
2501 | 2501 | $new_attendee = clone $attendee; |
2502 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2502 | + $new_attendee->set('ATT_ID', 0); |
|
2503 | 2503 | $new_attendee->save(); |
2504 | 2504 | |
2505 | 2505 | //add new attendee to reg |
2506 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2506 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2507 | 2507 | |
2508 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2508 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2509 | 2509 | |
2510 | 2510 | //redirect to edit page for attendee |
2511 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2511 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2512 | 2512 | |
2513 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2513 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2514 | 2514 | } |
2515 | 2515 | |
2516 | 2516 | |
2517 | 2517 | //related to cpt routes |
2518 | 2518 | protected function _insert_update_cpt_item($post_id, $post) { |
2519 | 2519 | $success = true; |
2520 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2520 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2521 | 2521 | //for attendee updates |
2522 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2522 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2523 | 2523 | //note we should only be UPDATING attendees at this point. |
2524 | 2524 | $updated_fields = array( |
2525 | 2525 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2526 | 2526 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2527 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2527 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2528 | 2528 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2529 | 2529 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2530 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2531 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2532 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2533 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2534 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2535 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2530 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2531 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2532 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2533 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2534 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2535 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2536 | 2536 | ); |
2537 | - foreach ( $updated_fields as $field => $value ) { |
|
2537 | + foreach ($updated_fields as $field => $value) { |
|
2538 | 2538 | $attendee->set($field, $value); |
2539 | 2539 | } |
2540 | 2540 | |
2541 | 2541 | $success = $attendee->save(); |
2542 | 2542 | |
2543 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2544 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2545 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2546 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2543 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2544 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2545 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2546 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2547 | 2547 | } |
2548 | 2548 | } |
2549 | 2549 | } |
2550 | 2550 | |
2551 | - if ( $success === FALSE ) |
|
2552 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2551 | + if ($success === FALSE) |
|
2552 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2553 | 2553 | |
2554 | 2554 | } |
2555 | 2555 | |
@@ -2569,17 +2569,17 @@ discard block |
||
2569 | 2569 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2570 | 2570 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2571 | 2571 | |
2572 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2573 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2572 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2573 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2574 | 2574 | } |
2575 | 2575 | |
2576 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2576 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2577 | 2577 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2578 | 2578 | } |
2579 | 2579 | |
2580 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2581 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2582 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2580 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2581 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2582 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2583 | 2583 | } |
2584 | 2584 | |
2585 | 2585 | |
@@ -2588,10 +2588,10 @@ discard block |
||
2588 | 2588 | * @param WP_Post $post wp post object |
2589 | 2589 | * @return string attendee contact info ( and form ) |
2590 | 2590 | */ |
2591 | - public function attendee_contact_info( $post ) { |
|
2591 | + public function attendee_contact_info($post) { |
|
2592 | 2592 | //get attendee object ( should already have it ) |
2593 | 2593 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2594 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2594 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2595 | 2595 | EEH_Template::display_template($template, $this->_template_args); |
2596 | 2596 | } |
2597 | 2597 | |
@@ -2607,12 +2607,12 @@ discard block |
||
2607 | 2607 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2608 | 2608 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2609 | 2609 | new EE_Question_Form_Input( |
2610 | - EE_Question::new_instance( array( |
|
2610 | + EE_Question::new_instance(array( |
|
2611 | 2611 | 'QST_ID' => 0, |
2612 | 2612 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2613 | 2613 | 'QST_system' => 'admin-state' |
2614 | 2614 | )), |
2615 | - EE_Answer::new_instance( array( |
|
2615 | + EE_Answer::new_instance(array( |
|
2616 | 2616 | 'ANS_ID' => 0, |
2617 | 2617 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2618 | 2618 | )), |
@@ -2625,12 +2625,12 @@ discard block |
||
2625 | 2625 | )); |
2626 | 2626 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2627 | 2627 | new EE_Question_Form_Input( |
2628 | - EE_Question::new_instance( array( |
|
2628 | + EE_Question::new_instance(array( |
|
2629 | 2629 | 'QST_ID' => 0, |
2630 | 2630 | 'QST_display_text' => __('Country', 'event_espresso'), |
2631 | 2631 | 'QST_system' => 'admin-country' |
2632 | 2632 | )), |
2633 | - EE_Answer::new_instance( array( |
|
2633 | + EE_Answer::new_instance(array( |
|
2634 | 2634 | 'ANS_ID' => 0, |
2635 | 2635 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2636 | 2636 | )), |
@@ -2641,8 +2641,8 @@ discard block |
||
2641 | 2641 | 'append_qstn_id' => FALSE |
2642 | 2642 | ) |
2643 | 2643 | )); |
2644 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2645 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2644 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2645 | + EEH_Template::display_template($template, $this->_template_args); |
|
2646 | 2646 | |
2647 | 2647 | } |
2648 | 2648 | |
@@ -2652,11 +2652,11 @@ discard block |
||
2652 | 2652 | * @access protected |
2653 | 2653 | * @return void |
2654 | 2654 | */ |
2655 | - public function attendee_registrations_meta_box( $post ) { |
|
2655 | + public function attendee_registrations_meta_box($post) { |
|
2656 | 2656 | |
2657 | 2657 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2658 | 2658 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2659 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2659 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2660 | 2660 | EEH_Template::display_template($template, $this->_template_args); |
2661 | 2661 | |
2662 | 2662 | } |
@@ -2670,8 +2670,8 @@ discard block |
||
2670 | 2670 | * @return string html for new form. |
2671 | 2671 | */ |
2672 | 2672 | public function after_title_form_fields($post) { |
2673 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2674 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2673 | + if ($post->post_type == 'espresso_attendees') { |
|
2674 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2675 | 2675 | $template_args['attendee'] = $this->_cpt_model_obj; |
2676 | 2676 | EEH_Template::display_template($template, $template_args); |
2677 | 2677 | } |
@@ -2688,21 +2688,21 @@ discard block |
||
2688 | 2688 | * @access protected |
2689 | 2689 | * @return void |
2690 | 2690 | */ |
2691 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2691 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2692 | 2692 | |
2693 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2693 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2694 | 2694 | |
2695 | 2695 | $ATT_MDL = EEM_Attendee::instance(); |
2696 | 2696 | |
2697 | 2697 | $success = 1; |
2698 | 2698 | //Checkboxes |
2699 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2699 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2700 | 2700 | // if array has more than one element than success message should be plural |
2701 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2701 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2702 | 2702 | // cycle thru checkboxes |
2703 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2704 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2705 | - if ( !$updated ) { |
|
2703 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2704 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2705 | + if ( ! $updated) { |
|
2706 | 2706 | $success = 0; |
2707 | 2707 | } |
2708 | 2708 | } |
@@ -2711,18 +2711,18 @@ discard block |
||
2711 | 2711 | // grab single id and delete |
2712 | 2712 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2713 | 2713 | //get attendee |
2714 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2714 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2715 | 2715 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2716 | 2716 | $updated = $att->save(); |
2717 | - if ( ! $updated ) { |
|
2717 | + if ( ! $updated) { |
|
2718 | 2718 | $success = 0; |
2719 | 2719 | } |
2720 | 2720 | |
2721 | 2721 | } |
2722 | 2722 | |
2723 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2724 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2725 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2723 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2724 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2725 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2726 | 2726 | |
2727 | 2727 | } |
2728 | 2728 |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | function __construct() { |
31 | 31 | parent::__construct( |
32 | 32 | 'ee-upcoming-events-widget', |
33 | - __( 'Event Espresso Upcoming Events', 'event_espresso' ), |
|
34 | - array( 'description' => __( 'A widget to display your upcoming events.', 'event_espresso' )), |
|
33 | + __('Event Espresso Upcoming Events', 'event_espresso'), |
|
34 | + array('description' => __('A widget to display your upcoming events.', 'event_espresso')), |
|
35 | 35 | array( |
36 | 36 | 'width' => 300, |
37 | 37 | 'height' => 350, |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @param array $instance Previously saved values from database. |
50 | 50 | * @return string|void |
51 | 51 | */ |
52 | - public function form( $instance ) { |
|
52 | + public function form($instance) { |
|
53 | 53 | |
54 | - EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE ); |
|
54 | + EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE); |
|
55 | 55 | // Set up some default widget settings. |
56 | 56 | $defaults = array( |
57 | 57 | 'title' => __('Upcoming Events', 'event_espresso'), |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | 'image_size' => 'medium' |
67 | 67 | ); |
68 | 68 | |
69 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
69 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
70 | 70 | // don't add HTML labels for EE_Form_Fields generated inputs |
71 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
71 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
72 | 72 | $yes_no_values = array( |
73 | - EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
74 | - EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
73 | + EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
74 | + EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | ?> |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | <label for="<?php echo $this->get_field_id('title'); ?>"> |
83 | 83 | <?php _e('Title:', 'event_espresso'); ?> |
84 | 84 | </label> |
85 | - <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" /> |
|
85 | + <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" /> |
|
86 | 86 | </p> |
87 | 87 | <p> |
88 | 88 | <label for="<?php echo $this->get_field_id('category_name'); ?>"> |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | <?php |
92 | 92 | $event_categories = array(); |
93 | 93 | /** @type EEM_Term $EEM_Term */ |
94 | - $EEM_Term = EE_Registry::instance()->load_model( 'Term' ); |
|
95 | - $categories = $EEM_Term->get_all_ee_categories( TRUE ); |
|
96 | - if ( $categories ) { |
|
97 | - foreach ( $categories as $category ) { |
|
98 | - if ( $category instanceof EE_Term ) { |
|
99 | - $event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' ))); |
|
94 | + $EEM_Term = EE_Registry::instance()->load_model('Term'); |
|
95 | + $categories = $EEM_Term->get_all_ee_categories(TRUE); |
|
96 | + if ($categories) { |
|
97 | + foreach ($categories as $category) { |
|
98 | + if ($category instanceof EE_Term) { |
|
99 | + $event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name'))); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
103 | + array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
104 | 104 | echo EEH_Form_Fields::select( |
105 | 105 | __('Event Category:', 'event_espresso'), |
106 | 106 | $instance['category_name'], |
@@ -137,16 +137,16 @@ discard block |
||
137 | 137 | <?php |
138 | 138 | $image_sizes = array(); |
139 | 139 | $sizes = get_intermediate_image_sizes(); |
140 | - if ( $sizes ) { |
|
140 | + if ($sizes) { |
|
141 | 141 | // loop thru images and create option objects out of them |
142 | - foreach ( $sizes as $image_size ) { |
|
143 | - $image_size = trim( $image_size ); |
|
142 | + foreach ($sizes as $image_size) { |
|
143 | + $image_size = trim($image_size); |
|
144 | 144 | // no big images plz |
145 | - if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) { |
|
146 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size )); |
|
145 | + if ( ! in_array($image_size, array('large', 'post-thumbnail'))) { |
|
146 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size)); |
|
147 | 147 | } |
148 | 148 | } |
149 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso') )); |
|
149 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso'))); |
|
150 | 150 | } |
151 | 151 | echo EEH_Form_Fields::select( |
152 | 152 | __('Image Size:', 'event_espresso'), |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | <label for="<?php echo $this->get_field_id('date_limit'); ?>"> |
205 | 205 | <?php _e('Number of Dates to Display:', 'event_espresso'); ?> |
206 | 206 | </label> |
207 | - <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" /> |
|
207 | + <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr($instance['date_limit']); ?>" size="3" type="text" /> |
|
208 | 208 | </p> |
209 | 209 | <p> |
210 | 210 | <label for="<?php echo $this->get_field_id('date_range'); ?>"> |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return array Updated safe values to be saved. |
238 | 238 | */ |
239 | - public function update( $new_instance, $old_instance ) { |
|
239 | + public function update($new_instance, $old_instance) { |
|
240 | 240 | $instance = $old_instance; |
241 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
241 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
242 | 242 | $instance['category_name'] = $new_instance['category_name']; |
243 | 243 | $instance['show_expired'] = $new_instance['show_expired']; |
244 | 244 | $instance['limit'] = $new_instance['limit']; |
@@ -261,18 +261,18 @@ discard block |
||
261 | 261 | * @param array $args Widget arguments. |
262 | 262 | * @param array $instance Saved values from database. |
263 | 263 | */ |
264 | - public function widget( $args, $instance ) { |
|
264 | + public function widget($args, $instance) { |
|
265 | 265 | |
266 | 266 | global $post; |
267 | 267 | // make sure there is some kinda post object |
268 | - if ( $post instanceof WP_Post ) { |
|
268 | + if ($post instanceof WP_Post) { |
|
269 | 269 | $before_widget = ''; |
270 | 270 | $before_title = ''; |
271 | 271 | $after_title = ''; |
272 | 272 | $after_widget = ''; |
273 | 273 | // but NOT an events archives page, cuz that would be like two event lists on the same page |
274 | - $show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE; |
|
275 | - if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) { |
|
274 | + $show_everywhere = isset($instance['show_everywhere']) ? (bool) absint($instance['show_everywhere']) : TRUE; |
|
275 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
276 | 276 | // let's use some of the event helper functions' |
277 | 277 | // make separate vars out of attributes |
278 | 278 | |
@@ -291,76 +291,76 @@ discard block |
||
291 | 291 | // Before widget (defined by themes). |
292 | 292 | echo $before_widget; |
293 | 293 | // Display the widget title if one was input (before and after defined by themes). |
294 | - if ( ! empty( $title )) { |
|
295 | - echo $before_title . $title . $after_title; |
|
294 | + if ( ! empty($title)) { |
|
295 | + echo $before_title.$title.$after_title; |
|
296 | 296 | } |
297 | 297 | // grab widget settings |
298 | - $category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE; |
|
299 | - $show_expired = isset( $instance['show_expired'] ) ? (bool) absint( $instance['show_expired'] ) : FALSE; |
|
300 | - $image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium'; |
|
301 | - $show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE; |
|
302 | - $show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE; |
|
303 | - $date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL; |
|
304 | - $date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE; |
|
298 | + $category = isset($instance['category_name']) && ! empty($instance['category_name']) ? $instance['category_name'] : FALSE; |
|
299 | + $show_expired = isset($instance['show_expired']) ? (bool) absint($instance['show_expired']) : FALSE; |
|
300 | + $image_size = isset($instance['image_size']) && ! empty($instance['image_size']) ? $instance['image_size'] : 'medium'; |
|
301 | + $show_desc = isset($instance['show_desc']) ? (bool) absint($instance['show_desc']) : TRUE; |
|
302 | + $show_dates = isset($instance['show_dates']) ? (bool) absint($instance['show_dates']) : TRUE; |
|
303 | + $date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) ? $instance['date_limit'] : NULL; |
|
304 | + $date_range = isset($instance['date_range']) && ! empty($instance['date_range']) ? $instance['date_range'] : FALSE; |
|
305 | 305 | // start to build our where clause |
306 | 306 | $where = array( |
307 | 307 | // 'Datetime.DTT_is_primary' => 1, |
308 | 308 | 'status' => 'publish' |
309 | 309 | ); |
310 | 310 | // add category |
311 | - if ( $category ) { |
|
311 | + if ($category) { |
|
312 | 312 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
313 | 313 | $where['Term_Taxonomy.Term.slug'] = $category; |
314 | 314 | } |
315 | 315 | // if NOT expired then we want events that start today or in the future |
316 | - if ( ! $show_expired ) { |
|
317 | - $where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
316 | + if ( ! $show_expired) { |
|
317 | + $where['Datetime.DTT_EVT_end'] = array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
318 | 318 | } |
319 | 319 | // run the query |
320 | - $events = EE_Registry::instance()->load_model( 'Event' )->get_all( array( |
|
320 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array( |
|
321 | 321 | $where, |
322 | - 'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10', |
|
322 | + 'limit' => $instance['limit'] > 0 ? '0,'.$instance['limit'] : '0,10', |
|
323 | 323 | 'order_by' => 'Datetime.DTT_EVT_start', |
324 | 324 | 'order' => 'ASC', |
325 | 325 | 'group_by' => 'EVT_ID' |
326 | 326 | )); |
327 | 327 | |
328 | - if ( ! empty( $events )) { |
|
328 | + if ( ! empty($events)) { |
|
329 | 329 | echo '<ul class="ee-upcoming-events-widget-ul">'; |
330 | - foreach ( $events as $event ) { |
|
331 | - if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) { |
|
330 | + foreach ($events as $event) { |
|
331 | + if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) { |
|
332 | 332 | //printr( $event, '$event <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
333 | - echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">'; |
|
333 | + echo '<li id="ee-upcoming-events-widget-li-'.$event->ID().'" class="ee-upcoming-events-widget-li">'; |
|
334 | 334 | // how big is the event name ? |
335 | - $name_length = strlen( $event->name() ); |
|
336 | - switch( $name_length ) { |
|
335 | + $name_length = strlen($event->name()); |
|
336 | + switch ($name_length) { |
|
337 | 337 | case $name_length > 70 : |
338 | - $len_class = ' three-line'; |
|
338 | + $len_class = ' three-line'; |
|
339 | 339 | break; |
340 | 340 | case $name_length > 35 : |
341 | - $len_class = ' two-line'; |
|
341 | + $len_class = ' two-line'; |
|
342 | 342 | break; |
343 | 343 | default : |
344 | - $len_class = ' one-line'; |
|
344 | + $len_class = ' one-line'; |
|
345 | 345 | } |
346 | - echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . get_permalink( $event->ID() ) . '">' . $event->name() . '</a></h5>'; |
|
347 | - if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) { |
|
348 | - echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . get_permalink( $event->ID() ) . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>'; |
|
346 | + echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a'.$len_class.'" href="'.get_permalink($event->ID()).'">'.$event->name().'</a></h5>'; |
|
347 | + if (has_post_thumbnail($event->ID()) && $image_size != 'none') { |
|
348 | + echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="'.get_permalink($event->ID()).'">'.get_the_post_thumbnail($event->ID(), $image_size).'</a></div>'; |
|
349 | 349 | } |
350 | - $desc = $event->short_description( 25 ); |
|
351 | - if ( $show_dates ) { |
|
352 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' )); |
|
353 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' )); |
|
354 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' )); |
|
355 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
|
356 | - if ( $date_range == TRUE ) { |
|
357 | - echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
|
358 | - }else{ |
|
359 | - echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
|
350 | + $desc = $event->short_description(25); |
|
351 | + if ($show_dates) { |
|
352 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', get_option('date_format')); |
|
353 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', get_option('time_format')); |
|
354 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', get_option('date_format')); |
|
355 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', get_option('time_format')); |
|
356 | + if ($date_range == TRUE) { |
|
357 | + echo espresso_event_date_range($date_format, $time_format, $single_date_format, $single_time_format, $event->ID()); |
|
358 | + } else { |
|
359 | + echo espresso_list_of_event_dates($event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit); |
|
360 | 360 | } |
361 | 361 | } |
362 | - if ( $show_desc && $desc ) { |
|
363 | - echo '<p style="margin-top: .5em">' . $desc . '</p>'; |
|
362 | + if ($show_desc && $desc) { |
|
363 | + echo '<p style="margin-top: .5em">'.$desc.'</p>'; |
|
364 | 364 | } |
365 | 365 | echo '</li>'; |
366 | 366 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @return string |
384 | 384 | */ |
385 | 385 | public function make_the_title_a_link($title) { |
386 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
386 | + return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>'; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | } |