@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | $this->_name = 'pricing'; |
55 | 55 | |
56 | 56 | //capability check |
57 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) { |
|
57 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
61 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
62 | 62 | |
63 | 63 | //if we were going to add our own metaboxes we'd use the below. |
64 | 64 | $this->_metaboxes = array( |
65 | 65 | 0 => array( |
66 | - 'page_route' => array('edit','create_new'), |
|
66 | + 'page_route' => array('edit', 'create_new'), |
|
67 | 67 | 'func' => 'pricing_metabox', |
68 | 68 | 'label' => __('Event Tickets & Datetimes', 'event_espresso'), |
69 | 69 | 'priority' => 'high', |
70 | 70 | 'context' => 'normal' |
71 | 71 | ), |
72 | 72 | |
73 | - );/**/ |
|
73 | + ); /**/ |
|
74 | 74 | |
75 | 75 | $this->_remove_metaboxes = array( |
76 | 76 | 0 => array( |
@@ -89,24 +89,24 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @var array Expected an array returned with 'date' and 'time' keys. |
91 | 91 | */ |
92 | - $this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
92 | + $this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
93 | 93 | 'date' => 'Y-m-d', |
94 | 94 | 'time' => 'h:i a' |
95 | 95 | )); |
96 | 96 | |
97 | 97 | //validate |
98 | - $this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null; |
|
99 | - $this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null; |
|
98 | + $this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null; |
|
99 | + $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null; |
|
100 | 100 | |
101 | 101 | //validate format strings |
102 | - $format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
103 | - if ( is_array( $format_validation ) ) { |
|
104 | - $msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>'; |
|
105 | - foreach ( $format_validation as $error ) { |
|
106 | - $msg .= '<li>' . $error . '</li>'; |
|
102 | + $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
103 | + if (is_array($format_validation)) { |
|
104 | + $msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>'; |
|
105 | + foreach ($format_validation as $error) { |
|
106 | + $msg .= '<li>'.$error.'</li>'; |
|
107 | 107 | } |
108 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
109 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
108 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
109 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
110 | 110 | $this->_date_format_strings = array( |
111 | 111 | 'date' => 'Y-m-d', |
112 | 112 | 'time' => 'h:i a' |
@@ -117,60 +117,60 @@ discard block |
||
117 | 117 | $this->_scripts_styles = array( |
118 | 118 | 'registers' => array( |
119 | 119 | 'ee-tickets-datetimes-css' => array( |
120 | - 'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css', |
|
120 | + 'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css', |
|
121 | 121 | 'type' => 'css' |
122 | 122 | ), |
123 | 123 | 'ee-dtt-ticket-metabox' => array( |
124 | - 'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js', |
|
124 | + 'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js', |
|
125 | 125 | 'depends' => array('ee-datepicker', 'ee-dialog', 'underscore') |
126 | 126 | ) |
127 | 127 | ), |
128 | 128 | 'deregisters' => array( |
129 | - 'event-editor-css' => array('type' => 'css' ), |
|
129 | + 'event-editor-css' => array('type' => 'css'), |
|
130 | 130 | 'event-datetime-metabox' => array('type' => 'js') |
131 | 131 | ), |
132 | 132 | 'enqueues' => array( |
133 | - 'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ), |
|
134 | - 'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' ) |
|
133 | + 'ee-tickets-datetimes-css' => array('edit', 'create_new'), |
|
134 | + 'ee-dtt-ticket-metabox' => array('edit', 'create_new') |
|
135 | 135 | ), |
136 | 136 | 'localize' => array( |
137 | 137 | 'ee-dtt-ticket-metabox' => array( |
138 | 138 | 'DTT_TRASH_BLOCK' => array( |
139 | 139 | 'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'), |
140 | 140 | 'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'), |
141 | - 'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>', |
|
141 | + 'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>', |
|
142 | 142 | 'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), |
143 | 143 | 'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), |
144 | - 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>' |
|
144 | + 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>' |
|
145 | 145 | ), |
146 | 146 | 'DTT_ERROR_MSG' => array( |
147 | 147 | 'no_ticket_name' => __('General Admission', 'event_espresso'), |
148 | - 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>' |
|
148 | + 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>' |
|
149 | 149 | ), |
150 | 150 | 'DTT_OVERSELL_WARNING' => array( |
151 | 151 | 'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'), |
152 | 152 | 'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso') |
153 | 153 | ), |
154 | - 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ), |
|
155 | - 'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) ) |
|
154 | + 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']), |
|
155 | + 'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week')) |
|
156 | 156 | ) |
157 | 157 | ) |
158 | 158 | ); |
159 | 159 | |
160 | 160 | |
161 | - add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 ); |
|
162 | - add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 ); |
|
161 | + add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10); |
|
162 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | |
167 | - public function caf_updates( $update_callbacks ) { |
|
168 | - foreach ( $update_callbacks as $key => $callback ) { |
|
169 | - if ( $callback[1] == '_default_tickets_update' ) |
|
170 | - unset( $update_callbacks[$key] ); |
|
167 | + public function caf_updates($update_callbacks) { |
|
168 | + foreach ($update_callbacks as $key => $callback) { |
|
169 | + if ($callback[1] == '_default_tickets_update') |
|
170 | + unset($update_callbacks[$key]); |
|
171 | 171 | } |
172 | 172 | |
173 | - $update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' ); |
|
173 | + $update_callbacks[] = array($this, 'dtt_and_tickets_caf_update'); |
|
174 | 174 | return $update_callbacks; |
175 | 175 | } |
176 | 176 | |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @param array $data The request data from the form |
184 | 184 | * @return bool success or fail |
185 | 185 | */ |
186 | - public function dtt_and_tickets_caf_update( $evtobj, $data ) { |
|
186 | + public function dtt_and_tickets_caf_update($evtobj, $data) { |
|
187 | 187 | //first we need to start with datetimes cause they are the "root" items attached to events. |
188 | - $saved_dtts = $this->_update_dtts( $evtobj, $data ); |
|
188 | + $saved_dtts = $this->_update_dtts($evtobj, $data); |
|
189 | 189 | //next tackle the tickets (and prices?) |
190 | - $this->_update_tkts( $evtobj, $saved_dtts, $data ); |
|
190 | + $this->_update_tkts($evtobj, $saved_dtts, $data); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -198,41 +198,41 @@ discard block |
||
198 | 198 | * @param array $data the request data from the form |
199 | 199 | * @return EE_Datetime[] |
200 | 200 | */ |
201 | - protected function _update_dtts( $evt_obj, $data ) { |
|
202 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
201 | + protected function _update_dtts($evt_obj, $data) { |
|
202 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
203 | 203 | $saved_dtt_ids = array(); |
204 | 204 | $saved_dtt_objs = array(); |
205 | 205 | |
206 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
206 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
207 | 207 | //trim all values to ensure any excess whitespace is removed. |
208 | 208 | $dtt = array_map( |
209 | - function( $datetime_data ) { |
|
210 | - return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data ); |
|
209 | + function($datetime_data) { |
|
210 | + return is_array($datetime_data) ? $datetime_data : trim($datetime_data); |
|
211 | 211 | }, |
212 | 212 | $dtt |
213 | 213 | ); |
214 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
214 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
215 | 215 | $datetime_values = array( |
216 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
217 | - 'DTT_name' => ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '', |
|
218 | - 'DTT_description' => ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '', |
|
216 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
217 | + 'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '', |
|
218 | + 'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '', |
|
219 | 219 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
220 | 220 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
221 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ], |
|
222 | - 'DTT_order' => ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'], |
|
221 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
222 | + 'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'], |
|
223 | 223 | ); |
224 | 224 | |
225 | 225 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
226 | 226 | |
227 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
228 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
227 | + if ( ! empty($dtt['DTT_ID'])) { |
|
228 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']); |
|
229 | 229 | |
230 | 230 | //set date and time format according to what is set in this class. |
231 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
232 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
231 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
232 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
233 | 233 | |
234 | - foreach ( $datetime_values as $field => $value ) { |
|
235 | - $DTM->set( $field, $value ); |
|
234 | + foreach ($datetime_values as $field => $value) { |
|
235 | + $DTM->set($field, $value); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | // make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. |
@@ -240,24 +240,24 @@ discard block |
||
240 | 240 | $saved_dtt_ids[$DTM->ID()] = $DTM->ID(); |
241 | 241 | |
242 | 242 | } else { |
243 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE ); |
|
243 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE); |
|
244 | 244 | |
245 | 245 | //reset date and times to match the format |
246 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
247 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
248 | - foreach( $datetime_values as $field => $value ) { |
|
249 | - $DTM->set( $field, $value ); |
|
246 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
247 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
248 | + foreach ($datetime_values as $field => $value) { |
|
249 | + $DTM->set($field, $value); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | 253 | |
254 | 254 | $DTM->save(); |
255 | - $DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' ); |
|
255 | + $DTM = $evt_obj->_add_relation_to($DTM, 'Datetime'); |
|
256 | 256 | $evt_obj->save(); |
257 | 257 | |
258 | 258 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
259 | - if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) { |
|
260 | - $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') ); |
|
259 | + if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) { |
|
260 | + $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start')); |
|
261 | 261 | EE_Registry::instance()->load_helper('DTT_Helper'); |
262 | 262 | $DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days'); |
263 | 263 | $DTM->save(); |
@@ -273,25 +273,25 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | //now we need to REMOVE any dtts that got deleted. Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point. |
276 | - $old_datetimes = explode(',', $data['datetime_IDs'] ); |
|
276 | + $old_datetimes = explode(',', $data['datetime_IDs']); |
|
277 | 277 | $old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes; |
278 | 278 | |
279 | - if ( is_array( $old_datetimes ) ) { |
|
280 | - $dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids ); |
|
281 | - foreach ( $dtts_to_delete as $id ) { |
|
282 | - $id = absint( $id ); |
|
283 | - if ( empty( $id ) ) |
|
279 | + if (is_array($old_datetimes)) { |
|
280 | + $dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids); |
|
281 | + foreach ($dtts_to_delete as $id) { |
|
282 | + $id = absint($id); |
|
283 | + if (empty($id)) |
|
284 | 284 | continue; |
285 | 285 | |
286 | 286 | $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id); |
287 | 287 | |
288 | 288 | //remove tkt relationships. |
289 | 289 | $related_tickets = $dtt_to_remove->get_many_related('Ticket'); |
290 | - foreach ( $related_tickets as $tkt ) { |
|
290 | + foreach ($related_tickets as $tkt) { |
|
291 | 291 | $dtt_to_remove->_remove_relation_to($tkt, 'Ticket'); |
292 | 292 | } |
293 | 293 | |
294 | - $evt_obj->_remove_relation_to( $id, 'Datetime' ); |
|
294 | + $evt_obj->_remove_relation_to($id, 'Datetime'); |
|
295 | 295 | $dtt_to_remove->refresh_cache_of_related_objects(); |
296 | 296 | |
297 | 297 | } |
@@ -312,86 +312,86 @@ discard block |
||
312 | 312 | * @param array $data incoming request data |
313 | 313 | * @return EE_Ticket[] |
314 | 314 | */ |
315 | - protected function _update_tkts( $evtobj, $saved_dtts, $data ) { |
|
315 | + protected function _update_tkts($evtobj, $saved_dtts, $data) { |
|
316 | 316 | |
317 | 317 | $new_tkt = null; |
318 | 318 | $new_default = null; |
319 | 319 | //stripslashes because WP filtered the $_POST ($data) array to add slashes |
320 | 320 | $data = stripslashes_deep($data); |
321 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
321 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
322 | 322 | $saved_tickets = $dtts_on_existing = array(); |
323 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
323 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
324 | 324 | |
325 | 325 | //load money helper |
326 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
326 | + EE_Registry::instance()->load_helper('Money'); |
|
327 | 327 | |
328 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
328 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
329 | 329 | |
330 | 330 | $update_prices = $create_new_TKT = FALSE; |
331 | 331 | |
332 | 332 | //figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session. |
333 | 333 | |
334 | - $starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]); |
|
335 | - $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] ); |
|
334 | + $starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]); |
|
335 | + $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]); |
|
336 | 336 | $dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows); |
337 | 337 | $dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows); |
338 | 338 | |
339 | 339 | // trim inputs to ensure any excess whitespace is removed. |
340 | 340 | $tkt = array_map( |
341 | - function( $ticket_data ) { |
|
342 | - return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data ); |
|
341 | + function($ticket_data) { |
|
342 | + return is_array($ticket_data) ? $ticket_data : trim($ticket_data); |
|
343 | 343 | }, |
344 | 344 | $tkt |
345 | 345 | ); |
346 | 346 | |
347 | 347 | //note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models. |
348 | 348 | //note incoming ['TKT_price'] value is already in standard notation (via js). |
349 | - $ticket_price = isset( $tkt['TKT_price'] ) ? round ( (float) $tkt['TKT_price'], 3 ) : 0; |
|
349 | + $ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0; |
|
350 | 350 | |
351 | 351 | //note incoming base price needs converted from localized value. |
352 | - $base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0; |
|
352 | + $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0; |
|
353 | 353 | //if ticket price == 0 and $base_price != 0 then ticket price == base_price |
354 | 354 | $ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price; |
355 | - $base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0; |
|
355 | + $base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0; |
|
356 | 356 | |
357 | 357 | $price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array(); |
358 | 358 | |
359 | 359 | $now = null; |
360 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
360 | + if (empty($tkt['TKT_start_date'])) { |
|
361 | 361 | //lets' use now in the set timezone. |
362 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
363 | - $tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
362 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
363 | + $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
364 | 364 | } |
365 | 365 | |
366 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
366 | + if (empty($tkt['TKT_end_date'])) { |
|
367 | 367 | /** |
368 | 368 | * set the TKT_end_date to the first datetime attached to the ticket. |
369 | 369 | */ |
370 | - $first_dtt = $saved_dtts[reset( $tkt_dtt_rows )]; |
|
371 | - $tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] ); |
|
370 | + $first_dtt = $saved_dtts[reset($tkt_dtt_rows)]; |
|
371 | + $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | $TKT_values = array( |
375 | - 'TKT_ID' => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
376 | - 'TTM_ID' => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
377 | - 'TKT_name' => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
378 | - 'TKT_description' => ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
375 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
376 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
377 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
378 | + 'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
379 | 379 | 'TKT_start_date' => $tkt['TKT_start_date'], |
380 | 380 | 'TKT_end_date' => $tkt['TKT_end_date'], |
381 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ], |
|
382 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'], |
|
383 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
384 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
381 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
382 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
383 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
384 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
385 | 385 | 'TKT_row' => $row, |
386 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0, |
|
387 | - 'TKT_taxable' => ! empty( $tkt['TKT_taxable'] ) ? 1 : 0, |
|
388 | - 'TKT_required' => ! empty( $tkt['TKT_required'] ) ? 1 : 0, |
|
386 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0, |
|
387 | + 'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0, |
|
388 | + 'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0, |
|
389 | 389 | 'TKT_price' => $ticket_price |
390 | 390 | ); |
391 | 391 | |
392 | 392 | |
393 | 393 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
394 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
394 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
395 | 395 | $TKT_values['TKT_ID'] = 0; |
396 | 396 | $TKT_values['TKT_is_default'] = 0; |
397 | 397 | $update_prices = TRUE; |
@@ -403,21 +403,21 @@ discard block |
||
403 | 403 | // but DID have it's items modified. |
404 | 404 | // keep in mind that if the TKT has been sold (and we have changed pricing information), |
405 | 405 | // then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
406 | - if ( absint( $TKT_values['TKT_ID'] ) ) { |
|
407 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
408 | - if ( $TKT instanceof EE_Ticket ) { |
|
406 | + if (absint($TKT_values['TKT_ID'])) { |
|
407 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']); |
|
408 | + if ($TKT instanceof EE_Ticket) { |
|
409 | 409 | |
410 | - $TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed ); |
|
410 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
411 | 411 | // are there any registrations using this ticket ? |
412 | 412 | $tickets_sold = $TKT->count_related( |
413 | 413 | 'Registration', |
414 | - array( array( |
|
415 | - 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) |
|
416 | - ) ) |
|
414 | + array(array( |
|
415 | + 'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete)) |
|
416 | + )) |
|
417 | 417 | ); |
418 | 418 | //set ticket formats |
419 | - $TKT->set_date_format( $this->_date_format_strings['date'] ); |
|
420 | - $TKT->set_time_format( $this->_date_format_strings['time'] ); |
|
419 | + $TKT->set_date_format($this->_date_format_strings['date']); |
|
420 | + $TKT->set_time_format($this->_date_format_strings['time']); |
|
421 | 421 | |
422 | 422 | // let's just check the total price for the existing ticket |
423 | 423 | // and determine if it matches the new total price. |
@@ -427,17 +427,17 @@ discard block |
||
427 | 427 | ? TRUE : FALSE; |
428 | 428 | |
429 | 429 | //set new values |
430 | - foreach ( $TKT_values as $field => $value ) { |
|
431 | - if ( $field === 'TKT_qty' ) { |
|
432 | - $TKT->set_qty( $value ); |
|
430 | + foreach ($TKT_values as $field => $value) { |
|
431 | + if ($field === 'TKT_qty') { |
|
432 | + $TKT->set_qty($value); |
|
433 | 433 | } else { |
434 | - $TKT->set( $field, $value ); |
|
434 | + $TKT->set($field, $value); |
|
435 | 435 | } |
436 | 436 | } |
437 | 437 | |
438 | 438 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
439 | - if ( $create_new_TKT ) { |
|
440 | - $new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id ); |
|
439 | + if ($create_new_TKT) { |
|
440 | + $new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
@@ -446,12 +446,12 @@ discard block |
||
446 | 446 | $TKT = EE_Ticket::new_instance( |
447 | 447 | $TKT_values, |
448 | 448 | $timezone, |
449 | - array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ] ) |
|
449 | + array($this->_date_format_strings['date'], $this->_date_format_strings['time']) |
|
450 | 450 | ); |
451 | - if ( $TKT instanceof EE_Ticket ) { |
|
451 | + if ($TKT instanceof EE_Ticket) { |
|
452 | 452 | // make sure ticket has an ID of setting relations won't work |
453 | 453 | $TKT->save(); |
454 | - $TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed ); |
|
454 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
455 | 455 | $update_prices = TRUE; |
456 | 456 | } |
457 | 457 | } |
@@ -459,38 +459,38 @@ discard block |
||
459 | 459 | //$TKT->save(); |
460 | 460 | |
461 | 461 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
462 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
463 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
462 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
463 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
464 | 464 | EE_Registry::instance()->load_helper('DTT_Helper'); |
465 | 465 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
466 | 466 | } |
467 | 467 | |
468 | 468 | //let's make sure the base price is handled |
469 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT; |
|
469 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT; |
|
470 | 470 | |
471 | 471 | //add/update price_modifiers |
472 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT; |
|
472 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT; |
|
473 | 473 | |
474 | 474 | //need to make sue that the TKT_price is accurate after saving the prices. |
475 | 475 | $TKT->ensure_TKT_Price_correct(); |
476 | 476 | |
477 | 477 | //handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave. |
478 | - if ( ! defined('DOING_AUTOSAVE' ) ) { |
|
479 | - if ( !empty($tkt['TKT_is_default_selector'] ) ) { |
|
478 | + if ( ! defined('DOING_AUTOSAVE')) { |
|
479 | + if ( ! empty($tkt['TKT_is_default_selector'])) { |
|
480 | 480 | $update_prices = TRUE; |
481 | 481 | $new_default = clone $TKT; |
482 | - $new_default->set( 'TKT_ID', 0 ); |
|
483 | - $new_default->set( 'TKT_is_default', 1 ); |
|
484 | - $new_default->set( 'TKT_row', 1 ); |
|
485 | - $new_default->set( 'TKT_price', $ticket_price ); |
|
482 | + $new_default->set('TKT_ID', 0); |
|
483 | + $new_default->set('TKT_is_default', 1); |
|
484 | + $new_default->set('TKT_row', 1); |
|
485 | + $new_default->set('TKT_price', $ticket_price); |
|
486 | 486 | //remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object) |
487 | 487 | $new_default->_remove_relations('Datetime'); |
488 | 488 | //todo we need to add the current attached prices as new prices to the new default ticket. |
489 | - $new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices ); |
|
489 | + $new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices); |
|
490 | 490 | //don't forget the base price! |
491 | - $new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id ); |
|
491 | + $new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id); |
|
492 | 492 | $new_default->save(); |
493 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data ); |
|
493 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data); |
|
494 | 494 | } |
495 | 495 | } |
496 | 496 | |
@@ -501,19 +501,19 @@ discard block |
||
501 | 501 | //let's assign any tickets that have been setup to the saved_tickets tracker |
502 | 502 | //save existing TKT |
503 | 503 | $TKT->save(); |
504 | - if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) { |
|
504 | + if ($create_new_TKT && $new_tkt instanceof EE_Ticket) { |
|
505 | 505 | //save new TKT |
506 | 506 | $new_tkt->save(); |
507 | 507 | //add new ticket to array |
508 | - $saved_tickets[ $new_tkt->ID() ] = $new_tkt; |
|
508 | + $saved_tickets[$new_tkt->ID()] = $new_tkt; |
|
509 | 509 | |
510 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data ); |
|
510 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data); |
|
511 | 511 | |
512 | 512 | } else { |
513 | 513 | //add tkt to saved tkts |
514 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
514 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
515 | 515 | |
516 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data ); |
|
516 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | } |
@@ -523,22 +523,22 @@ discard block |
||
523 | 523 | // (i.e. autosaves are happening and then in between autosaves the user trashes a ticket). |
524 | 524 | // Or a draft event was saved and in the process of editing a ticket is trashed. |
525 | 525 | // No sense in keeping all the related data in the db! |
526 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
527 | - $tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) ); |
|
526 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
527 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
528 | 528 | |
529 | - foreach ( $tickets_removed as $id ) { |
|
530 | - $id = absint( $id ); |
|
529 | + foreach ($tickets_removed as $id) { |
|
530 | + $id = absint($id); |
|
531 | 531 | |
532 | 532 | //get the ticket for this id |
533 | 533 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
534 | 534 | |
535 | 535 | //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime |
536 | - if ( $tkt_to_remove->get('TKT_is_default') ) |
|
536 | + if ($tkt_to_remove->get('TKT_is_default')) |
|
537 | 537 | continue; |
538 | 538 | |
539 | 539 | // if this tkt has any registrations attached so then we just ARCHIVE |
540 | 540 | // because we don't actually permanently delete these tickets. |
541 | - if ( $tkt_to_remove->count_related('Registration') > 0 ) { |
|
541 | + if ($tkt_to_remove->count_related('Registration') > 0) { |
|
542 | 542 | $tkt_to_remove->delete(); |
543 | 543 | continue; |
544 | 544 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | // (remember this process can ONLY kick off if there are NO tkts_sold) |
548 | 548 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
549 | 549 | |
550 | - foreach( $dtts as $dtt ) { |
|
550 | + foreach ($dtts as $dtt) { |
|
551 | 551 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
552 | 552 | } |
553 | 553 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | // tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
556 | 556 | $tkt_to_remove->delete_related_permanently('Price'); |
557 | 557 | |
558 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove ); |
|
558 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove); |
|
559 | 559 | |
560 | 560 | // finally let's delete this ticket |
561 | 561 | // (which should not be blocked at this point b/c we've removed all our relationships) |
@@ -587,39 +587,39 @@ discard block |
||
587 | 587 | // and removing the ticket from datetimes it got removed from. |
588 | 588 | |
589 | 589 | // first let's add datetimes |
590 | - if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) { |
|
591 | - foreach ( $added_datetimes as $row_id ) { |
|
592 | - $row_id = (int)$row_id; |
|
593 | - if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) { |
|
594 | - $ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' ); |
|
590 | + if ( ! empty($added_datetimes) && is_array($added_datetimes)) { |
|
591 | + foreach ($added_datetimes as $row_id) { |
|
592 | + $row_id = (int) $row_id; |
|
593 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
594 | + $ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
595 | 595 | // Is this an existing ticket (has an ID) and does it have any sold? |
596 | 596 | // If so, then we need to add that to the DTT sold because this DTT is getting added. |
597 | - if ( $ticket->ID() && $ticket->sold() > 0 ) { |
|
598 | - $saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() ); |
|
599 | - $saved_datetimes[ $row_id ]->save(); |
|
597 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
598 | + $saved_datetimes[$row_id]->increase_sold($ticket->sold()); |
|
599 | + $saved_datetimes[$row_id]->save(); |
|
600 | 600 | } |
601 | 601 | } |
602 | 602 | } |
603 | 603 | } |
604 | 604 | // then remove datetimes |
605 | - if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) { |
|
606 | - foreach ( $removed_datetimes as $row_id ) { |
|
607 | - $row_id = (int)$row_id; |
|
605 | + if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) { |
|
606 | + foreach ($removed_datetimes as $row_id) { |
|
607 | + $row_id = (int) $row_id; |
|
608 | 608 | // its entirely possible that a datetime got deleted (instead of just removed from relationship. |
609 | 609 | // So make sure we skip over this if the dtt isn't in the $saved_datetimes array) |
610 | - if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) { |
|
611 | - $ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' ); |
|
610 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
611 | + $ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
612 | 612 | // Is this an existing ticket (has an ID) and does it have any sold? |
613 | 613 | // If so, then we need to remove it's sold from the DTT_sold. |
614 | - if ( $ticket->ID() && $ticket->sold() > 0 ) { |
|
615 | - $saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() ); |
|
616 | - $saved_datetimes[ $row_id ]->save(); |
|
614 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
615 | + $saved_datetimes[$row_id]->decrease_sold($ticket->sold()); |
|
616 | + $saved_datetimes[$row_id]->save(); |
|
617 | 617 | } |
618 | 618 | } |
619 | 619 | } |
620 | 620 | } |
621 | 621 | // cap ticket qty by datetime reg limits |
622 | - $ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) ); |
|
622 | + $ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit'))); |
|
623 | 623 | return $ticket; |
624 | 624 | } |
625 | 625 | |
@@ -640,39 +640,39 @@ discard block |
||
640 | 640 | EE_Ticket $ticket, |
641 | 641 | $price_rows = array(), |
642 | 642 | $ticket_price = 0, |
643 | - $base_price = 0 , |
|
643 | + $base_price = 0, |
|
644 | 644 | $base_price_id = 0 |
645 | 645 | ) { |
646 | 646 | |
647 | 647 | // create new ticket that's a copy of the existing |
648 | 648 | // except a new id of course (and not archived) |
649 | 649 | // AND has the new TKT_price associated with it. |
650 | - $new_ticket = clone( $ticket ); |
|
651 | - $new_ticket->set( 'TKT_ID', 0 ); |
|
652 | - $new_ticket->set( 'TKT_deleted', 0 ); |
|
653 | - $new_ticket->set( 'TKT_price', $ticket_price ); |
|
654 | - $new_ticket->set( 'TKT_sold', 0 ); |
|
650 | + $new_ticket = clone($ticket); |
|
651 | + $new_ticket->set('TKT_ID', 0); |
|
652 | + $new_ticket->set('TKT_deleted', 0); |
|
653 | + $new_ticket->set('TKT_price', $ticket_price); |
|
654 | + $new_ticket->set('TKT_sold', 0); |
|
655 | 655 | // let's get a new ID for this ticket |
656 | 656 | $new_ticket->save(); |
657 | 657 | // we also need to make sure this new ticket gets the same datetime attachments as the archived ticket |
658 | - $datetimes_on_existing = $ticket->get_many_related( 'Datetime' ); |
|
658 | + $datetimes_on_existing = $ticket->get_many_related('Datetime'); |
|
659 | 659 | $new_ticket = $this->_update_ticket_datetimes( |
660 | 660 | $new_ticket, |
661 | 661 | $datetimes_on_existing, |
662 | - array_keys( $datetimes_on_existing ) |
|
662 | + array_keys($datetimes_on_existing) |
|
663 | 663 | ); |
664 | 664 | |
665 | 665 | // $ticket will get archived later b/c we are NOT adding it to the saved_tickets array. |
666 | 666 | // if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining |
667 | 667 | // available. |
668 | - if ( $ticket->sold() > 0 ) { |
|
668 | + if ($ticket->sold() > 0) { |
|
669 | 669 | $new_qty = $ticket->qty() - $ticket->sold(); |
670 | - $new_ticket->set_qty( $new_qty ); |
|
670 | + $new_ticket->set_qty($new_qty); |
|
671 | 671 | } |
672 | 672 | //now we update the prices just for this ticket |
673 | - $new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true ); |
|
673 | + $new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true); |
|
674 | 674 | //and we update the base price |
675 | - $new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id ); |
|
675 | + $new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id); |
|
676 | 676 | return $new_ticket; |
677 | 677 | } |
678 | 678 | |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | * @param int|bool $base_price_id if present then this is the base_price_id being updated. |
693 | 693 | * @return EE_Ticket |
694 | 694 | */ |
695 | - protected function _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) { |
|
695 | + protected function _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) { |
|
696 | 696 | |
697 | 697 | //let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session. |
698 | 698 | $current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers(); |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | $updated_prices = array(); |
701 | 701 | |
702 | 702 | // if $base_price ! FALSE then updating a base price. |
703 | - if ( $base_price !== FALSE ) { |
|
703 | + if ($base_price !== FALSE) { |
|
704 | 704 | $prices[1] = array( |
705 | 705 | 'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id, |
706 | 706 | 'PRT_ID' => 1, |
@@ -711,47 +711,47 @@ discard block |
||
711 | 711 | } |
712 | 712 | |
713 | 713 | //possibly need to save tkt |
714 | - if ( ! $ticket->ID() ) |
|
714 | + if ( ! $ticket->ID()) |
|
715 | 715 | $ticket->save(); |
716 | 716 | |
717 | - foreach ( $prices as $row => $prc ) { |
|
718 | - $prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL; |
|
719 | - if ( empty($prt_id) ) |
|
717 | + foreach ($prices as $row => $prc) { |
|
718 | + $prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL; |
|
719 | + if (empty($prt_id)) |
|
720 | 720 | continue; //prices MUST have a price type id. |
721 | 721 | $PRC_values = array( |
722 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
722 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
723 | 723 | 'PRT_ID' => $prt_id, |
724 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
725 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
726 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
724 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
725 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
726 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
727 | 727 | 'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor |
728 | 728 | 'PRC_order' => $row |
729 | 729 | ); |
730 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
730 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
731 | 731 | $PRC_values['PRC_ID'] = 0; |
732 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
732 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
733 | 733 | } else { |
734 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
734 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
735 | 735 | //update this price with new values |
736 | - foreach ( $PRC_values as $field => $newprc ) { |
|
737 | - $PRC->set( $field, $newprc ); |
|
736 | + foreach ($PRC_values as $field => $newprc) { |
|
737 | + $PRC->set($field, $newprc); |
|
738 | 738 | } |
739 | 739 | } |
740 | 740 | $PRC->save(); |
741 | 741 | $prcid = $PRC->ID(); |
742 | 742 | $updated_prices[$prcid] = $PRC; |
743 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
743 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | //now let's remove any prices that got removed from the ticket |
747 | - if ( !empty ( $current_prices_on_ticket ) ) { |
|
747 | + if ( ! empty ($current_prices_on_ticket)) { |
|
748 | 748 | $current = array_keys($current_prices_on_ticket); |
749 | 749 | $updated = array_keys($updated_prices); |
750 | 750 | $prices_to_remove = array_diff($current, $updated); |
751 | - if ( !empty( $prices_to_remove ) ) { |
|
752 | - foreach ( $prices_to_remove as $prc_id ) { |
|
751 | + if ( ! empty($prices_to_remove)) { |
|
752 | + foreach ($prices_to_remove as $prc_id) { |
|
753 | 753 | $p = $current_prices_on_ticket[$prc_id]; |
754 | - $ticket->_remove_relation_to( $p, 'Price' ); |
|
754 | + $ticket->_remove_relation_to($p, 'Price'); |
|
755 | 755 | |
756 | 756 | //delete permanently the price |
757 | 757 | $p->delete_permanently(); |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | |
765 | 765 | |
766 | 766 | |
767 | - public function autosave_handling( $event_admin_obj ) { |
|
767 | + public function autosave_handling($event_admin_obj) { |
|
768 | 768 | return $event_admin_obj; //doing nothing for the moment. |
769 | 769 | //todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method) |
770 | 770 | |
@@ -798,12 +798,12 @@ discard block |
||
798 | 798 | |
799 | 799 | //default main template args |
800 | 800 | $main_template_args = array( |
801 | - 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
801 | + 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
802 | 802 | 'existing_datetime_ids' => '', |
803 | 803 | 'total_dtt_rows' => 1, |
804 | - 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
804 | + 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
805 | 805 | 'datetime_rows' => '', |
806 | - 'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
806 | + 'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
807 | 807 | 'ticket_rows' => '', |
808 | 808 | 'existing_ticket_ids' => '', |
809 | 809 | 'total_ticket_rows' => 1, |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | |
814 | 814 | $timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL; |
815 | 815 | |
816 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
816 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
817 | 817 | |
818 | 818 | /** |
819 | 819 | * 1. Start with retrieving Datetimes |
@@ -821,37 +821,37 @@ discard block |
||
821 | 821 | * 3. For each ticket get related prices |
822 | 822 | */ |
823 | 823 | |
824 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) ); |
|
825 | - $times = $DTM->get_all_event_dates( $evtID ); |
|
824 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone)); |
|
825 | + $times = $DTM->get_all_event_dates($evtID); |
|
826 | 826 | |
827 | 827 | |
828 | 828 | |
829 | 829 | $main_template_args['total_dtt_rows'] = count($times); |
830 | - foreach ( $times as $time ) { |
|
830 | + foreach ($times as $time) { |
|
831 | 831 | $dttid = $time->get('DTT_ID'); |
832 | 832 | $dttrow = $time->get('DTT_order'); |
833 | 833 | $existing_datetime_ids[] = $dttid; |
834 | 834 | |
835 | 835 | //tickets attached |
836 | - $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array(); |
|
836 | + $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array(); |
|
837 | 837 | |
838 | 838 | //if there are no related tickets this is likely a new event OR autodraft |
839 | 839 | // event so we need to generate the default tickets because dtts |
840 | 840 | // ALWAYS have at least one related ticket!!. EXCEPT, we dont' do this if there is already more than one |
841 | 841 | // datetime on the event. |
842 | - if ( empty ( $related_tickets ) && count( $times ) < 2 ) { |
|
842 | + if (empty ($related_tickets) && count($times) < 2) { |
|
843 | 843 | $related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
844 | 844 | |
845 | 845 | //this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save). |
846 | 846 | $default_prices = EEM_Price::instance()->get_all_default_prices(); |
847 | 847 | |
848 | - $main_default_ticket = reset( $related_tickets ); |
|
849 | - if ( $main_default_ticket instanceof EE_Ticket ) { |
|
850 | - foreach ( $default_prices as $default_price ) { |
|
851 | - if ( $default_price->is_base_price() ) { |
|
848 | + $main_default_ticket = reset($related_tickets); |
|
849 | + if ($main_default_ticket instanceof EE_Ticket) { |
|
850 | + foreach ($default_prices as $default_price) { |
|
851 | + if ($default_price->is_base_price()) { |
|
852 | 852 | continue; |
853 | 853 | } |
854 | - $main_default_ticket->cache( 'Price', $default_price ); |
|
854 | + $main_default_ticket->cache('Price', $default_price); |
|
855 | 855 | } |
856 | 856 | } |
857 | 857 | } |
@@ -860,11 +860,11 @@ discard block |
||
860 | 860 | //we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information. |
861 | 861 | |
862 | 862 | //loop through and setup the ticket rows and make sure the order is set. |
863 | - foreach ( $related_tickets as $ticket ) { |
|
863 | + foreach ($related_tickets as $ticket) { |
|
864 | 864 | $tktid = $ticket->get('TKT_ID'); |
865 | 865 | $tktrow = $ticket->get('TKT_row'); |
866 | 866 | //we only want unique tickets in our final display!! |
867 | - if ( !in_array( $tktid, $existing_ticket_ids ) ) { |
|
867 | + if ( ! in_array($tktid, $existing_ticket_ids)) { |
|
868 | 868 | $existing_ticket_ids[] = $tktid; |
869 | 869 | $all_tickets[] = $ticket; |
870 | 870 | } |
@@ -873,56 +873,56 @@ discard block |
||
873 | 873 | $datetime_tickets[$dttid][] = $tktrow; |
874 | 874 | |
875 | 875 | //temporary cache of this datetime info for this ticket for later processing of ticket rows. |
876 | - if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) |
|
876 | + if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid])) |
|
877 | 877 | $ticket_datetimes[$tktid][] = $dttrow; |
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
881 | - $main_template_args['total_ticket_rows'] = count( $existing_ticket_ids ); |
|
882 | - $main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
883 | - $main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
881 | + $main_template_args['total_ticket_rows'] = count($existing_ticket_ids); |
|
882 | + $main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
883 | + $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
884 | 884 | |
885 | 885 | //sort $all_tickets by order |
886 | - usort( $all_tickets, function( $a, $b ) { |
|
886 | + usort($all_tickets, function($a, $b) { |
|
887 | 887 | $a_order = (int) $a->get('TKT_order'); |
888 | 888 | $b_order = (int) $b->get('TKT_order'); |
889 | - if ( $a_order == $b_order ) { |
|
889 | + if ($a_order == $b_order) { |
|
890 | 890 | return 0; |
891 | 891 | } |
892 | - return ( $a_order < $b_order ) ? -1 : 1; |
|
892 | + return ($a_order < $b_order) ? -1 : 1; |
|
893 | 893 | }); |
894 | 894 | |
895 | 895 | //k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again. |
896 | 896 | $dttrow = 1; |
897 | - foreach ( $times as $time ) { |
|
898 | - $main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times ); |
|
897 | + foreach ($times as $time) { |
|
898 | + $main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times); |
|
899 | 899 | $dttrow++; |
900 | 900 | } |
901 | 901 | |
902 | 902 | //then loop through all tickets for the ticket rows. |
903 | 903 | $tktrow = 1; |
904 | - foreach ( $all_tickets as $ticket ) { |
|
905 | - $main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets ); |
|
904 | + foreach ($all_tickets as $ticket) { |
|
905 | + $main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets); |
|
906 | 906 | $tktrow++; |
907 | 907 | } |
908 | 908 | |
909 | 909 | $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets); |
910 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'; |
|
911 | - EEH_Template::display_template( $template, $main_template_args ); |
|
910 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'; |
|
911 | + EEH_Template::display_template($template, $main_template_args); |
|
912 | 912 | return; |
913 | 913 | } |
914 | 914 | |
915 | 915 | |
916 | 916 | |
917 | - protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) { |
|
917 | + protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) { |
|
918 | 918 | |
919 | 919 | $dtt_display_template_args = array( |
920 | - 'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ), |
|
921 | - 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ), |
|
920 | + 'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts), |
|
921 | + 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default), |
|
922 | 922 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow |
923 | 923 | ); |
924 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php'; |
|
925 | - return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE); |
|
924 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php'; |
|
925 | + return EEH_Template::display_template($template, $dtt_display_template_args, TRUE); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return string Generated edit row. |
942 | 942 | */ |
943 | - protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) { |
|
943 | + protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) { |
|
944 | 944 | |
945 | 945 | // if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true. |
946 | 946 | $default = ! $dtt instanceof EE_Datetime ? true : false; |
@@ -948,30 +948,30 @@ discard block |
||
948 | 948 | $template_args = array( |
949 | 949 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
950 | 950 | 'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes', |
951 | - 'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
951 | + 'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
952 | 952 | 'DTT_ID' => $default ? '' : $dtt->ID(), |
953 | 953 | 'DTT_name' => $default ? '' : $dtt->name(), |
954 | 954 | 'DTT_description' => $default ? '' : $dtt->description(), |
955 | - 'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
956 | - 'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
957 | - 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'), |
|
955 | + 'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
956 | + 'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
957 | + 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'), |
|
958 | 958 | 'DTT_order' => $default ? 'DTTNUM' : $dttrow, |
959 | 959 | 'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'), |
960 | - 'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
961 | - 'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable' |
|
960 | + 'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
961 | + 'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable' |
|
962 | 962 | ); |
963 | 963 | |
964 | - $template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
964 | + $template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
965 | 965 | |
966 | 966 | //allow filtering of template args at this point. |
967 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event ); |
|
967 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event); |
|
968 | 968 | |
969 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php'; |
|
970 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
969 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php'; |
|
970 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
971 | 971 | } |
972 | 972 | |
973 | 973 | |
974 | - protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) { |
|
974 | + protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) { |
|
975 | 975 | |
976 | 976 | $template_args = array( |
977 | 977 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
@@ -979,47 +979,47 @@ discard block |
||
979 | 979 | 'DTT_description' => $default ? '' : $dtt->description(), |
980 | 980 | 'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '', |
981 | 981 | 'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '', |
982 | - 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
982 | + 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
983 | 983 | 'DTT_ID' => $default ? '' : $dtt->ID() |
984 | 984 | ); |
985 | 985 | |
986 | 986 | //need to setup the list items (but only if this isnt' a default skeleton setup) |
987 | - if ( !$default ) { |
|
987 | + if ( ! $default) { |
|
988 | 988 | $tktrow = 1; |
989 | - foreach ( $all_tickets as $ticket ) { |
|
990 | - $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ); |
|
989 | + foreach ($all_tickets as $ticket) { |
|
990 | + $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default); |
|
991 | 991 | $tktrow++; |
992 | 992 | } |
993 | 993 | } |
994 | 994 | |
995 | 995 | //filter template args at this point |
996 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event ); |
|
996 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event); |
|
997 | 997 | |
998 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php'; |
|
999 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
998 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php'; |
|
999 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | |
1003 | 1003 | |
1004 | - protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) { |
|
1005 | - $tktid = !empty( $ticket ) ? $ticket->ID() : 0; |
|
1006 | - $dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array(); |
|
1004 | + protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) { |
|
1005 | + $tktid = ! empty($ticket) ? $ticket->ID() : 0; |
|
1006 | + $dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array(); |
|
1007 | 1007 | |
1008 | - $displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0; |
|
1008 | + $displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0; |
|
1009 | 1009 | $template_args = array( |
1010 | 1010 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
1011 | - 'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow, |
|
1011 | + 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
|
1012 | 1012 | 'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '', |
1013 | 1013 | 'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '', |
1014 | - 'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
1015 | - 'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(), |
|
1014 | + 'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
1015 | + 'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(), |
|
1016 | 1016 | ); |
1017 | 1017 | |
1018 | 1018 | //filter template args |
1019 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event ); |
|
1019 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event); |
|
1020 | 1020 | |
1021 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1022 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1021 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1022 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | |
@@ -1041,37 +1041,37 @@ discard block |
||
1041 | 1041 | * |
1042 | 1042 | * @return [type] [description] |
1043 | 1043 | */ |
1044 | - protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) { |
|
1044 | + protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) { |
|
1045 | 1045 | |
1046 | 1046 | //if $ticket is not an instance of EE_Ticket then force default to true. |
1047 | - $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1047 | + $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1048 | 1048 | |
1049 | - $prices = ! empty( $ticket ) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array(); |
|
1049 | + $prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array(); |
|
1050 | 1050 | |
1051 | 1051 | //if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on |
1052 | 1052 | //the object. This is done by not including any query_params. |
1053 | - if ( $ticket instanceof EE_Ticket && $ticket->is_default() && ( count( $prices ) === 1 || empty( $prices ) ) ) { |
|
1054 | - $prices = $ticket->get_many_related( 'Price' ); |
|
1053 | + if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) { |
|
1054 | + $prices = $ticket->get_many_related('Price'); |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | // check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket). This will future proof in case there is ever any behaviour change between what the primary_key defaults to. |
1058 | - $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE; |
|
1058 | + $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE; |
|
1059 | 1059 | |
1060 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1060 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1061 | 1061 | |
1062 | 1062 | $ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal(); |
1063 | - $base_price = $default ? NULL : $ticket->base_price(); |
|
1063 | + $base_price = $default ? NULL : $ticket->base_price(); |
|
1064 | 1064 | $count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE); |
1065 | 1065 | |
1066 | 1066 | //breaking out complicated condition for ticket_status |
1067 | - if ( $default ) { |
|
1068 | - $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale; |
|
1067 | + if ($default) { |
|
1068 | + $ticket_status_class = ' tkt-status-'.EE_Ticket::onsale; |
|
1069 | 1069 | } else { |
1070 | - $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(); |
|
1070 | + $ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(); |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | //breaking out complicated condition for TKT_taxable |
1074 | - if ( $default ) { |
|
1074 | + if ($default) { |
|
1075 | 1075 | $TKT_taxable = ''; |
1076 | 1076 | } else { |
1077 | 1077 | $TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : ''; |
@@ -1086,19 +1086,19 @@ discard block |
||
1086 | 1086 | 'edit_tkt_expanded' => '', |
1087 | 1087 | 'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets', |
1088 | 1088 | 'TKT_name' => $default ? '' : $ticket->get('TKT_name'), |
1089 | - 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
1090 | - 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
1091 | - 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE), |
|
1089 | + 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1090 | + 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1091 | + 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE), |
|
1092 | 1092 | 'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE), |
1093 | 1093 | 'TKT_price_code' => EE_Registry::instance()->CFG->currency->code, |
1094 | 1094 | 'TKT_price_amount' => $default ? 0 : $ticket_subtotal, |
1095 | - 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'), |
|
1096 | - 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'), |
|
1097 | - 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'), |
|
1098 | - 'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ), |
|
1099 | - 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max','input'), |
|
1095 | + 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'), |
|
1096 | + 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'), |
|
1097 | + 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'), |
|
1098 | + 'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')), |
|
1099 | + 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'), |
|
1100 | 1100 | 'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'), |
1101 | - 'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ), |
|
1101 | + 'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))), |
|
1102 | 1102 | 'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'), |
1103 | 1103 | 'TKT_description' => $default ? '' : $ticket->get('TKT_description'), |
1104 | 1104 | 'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'), |
@@ -1107,99 +1107,99 @@ discard block |
||
1107 | 1107 | 'ticket_price_rows' => '', |
1108 | 1108 | 'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'), |
1109 | 1109 | 'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(), |
1110 | - 'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"', |
|
1111 | - 'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '', |
|
1110 | + 'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"', |
|
1111 | + 'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '', |
|
1112 | 1112 | 'total_price_rows' => count($prices) > 1 ? count($prices) : 1, |
1113 | 1113 | 'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '', |
1114 | 1114 | 'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts), |
1115 | 1115 | 'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts), |
1116 | - 'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ), |
|
1116 | + 'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)), |
|
1117 | 1117 | 'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'), |
1118 | 1118 | 'TKT_taxable' => $TKT_taxable, |
1119 | 1119 | 'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"', |
1120 | 1120 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1121 | - 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ), |
|
1121 | + 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE), |
|
1122 | 1122 | 'TKT_subtotal_amount' => $ticket_subtotal, |
1123 | - 'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ), |
|
1124 | - 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE, |
|
1123 | + 'tax_rows' => $this->_get_tax_rows($tktrow, $ticket), |
|
1124 | + 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE, |
|
1125 | 1125 | 'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '', |
1126 | 1126 | 'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable', |
1127 | 1127 | 'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable' |
1128 | 1128 | ); |
1129 | 1129 | |
1130 | - $template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1130 | + $template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1131 | 1131 | |
1132 | 1132 | //handle rows that should NOT be empty |
1133 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1133 | + if (empty($template_args['TKT_start_date'])) { |
|
1134 | 1134 | //if empty then the start date will be now. |
1135 | - $template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp')); |
|
1136 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1135 | + $template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp')); |
|
1136 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1137 | 1137 | } |
1138 | 1138 | |
1139 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1139 | + if (empty($template_args['TKT_end_date'])) { |
|
1140 | 1140 | |
1141 | 1141 | //get the earliest datetime (if present); |
1142 | - $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1142 | + $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1143 | 1143 | |
1144 | - if ( !empty( $earliest_dtt ) ) { |
|
1145 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
1144 | + if ( ! empty($earliest_dtt)) { |
|
1145 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
1146 | 1146 | } else { |
1147 | 1147 | //default so let's just use what's been set for the default date-time which is 30 days from now. |
1148 | - $template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") ) ); |
|
1148 | + $template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y"))); |
|
1149 | 1149 | } |
1150 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1150 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1151 | 1151 | } |
1152 | 1152 | |
1153 | 1153 | //generate ticket_datetime items |
1154 | - if ( ! $default ) { |
|
1154 | + if ( ! $default) { |
|
1155 | 1155 | $dttrow = 1; |
1156 | - foreach ( $all_dtts as $dtt ) { |
|
1157 | - $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ); |
|
1156 | + foreach ($all_dtts as $dtt) { |
|
1157 | + $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default); |
|
1158 | 1158 | $dttrow++; |
1159 | 1159 | } |
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | $prcrow = 1; |
1163 | - foreach ( $prices as $price ) { |
|
1164 | - if ( $price->is_base_price() ) { |
|
1163 | + foreach ($prices as $price) { |
|
1164 | + if ($price->is_base_price()) { |
|
1165 | 1165 | $prcrow++; |
1166 | 1166 | continue; |
1167 | 1167 | } |
1168 | - $show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1 ? FALSE : TRUE; |
|
1169 | - $show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE; |
|
1170 | - $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create ); |
|
1168 | + $show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE; |
|
1169 | + $show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE; |
|
1170 | + $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create); |
|
1171 | 1171 | $prcrow++; |
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | //filter $template_args |
1175 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event ); |
|
1175 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event); |
|
1176 | 1176 | |
1177 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php'; |
|
1178 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1177 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php'; |
|
1178 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1179 | 1179 | } |
1180 | 1180 | |
1181 | 1181 | |
1182 | 1182 | |
1183 | 1183 | |
1184 | 1184 | |
1185 | - protected function _get_tax_rows( $tktrow, $ticket ) { |
|
1185 | + protected function _get_tax_rows($tktrow, $ticket) { |
|
1186 | 1186 | $tax_rows = ''; |
1187 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1187 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1188 | 1188 | $template_args = array(); |
1189 | - $taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1190 | - foreach ( $taxes as $tax ) { |
|
1191 | - $tax_added = $this->_get_tax_added( $tax, $ticket ); |
|
1189 | + $taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1190 | + foreach ($taxes as $tax) { |
|
1191 | + $tax_added = $this->_get_tax_added($tax, $ticket); |
|
1192 | 1192 | $template_args = array( |
1193 | - 'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1193 | + 'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1194 | 1194 | 'tax_id' => $tax->ID(), |
1195 | 1195 | 'tkt_row' => $tktrow, |
1196 | 1196 | 'tax_label' => $tax->get('PRC_name'), |
1197 | 1197 | 'tax_added' => $tax_added, |
1198 | - 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ), |
|
1198 | + 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE), |
|
1199 | 1199 | 'tax_amount' => $tax->get('PRC_amount') |
1200 | 1200 | ); |
1201 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event ); |
|
1202 | - $tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1201 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event); |
|
1202 | + $tax_rows .= EEH_Template::display_template($template, $template_args, TRUE); |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | |
@@ -1207,81 +1207,81 @@ discard block |
||
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | |
1210 | - protected function _get_tax_added( EE_Price $tax, $ticket ) { |
|
1211 | - $subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal(); |
|
1210 | + protected function _get_tax_added(EE_Price $tax, $ticket) { |
|
1211 | + $subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal(); |
|
1212 | 1212 | return $subtotal * $tax->get('PRC_amount') / 100; |
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | |
1216 | 1216 | |
1217 | 1217 | |
1218 | - protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) { |
|
1219 | - $send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1218 | + protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) { |
|
1219 | + $send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1220 | 1220 | $template_args = array( |
1221 | 1221 | 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
1222 | 1222 | 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
1223 | 1223 | 'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices', |
1224 | - 'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ), |
|
1224 | + 'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled), |
|
1225 | 1225 | 'PRC_ID' => $default && empty($price) ? 0 : $price->ID(), |
1226 | 1226 | 'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'), |
1227 | 1227 | 'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'), |
1228 | 1228 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1229 | 1229 | 'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"', |
1230 | - 'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1231 | - 'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1232 | - 'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ), |
|
1233 | - 'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1234 | - 'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ), |
|
1230 | + 'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1231 | + 'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1232 | + 'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''), |
|
1233 | + 'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1234 | + 'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'), |
|
1235 | 1235 | 'show_trash_icon' => $show_trash ? '' : ' style="display:none;"', |
1236 | 1236 | 'show_create_button' => $show_create ? '' : ' style="display:none;"', |
1237 | - 'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'), |
|
1238 | - 'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1237 | + 'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'), |
|
1238 | + 'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1239 | 1239 | ); |
1240 | 1240 | |
1241 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event ); |
|
1241 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event); |
|
1242 | 1242 | |
1243 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php'; |
|
1244 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1243 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php'; |
|
1244 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | |
1248 | - protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1249 | - if ( $price->is_base_price() ) { |
|
1250 | - return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ); |
|
1248 | + protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1249 | + if ($price->is_base_price()) { |
|
1250 | + return $this->_get_base_price_template($tktrow, $prcrow, $price, $default); |
|
1251 | 1251 | } else { |
1252 | - return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled ); |
|
1252 | + return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled); |
|
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
1258 | - protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) { |
|
1258 | + protected function _get_base_price_template($tktrow, $prcrow, $price, $default) { |
|
1259 | 1259 | $template_args = array( |
1260 | 1260 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1261 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1262 | - 'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'), |
|
1261 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1262 | + 'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'), |
|
1263 | 1263 | 'PRT_name' => __('Price', 'event_espresso'), |
1264 | 1264 | 'price_selected_operator' => '+', |
1265 | 1265 | 'price_selected_is_percent' => 0 |
1266 | 1266 | ); |
1267 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php'; |
|
1267 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php'; |
|
1268 | 1268 | |
1269 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event ); |
|
1269 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event); |
|
1270 | 1270 | |
1271 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1271 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | |
1275 | 1275 | |
1276 | - protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1277 | - $select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]'; |
|
1278 | - $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) ); |
|
1279 | - $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php'; |
|
1280 | - $all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array(); |
|
1281 | - $selected_price_type_id = $default && empty( $price ) ? 0 : $price->type(); |
|
1276 | + protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1277 | + $select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]'; |
|
1278 | + $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3')))); |
|
1279 | + $price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php'; |
|
1280 | + $all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array(); |
|
1281 | + $selected_price_type_id = $default && empty($price) ? 0 : $price->type(); |
|
1282 | 1282 | $price_option_spans = ''; |
1283 | 1283 | //setup pricetypes for selector |
1284 | - foreach ( $price_types as $price_type ) { |
|
1284 | + foreach ($price_types as $price_type) { |
|
1285 | 1285 | $all_price_types[] = array( |
1286 | 1286 | 'id' => $price_type->ID(), |
1287 | 1287 | 'text' => $price_type->get('PRT_name'), |
@@ -1293,50 +1293,50 @@ discard block |
||
1293 | 1293 | 'PRT_operator' => $price_type->is_discount() ? '-' : '+', |
1294 | 1294 | 'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0 |
1295 | 1295 | ); |
1296 | - $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE ); |
|
1296 | + $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | - $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1299 | + $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1300 | 1300 | $main_name = $select_name; |
1301 | - $select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name; |
|
1301 | + $select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name; |
|
1302 | 1302 | |
1303 | 1303 | $template_args = array( |
1304 | 1304 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1305 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1306 | - 'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ), |
|
1305 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1306 | + 'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'), |
|
1307 | 1307 | 'main_name' => $main_name, |
1308 | 1308 | 'selected_price_type_id' => $selected_price_type_id, |
1309 | 1309 | 'price_option_spans' => $price_option_spans, |
1310 | - 'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ), |
|
1311 | - 'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ), |
|
1310 | + 'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'), |
|
1311 | + 'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0), |
|
1312 | 1312 | 'disabled' => $disabled |
1313 | 1313 | ); |
1314 | 1314 | |
1315 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event ); |
|
1315 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event); |
|
1316 | 1316 | |
1317 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1317 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1318 | 1318 | |
1319 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1319 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | |
1323 | 1323 | |
1324 | - protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) { |
|
1325 | - $dttid = !empty($dtt) ? $dtt->ID() : 0; |
|
1326 | - $displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1327 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1324 | + protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) { |
|
1325 | + $dttid = ! empty($dtt) ? $dtt->ID() : 0; |
|
1326 | + $displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1327 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1328 | 1328 | $template_args = array( |
1329 | - 'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow, |
|
1329 | + 'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow, |
|
1330 | 1330 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1331 | - 'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '', |
|
1332 | - 'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '', |
|
1333 | - 'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ), |
|
1331 | + 'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '', |
|
1332 | + 'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '', |
|
1333 | + 'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE), |
|
1334 | 1334 | 'tkt_status_class' => '', |
1335 | 1335 | ); |
1336 | 1336 | |
1337 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event ); |
|
1338 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1339 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1337 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event); |
|
1338 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1339 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | |
@@ -1344,53 +1344,53 @@ discard block |
||
1344 | 1344 | protected function _get_ticket_js_structure($all_dtts, $all_tickets) { |
1345 | 1345 | $template_args = array( |
1346 | 1346 | 'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts), |
1347 | - 'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE), |
|
1348 | - 'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ), |
|
1347 | + 'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE), |
|
1348 | + 'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL), |
|
1349 | 1349 | 'default_price_rows' => '', |
1350 | 1350 | 'default_base_price_amount' => 0, |
1351 | 1351 | 'default_base_price_name' => '', |
1352 | 1352 | 'default_base_price_description' => '', |
1353 | - 'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ), |
|
1354 | - 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ), |
|
1353 | + 'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE), |
|
1354 | + 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE), |
|
1355 | 1355 | 'existing_available_datetime_tickets_list' => '', |
1356 | 1356 | 'existing_available_ticket_datetimes_list' => '', |
1357 | - 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ), |
|
1358 | - 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ) |
|
1357 | + 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE), |
|
1358 | + 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE) |
|
1359 | 1359 | ); |
1360 | 1360 | |
1361 | 1361 | $tktrow = 1; |
1362 | - foreach ( $all_tickets as $ticket ) { |
|
1363 | - $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE ); |
|
1362 | + foreach ($all_tickets as $ticket) { |
|
1363 | + $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE); |
|
1364 | 1364 | $tktrow++; |
1365 | 1365 | } |
1366 | 1366 | |
1367 | 1367 | |
1368 | 1368 | $dttrow = 1; |
1369 | - foreach ( $all_dtts as $dtt ) { |
|
1370 | - $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE ); |
|
1369 | + foreach ($all_dtts as $dtt) { |
|
1370 | + $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE); |
|
1371 | 1371 | $dttrow++; |
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | $default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices(); |
1375 | 1375 | $prcrow = 1; |
1376 | - foreach ( $default_prices as $price ) { |
|
1377 | - if ( $price->is_base_price() ) { |
|
1376 | + foreach ($default_prices as $price) { |
|
1377 | + if ($price->is_base_price()) { |
|
1378 | 1378 | $template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float'); |
1379 | 1379 | $template_args['default_base_price_name'] = $price->get('PRC_name'); |
1380 | 1380 | $template_args['default_base_price_description'] = $price->get('PRC_desc'); |
1381 | 1381 | $prcrow++; |
1382 | 1382 | continue; |
1383 | 1383 | } |
1384 | - $show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1 ? FALSE : TRUE; |
|
1385 | - $show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE; |
|
1386 | - $template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create ); |
|
1384 | + $show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE; |
|
1385 | + $show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE; |
|
1386 | + $template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create); |
|
1387 | 1387 | $prcrow++; |
1388 | 1388 | } |
1389 | 1389 | |
1390 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event ); |
|
1390 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event); |
|
1391 | 1391 | |
1392 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1393 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1392 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1393 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param bool $routing |
43 | 43 | * @return Registrations_Admin_Page |
44 | 44 | */ |
45 | - public function __construct( $routing = TRUE ) { |
|
46 | - parent::__construct( $routing ); |
|
45 | + public function __construct($routing = TRUE) { |
|
46 | + parent::__construct($routing); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | 'trash' => 'post.php' |
76 | 76 | ); |
77 | 77 | |
78 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
78 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
79 | 79 | //add filters so that the comment urls don't take users to a confusing 404 page |
80 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
80 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | - public function clear_comment_link( $link, $comment, $args ) { |
|
84 | + public function clear_comment_link($link, $comment, $args) { |
|
85 | 85 | //gotta make sure this only happens on this route |
86 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
87 | - if ( $post_type == 'espresso_attendees' ) |
|
86 | + $post_type = get_post_type($comment->comment_post_ID); |
|
87 | + if ($post_type == 'espresso_attendees') |
|
88 | 88 | return '#commentsdiv'; |
89 | 89 | return $link; |
90 | 90 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | protected function _ajax_hooks() { |
94 | 94 | //todo: all hooks for registrations ajax goes in here |
95 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
95 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
108 | 108 | 'edit' => __('Edit Contact', 'event_espresso'), |
109 | 109 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
110 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
111 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
110 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
111 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
112 | 112 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
113 | 113 | ), |
114 | 114 | 'publishbox' => array( |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | |
137 | 137 | $this->_get_registration_status_array(); |
138 | 138 | |
139 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
140 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
141 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
139 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
140 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
141 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
142 | 142 | |
143 | 143 | $this->_page_routes = array( |
144 | 144 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | 'edit_registration' => array( |
157 | 157 | 'func' => '_registration_details', |
158 | - 'args' => array( 'edit' ), |
|
158 | + 'args' => array('edit'), |
|
159 | 159 | 'noheader' => TRUE, |
160 | 160 | 'capability' => 'ee_edit_registration', |
161 | 161 | 'obj_id' => $reg_id |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | 'restore_registrations' => array( |
172 | 172 | 'func' => '_trash_or_restore_registrations', |
173 | - 'args' => array( 'trash' => FALSE ), |
|
173 | + 'args' => array('trash' => FALSE), |
|
174 | 174 | 'noheader' => TRUE, |
175 | 175 | 'capability' => 'ee_delete_registrations' |
176 | 176 | ), |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | 'filename' => 'registrations_overview_other' |
405 | 405 | ) |
406 | 406 | ), |
407 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
407 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
408 | 408 | 'qtips' => array('Registration_List_Table_Tips'), |
409 | 409 | 'list_table' => 'EE_Registrations_List_Table', |
410 | 410 | 'require_nonce' => FALSE |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'nav' => array( |
415 | 415 | 'label' => __('REG Details', 'event_espresso'), |
416 | 416 | 'order' => 15, |
417 | - '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, |
|
417 | + '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, |
|
418 | 418 | 'persistent' => FALSE |
419 | 419 | ), |
420 | 420 | 'help_tabs' => array( |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | 'filename' => 'registrations_details_registrant_details' |
436 | 436 | ) |
437 | 437 | ), |
438 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
439 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
438 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
439 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
440 | 440 | 'require_nonce' => FALSE |
441 | 441 | ), |
442 | 442 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | 'order' => 15, |
461 | 461 | 'persistent' => FALSE |
462 | 462 | ), |
463 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
463 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
464 | 464 | 'require_nonce' => FALSE |
465 | 465 | ), |
466 | 466 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | 'label' => __('Edit Contact', 'event_espresso'), |
470 | 470 | 'order' => 15, |
471 | 471 | 'persistent' => FALSE, |
472 | - '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 |
|
472 | + '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 |
|
473 | 473 | ), |
474 | 474 | 'metaboxes' => array('attendee_editor_metaboxes'), |
475 | 475 | 'require_nonce' => FALSE |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | 'filename' => 'registrations_contact_list_other' |
500 | 500 | ) |
501 | 501 | ), |
502 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
502 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
503 | 503 | 'metaboxes' => array(), |
504 | 504 | 'require_nonce' => FALSE |
505 | 505 | ), |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | protected function _add_screen_options() {} |
519 | 519 | protected function _add_feature_pointers() {} |
520 | 520 | public function admin_init() { |
521 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
521 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
522 | 522 | } |
523 | 523 | public function admin_notices() {} |
524 | 524 | public function admin_footer_scripts() {} |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | * @return void |
537 | 537 | */ |
538 | 538 | private function _get_registration_status_array() { |
539 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
539 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | |
@@ -559,11 +559,11 @@ discard block |
||
559 | 559 | public function load_scripts_styles() { |
560 | 560 | //style |
561 | 561 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
562 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
562 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
563 | 563 | wp_enqueue_style('espresso_reg'); |
564 | 564 | |
565 | 565 | //script |
566 | - 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); |
|
566 | + 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); |
|
567 | 567 | wp_enqueue_script('espresso_reg'); |
568 | 568 | } |
569 | 569 | |
@@ -572,9 +572,9 @@ discard block |
||
572 | 572 | public function load_scripts_styles_edit_attendee() { |
573 | 573 | //stuff to only show up on our attendee edit details page. |
574 | 574 | $attendee_details_translations = array( |
575 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
575 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
576 | 576 | ); |
577 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
577 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
578 | 578 | wp_enqueue_script('jquery-validate'); |
579 | 579 | } |
580 | 580 | |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | |
593 | 593 | public function load_scripts_styles_contact_list() { |
594 | 594 | wp_deregister_style('espresso_reg'); |
595 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
595 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
596 | 596 | wp_enqueue_style('espresso_att'); |
597 | 597 | } |
598 | 598 | |
@@ -601,9 +601,9 @@ discard block |
||
601 | 601 | |
602 | 602 | |
603 | 603 | public function load_scripts_styles_new_registration() { |
604 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
604 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
605 | 605 | wp_enqueue_script('ee-spco-for-admin'); |
606 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
606 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
607 | 607 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
608 | 608 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
609 | 609 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -642,23 +642,23 @@ discard block |
||
642 | 642 | |
643 | 643 | /** setup reg status bulk actions **/ |
644 | 644 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
645 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
645 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
646 | 646 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
647 | 647 | } |
648 | 648 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
649 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
649 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
650 | 650 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
651 | 651 | } |
652 | 652 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
653 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
653 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
654 | 654 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
655 | 655 | } |
656 | 656 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
657 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
657 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
658 | 658 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
659 | 659 | } |
660 | 660 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
661 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
661 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
662 | 662 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
663 | 663 | } |
664 | 664 | |
@@ -667,29 +667,29 @@ discard block |
||
667 | 667 | 'slug' => 'all', |
668 | 668 | 'label' => __('View All Registrations', 'event_espresso'), |
669 | 669 | 'count' => 0, |
670 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
670 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
671 | 671 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
672 | - ) ) |
|
672 | + )) |
|
673 | 673 | ), |
674 | 674 | 'month' => array( |
675 | 675 | 'slug' => 'month', |
676 | 676 | 'label' => __('This Month', 'event_espresso'), |
677 | 677 | 'count' => 0, |
678 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
678 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
679 | 679 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
680 | 680 | )) |
681 | 681 | ), |
682 | 682 | 'today' => array( |
683 | 683 | 'slug' => 'today', |
684 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
684 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
685 | 685 | 'count' => 0, |
686 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
686 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
687 | 687 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
688 | 688 | )) |
689 | 689 | ) |
690 | 690 | ); |
691 | 691 | |
692 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
692 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
693 | 693 | $this->_views['incomplete'] = array( |
694 | 694 | 'slug' => 'incomplete', |
695 | 695 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | ) |
726 | 726 | ); |
727 | 727 | |
728 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
728 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
729 | 729 | $this->_views['trash'] = array( |
730 | 730 | 'slug' => 'trash', |
731 | 731 | 'label' => __('Trash', 'event_espresso'), |
@@ -764,42 +764,42 @@ discard block |
||
764 | 764 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
765 | 765 | ), |
766 | 766 | ); |
767 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
767 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
768 | 768 | $fc_items['resend_registration'] = array( |
769 | 769 | 'class' => 'dashicons dashicons-email-alt', |
770 | 770 | 'desc' => __('Resend Registration Details', 'event_espresso') |
771 | 771 | ); |
772 | 772 | } else { |
773 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
773 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | $sc_items = array( |
777 | 777 | 'approved_status' => array( |
778 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
779 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
778 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
779 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
780 | 780 | ), |
781 | 781 | 'pending_status' => array( |
782 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
783 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
782 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
783 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
784 | 784 | ), |
785 | 785 | 'incomplete_status' => array( |
786 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
787 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
786 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
787 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
788 | 788 | ), |
789 | 789 | 'not_approved' => array( |
790 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
791 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
790 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
791 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
792 | 792 | ), |
793 | 793 | 'declined_status' => array( |
794 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
795 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
794 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
795 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
796 | 796 | ), |
797 | 797 | 'cancelled_status' => array( |
798 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
799 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
798 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
799 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
800 | 800 | ) |
801 | 801 | ); |
802 | - return array_merge( $fc_items, $sc_items ); |
|
802 | + return array_merge($fc_items, $sc_items); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | |
@@ -812,15 +812,15 @@ discard block |
||
812 | 812 | |
813 | 813 | |
814 | 814 | protected function _registrations_overview_list_table() { |
815 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
816 | - if ( $EVT_ID ) { |
|
817 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
818 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
815 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
816 | + if ($EVT_ID) { |
|
817 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
818 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
819 | 819 | } |
820 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
821 | - $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>' ) : ''; |
|
820 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
821 | + $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>') : ''; |
|
822 | 822 | } |
823 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
823 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
824 | 824 | $this->display_admin_list_table_page_with_no_sidebar(); |
825 | 825 | } |
826 | 826 | |
@@ -835,19 +835,19 @@ discard block |
||
835 | 835 | */ |
836 | 836 | private function _set_registration_object() { |
837 | 837 | //get out if we've already set the object |
838 | - if ( is_object( $this->_registration )) { |
|
838 | + if (is_object($this->_registration)) { |
|
839 | 839 | return TRUE; |
840 | 840 | } |
841 | 841 | |
842 | 842 | $REG = EEM_Registration::instance(); |
843 | 843 | |
844 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
844 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
845 | 845 | |
846 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
846 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
847 | 847 | return TRUE; |
848 | 848 | else { |
849 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
850 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
849 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
850 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
851 | 851 | $this->_registration = NULL; |
852 | 852 | return FALSE; |
853 | 853 | } |
@@ -866,25 +866,25 @@ discard block |
||
866 | 866 | * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set) |
867 | 867 | * @return mixed (int|array) int = count || array of registration objects |
868 | 868 | */ |
869 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
870 | - |
|
871 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
872 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
873 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
874 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
875 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
876 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
869 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
870 | + |
|
871 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
872 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
873 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
874 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
875 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
876 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
877 | 877 | $start_date = FALSE; |
878 | 878 | $end_date = FALSE; |
879 | 879 | $_where = array(); |
880 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
881 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
880 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
881 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
882 | 882 | |
883 | 883 | //set orderby |
884 | 884 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
885 | 885 | |
886 | 886 | |
887 | - switch ( $this->_req_data['orderby'] ) { |
|
887 | + switch ($this->_req_data['orderby']) { |
|
888 | 888 | case '_REG_ID': |
889 | 889 | $orderby = 'REG_ID'; |
890 | 890 | break; |
@@ -904,26 +904,26 @@ discard block |
||
904 | 904 | $orderby = 'REG_date'; |
905 | 905 | } |
906 | 906 | |
907 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
908 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
909 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
907 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
908 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
909 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
910 | 910 | |
911 | 911 | |
912 | - $offset = ($current_page-1)*$per_page; |
|
913 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
912 | + $offset = ($current_page - 1) * $per_page; |
|
913 | + $limit = $count ? NULL : array($offset, $per_page); |
|
914 | 914 | |
915 | - if($EVT_ID){ |
|
916 | - $_where['EVT_ID']=$EVT_ID; |
|
915 | + if ($EVT_ID) { |
|
916 | + $_where['EVT_ID'] = $EVT_ID; |
|
917 | 917 | } |
918 | - if($CAT_ID){ |
|
918 | + if ($CAT_ID) { |
|
919 | 919 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
920 | 920 | } |
921 | - if ( $incomplete ) { |
|
921 | + if ($incomplete) { |
|
922 | 922 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
923 | 923 | } else if ( ! $trash) { |
924 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
924 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
925 | 925 | } |
926 | - if($reg_status){ |
|
926 | + if ($reg_status) { |
|
927 | 927 | $_where['STS_ID'] = $reg_status; |
928 | 928 | } |
929 | 929 | |
@@ -935,105 +935,105 @@ discard block |
||
935 | 935 | $time_start = ' 00:00:00'; |
936 | 936 | $time_end = ' 23:59:59'; |
937 | 937 | |
938 | - if($today_a || $today ){ |
|
938 | + if ($today_a || $today) { |
|
939 | 939 | $curdate = date('Y-m-d', current_time('timestamp')); |
940 | - $_where['REG_date']= array('BETWEEN', |
|
940 | + $_where['REG_date'] = array('BETWEEN', |
|
941 | 941 | array( |
942 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
943 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
942 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
943 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
944 | 944 | )); |
945 | - }elseif($this_month_a || $this_month){ |
|
945 | + }elseif ($this_month_a || $this_month) { |
|
946 | 946 | $this_month_r = date('m', current_time('timestamp')); |
947 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
948 | - $_where['REG_date']= array('BETWEEN', |
|
947 | + $days_this_month = date('t', current_time('timestamp')); |
|
948 | + $_where['REG_date'] = array('BETWEEN', |
|
949 | 949 | array( |
950 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
951 | - 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' ) |
|
950 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
951 | + 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') |
|
952 | 952 | )); |
953 | - }elseif($month_range){ |
|
953 | + }elseif ($month_range) { |
|
954 | 954 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
955 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
956 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
957 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
958 | - $_where['REG_date']= array('BETWEEN', |
|
959 | - 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' ) ) ); |
|
960 | - }elseif($start_date && $end_date){ |
|
955 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
956 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
957 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
958 | + $_where['REG_date'] = array('BETWEEN', |
|
959 | + 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'))); |
|
960 | + }elseif ($start_date && $end_date) { |
|
961 | 961 | throw new EE_Error("not yet supported"); |
962 | - }elseif($start_date){ |
|
962 | + }elseif ($start_date) { |
|
963 | 963 | throw new EE_Error("not yet supported"); |
964 | - }elseif($end_date){ |
|
964 | + }elseif ($end_date) { |
|
965 | 965 | throw new EE_Error("not yet supported"); |
966 | 966 | } |
967 | 967 | |
968 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
969 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
968 | + if ( ! empty($this->_req_data['s'])) { |
|
969 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
970 | 970 | $_where['OR'] = array( |
971 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
972 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
973 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
974 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
975 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
976 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
977 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
978 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
979 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
980 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
981 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
982 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
983 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
984 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
985 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
986 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
987 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
988 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
971 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
972 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
973 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
974 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
975 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
976 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
977 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
978 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
979 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
980 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
981 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
982 | + 'REG_final_price' => array('LIKE', $sstr), |
|
983 | + 'REG_code' => array('LIKE', $sstr), |
|
984 | + 'REG_count' => array('LIKE', $sstr), |
|
985 | + 'REG_group_size' => array('LIKE', $sstr), |
|
986 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
987 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
988 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
989 | 989 | ); |
990 | 990 | } |
991 | 991 | |
992 | 992 | //capability checks |
993 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
993 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
994 | 994 | $_where['AND'] = array( |
995 | 995 | 'Event.EVT_wp_user' => get_current_user_id() |
996 | 996 | ); |
997 | 997 | } |
998 | 998 | |
999 | 999 | |
1000 | - if( $count ){ |
|
1001 | - if ( $trash ) { |
|
1002 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1003 | - } else if ( $incomplete ) { |
|
1004 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1000 | + if ($count) { |
|
1001 | + if ($trash) { |
|
1002 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1003 | + } else if ($incomplete) { |
|
1004 | + return EEM_Registration::instance()->count(array($_where)); |
|
1005 | 1005 | } else { |
1006 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1006 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1007 | 1007 | } |
1008 | 1008 | } else { |
1009 | 1009 | //make sure we remove default where conditions cause all registrations matching query are returned |
1010 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1011 | - if ( $per_page !== -1 ) { |
|
1010 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1011 | + if ($per_page !== -1) { |
|
1012 | 1012 | $query_params['limit'] = $limit; |
1013 | 1013 | } |
1014 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1014 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1015 | 1015 | |
1016 | 1016 | |
1017 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1017 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1018 | 1018 | $first_registration = $registrations[0]; |
1019 | 1019 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1020 | 1020 | $event_name = $first_registration->event_obj()->name(); |
1021 | - $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 ) : ''; |
|
1021 | + $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 ) : ''; |
|
1022 | 1022 | // edit event link |
1023 | - if ( $event_name != '' ) { |
|
1024 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1025 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1026 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1023 | + if ($event_name != '') { |
|
1024 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1025 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1026 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1030 | - $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>'; |
|
1029 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1030 | + $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>'; |
|
1031 | 1031 | |
1032 | 1032 | $this->_template_args['before_admin_page_content'] = ' |
1033 | 1033 | <div id="admin-page-header"> |
1034 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1035 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1036 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1034 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1035 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1036 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1037 | 1037 | </div> |
1038 | 1038 | '; |
1039 | 1039 | |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | |
1072 | 1072 | $this->_set_registration_object(); |
1073 | 1073 | |
1074 | - if ( is_object( $this->_registration )) { |
|
1074 | + if (is_object($this->_registration)) { |
|
1075 | 1075 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1076 | 1076 | $this->_session = $transaction->session_data(); |
1077 | 1077 | |
@@ -1079,10 +1079,10 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | |
1081 | 1081 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1082 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1082 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1083 | 1083 | |
1084 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y','g:i:s a') ; |
|
1085 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1084 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); |
|
1085 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1086 | 1086 | |
1087 | 1087 | $this->_template_args['grand_total'] = $transaction->total(); |
1088 | 1088 | |
@@ -1090,19 +1090,19 @@ discard block |
||
1090 | 1090 | // link back to overview |
1091 | 1091 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1092 | 1092 | $this->_template_args['registration'] = $this->_registration; |
1093 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1094 | - $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' ) ); |
|
1095 | - $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' ) ); |
|
1093 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1094 | + $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')); |
|
1095 | + $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')); |
|
1096 | 1096 | |
1097 | 1097 | //next and previous links |
1098 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1099 | - $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' ) : ''; |
|
1100 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1101 | - $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' ) : ''; |
|
1098 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1099 | + $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') : ''; |
|
1100 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1101 | + $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') : ''; |
|
1102 | 1102 | |
1103 | 1103 | // grab header |
1104 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1105 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1104 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1105 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1106 | 1106 | |
1107 | 1107 | } else { |
1108 | 1108 | |
@@ -1123,14 +1123,14 @@ discard block |
||
1123 | 1123 | protected function _registration_details_metaboxes() { |
1124 | 1124 | $this->_set_registration_object(); |
1125 | 1125 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1126 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1127 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1128 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1129 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1126 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1127 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1128 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1129 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1130 | 1130 | } |
1131 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1132 | - if ( $this->_registration->group_size() > 1 ) { |
|
1133 | - 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' ); |
|
1131 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1132 | + if ($this->_registration->group_size() > 1) { |
|
1133 | + 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'); |
|
1134 | 1134 | } |
1135 | 1135 | } |
1136 | 1136 | |
@@ -1151,23 +1151,23 @@ discard block |
||
1151 | 1151 | |
1152 | 1152 | //let's get an array of all possible buttons that we can just reference |
1153 | 1153 | $status_buttons = $this->_get_reg_status_buttons(); |
1154 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1155 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1154 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1155 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1156 | 1156 | $template_args['attendee'] = $this->_registration->attendee(); |
1157 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1158 | - if ( $this->_set_registration_object() ) { |
|
1157 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1158 | + if ($this->_set_registration_object()) { |
|
1159 | 1159 | $current_status = $this->_registration->status_ID(); |
1160 | - unset( $status_buttons[$current_status] ); |
|
1161 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1162 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1160 | + unset($status_buttons[$current_status]); |
|
1161 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1162 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1163 | 1163 | } |
1164 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1164 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1165 | 1165 | } |
1166 | 1166 | $template_args['form_url'] = REG_ADMIN_URL; |
1167 | 1167 | $template_args['REG_ID'] = $this->_registration->ID(); |
1168 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1168 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1169 | 1169 | |
1170 | - EEH_Template::display_template( $template, $template_args ); |
|
1170 | + EEH_Template::display_template($template, $template_args); |
|
1171 | 1171 | |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1181,11 +1181,11 @@ discard block |
||
1181 | 1181 | private function _get_reg_status_buttons() { |
1182 | 1182 | |
1183 | 1183 | $buttons = array( |
1184 | - 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' ) . '">', |
|
1185 | - 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' ) . '">', |
|
1186 | - 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' ) . '">', |
|
1187 | - 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' ) . '">', |
|
1188 | - 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' ) . '">', |
|
1184 | + 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').'">', |
|
1185 | + 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').'">', |
|
1186 | + 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').'">', |
|
1187 | + 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').'">', |
|
1188 | + 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').'">', |
|
1189 | 1189 | ); |
1190 | 1190 | return $buttons; |
1191 | 1191 | } |
@@ -1199,13 +1199,13 @@ discard block |
||
1199 | 1199 | * |
1200 | 1200 | * @return array (array with reg_id(s) updated and whether update was successful. |
1201 | 1201 | */ |
1202 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1203 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1202 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1203 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1204 | 1204 | |
1205 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1205 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1206 | 1206 | |
1207 | 1207 | //notify? |
1208 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1208 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1209 | 1209 | $this->_process_resend_registration(); |
1210 | 1210 | } |
1211 | 1211 | |
@@ -1223,19 +1223,19 @@ discard block |
||
1223 | 1223 | * @param bool $status |
1224 | 1224 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1225 | 1225 | */ |
1226 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1226 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1227 | 1227 | $success = true; |
1228 | 1228 | // set default status if none is passed |
1229 | 1229 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1230 | 1230 | |
1231 | 1231 | //typecast and sanitize reg_id |
1232 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1232 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1233 | 1233 | |
1234 | 1234 | //loop through REG_ID's and change status |
1235 | - foreach ( $reg_ids as $r_id ) { |
|
1236 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1237 | - if ( $registration instanceof EE_Registration ) { |
|
1238 | - $registration->set_status( $status ); |
|
1235 | + foreach ($reg_ids as $r_id) { |
|
1236 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1237 | + if ($registration instanceof EE_Registration) { |
|
1238 | + $registration->set_status($status); |
|
1239 | 1239 | $result = $registration->save(); |
1240 | 1240 | |
1241 | 1241 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | $this->_req_data['_REG_ID'] = $reg_ids; |
1248 | 1248 | |
1249 | 1249 | //return $success and processed registrations |
1250 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1250 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | |
@@ -1259,37 +1259,37 @@ discard block |
||
1259 | 1259 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1260 | 1260 | * @return void |
1261 | 1261 | */ |
1262 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1262 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1263 | 1263 | |
1264 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1264 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1265 | 1265 | |
1266 | 1266 | |
1267 | - $success = isset( $result['success'] ) && $result['success']; |
|
1267 | + $success = isset($result['success']) && $result['success']; |
|
1268 | 1268 | |
1269 | 1269 | //setup success message |
1270 | - if ( $success ) { |
|
1271 | - $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' ) ) ; |
|
1272 | - EE_Error::add_success( $msg ); |
|
1270 | + if ($success) { |
|
1271 | + $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')); |
|
1272 | + EE_Error::add_success($msg); |
|
1273 | 1273 | } else { |
1274 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1274 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | - $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' ); |
|
1277 | + $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'); |
|
1278 | 1278 | //unset nonces |
1279 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1280 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1281 | - unset( $this->_req_data[$ref] ); |
|
1279 | + foreach ($this->_req_data as $ref => $value) { |
|
1280 | + if (strpos($ref, 'nonce') !== false) { |
|
1281 | + unset($this->_req_data[$ref]); |
|
1282 | 1282 | continue; |
1283 | 1283 | } |
1284 | 1284 | |
1285 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1285 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1286 | 1286 | $this->_req_data[$ref] = $value; |
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | //merge request vars so that the reloaded list table contains any existing filter query params |
1290 | - $route = array_merge( $this->_req_data, $route ); |
|
1290 | + $route = array_merge($this->_req_data, $route); |
|
1291 | 1291 | |
1292 | - $this->_redirect_after_action( $success, '', '', $route, true ); |
|
1292 | + $this->_redirect_after_action($success, '', '', $route, true); |
|
1293 | 1293 | |
1294 | 1294 | } |
1295 | 1295 | |
@@ -1302,29 +1302,29 @@ discard block |
||
1302 | 1302 | protected function _change_reg_status() { |
1303 | 1303 | $this->_req_data['return'] = 'view_registration'; |
1304 | 1304 | //set notify based on whether the send notifications toggle is set or not |
1305 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1306 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1305 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1306 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1307 | 1307 | |
1308 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1309 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1310 | - $this->approve_registration( $notify ); |
|
1308 | + switch ($this->_req_data['_reg_status_id']) { |
|
1309 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1310 | + $this->approve_registration($notify); |
|
1311 | 1311 | break; |
1312 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1313 | - $this->pending_registration( $notify ); |
|
1312 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1313 | + $this->pending_registration($notify); |
|
1314 | 1314 | break; |
1315 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1316 | - $this->not_approve_registration( $notify ); |
|
1315 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1316 | + $this->not_approve_registration($notify); |
|
1317 | 1317 | break; |
1318 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1319 | - $this->decline_registration( $notify ); |
|
1318 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1319 | + $this->decline_registration($notify); |
|
1320 | 1320 | break; |
1321 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1322 | - $this->cancel_registration( $notify ); |
|
1321 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1322 | + $this->cancel_registration($notify); |
|
1323 | 1323 | break; |
1324 | 1324 | default : |
1325 | 1325 | $result['success'] = false; |
1326 | - unset( $this->_req_data['return'] ); |
|
1327 | - $this->_reg_status_change_return( '', false ); |
|
1326 | + unset($this->_req_data['return']); |
|
1327 | + $this->_reg_status_change_return('', false); |
|
1328 | 1328 | break; |
1329 | 1329 | } |
1330 | 1330 | } |
@@ -1337,8 +1337,8 @@ discard block |
||
1337 | 1337 | * @param bool $notify whether or not to notify the registrant about their approval. |
1338 | 1338 | * @return void |
1339 | 1339 | */ |
1340 | - protected function approve_registration( $notify = false ) { |
|
1341 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1340 | + protected function approve_registration($notify = false) { |
|
1341 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | |
@@ -1350,8 +1350,8 @@ discard block |
||
1350 | 1350 | * @param bool $notify whether or not to notify the registrant about their approval. |
1351 | 1351 | * @return void |
1352 | 1352 | */ |
1353 | - protected function decline_registration( $notify = false ) { |
|
1354 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1353 | + protected function decline_registration($notify = false) { |
|
1354 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | |
@@ -1363,8 +1363,8 @@ discard block |
||
1363 | 1363 | * @param bool $notify whether or not to notify the registrant about their approval. |
1364 | 1364 | * @return void |
1365 | 1365 | */ |
1366 | - protected function cancel_registration( $notify = false ) { |
|
1367 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1366 | + protected function cancel_registration($notify = false) { |
|
1367 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | |
@@ -1377,8 +1377,8 @@ discard block |
||
1377 | 1377 | * @param bool $notify whether or not to notify the registrant about their approval. |
1378 | 1378 | * @return void |
1379 | 1379 | */ |
1380 | - protected function not_approve_registration( $notify = false ) { |
|
1381 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1380 | + protected function not_approve_registration($notify = false) { |
|
1381 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | |
@@ -1389,8 +1389,8 @@ discard block |
||
1389 | 1389 | * @param bool $notify whether or not to notify the registrant about their approval. |
1390 | 1390 | * @return void |
1391 | 1391 | */ |
1392 | - protected function pending_registration( $notify = false ) { |
|
1393 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1392 | + protected function pending_registration($notify = false) { |
|
1393 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | |
@@ -1404,75 +1404,75 @@ discard block |
||
1404 | 1404 | public function _reg_details_meta_box() { |
1405 | 1405 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1406 | 1406 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1407 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1407 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1408 | 1408 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1409 | 1409 | $this->_session = $transaction->session_data(); |
1410 | 1410 | |
1411 | 1411 | $filters = new EE_Line_Item_Filter_Collection(); |
1412 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1413 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1414 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1412 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1413 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1414 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1415 | 1415 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1416 | 1416 | |
1417 | 1417 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1418 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1419 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1418 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1419 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1420 | 1420 | |
1421 | 1421 | |
1422 | 1422 | $attendee = $this->_registration->attendee(); |
1423 | 1423 | |
1424 | 1424 | |
1425 | - $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' ) : ''; |
|
1426 | - $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' ) : ''; |
|
1425 | + $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') : ''; |
|
1426 | + $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') : ''; |
|
1427 | 1427 | |
1428 | 1428 | |
1429 | 1429 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1430 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1430 | + $payment = $transaction->get_first_related('Payment'); |
|
1431 | 1431 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1432 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1432 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1433 | 1433 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1434 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1434 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1435 | 1435 | $reg_details = array( |
1436 | 1436 | 'payment_method' => $payment_method->name(), |
1437 | 1437 | 'response_msg' => $payment->gateway_response(), |
1438 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1438 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1439 | 1439 | 'registration_session' => $this->_registration->session_ID(), |
1440 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1441 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1440 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1441 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1442 | 1442 | ); |
1443 | 1443 | |
1444 | 1444 | |
1445 | - if ( isset( $reg_details['registration_id'] )) { |
|
1445 | + if (isset($reg_details['registration_id'])) { |
|
1446 | 1446 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1447 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1447 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1448 | 1448 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1449 | 1449 | } |
1450 | 1450 | |
1451 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1451 | + if (isset($reg_details['payment_method'])) { |
|
1452 | 1452 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1453 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1453 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1454 | 1454 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1455 | 1455 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1456 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1456 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1457 | 1457 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1461 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1461 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1462 | 1462 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1463 | 1463 | |
1464 | 1464 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1465 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1465 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1466 | 1466 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1467 | 1467 | |
1468 | 1468 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1469 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1469 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1470 | 1470 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1471 | 1471 | |
1472 | - $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 ); |
|
1472 | + $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); |
|
1473 | 1473 | |
1474 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1475 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1474 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1475 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1476 | 1476 | |
1477 | 1477 | } |
1478 | 1478 | |
@@ -1488,23 +1488,23 @@ discard block |
||
1488 | 1488 | */ |
1489 | 1489 | public function _reg_questions_meta_box() { |
1490 | 1490 | |
1491 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 ); |
|
1492 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 ); |
|
1493 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 ); |
|
1494 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 ); |
|
1491 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1); |
|
1492 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1); |
|
1493 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1); |
|
1494 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1); |
|
1495 | 1495 | |
1496 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') ); |
|
1496 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID')); |
|
1497 | 1497 | |
1498 | 1498 | //EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1499 | 1499 | |
1500 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
1501 | - $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups ); |
|
1500 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
1501 | + $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups); |
|
1502 | 1502 | |
1503 | 1503 | $this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form'; |
1504 | 1504 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1505 | 1505 | |
1506 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1507 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1506 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1507 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1508 | 1508 | |
1509 | 1509 | } |
1510 | 1510 | |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | * @param string $output |
1520 | 1520 | * @return string |
1521 | 1521 | */ |
1522 | - public function form_before_question_group( $output ) { |
|
1522 | + public function form_before_question_group($output) { |
|
1523 | 1523 | return ' |
1524 | 1524 | <table class="form-table ee-width-100"> |
1525 | 1525 | <tbody> |
@@ -1536,13 +1536,13 @@ discard block |
||
1536 | 1536 | * @param string $output |
1537 | 1537 | * @return string |
1538 | 1538 | */ |
1539 | - public function form_after_question_group( $output ) { |
|
1539 | + public function form_after_question_group($output) { |
|
1540 | 1540 | return ' |
1541 | 1541 | <tr class="hide-if-no-js"> |
1542 | 1542 | <th> </th> |
1543 | 1543 | <td class="reg-admin-edit-attendee-question-td"> |
1544 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1545 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1544 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1545 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1546 | 1546 | <div class="dashicons dashicons-edit"></div> |
1547 | 1547 | </a> |
1548 | 1548 | </td> |
@@ -1562,11 +1562,11 @@ discard block |
||
1562 | 1562 | * @param string $label |
1563 | 1563 | * @return string |
1564 | 1564 | */ |
1565 | - public function form_form_field_label_wrap( $label ) { |
|
1565 | + public function form_form_field_label_wrap($label) { |
|
1566 | 1566 | return ' |
1567 | 1567 | <tr> |
1568 | 1568 | <th> |
1569 | - ' . $label . ' |
|
1569 | + ' . $label.' |
|
1570 | 1570 | </th>'; |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1580,10 +1580,10 @@ discard block |
||
1580 | 1580 | * @param string $label |
1581 | 1581 | * @return string |
1582 | 1582 | */ |
1583 | - public function form_form_field_input__wrap( $input ) { |
|
1583 | + public function form_form_field_input__wrap($input) { |
|
1584 | 1584 | return ' |
1585 | 1585 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1586 | - ' . $input . ' |
|
1586 | + ' . $input.' |
|
1587 | 1587 | </td> |
1588 | 1588 | </tr>'; |
1589 | 1589 | } |
@@ -1597,13 +1597,13 @@ discard block |
||
1597 | 1597 | * @return void |
1598 | 1598 | */ |
1599 | 1599 | protected function _update_attendee_registration_form() { |
1600 | - $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE; |
|
1601 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1602 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
1603 | - $success = $this->_save_attendee_registration_form( $REG_ID, $qstns ); |
|
1600 | + $qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE; |
|
1601 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1602 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
1603 | + $success = $this->_save_attendee_registration_form($REG_ID, $qstns); |
|
1604 | 1604 | $what = __('Registration Form', 'event_espresso'); |
1605 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1606 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1605 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1606 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1607 | 1607 | |
1608 | 1608 | } |
1609 | 1609 | |
@@ -1616,26 +1616,26 @@ discard block |
||
1616 | 1616 | * @param bool $qstns |
1617 | 1617 | * @return bool |
1618 | 1618 | */ |
1619 | - private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) { |
|
1619 | + private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) { |
|
1620 | 1620 | |
1621 | - if ( ! $REG_ID || ! $qstns ) { |
|
1622 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1621 | + if ( ! $REG_ID || ! $qstns) { |
|
1622 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1623 | 1623 | } |
1624 | 1624 | $success = TRUE; |
1625 | 1625 | |
1626 | 1626 | // allow others to get in on this awesome fun :D |
1627 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
1627 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
1628 | 1628 | // loop thru questions... FINALLY!!! |
1629 | 1629 | |
1630 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
1630 | + foreach ($qstns as $QST_ID => $qstn) { |
|
1631 | 1631 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
1632 | - if ( !is_array($qstn) ) { |
|
1633 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1632 | + if ( ! is_array($qstn)) { |
|
1633 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1634 | 1634 | continue; |
1635 | 1635 | } |
1636 | 1636 | |
1637 | 1637 | |
1638 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
1638 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
1639 | 1639 | //get answer |
1640 | 1640 | $query_params = array( |
1641 | 1641 | 0 => array( |
@@ -1646,8 +1646,8 @@ discard block |
||
1646 | 1646 | ); |
1647 | 1647 | $answer = EEM_Answer::instance()->get_one($query_params); |
1648 | 1648 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
1649 | - if ( ! $answer instanceof EE_Answer ) { |
|
1650 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1649 | + if ( ! $answer instanceof EE_Answer) { |
|
1650 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1651 | 1651 | continue 2; |
1652 | 1652 | } |
1653 | 1653 | |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | |
1662 | 1662 | |
1663 | 1663 | //TODO: try changing this to use the model directly... not indirectly through creating a default object... |
1664 | - private function _save_new_answer( $REG_ID, $QST_ID, $ans ) { |
|
1664 | + private function _save_new_answer($REG_ID, $QST_ID, $ans) { |
|
1665 | 1665 | $set_values = array( |
1666 | 1666 | 'QST_ID' => $QST_ID, |
1667 | 1667 | 'REG_ID' => $REG_ID, |
@@ -1688,30 +1688,30 @@ discard block |
||
1688 | 1688 | $registrations = $REG->get_all(array( |
1689 | 1689 | array( |
1690 | 1690 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1691 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1691 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1692 | 1692 | ), |
1693 | 1693 | 'force_join'=>array('Attendee'))); |
1694 | 1694 | |
1695 | 1695 | $this->_template_args['attendees'] = array(); |
1696 | 1696 | $this->_template_args['attendee_notice'] = ''; |
1697 | 1697 | EE_Registry::instance()->load_helper('Array'); |
1698 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1699 | - 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__ ); |
|
1698 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1699 | + 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__); |
|
1700 | 1700 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1701 | 1701 | } else { |
1702 | 1702 | |
1703 | 1703 | $att_nmbr = 1; |
1704 | - foreach ( $registrations as $registration ) { |
|
1704 | + foreach ($registrations as $registration) { |
|
1705 | 1705 | /* @var $registration EE_Registration */ |
1706 | 1706 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1707 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1708 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1709 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1710 | - $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 : ''; |
|
1707 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1708 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1709 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1710 | + $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 : ''; |
|
1711 | 1711 | |
1712 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1712 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1713 | 1713 | |
1714 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1714 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1715 | 1715 | |
1716 | 1716 | $att_nmbr++; |
1717 | 1717 | } |
@@ -1723,8 +1723,8 @@ discard block |
||
1723 | 1723 | |
1724 | 1724 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1725 | 1725 | } |
1726 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1727 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1726 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1727 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1728 | 1728 | |
1729 | 1729 | } |
1730 | 1730 | |
@@ -1745,11 +1745,11 @@ discard block |
||
1745 | 1745 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1746 | 1746 | |
1747 | 1747 | //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) |
1748 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1748 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1749 | 1749 | $primary_registration = $this->_registration->get_primary_registration(); |
1750 | 1750 | $primary_attendee = $primary_registration->attendee(); |
1751 | 1751 | |
1752 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1752 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1753 | 1753 | //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. |
1754 | 1754 | $primary_registration = NULL; |
1755 | 1755 | } |
@@ -1758,28 +1758,28 @@ discard block |
||
1758 | 1758 | } |
1759 | 1759 | |
1760 | 1760 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1761 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1762 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1763 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1761 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1762 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1763 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1764 | 1764 | $this->_template_args['phone'] = $attendee->phone(); |
1765 | 1765 | |
1766 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1767 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1766 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1767 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1768 | 1768 | |
1769 | 1769 | |
1770 | 1770 | //edit link |
1771 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1772 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1771 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1772 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1773 | 1773 | |
1774 | 1774 | //create link |
1775 | - $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 ): ''; |
|
1775 | + $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) : ''; |
|
1776 | 1776 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1777 | 1777 | |
1778 | 1778 | $this->_template_args['att_check'] = $att_check; |
1779 | 1779 | |
1780 | 1780 | |
1781 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1782 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1781 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1782 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1783 | 1783 | } |
1784 | 1784 | |
1785 | 1785 | |
@@ -1792,7 +1792,7 @@ discard block |
||
1792 | 1792 | * @access protected |
1793 | 1793 | * @return void |
1794 | 1794 | */ |
1795 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1795 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1796 | 1796 | $REGM = EEM_Registration::instance(); |
1797 | 1797 | |
1798 | 1798 | $success = 1; |
@@ -1802,26 +1802,26 @@ discard block |
||
1802 | 1802 | $dtts = array(); |
1803 | 1803 | |
1804 | 1804 | //if empty _REG_ID then get out because there's nothing to do |
1805 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1805 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1806 | 1806 | $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'); |
1807 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1808 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1807 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1808 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1809 | 1809 | } |
1810 | 1810 | |
1811 | 1811 | //Checkboxes |
1812 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1812 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1813 | 1813 | // if array has more than one element than success message should be plural |
1814 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1814 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1815 | 1815 | // cycle thru checkboxes |
1816 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1816 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1817 | 1817 | |
1818 | 1818 | $REG = $REGM->get_one_by_ID($REG_ID); |
1819 | 1819 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1820 | - if ( $payment_count > 0 ) { |
|
1821 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1820 | + if ($payment_count > 0) { |
|
1821 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1822 | 1822 | $error = 1; |
1823 | 1823 | $success = 0; |
1824 | - 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__ ); |
|
1824 | + 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__); |
|
1825 | 1825 | continue; //can't trash this registration because it has payments. |
1826 | 1826 | } |
1827 | 1827 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | $dtts = array_merge($dtts, $dtt); |
1831 | 1831 | |
1832 | 1832 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1833 | - if ( !$updated ) { |
|
1833 | + if ( ! $updated) { |
|
1834 | 1834 | $success = 0; |
1835 | 1835 | } else { |
1836 | 1836 | $success = 2; |
@@ -1845,7 +1845,7 @@ discard block |
||
1845 | 1845 | $tickets[$ticket->ID()] = $ticket; |
1846 | 1846 | $dtts = $ticket->get_many_related('Datetime'); |
1847 | 1847 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1848 | - if ( ! $updated ) { |
|
1848 | + if ( ! $updated) { |
|
1849 | 1849 | $success = 0; |
1850 | 1850 | } |
1851 | 1851 | |
@@ -1855,10 +1855,10 @@ discard block |
||
1855 | 1855 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1856 | 1856 | EEM_Datetime::instance()->update_sold($dtts); |
1857 | 1857 | |
1858 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1859 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1858 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1859 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1860 | 1860 | $overwrite_msgs = $error ? TRUE : FALSE; |
1861 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1861 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1862 | 1862 | } |
1863 | 1863 | |
1864 | 1864 | |
@@ -1882,16 +1882,16 @@ discard block |
||
1882 | 1882 | $success = 1; |
1883 | 1883 | |
1884 | 1884 | //Checkboxes |
1885 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1885 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1886 | 1886 | // if array has more than one element than success message should be plural |
1887 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1887 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1888 | 1888 | // cycle thru checkboxes |
1889 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1889 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1890 | 1890 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1891 | - if ( ! $REG instanceof EE_Registration ) |
|
1891 | + if ( ! $REG instanceof EE_Registration) |
|
1892 | 1892 | continue; |
1893 | 1893 | $deleted = $this->_delete_registration($REG); |
1894 | - if ( !$deleted ) { |
|
1894 | + if ( ! $deleted) { |
|
1895 | 1895 | $success = 0; |
1896 | 1896 | } |
1897 | 1897 | } |
@@ -1901,15 +1901,15 @@ discard block |
||
1901 | 1901 | $REG_ID = $this->_req_data['_REG_ID']; |
1902 | 1902 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1903 | 1903 | $deleted = $this->_delete_registration($REG); |
1904 | - if ( ! $deleted ) { |
|
1904 | + if ( ! $deleted) { |
|
1905 | 1905 | $success = 0; |
1906 | 1906 | } |
1907 | 1907 | |
1908 | 1908 | } |
1909 | 1909 | |
1910 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1911 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1912 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1910 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1911 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1912 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1913 | 1913 | } |
1914 | 1914 | |
1915 | 1915 | |
@@ -1921,31 +1921,31 @@ discard block |
||
1921 | 1921 | * @param EE_Registration $REG registration to be deleted permenantly |
1922 | 1922 | * @return boolean true = successful deletion, false = fail. |
1923 | 1923 | */ |
1924 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1924 | + protected function _delete_registration(EE_Registration $REG) { |
|
1925 | 1925 | //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. |
1926 | 1926 | $TXN = $REG->get_first_related('Transaction'); |
1927 | 1927 | $REGS = $TXN->get_many_related('Registration'); |
1928 | 1928 | |
1929 | 1929 | $all_trashed = TRUE; |
1930 | - foreach ( $REGS as $registration ) { |
|
1931 | - if ( ! $registration->get('REG_deleted') ) |
|
1930 | + foreach ($REGS as $registration) { |
|
1931 | + if ( ! $registration->get('REG_deleted')) |
|
1932 | 1932 | $all_trashed = FALSE; |
1933 | 1933 | } |
1934 | 1934 | |
1935 | - if ( ! $all_trashed ) { |
|
1936 | - 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__ ); |
|
1935 | + if ( ! $all_trashed) { |
|
1936 | + 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__); |
|
1937 | 1937 | return false; |
1938 | 1938 | } |
1939 | 1939 | |
1940 | 1940 | //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). |
1941 | - foreach ( $REGS as $registration ) { |
|
1941 | + foreach ($REGS as $registration) { |
|
1942 | 1942 | |
1943 | 1943 | //delete related answers |
1944 | 1944 | $registration->delete_related_permanently('Answer'); |
1945 | 1945 | |
1946 | 1946 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1947 | 1947 | $attendee = $registration->get_first_related('Attendee'); |
1948 | - if ( $attendee instanceof EE_Attendee ) { |
|
1948 | + if ($attendee instanceof EE_Attendee) { |
|
1949 | 1949 | $registration->_remove_relation_to($attendee, 'Attendee'); |
1950 | 1950 | } |
1951 | 1951 | |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | //now delete permanently the checkins related to this registration. |
1956 | 1956 | $registration->delete_related_permanently('Checkin'); |
1957 | 1957 | |
1958 | - if ( $registration->ID() === $REG->ID() ) |
|
1958 | + if ($registration->ID() === $REG->ID()) |
|
1959 | 1959 | continue; //we don't want to delete permanently the existing registration just yet. |
1960 | 1960 | |
1961 | 1961 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -1988,34 +1988,34 @@ discard block |
||
1988 | 1988 | * @return void |
1989 | 1989 | */ |
1990 | 1990 | public function new_registration() { |
1991 | - if ( ! $this->_set_reg_event() ) { |
|
1992 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
1991 | + if ( ! $this->_set_reg_event()) { |
|
1992 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
1993 | 1993 | } |
1994 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
1994 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
1995 | 1995 | |
1996 | 1996 | // gotta start with a clean slate if we're not coming here via ajax |
1997 | - if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) { |
|
1998 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
1997 | + if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) { |
|
1998 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
1999 | 1999 | } |
2000 | 2000 | |
2001 | - $this->_template_args['event_name'] = '' ; |
|
2001 | + $this->_template_args['event_name'] = ''; |
|
2002 | 2002 | // event name |
2003 | - if ( $this->_reg_event ) { |
|
2003 | + if ($this->_reg_event) { |
|
2004 | 2004 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2005 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2006 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2007 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2005 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2006 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2007 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2008 | 2008 | } |
2009 | 2009 | |
2010 | 2010 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2011 | 2011 | |
2012 | - if ( defined('DOING_AJAX' ) ) |
|
2012 | + if (defined('DOING_AJAX')) |
|
2013 | 2013 | $this->_return_json(); |
2014 | 2014 | |
2015 | 2015 | |
2016 | 2016 | // grab header |
2017 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2018 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2017 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2018 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2019 | 2019 | |
2020 | 2020 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2021 | 2021 | // the details template wrapper |
@@ -2033,7 +2033,7 @@ discard block |
||
2033 | 2033 | */ |
2034 | 2034 | protected function _get_registration_step_content() { |
2035 | 2035 | |
2036 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php'; |
|
2036 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php'; |
|
2037 | 2037 | $template_args = array( |
2038 | 2038 | 'title' => '', |
2039 | 2039 | 'content' => '', |
@@ -2054,11 +2054,11 @@ discard block |
||
2054 | 2054 | |
2055 | 2055 | //if the cart is empty then we know we're at step one so we'll display ticket selector |
2056 | 2056 | $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
2057 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2058 | - switch ( $step ) { |
|
2057 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2058 | + switch ($step) { |
|
2059 | 2059 | case 'ticket' : |
2060 | 2060 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2061 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2061 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2062 | 2062 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2063 | 2063 | $template_args['show_notification_toggle'] = FALSE; |
2064 | 2064 | break; |
@@ -2071,9 +2071,9 @@ discard block |
||
2071 | 2071 | break; |
2072 | 2072 | } |
2073 | 2073 | |
2074 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2074 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2075 | 2075 | |
2076 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
2076 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
2077 | 2077 | } |
2078 | 2078 | |
2079 | 2079 | |
@@ -2087,11 +2087,11 @@ discard block |
||
2087 | 2087 | * @return boolean |
2088 | 2088 | */ |
2089 | 2089 | private function _set_reg_event() { |
2090 | - if ( is_object( $this->_reg_event )) { |
|
2090 | + if (is_object($this->_reg_event)) { |
|
2091 | 2091 | return TRUE; |
2092 | 2092 | } |
2093 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2094 | - if ( ! $EVT_ID ) { |
|
2093 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2094 | + if ( ! $EVT_ID) { |
|
2095 | 2095 | return FALSE; |
2096 | 2096 | } |
2097 | 2097 | |
@@ -2112,62 +2112,62 @@ discard block |
||
2112 | 2112 | public function process_reg_step() { |
2113 | 2113 | |
2114 | 2114 | $this->_set_reg_event(); |
2115 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2115 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2116 | 2116 | |
2117 | 2117 | //what step are we on? |
2118 | - $cart = EE_Registry::instance()->SSN->get_session_data( 'cart' ); |
|
2119 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2118 | + $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
|
2119 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2120 | 2120 | |
2121 | 2121 | //if doing ajax then we need to verify the nonce |
2122 | - if ( 'DOING_AJAX' ) { |
|
2123 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2124 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2122 | + if ('DOING_AJAX') { |
|
2123 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2124 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2125 | 2125 | } |
2126 | 2126 | |
2127 | - switch ( $step ) { |
|
2127 | + switch ($step) { |
|
2128 | 2128 | case 'ticket' : |
2129 | 2129 | //process ticket selection |
2130 | 2130 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2131 | - if ( $success ) { |
|
2132 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2131 | + if ($success) { |
|
2132 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2133 | 2133 | } else { |
2134 | 2134 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2135 | 2135 | } |
2136 | - if ( defined('DOING_AJAX') ) { |
|
2136 | + if (defined('DOING_AJAX')) { |
|
2137 | 2137 | $this->new_registration(); //display next step |
2138 | 2138 | } else { |
2139 | 2139 | $query_args['action'] = 'new_registration'; |
2140 | 2140 | $query_args['processing_registration'] = true; |
2141 | 2141 | $query_args['event_id'] = $this->_reg_event->ID(); |
2142 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2142 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2143 | 2143 | } |
2144 | 2144 | break; |
2145 | 2145 | case 'questions' : |
2146 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2147 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2146 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2147 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2148 | 2148 | } |
2149 | 2149 | //process registration |
2150 | 2150 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2151 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2151 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2152 | 2152 | $query_args = array( |
2153 | 2153 | 'action' => 'new_registration', |
2154 | 2154 | 'processing_registration' => true, |
2155 | 2155 | 'event_id' => $this->_reg_event->ID() |
2156 | 2156 | ); |
2157 | 2157 | |
2158 | - if ( defined('DOING_AJAX' )) { |
|
2158 | + if (defined('DOING_AJAX')) { |
|
2159 | 2159 | //display registration form again because there are errors (maybe validation?) |
2160 | 2160 | $this->new_registration(); |
2161 | 2161 | return; |
2162 | 2162 | } else { |
2163 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2163 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2164 | 2164 | return; |
2165 | 2165 | } |
2166 | 2166 | } |
2167 | 2167 | /** @type EE_Transaction_Payments $transaction_payments */ |
2168 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2168 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2169 | 2169 | // maybe update status, and make sure to save transaction if not done already |
2170 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2170 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2171 | 2171 | $transaction->save(); |
2172 | 2172 | } |
2173 | 2173 | $query_args = array( |
@@ -2175,8 +2175,8 @@ discard block |
||
2175 | 2175 | 'TXN_ID' => $transaction->ID(), |
2176 | 2176 | 'page' => 'espresso_transactions' |
2177 | 2177 | ); |
2178 | - EE_Error::add_success( __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') ); |
|
2179 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2178 | + EE_Error::add_success(__('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso')); |
|
2179 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2180 | 2180 | break; |
2181 | 2181 | } |
2182 | 2182 | |
@@ -2196,7 +2196,7 @@ discard block |
||
2196 | 2196 | * @return void |
2197 | 2197 | */ |
2198 | 2198 | protected function _attendee_contact_list_table() { |
2199 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2199 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2200 | 2200 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2201 | 2201 | $this->display_admin_list_table_page_with_no_sidebar(); |
2202 | 2202 | } |
@@ -2211,10 +2211,10 @@ discard block |
||
2211 | 2211 | * @access public |
2212 | 2212 | * @return array |
2213 | 2213 | */ |
2214 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2214 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2215 | 2215 | |
2216 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2217 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2216 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2217 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2218 | 2218 | $ATT_MDL = EEM_Attendee::instance(); |
2219 | 2219 | |
2220 | 2220 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2242,47 +2242,47 @@ discard block |
||
2242 | 2242 | $orderby = 'ATT_lname'; |
2243 | 2243 | } |
2244 | 2244 | |
2245 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2245 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2246 | 2246 | |
2247 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2248 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2249 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2247 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2248 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2249 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2250 | 2250 | |
2251 | 2251 | $_where = array(); |
2252 | 2252 | |
2253 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2254 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2253 | + if (isset($this->_req_data['s'])) { |
|
2254 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2255 | 2255 | $_where['OR'] = array( |
2256 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2257 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2258 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2259 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2260 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2261 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2262 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2263 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2264 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2265 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2266 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2267 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2268 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2269 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2270 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2271 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2272 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2256 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2257 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2258 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2259 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2260 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2261 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2262 | + 'ATT_email' => array('LIKE', $sstr), |
|
2263 | + 'ATT_address' => array('LIKE', $sstr), |
|
2264 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2265 | + 'ATT_city' => array('LIKE', $sstr), |
|
2266 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2267 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2268 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2269 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2270 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2271 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2272 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2273 | 2273 | ); |
2274 | 2274 | } |
2275 | 2275 | |
2276 | 2276 | |
2277 | - $offset = ($current_page-1)*$per_page; |
|
2278 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2277 | + $offset = ($current_page - 1) * $per_page; |
|
2278 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2279 | 2279 | |
2280 | - if ( $trash ) { |
|
2281 | - $_where['status'] = array( '!=', 'publish' ); |
|
2282 | - $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)); |
|
2280 | + if ($trash) { |
|
2281 | + $_where['status'] = array('!=', 'publish'); |
|
2282 | + $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)); |
|
2283 | 2283 | } else { |
2284 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2285 | - $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) ); |
|
2284 | + $_where['status'] = array('IN', array('publish')); |
|
2285 | + $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)); |
|
2286 | 2286 | } |
2287 | 2287 | |
2288 | 2288 | return $all_attendees; |
@@ -2299,10 +2299,10 @@ discard block |
||
2299 | 2299 | */ |
2300 | 2300 | protected function _resend_registration() { |
2301 | 2301 | $this->_process_resend_registration(); |
2302 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2302 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2303 | 2303 | 'action' => 'default' |
2304 | 2304 | ); |
2305 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2305 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2306 | 2306 | } |
2307 | 2307 | |
2308 | 2308 | |
@@ -2310,27 +2310,27 @@ discard block |
||
2310 | 2310 | |
2311 | 2311 | |
2312 | 2312 | |
2313 | - public function _registrations_report(){ |
|
2314 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2315 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2313 | + public function _registrations_report() { |
|
2314 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2315 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2316 | 2316 | array( |
2317 | 2317 | 'page' => 'espresso_batch', |
2318 | 2318 | 'batch' => 'file', |
2319 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2320 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2321 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2322 | - )) ); |
|
2319 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2320 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2321 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2322 | + ))); |
|
2323 | 2323 | } else { |
2324 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2324 | + EE_Registry::instance()->load_helper('File'); |
|
2325 | 2325 | $new_request_args = array( |
2326 | 2326 | 'export' => 'report', |
2327 | 2327 | 'action' => 'registrations_report_for_event', |
2328 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2328 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2329 | 2329 | ); |
2330 | 2330 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2331 | 2331 | |
2332 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2333 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2332 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2333 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2334 | 2334 | $EE_Export = EE_Export::instance($this->_req_data); |
2335 | 2335 | $EE_Export->export(); |
2336 | 2336 | } |
@@ -2339,28 +2339,28 @@ discard block |
||
2339 | 2339 | |
2340 | 2340 | |
2341 | 2341 | |
2342 | - public function _contact_list_export(){ |
|
2343 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2344 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2345 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2342 | + public function _contact_list_export() { |
|
2343 | + EE_Registry::instance()->load_helper('File'); |
|
2344 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2345 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2346 | 2346 | $EE_Export = EE_Export::instance($this->_req_data); |
2347 | 2347 | $EE_Export->export_attendees(); |
2348 | 2348 | } |
2349 | 2349 | } |
2350 | 2350 | |
2351 | - public function _contact_list_report(){ |
|
2352 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2353 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2351 | + public function _contact_list_report() { |
|
2352 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2353 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2354 | 2354 | array( |
2355 | 2355 | 'page' => 'espresso_batch', |
2356 | 2356 | 'batch' => 'file', |
2357 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2358 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2359 | - )) ); |
|
2357 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2358 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2359 | + ))); |
|
2360 | 2360 | } else { |
2361 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2362 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2363 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2361 | + EE_Registry::instance()->load_helper('File'); |
|
2362 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2363 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2364 | 2364 | $EE_Export = EE_Export::instance($this->_req_data); |
2365 | 2365 | $EE_Export->report_attendees(); |
2366 | 2366 | } |
@@ -2380,73 +2380,73 @@ discard block |
||
2380 | 2380 | * @return void |
2381 | 2381 | */ |
2382 | 2382 | protected function _duplicate_attendee() { |
2383 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2383 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2384 | 2384 | //verify we have necessary info |
2385 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2386 | - 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__ ); |
|
2387 | - $query_args = array( 'action' => $action ); |
|
2385 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2386 | + 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__); |
|
2387 | + $query_args = array('action' => $action); |
|
2388 | 2388 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2389 | 2389 | } |
2390 | 2390 | |
2391 | 2391 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2392 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2392 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2393 | 2393 | $attendee = $registration->attendee(); |
2394 | 2394 | |
2395 | 2395 | //remove relation of existing attendee on registration |
2396 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2396 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2397 | 2397 | //new attendee |
2398 | 2398 | $new_attendee = clone $attendee; |
2399 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2399 | + $new_attendee->set('ATT_ID', 0); |
|
2400 | 2400 | $new_attendee->save(); |
2401 | 2401 | |
2402 | 2402 | //add new attendee to reg |
2403 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2403 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2404 | 2404 | |
2405 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2405 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2406 | 2406 | |
2407 | 2407 | //redirect to edit page for attendee |
2408 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2408 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2409 | 2409 | |
2410 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2410 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2411 | 2411 | } |
2412 | 2412 | |
2413 | 2413 | |
2414 | 2414 | //related to cpt routes |
2415 | 2415 | protected function _insert_update_cpt_item($post_id, $post) { |
2416 | 2416 | $success = true; |
2417 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2417 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2418 | 2418 | //for attendee updates |
2419 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2419 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2420 | 2420 | //note we should only be UPDATING attendees at this point. |
2421 | 2421 | $updated_fields = array( |
2422 | 2422 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2423 | 2423 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2424 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2424 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2425 | 2425 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2426 | 2426 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2427 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2428 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2429 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2430 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2431 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2432 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2427 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2428 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2429 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2430 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2431 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2432 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2433 | 2433 | ); |
2434 | - foreach ( $updated_fields as $field => $value ) { |
|
2434 | + foreach ($updated_fields as $field => $value) { |
|
2435 | 2435 | $attendee->set($field, $value); |
2436 | 2436 | } |
2437 | 2437 | |
2438 | 2438 | $success = $attendee->save(); |
2439 | 2439 | |
2440 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2441 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2442 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2443 | - 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 ) ); |
|
2440 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2441 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2442 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2443 | + 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)); |
|
2444 | 2444 | } |
2445 | 2445 | } |
2446 | 2446 | } |
2447 | 2447 | |
2448 | - if ( $success === FALSE ) |
|
2449 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2448 | + if ($success === FALSE) |
|
2449 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2450 | 2450 | |
2451 | 2451 | } |
2452 | 2452 | |
@@ -2466,17 +2466,17 @@ discard block |
||
2466 | 2466 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2467 | 2467 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2468 | 2468 | |
2469 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2470 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2469 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2470 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2471 | 2471 | } |
2472 | 2472 | |
2473 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2473 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2474 | 2474 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2475 | 2475 | } |
2476 | 2476 | |
2477 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2478 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2479 | - 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'); |
|
2477 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2478 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2479 | + 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'); |
|
2480 | 2480 | } |
2481 | 2481 | |
2482 | 2482 | |
@@ -2485,10 +2485,10 @@ discard block |
||
2485 | 2485 | * @param WP_Post $post wp post object |
2486 | 2486 | * @return string attendee contact info ( and form ) |
2487 | 2487 | */ |
2488 | - public function attendee_contact_info( $post ) { |
|
2488 | + public function attendee_contact_info($post) { |
|
2489 | 2489 | //get attendee object ( should already have it ) |
2490 | 2490 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2491 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2491 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2492 | 2492 | EEH_Template::display_template($template, $this->_template_args); |
2493 | 2493 | } |
2494 | 2494 | |
@@ -2504,12 +2504,12 @@ discard block |
||
2504 | 2504 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2505 | 2505 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2506 | 2506 | new EE_Question_Form_Input( |
2507 | - EE_Question::new_instance( array( |
|
2507 | + EE_Question::new_instance(array( |
|
2508 | 2508 | 'QST_ID' => 0, |
2509 | 2509 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2510 | 2510 | 'QST_system' => 'admin-state' |
2511 | 2511 | )), |
2512 | - EE_Answer::new_instance( array( |
|
2512 | + EE_Answer::new_instance(array( |
|
2513 | 2513 | 'ANS_ID' => 0, |
2514 | 2514 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2515 | 2515 | )), |
@@ -2522,12 +2522,12 @@ discard block |
||
2522 | 2522 | )); |
2523 | 2523 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2524 | 2524 | new EE_Question_Form_Input( |
2525 | - EE_Question::new_instance( array( |
|
2525 | + EE_Question::new_instance(array( |
|
2526 | 2526 | 'QST_ID' => 0, |
2527 | 2527 | 'QST_display_text' => __('Country', 'event_espresso'), |
2528 | 2528 | 'QST_system' => 'admin-country' |
2529 | 2529 | )), |
2530 | - EE_Answer::new_instance( array( |
|
2530 | + EE_Answer::new_instance(array( |
|
2531 | 2531 | 'ANS_ID' => 0, |
2532 | 2532 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2533 | 2533 | )), |
@@ -2538,8 +2538,8 @@ discard block |
||
2538 | 2538 | 'append_qstn_id' => FALSE |
2539 | 2539 | ) |
2540 | 2540 | )); |
2541 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2542 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2541 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2542 | + EEH_Template::display_template($template, $this->_template_args); |
|
2543 | 2543 | |
2544 | 2544 | } |
2545 | 2545 | |
@@ -2549,11 +2549,11 @@ discard block |
||
2549 | 2549 | * @access protected |
2550 | 2550 | * @return void |
2551 | 2551 | */ |
2552 | - public function attendee_registrations_meta_box( $post ) { |
|
2552 | + public function attendee_registrations_meta_box($post) { |
|
2553 | 2553 | |
2554 | 2554 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2555 | 2555 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2556 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2556 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2557 | 2557 | EEH_Template::display_template($template, $this->_template_args); |
2558 | 2558 | |
2559 | 2559 | } |
@@ -2567,8 +2567,8 @@ discard block |
||
2567 | 2567 | * @return string html for new form. |
2568 | 2568 | */ |
2569 | 2569 | public function after_title_form_fields($post) { |
2570 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2571 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2570 | + if ($post->post_type == 'espresso_attendees') { |
|
2571 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2572 | 2572 | $template_args['attendee'] = $this->_cpt_model_obj; |
2573 | 2573 | EEH_Template::display_template($template, $template_args); |
2574 | 2574 | } |
@@ -2585,21 +2585,21 @@ discard block |
||
2585 | 2585 | * @access protected |
2586 | 2586 | * @return void |
2587 | 2587 | */ |
2588 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2588 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2589 | 2589 | |
2590 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2590 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2591 | 2591 | |
2592 | 2592 | $ATT_MDL = EEM_Attendee::instance(); |
2593 | 2593 | |
2594 | 2594 | $success = 1; |
2595 | 2595 | //Checkboxes |
2596 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2596 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2597 | 2597 | // if array has more than one element than success message should be plural |
2598 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2598 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2599 | 2599 | // cycle thru checkboxes |
2600 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2601 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2602 | - if ( !$updated ) { |
|
2600 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2601 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2602 | + if ( ! $updated) { |
|
2603 | 2603 | $success = 0; |
2604 | 2604 | } |
2605 | 2605 | } |
@@ -2608,18 +2608,18 @@ discard block |
||
2608 | 2608 | // grab single id and delete |
2609 | 2609 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2610 | 2610 | //get attendee |
2611 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2611 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2612 | 2612 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2613 | 2613 | $updated = $att->save(); |
2614 | - if ( ! $updated ) { |
|
2614 | + if ( ! $updated) { |
|
2615 | 2615 | $success = 0; |
2616 | 2616 | } |
2617 | 2617 | |
2618 | 2618 | } |
2619 | 2619 | |
2620 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2621 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2622 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2620 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2621 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2622 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2623 | 2623 | |
2624 | 2624 | } |
2625 | 2625 |
@@ -36,53 +36,53 @@ discard block |
||
36 | 36 | <h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso')?></h2> |
37 | 37 | <h3 id="invoice-date"><?php _e('Date:', 'event_espresso')?> <span class="plain-text">[registration_date]</span></h3> |
38 | 38 | <h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso')?> <span class="plain-text">[transaction_id]</span></h3> |
39 | - <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status();?></span></h3> |
|
39 | + <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status(); ?></span></h3> |
|
40 | 40 | </div> |
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | </table> |
44 | 44 | <div class="events"> |
45 | - <?php foreach($events_for_txn as $event_id => $event){ |
|
46 | - ?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png';?>"><?php _e("Event Name:","event_espresso")?> <span class="plain-text"><?php echo $event->name();?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3> |
|
47 | - <?php if (strlen($event->description()>1)){?><p class="event-description"><?php $event->description()?></p><?php }?> |
|
45 | + <?php foreach ($events_for_txn as $event_id => $event) { |
|
46 | + ?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png'; ?>"><?php _e("Event Name:", "event_espresso")?> <span class="plain-text"><?php echo $event->name(); ?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3> |
|
47 | + <?php if (strlen($event->description() > 1)) {?><p class="event-description"><?php $event->description()?></p><?php }?> |
|
48 | 48 | <ul class="tickets-per-event"> |
49 | - <?php foreach($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item){ |
|
49 | + <?php foreach ($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item) { |
|
50 | 50 | $ticket = $line_item->ticket(); |
51 | - $taxable_html = $ticket->taxable() ? '*': ''; |
|
51 | + $taxable_html = $ticket->taxable() ? '*' : ''; |
|
52 | 52 | $subitems = $line_item->children(); |
53 | - $ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso")); |
|
53 | + $ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso")); |
|
54 | 54 | ?> |
55 | 55 | <li class="event-ticket"> |
56 | 56 | <div class="ticket-details"> |
57 | 57 | <table class="invoice-amount"> |
58 | 58 | <thead> |
59 | 59 | <tr class="header_row"> |
60 | - <th class="name-column"><?php _e("Ticket", "event_espresso");?></th> |
|
61 | - <th colspan="2" class="desc-column"><?php _e("Description", "event_espresso");?></th> |
|
62 | - <th class="number-column item_c"><?php _e("Quantity", "event_espresso");?></th> |
|
63 | - <th class="number-column item_c"><?php _e("Price", "event_espresso");?></th> |
|
64 | - <th class="number-column item_r"><?php _e("Total", "event_espresso");?></th> |
|
60 | + <th class="name-column"><?php _e("Ticket", "event_espresso"); ?></th> |
|
61 | + <th colspan="2" class="desc-column"><?php _e("Description", "event_espresso"); ?></th> |
|
62 | + <th class="number-column item_c"><?php _e("Quantity", "event_espresso"); ?></th> |
|
63 | + <th class="number-column item_c"><?php _e("Price", "event_espresso"); ?></th> |
|
64 | + <th class="number-column item_r"><?php _e("Total", "event_espresso"); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if( count($subitems) < 2){?> |
|
68 | + <?php if (count($subitems) < 2) {?> |
|
69 | 69 | <tr class="item"> |
70 | 70 | <td><?php echo $line_item->name().$taxable_html?></td> |
71 | - <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
71 | + <td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
72 | 72 | <td class="item_c"><?php echo $line_item->quantity()?></td> |
73 | 73 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
74 | 74 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
75 | 75 | </tr> |
76 | - <?php }else{?> |
|
76 | + <?php } else {?> |
|
77 | 77 | <tr class="item"> |
78 | 78 | <td class="aln-left"><?php echo $line_item->name().$taxable_html?></td> |
79 | - <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
79 | + <td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
80 | 80 | <td class="item_c"><?php echo $line_item->quantity()?></td> |
81 | 81 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
82 | 82 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
83 | 83 | </tr> |
84 | - <?php foreach($subitems as $sub_line_item){ |
|
85 | - $is_percent = $sub_line_item->is_percent();?> |
|
84 | + <?php foreach ($subitems as $sub_line_item) { |
|
85 | + $is_percent = $sub_line_item->is_percent(); ?> |
|
86 | 86 | <tr class="subitem-row"> |
87 | 87 | <td class="subitem"><?php echo $sub_line_item->name()?></td> |
88 | 88 | <td colspan="2"><?php echo $sub_line_item->desc()?></td> |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | <?php } ?> |
94 | 94 | <tr class="total_tr odd"> |
95 | 95 | <td colspan="4"></td> |
96 | - <td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso");?></td> |
|
96 | + <td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso"); ?></td> |
|
97 | 97 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
98 | 98 | </tr> |
99 | 99 | <?php }?> |
@@ -104,22 +104,22 @@ discard block |
||
104 | 104 | <div class="reg-details-for-ticket"> |
105 | 105 | <div class="ticket-time-and-place-details"> |
106 | 106 | <div class="ticket-time-details"> |
107 | - <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png';?>"><?php echo _n("Date/Time:","Dates/Times:",count($ticket->datetimes()), "event_espresso");?></h4> |
|
107 | + <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png'; ?>"><?php echo _n("Date/Time:", "Dates/Times:", count($ticket->datetimes()), "event_espresso"); ?></h4> |
|
108 | 108 | <ul class="event-dates"> |
109 | - <?php foreach($ticket->datetimes_ordered() as $datetime){ |
|
109 | + <?php foreach ($ticket->datetimes_ordered() as $datetime) { |
|
110 | 110 | /* @var $datetime EE_Datetime */ ?> |
111 | 111 | <li><?php |
112 | - echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : '' ; |
|
113 | - echo sprintf(__("%s - %s (%s)", "event_espresso"),$datetime->start_date_and_time(),$datetime->end_date_and_time(),$datetime->get_timezone()); |
|
112 | + echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : ''; |
|
113 | + echo sprintf(__("%s - %s (%s)", "event_espresso"), $datetime->start_date_and_time(), $datetime->end_date_and_time(), $datetime->get_timezone()); |
|
114 | 114 | echo $datetime->description() ? '<p class="ticket-note">'.$datetime->description().'</p>' : '' ?></li> |
115 | 115 | <?php }?> |
116 | 116 | </ul> |
117 | 117 | </div> |
118 | - <?php if ($event->venues()){?> |
|
118 | + <?php if ($event->venues()) {?> |
|
119 | 119 | <div class="ticket-place-details"> |
120 | - <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png';?>"><?php echo _n("Venue:","Venues:",count($event->venues()), "event_espresso");?></h4> |
|
120 | + <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png'; ?>"><?php echo _n("Venue:", "Venues:", count($event->venues()), "event_espresso"); ?></h4> |
|
121 | 121 | <ul class="event-venues"> |
122 | - <?php foreach($event->venues() as $venue){?> |
|
122 | + <?php foreach ($event->venues() as $venue) {?> |
|
123 | 123 | <li><?php echo $venue->name()?> <span class="small-text">[ <a href='<?php echo $venue->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></li> |
124 | 124 | <?php } ?> |
125 | 125 | </ul> |
@@ -127,34 +127,34 @@ discard block |
||
127 | 127 | <?php }?> |
128 | 128 | </div> |
129 | 129 | <div class="ticket-registrations-area"> |
130 | - <h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png';?>"><?php echo __("Registration Details", "event_espresso");?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4> |
|
130 | + <h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png'; ?>"><?php echo __("Registration Details", "event_espresso"); ?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4> |
|
131 | 131 | <ul class="ticket-registrations-list"> |
132 | - <?php foreach($registrations_per_line_item[$line_item_id] as $registration){ |
|
132 | + <?php foreach ($registrations_per_line_item[$line_item_id] as $registration) { |
|
133 | 133 | /* @var $registration EE_Registration */ |
134 | 134 | $attendee = $registration->attendee(); |
135 | - $answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC')));?> |
|
135 | + $answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC'))); ?> |
|
136 | 136 | <li class="ticket-registration"> |
137 | 137 | <table class="registration-details"> |
138 | 138 | <tr class="odd"> |
139 | - <th><?php echo _e("Registration Code:", "event_espresso");?></th> |
|
140 | - <td><?php echo $registration->reg_code();?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td> |
|
139 | + <th><?php echo _e("Registration Code:", "event_espresso"); ?></th> |
|
140 | + <td><?php echo $registration->reg_code(); ?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td> |
|
141 | 141 | </tr> |
142 | 142 | <?php |
143 | - foreach($event->question_groups() as $question_group){ |
|
144 | - ?><tr><th><?php $question_group->e('QSG_name');?></th><td></td></tr><?php |
|
143 | + foreach ($event->question_groups() as $question_group) { |
|
144 | + ?><tr><th><?php $question_group->e('QSG_name'); ?></th><td></td></tr><?php |
|
145 | 145 | $has_personal_info = false; |
146 | - foreach($question_group->questions() as $question){ |
|
147 | - if( in_array($question->system_ID(),$questions_to_skip)){ |
|
146 | + foreach ($question_group->questions() as $question) { |
|
147 | + if (in_array($question->system_ID(), $questions_to_skip)) { |
|
148 | 148 | $has_personal_info = true; |
149 | 149 | continue; |
150 | 150 | } |
151 | 151 | ?><tr> |
152 | 152 | <th><?php echo $question->display_text()?></th> |
153 | - <td><?php echo $registration->answer_value_to_question($question);?></td> |
|
153 | + <td><?php echo $registration->answer_value_to_question($question); ?></td> |
|
154 | 154 | </tr><?php |
155 | 155 | } |
156 | - if($has_personal_info){ |
|
157 | - ?><tr><th><?php _e('Attendee', 'event_espresso');?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"),$attendee->full_name(),$attendee->email())?></td></tr><?php |
|
156 | + if ($has_personal_info) { |
|
157 | + ?><tr><th><?php _e('Attendee', 'event_espresso'); ?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"), $attendee->full_name(), $attendee->email())?></td></tr><?php |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | ?> |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | <?php }?> |
172 | 172 | </div> |
173 | 173 | <div class="taxes"> |
174 | - <?php if ($tax_total_line_item && $tax_total_line_item->children()){?> |
|
175 | - <h3 class="section-title"><?php _e("Taxes",'event_espresso')?></h3> |
|
174 | + <?php if ($tax_total_line_item && $tax_total_line_item->children()) {?> |
|
175 | + <h3 class="section-title"><?php _e("Taxes", 'event_espresso')?></h3> |
|
176 | 176 | <table class="invoice-amount"> |
177 | 177 | |
178 | 178 | <thead> |
179 | 179 | <tr class="header_row"> |
180 | - <th class="left ticket_th"><?php _e("Tax Name", "event_espresso");?></th> |
|
181 | - <th class="left"><?php _e('Description', 'event_espresso');?></th> |
|
180 | + <th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th> |
|
181 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
182 | 182 | <th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th> |
183 | 183 | <th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th> |
184 | 184 | </tr> |
185 | 185 | </thead> |
186 | 186 | <tbody> |
187 | 187 | <?php |
188 | - foreach($tax_total_line_item->children() as $child_tax){?> |
|
188 | + foreach ($tax_total_line_item->children() as $child_tax) {?> |
|
189 | 189 | <tr> |
190 | 190 | <td><?php echo $child_tax->name()?></td> |
191 | 191 | <td><?php echo $child_tax->desc()?></td> |
@@ -195,26 +195,26 @@ discard block |
||
195 | 195 | <?php } ?> |
196 | 196 | <tr class="total_tr odd"> |
197 | 197 | <td class="total_tr" colspan="2"></td> |
198 | - <td class="total"><?php _e("Tax Total:", "event_espresso");?></td> |
|
198 | + <td class="total"><?php _e("Tax Total:", "event_espresso"); ?></td> |
|
199 | 199 | <td class="item_r"><?php echo $tax_total_line_item->total_no_code()?></td> |
200 | 200 | </tr> |
201 | 201 | </tbody> |
202 | 202 | |
203 | 203 | </table> |
204 | 204 | <?php }?> |
205 | - <p><?php _e("* taxable items", "event_espresso");?></p> |
|
205 | + <p><?php _e("* taxable items", "event_espresso"); ?></p> |
|
206 | 206 | </div> |
207 | 207 | <div class="grand-total-dv"> |
208 | - <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"),EEH_Template::format_currency($total_cost));?></h2> |
|
208 | + <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), EEH_Template::format_currency($total_cost)); ?></h2> |
|
209 | 209 | </div> |
210 | 210 | <div class="payment-dv"> |
211 | - <h3 class="section-title"><?php _e("Payments",'event_espresso')?></h3> |
|
211 | + <h3 class="section-title"><?php _e("Payments", 'event_espresso')?></h3> |
|
212 | 212 | <p>[instructions]</p> |
213 | 213 | <table class="invoice-amount"> |
214 | 214 | <thead> |
215 | 215 | <tr class="header_row"> |
216 | 216 | <th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th> |
217 | - <th class='left datetime_th'><?php _e("Date",'event_espresso')?></th> |
|
217 | + <th class='left datetime_th'><?php _e("Date", 'event_espresso')?></th> |
|
218 | 218 | <th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th> |
219 | 219 | <th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th> |
220 | 220 | <th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th> |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | <tbody> |
225 | 225 | <?php |
226 | 226 | $c = false; |
227 | - if(!empty($payments)){ |
|
227 | + if ( ! empty($payments)) { |
|
228 | 228 | |
229 | - foreach($payments as $payment){ |
|
229 | + foreach ($payments as $payment) { |
|
230 | 230 | /* @var $payment EE_Payment */?> |
231 | - <tr class='item <?php echo (($c = !$c) ? ' odd' : '')?>'> |
|
231 | + <tr class='item <?php echo (($c = ! $c) ? ' odd' : '')?>'> |
|
232 | 232 | <td><?php $payment->e('PAY_gateway')?></td> |
233 | 233 | <td><?php echo $payment->timestamp()?></td> |
234 | 234 | <td><?php $payment->e('PAY_txn_id_chq_nmbr')?></td> |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | <td class='item_r'><?php echo $payment->amount_no_code()?></td> |
238 | 238 | </tr> |
239 | 239 | <?php } |
240 | - }else{?> |
|
240 | + } else {?> |
|
241 | 241 | <tr class='item'> |
242 | - <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.",'event_espresso')?> </td> |
|
242 | + <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.", 'event_espresso')?> </td> |
|
243 | 243 | </tr> |
244 | 244 | <?php } |
245 | - ?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if($amount_owed){?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso");}?></a></td></tr> |
|
245 | + ?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if ($amount_owed) {?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso"); }?></a></td></tr> |
|
246 | 246 | </tbody> |
247 | 247 | <tfoot> |
248 | 248 | <tr class='total_tr'><td colspan="4"> </td> |
249 | - <td class="item_r"><?php _e('Total Paid','event_espresso')?></td> |
|
250 | - <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd,false,false)?> </td> |
|
249 | + <td class="item_r"><?php _e('Total Paid', 'event_espresso')?></td> |
|
250 | + <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd, false, false)?> </td> |
|
251 | 251 | </tr> |
252 | 252 | <?php //echo $discount; ?> |
253 | 253 | <tr class="total_tr odd"> |
@@ -259,20 +259,20 @@ discard block |
||
259 | 259 | </table> |
260 | 260 | </div> |
261 | 261 | <div class="additional-info-dv"> |
262 | - <h3 class="section-title"><?php _e("Additional Information:", "event_espresso");?></h3> |
|
262 | + <h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3> |
|
263 | 263 | <div class="additional-info"> |
264 | - <?php if($venues_for_events){?> |
|
265 | - <h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso",count($venues_for_events));?></h2> |
|
264 | + <?php if ($venues_for_events) {?> |
|
265 | + <h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso", count($venues_for_events)); ?></h2> |
|
266 | 266 | <table class="venue-list"> |
267 | - <?php foreach($venues_for_events as $venue){?> |
|
267 | + <?php foreach ($venues_for_events as $venue) {?> |
|
268 | 268 | <tr class="venue-details"> |
269 | 269 | <td class="venue-details-part venue-address-dv"> |
270 | 270 | <h3><a href='<?php echo $venue->get_permalink()?>'><?php |
271 | 271 | echo $venue->name() |
272 | 272 | ?></a></h3> |
273 | 273 | <p><?php echo $venue->description()?></p> |
274 | - <?php echo EEH_Address::format($venue);?></td> |
|
275 | - <?php if($venue->enable_for_gmap()){?> |
|
274 | + <?php echo EEH_Address::format($venue); ?></td> |
|
275 | + <?php if ($venue->enable_for_gmap()) {?> |
|
276 | 276 | <td class="venue-details-part venue-image-dv"><?php echo EEH_Venue_View::espresso_google_static_map($venue)?></td> |
277 | 277 | <?php } ?> |
278 | 278 | </tr> |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | </table> |
281 | 281 | <?php } ?> |
282 | 282 | |
283 | - <?php if($shameless_plug){?> |
|
283 | + <?php if ($shameless_plug) {?> |
|
284 | 284 | <div class='aln-cntr'><?php |
285 | - printf(__("Powered by %sEvent Espresso %s", "event_espresso"),"<a href='https://eventespresso.com'>","</a>"); |
|
285 | + printf(__("Powered by %sEvent Espresso %s", "event_espresso"), "<a href='https://eventespresso.com'>", "</a>"); |
|
286 | 286 | ?></div> |
287 | 287 | <?php } ?> |
288 | 288 | </div> |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | </td> |
24 | 24 | <td> |
25 | 25 | <div id="invoice-info"> |
26 | - <h2 id="invoice-hdr"><?php _e( 'Order Confirmation', 'event_espresso' ) ?></h2> |
|
26 | + <h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso') ?></h2> |
|
27 | 27 | |
28 | - <h3 id="invoice-date"><?php _e( 'Date:', 'event_espresso' ) ?> |
|
28 | + <h3 id="invoice-date"><?php _e('Date:', 'event_espresso') ?> |
|
29 | 29 | <span class="plain-text">[PRIMARY_REGISTRANT_REGISTRATION_DATE]</span></h3> |
30 | 30 | |
31 | - <h3 id="invoice-txn-id"><?php _e( 'Transaction ID:', 'event_espresso' ) ?> |
|
31 | + <h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso') ?> |
|
32 | 32 | <span class="plain-text">[TXN_ID]</span></h3> |
33 | 33 | |
34 | - <h3 id="invoice-txn-status"><?php _e( 'Status:', 'event_espresso' ) ?> |
|
34 | + <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso') ?> |
|
35 | 35 | <span class="[TXN_STATUS_ID] plain-text">[TXN_STATUS]</span></h3> |
36 | 36 | </div> |
37 | 37 | </td> |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | [EVENT_LIST] |
42 | 42 | </div> |
43 | 43 | <div class="taxes"> |
44 | - <h3 class="section-title"><?php _e( "Additional Charges/Discounts", 'event_espresso' ) ?></h3> |
|
44 | + <h3 class="section-title"><?php _e("Additional Charges/Discounts", 'event_espresso') ?></h3> |
|
45 | 45 | <table class="invoice-amount"> |
46 | 46 | <thead> |
47 | 47 | <tr class="header_row"> |
48 | - <th class="left ticket_th"><?php _e( "Name", "event_espresso" ); ?></th> |
|
49 | - <th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th> |
|
50 | - <th class="event_th item_c"><?php _e( 'Quantity', 'event_espresso' ); ?></th> |
|
51 | - <th class="event_th item_c"><?php _e( 'Unit Price', 'event_espresso' ); ?></th> |
|
52 | - <th class="subtotal_th"><?php _e( 'Total', 'event_espresso' ); ?></th> |
|
48 | + <th class="left ticket_th"><?php _e("Name", "event_espresso"); ?></th> |
|
49 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
50 | + <th class="event_th item_c"><?php _e('Quantity', 'event_espresso'); ?></th> |
|
51 | + <th class="event_th item_c"><?php _e('Unit Price', 'event_espresso'); ?></th> |
|
52 | + <th class="subtotal_th"><?php _e('Total', 'event_espresso'); ?></th> |
|
53 | 53 | </tr> |
54 | 54 | </thead> |
55 | 55 | <tbody> |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | </table> |
61 | 61 | </div> |
62 | 62 | <div class="taxes"> |
63 | - <h3 class="section-title"><?php _e( "Taxes", 'event_espresso' ) ?></h3> |
|
64 | - <p><?php printf( __( '%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso' ), '<strong>', '</strong>' ); ?></p> |
|
63 | + <h3 class="section-title"><?php _e("Taxes", 'event_espresso') ?></h3> |
|
64 | + <p><?php printf(__('%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
65 | 65 | <table class="invoice-amount"> |
66 | 66 | <thead> |
67 | 67 | <tr class="header_row"> |
68 | - <th class="left ticket_th"><?php _e( "Tax Name", "event_espresso" ); ?></th> |
|
69 | - <th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th> |
|
70 | - <th class="event_th item_c"><?php _e( 'Rate', 'event_espresso' ); ?></th> |
|
71 | - <th class="subtotal_th"><?php _e( 'Tax Amount', 'event_espresso' ); ?></th> |
|
68 | + <th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th> |
|
69 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
70 | + <th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th> |
|
71 | + <th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th> |
|
72 | 72 | </tr> |
73 | 73 | </thead> |
74 | 74 | <tbody> |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | </table> |
80 | 80 | </div> |
81 | 81 | <div class="grand-total-dv"> |
82 | - <h2 class="grand-total"><?php printf( __( "Grand Total: %s", "event_espresso" ), '[TOTAL_COST]' ); ?></h2> |
|
82 | + <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), '[TOTAL_COST]'); ?></h2> |
|
83 | 83 | </div> |
84 | 84 | <div class="payment-dv"> |
85 | - <h3 class="section-title"><?php _e( "Payments", 'event_espresso' ) ?></h3> |
|
85 | + <h3 class="section-title"><?php _e("Payments", 'event_espresso') ?></h3> |
|
86 | 86 | <table class="invoice-amount"> |
87 | 87 | <thead> |
88 | 88 | <tr class="header_row"> |
89 | - <th><span class=""><?php _e( 'Payment Method', 'event_espresso' ); ?></span></th> |
|
90 | - <th class='left datetime_th'><?php _e( "Date", 'event_espresso' ) ?></th> |
|
91 | - <th><span class=""><?php _e( 'Transaction Id / Cheque #', 'event_espresso' ); ?></span></th> |
|
92 | - <th><span class=""><?php _e( 'P.O. / S.O.#', 'event_espresso' ); ?></span></th> |
|
93 | - <th><span class=""><?php _e( 'Status', 'event_espresso' ); ?></span></th> |
|
94 | - <th><?php _e( 'Amount', 'event_espresso' ); ?></th> |
|
89 | + <th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th> |
|
90 | + <th class='left datetime_th'><?php _e("Date", 'event_espresso') ?></th> |
|
91 | + <th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th> |
|
92 | + <th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th> |
|
93 | + <th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th> |
|
94 | + <th><?php _e('Amount', 'event_espresso'); ?></th> |
|
95 | 95 | </tr> |
96 | 96 | </thead> |
97 | 97 | <tbody> |
@@ -105,21 +105,21 @@ discard block |
||
105 | 105 | <tfoot> |
106 | 106 | <tr class='total_tr'> |
107 | 107 | <td colspan="4"> </td> |
108 | - <td class="item_r"><?php _e( 'Total Paid', 'event_espresso' ) ?></td> |
|
108 | + <td class="item_r"><?php _e('Total Paid', 'event_espresso') ?></td> |
|
109 | 109 | <td class="item_r">[TOTAL_AMOUNT_PAID]</td> |
110 | 110 | </tr> |
111 | 111 | <tr class="total_tr odd"> |
112 | 112 | <td colspan="4"> </td> |
113 | - <td class="total" id="total_currency"><?php _e( 'Amount Owed:', 'event_espresso' ); ?></td> |
|
113 | + <td class="total" id="total_currency"><?php _e('Amount Owed:', 'event_espresso'); ?></td> |
|
114 | 114 | <td class="total">[TOTAL_OWING]</td> |
115 | 115 | </tr> |
116 | 116 | </tfoot> |
117 | 117 | </table> |
118 | 118 | </div> |
119 | 119 | <div class="additional-info-dv"> |
120 | - <h3 class="section-title"><?php _e( "Additional Information:", "event_espresso" ); ?></h3> |
|
120 | + <h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3> |
|
121 | 121 | <div class="additional-info"> |
122 | - <h2><?php _e( "Venue Details:", "event_espresso" ); ?></h2> |
|
122 | + <h2><?php _e("Venue Details:", "event_espresso"); ?></h2> |
|
123 | 123 | <table class="venue-list"> |
124 | 124 | <tr class="venue-details"> |
125 | 125 | <td class="venue-details-part venue-address-dv"> |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | <td class="venue-details-part venue-image-dv">[GOOGLE_MAP_IMAGE]</td> |
132 | 132 | </tr> |
133 | 133 | </table> |
134 | - <div class='aln-cntr'><?php printf( __( "Powered by %sEvent Espresso %s", "event_espresso" ), "<a href='https://eventespresso.com'>", "</a>" ); ?></div> |
|
134 | + <div class='aln-cntr'><?php printf(__("Powered by %sEvent Espresso %s", "event_espresso"), "<a href='https://eventespresso.com'>", "</a>"); ?></div> |
|
135 | 135 | </div> |
136 | 136 | </div> |
137 | 137 | </div> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return EED_Event_Single |
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | - return parent::get_instance( __CLASS__ ); |
|
43 | + return parent::get_instance(__CLASS__); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @return void |
53 | 53 | */ |
54 | 54 | public static function set_hooks() { |
55 | - add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
|
56 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
57 | - EE_Config::register_route( __( 'event', 'event_espresso' ), 'Event_Single', 'run' ); |
|
55 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
56 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
57 | + EE_Config::register_route(__('event', 'event_espresso'), 'Event_Single', 'run'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | public static function set_hooks_admin() { |
67 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
67 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | */ |
80 | 80 | public static function set_definitions() { |
81 | - define( 'EVENT_SINGLE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
82 | - define( 'EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
81 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
82 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @void |
91 | 91 | */ |
92 | - protected function set_config(){ |
|
93 | - $this->set_config_section( 'template_settings' ); |
|
94 | - $this->set_config_class( 'EE_Event_Single_Config' ); |
|
95 | - $this->set_config_name( 'EED_Event_Single' ); |
|
92 | + protected function set_config() { |
|
93 | + $this->set_config_section('template_settings'); |
|
94 | + $this->set_config_class('EE_Event_Single_Config'); |
|
95 | + $this->set_config_name('EED_Event_Single'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,35 +105,35 @@ discard block |
||
105 | 105 | * @param \EE_Event_Single_Config $config |
106 | 106 | * @return \EE_Template_Part_Manager |
107 | 107 | */ |
108 | - public function initialize_template_parts( EE_Event_Single_Config $config = null ) { |
|
108 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) { |
|
109 | 109 | $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
110 | 110 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
111 | 111 | $template_parts = new EE_Template_Part_Manager(); |
112 | 112 | $template_parts->add_template_part( |
113 | 113 | 'tickets', |
114 | - __( 'Ticket Selector', 'event_espresso' ), |
|
114 | + __('Ticket Selector', 'event_espresso'), |
|
115 | 115 | 'content-espresso_events-tickets.php', |
116 | 116 | $config->display_order_tickets |
117 | 117 | ); |
118 | 118 | $template_parts->add_template_part( |
119 | 119 | 'datetimes', |
120 | - __( 'Dates and Times', 'event_espresso' ), |
|
120 | + __('Dates and Times', 'event_espresso'), |
|
121 | 121 | 'content-espresso_events-datetimes.php', |
122 | 122 | $config->display_order_datetimes |
123 | 123 | ); |
124 | 124 | $template_parts->add_template_part( |
125 | 125 | 'event', |
126 | - __( 'Event Description', 'event_espresso' ), |
|
126 | + __('Event Description', 'event_espresso'), |
|
127 | 127 | 'content-espresso_events-details.php', |
128 | 128 | $config->display_order_event |
129 | 129 | ); |
130 | 130 | $template_parts->add_template_part( |
131 | 131 | 'venue', |
132 | - __( 'Venue Information', 'event_espresso' ), |
|
132 | + __('Venue Information', 'event_espresso'), |
|
133 | 133 | 'content-espresso_events-venues.php', |
134 | 134 | $config->display_order_venue |
135 | 135 | ); |
136 | - do_action( 'AHEE__EED_Event_Single__initialize_template_parts', $template_parts ); |
|
136 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
137 | 137 | return $template_parts; |
138 | 138 | } |
139 | 139 | |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
150 | + public function run($WP) { |
|
151 | 151 | // ensure valid EE_Events_Single_Config() object exists |
152 | 152 | $this->set_config(); |
153 | 153 | // check what template is loaded |
154 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
155 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
154 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
155 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
156 | 156 | // load css |
157 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
158 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
157 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
158 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -167,27 +167,27 @@ discard block |
||
167 | 167 | * @param string $template |
168 | 168 | * @return string |
169 | 169 | */ |
170 | - public function template_include( $template ) { |
|
170 | + public function template_include($template) { |
|
171 | 171 | global $post; |
172 | 172 | /** @type EE_Event_Single_Config $config */ |
173 | 173 | $config = $this->config(); |
174 | - if ( $config->display_status_banner_single ) { |
|
175 | - add_filter( 'the_title', array( 'EED_Event_Single', 'the_title' ), 100, 2 ); |
|
174 | + if ($config->display_status_banner_single) { |
|
175 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
176 | 176 | } |
177 | 177 | // not a custom template? |
178 | 178 | if ( |
179 | 179 | EE_Front_Controller::instance()->get_selected_template() != 'single-espresso_events.php' |
180 | - || apply_filters( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE ) |
|
181 | - && ! post_password_required( $post ) |
|
180 | + || apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE) |
|
181 | + && ! post_password_required($post) |
|
182 | 182 | ) { |
183 | 183 | EEH_Template::load_espresso_theme_functions(); |
184 | 184 | // then add extra event data via hooks |
185 | - add_action( 'loop_start', array( 'EED_Event_Single', 'loop_start' )); |
|
186 | - add_filter( 'get_the_excerpt', array( 'EED_Event_Single', 'get_the_excerpt' ), 1, 1 ); |
|
187 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
188 | - add_action( 'loop_end', array( 'EED_Event_Single', 'loop_end' )); |
|
185 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
186 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
187 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
188 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
189 | 189 | // don't display entry meta because the existing theme will take car of that |
190 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
190 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
191 | 191 | } |
192 | 192 | return $template; |
193 | 193 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | * @param array $wp_query_array an array containing the WP_Query object |
202 | 202 | * @return void |
203 | 203 | */ |
204 | - public static function loop_start( $wp_query_array ) { |
|
204 | + public static function loop_start($wp_query_array) { |
|
205 | 205 | global $post; |
206 | - do_action( 'AHEE_event_details_before_post', $post, $wp_query_array ); |
|
206 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | * @param int $id |
217 | 217 | * @return string |
218 | 218 | */ |
219 | - public static function the_title( $title = '', $id = 0 ) { |
|
219 | + public static function the_title($title = '', $id = 0) { |
|
220 | 220 | global $post; |
221 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
221 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | * @param string $excerpt |
231 | 231 | * @return string |
232 | 232 | */ |
233 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
233 | + public static function get_the_excerpt($excerpt = '') { |
|
234 | 234 | EED_Event_Single::$using_get_the_excerpt = true; |
235 | - add_filter( 'wp_trim_excerpt', array( 'EED_Event_Single', 'end_get_the_excerpt' ), 999, 1 ); |
|
235 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
236 | 236 | return $excerpt; |
237 | 237 | } |
238 | 238 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param string $text |
246 | 246 | * @return string |
247 | 247 | */ |
248 | - public static function end_get_the_excerpt( $text = '' ) { |
|
248 | + public static function end_get_the_excerpt($text = '') { |
|
249 | 249 | EED_Event_Single::$using_get_the_excerpt = false; |
250 | 250 | return $text; |
251 | 251 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @param string $content |
260 | 260 | * @return string |
261 | 261 | */ |
262 | - public static function event_details( $content ) { |
|
262 | + public static function event_details($content) { |
|
263 | 263 | global $post; |
264 | 264 | static $current_post_ID = 0; |
265 | 265 | if ( |
@@ -274,15 +274,15 @@ discard block |
||
274 | 274 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
275 | 275 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
276 | 276 | // so the following allows this filter to be applied multiple times, but only once for real |
277 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
278 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order ) { |
|
277 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
278 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
279 | 279 | // we need to first remove this callback from being applied to the_content() |
280 | 280 | // (otherwise it will recurse and blow up the interweb) |
281 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
281 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
282 | 282 | EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
283 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
284 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters( $content ); |
|
285 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
283 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
284 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
285 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
286 | 286 | } else { |
287 | 287 | $content = EED_Event_Single::use_filterable_display_order(); |
288 | 288 | } |
@@ -303,19 +303,19 @@ discard block |
||
303 | 303 | // it uses the_content() for displaying the $post->post_content |
304 | 304 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
305 | 305 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
306 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
306 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
307 | 307 | //now add additional content |
308 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110, 1 ); |
|
309 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120, 1 ); |
|
310 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130, 1 ); |
|
311 | - do_action( 'AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters' ); |
|
308 | + add_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110, 1); |
|
309 | + add_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120, 1); |
|
310 | + add_filter('the_content', array('EED_Event_Single', 'event_venues'), 130, 1); |
|
311 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
312 | 312 | // now load our template |
313 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
313 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
314 | 314 | //now add our filter back in, plus some others |
315 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
316 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 ); |
|
317 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 ); |
|
318 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130 ); |
|
315 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
316 | + remove_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110); |
|
317 | + remove_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120); |
|
318 | + remove_filter('the_content', array('EED_Event_Single', 'event_venues'), 130); |
|
319 | 319 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
320 | 320 | return $content; |
321 | 321 | } |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | * @param string $content |
330 | 330 | * @return string |
331 | 331 | */ |
332 | - public static function event_datetimes( $content ) { |
|
333 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
332 | + public static function event_datetimes($content) { |
|
333 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | * @param string $content |
343 | 343 | * @return string |
344 | 344 | */ |
345 | - public static function event_tickets( $content ) { |
|
346 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
345 | + public static function event_tickets($content) { |
|
346 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | |
@@ -355,8 +355,8 @@ discard block |
||
355 | 355 | * @param string $content |
356 | 356 | * @return string |
357 | 357 | */ |
358 | - public static function event_venue( $content ) { |
|
359 | - return EED_Event_Single::event_venues( $content ); |
|
358 | + public static function event_venue($content) { |
|
359 | + return EED_Event_Single::event_venues($content); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | * @param string $content |
369 | 369 | * @return string |
370 | 370 | */ |
371 | - public static function event_venues( $content ) { |
|
372 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
371 | + public static function event_venues($content) { |
|
372 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
@@ -381,9 +381,9 @@ discard block |
||
381 | 381 | * @param array $wp_query_array an array containing the WP_Query object |
382 | 382 | * @return void |
383 | 383 | */ |
384 | - public static function loop_end( $wp_query_array ) { |
|
384 | + public static function loop_end($wp_query_array) { |
|
385 | 385 | global $post; |
386 | - do_action( 'AHEE_event_details_after_post', $post, $wp_query_array ); |
|
386 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | */ |
397 | 397 | public function wp_enqueue_scripts() { |
398 | 398 | // get some style |
399 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && apply_filters( 'FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE )) { |
|
400 | - EE_Registry::instance()->load_helper( 'File' ); |
|
399 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)) { |
|
400 | + EE_Registry::instance()->load_helper('File'); |
|
401 | 401 | // first check uploads folder |
402 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
403 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
402 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
403 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
404 | 404 | } else { |
405 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
405 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
406 | 406 | } |
407 | - wp_enqueue_script( $this->theme ); |
|
408 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
409 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
410 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
407 | + wp_enqueue_script($this->theme); |
|
408 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
409 | + EE_Registry::instance()->load_helper('Maps'); |
|
410 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | } |
@@ -426,12 +426,12 @@ discard block |
||
426 | 426 | * @return bool |
427 | 427 | */ |
428 | 428 | public static function display_venue() { |
429 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
429 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
430 | 430 | /** @type EE_Event_Single_Config $config */ |
431 | 431 | $config = EED_Event_Single::instance()->config(); |
432 | - $display_venue= isset( $config->display_venue ) ? $config->display_venue : TRUE; |
|
432 | + $display_venue = isset($config->display_venue) ? $config->display_venue : TRUE; |
|
433 | 433 | $venue_name = EEH_Venue_View::venue_name(); |
434 | - return $display_venue && ! empty( $venue_name ) ? TRUE : FALSE; |
|
434 | + return $display_venue && ! empty($venue_name) ? TRUE : FALSE; |
|
435 | 435 | } |
436 | 436 | |
437 | 437 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return EED_Events_Archive |
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | - return parent::get_instance( __CLASS__ ); |
|
46 | + return parent::get_instance(__CLASS__); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | public static function set_hooks() { |
58 | - EE_Config::register_route( EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run' ); |
|
59 | - EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
|
60 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
58 | + EE_Config::register_route(EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run'); |
|
59 | + EE_Config::register_route('event_list', 'Events_Archive', 'event_list'); |
|
60 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | public static function set_hooks_admin() { |
70 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
70 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | public static function set_definitions() { |
83 | - define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
84 | - define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
83 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
84 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return \EE_Events_Archive_Config |
93 | 93 | */ |
94 | - protected function set_config(){ |
|
95 | - $this->set_config_section( 'template_settings' ); |
|
96 | - $this->set_config_class( 'EE_Events_Archive_Config' ); |
|
97 | - $this->set_config_name( 'EED_Events_Archive' ); |
|
94 | + protected function set_config() { |
|
95 | + $this->set_config_section('template_settings'); |
|
96 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
97 | + $this->set_config_name('EED_Events_Archive'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,35 +106,35 @@ discard block |
||
106 | 106 | * @param \EE_Events_Archive_Config $config |
107 | 107 | * @return \EE_Template_Part_Manager |
108 | 108 | */ |
109 | - public function initialize_template_parts( EE_Events_Archive_Config $config = null ) { |
|
109 | + public function initialize_template_parts(EE_Events_Archive_Config $config = null) { |
|
110 | 110 | $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config(); |
111 | 111 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
112 | 112 | $template_parts = new EE_Template_Part_Manager(); |
113 | 113 | $template_parts->add_template_part( |
114 | 114 | 'tickets', |
115 | - __( 'Ticket Selector', 'event_espresso' ), |
|
115 | + __('Ticket Selector', 'event_espresso'), |
|
116 | 116 | 'content-espresso_events-tickets.php', |
117 | 117 | $config->display_order_tickets |
118 | 118 | ); |
119 | 119 | $template_parts->add_template_part( |
120 | 120 | 'datetimes', |
121 | - __( 'Dates and Times', 'event_espresso' ), |
|
121 | + __('Dates and Times', 'event_espresso'), |
|
122 | 122 | 'content-espresso_events-datetimes.php', |
123 | 123 | $config->display_order_datetimes |
124 | 124 | ); |
125 | 125 | $template_parts->add_template_part( |
126 | 126 | 'event', |
127 | - __( 'Event Description', 'event_espresso' ), |
|
127 | + __('Event Description', 'event_espresso'), |
|
128 | 128 | 'content-espresso_events-details.php', |
129 | 129 | $config->display_order_event |
130 | 130 | ); |
131 | 131 | $template_parts->add_template_part( |
132 | 132 | 'venue', |
133 | - __( 'Venue Information', 'event_espresso' ), |
|
133 | + __('Venue Information', 'event_espresso'), |
|
134 | 134 | 'content-espresso_events-venues.php', |
135 | 135 | $config->display_order_venue |
136 | 136 | ); |
137 | - do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts ); |
|
137 | + do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts); |
|
138 | 138 | return $template_parts; |
139 | 139 | } |
140 | 140 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
151 | - do_action( 'AHEE__EED_Events_Archive__before_run' ); |
|
150 | + public function run($WP) { |
|
151 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
152 | 152 | // ensure valid EE_Events_Archive_Config() object exists |
153 | 153 | $this->set_config(); |
154 | 154 | /** @type EE_Events_Archive_Config $config */ |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | // load other required components |
157 | 157 | $this->load_event_list_assets(); |
158 | 158 | // filter the WP posts_join, posts_where, and posts_orderby SQL clauses |
159 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
159 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
160 | 160 | //add query filters |
161 | 161 | EEH_Event_Query::add_query_filters(); |
162 | 162 | // set params that will get used by the filters |
163 | 163 | EEH_Event_Query::set_query_params( |
164 | - '', // month |
|
165 | - '', // category |
|
166 | - $config->display_expired_events, // show_expired |
|
167 | - 'start_date', // orderby |
|
164 | + '', // month |
|
165 | + '', // category |
|
166 | + $config->display_expired_events, // show_expired |
|
167 | + 'start_date', // orderby |
|
168 | 168 | 'ASC' // sort |
169 | 169 | ); |
170 | 170 | // check what template is loaded |
171 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
171 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -200,32 +200,32 @@ discard block |
||
200 | 200 | * @param string $template |
201 | 201 | * @return string |
202 | 202 | */ |
203 | - public function template_include( $template = '' ) { |
|
203 | + public function template_include($template = '') { |
|
204 | 204 | // don't add content filter for dedicated EE child themes or private posts |
205 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
206 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
205 | + EE_Registry::instance()->load_helper('Template'); |
|
206 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
207 | 207 | /** @type EE_Events_Archive_Config $config */ |
208 | 208 | $config = $this->config(); |
209 | 209 | // add status banner ? |
210 | - if ( $config->display_status_banner ) { |
|
211 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
210 | + if ($config->display_status_banner) { |
|
211 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
212 | 212 | } |
213 | 213 | // if NOT a custom template |
214 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' |
|
215 | - || apply_filters( 'FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', FALSE ) |
|
214 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' |
|
215 | + || apply_filters('FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', FALSE) |
|
216 | 216 | ) { |
217 | 217 | // don't display entry meta because the existing theme will take care of that |
218 | - add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
|
218 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
219 | 219 | // load functions.php file for the theme (loaded by WP if using child theme) |
220 | 220 | EEH_Template::load_espresso_theme_functions(); |
221 | 221 | // because we don't know if the theme is using the_excerpt() |
222 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
222 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
223 | 223 | // or the_content |
224 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
224 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
225 | 225 | // and just in case they are running get_the_excerpt() which DESTROYS things |
226 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
226 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
227 | 227 | // don't display entry meta because the existing theme will take care of that |
228 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
228 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | return $template; |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | * @param string $excerpt |
241 | 241 | * @return string |
242 | 242 | */ |
243 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
244 | - if ( post_password_required() ) { |
|
243 | + public static function get_the_excerpt($excerpt = '') { |
|
244 | + if (post_password_required()) { |
|
245 | 245 | return $excerpt; |
246 | 246 | } |
247 | - if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) { |
|
248 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
249 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
250 | - $excerpt = EED_Events_Archive::event_details( $excerpt ); |
|
247 | + if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) { |
|
248 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
249 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
250 | + $excerpt = EED_Events_Archive::event_details($excerpt); |
|
251 | 251 | } else { |
252 | 252 | EED_Events_Archive::$using_get_the_excerpt = true; |
253 | - add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 ); |
|
253 | + add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1); |
|
254 | 254 | } |
255 | 255 | return $excerpt; |
256 | 256 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @param string $text |
265 | 265 | * @return string |
266 | 266 | */ |
267 | - public static function end_get_the_excerpt( $text = '' ) { |
|
267 | + public static function end_get_the_excerpt($text = '') { |
|
268 | 268 | EED_Events_Archive::$using_get_the_excerpt = false; |
269 | 269 | return $text; |
270 | 270 | } |
@@ -279,10 +279,10 @@ discard block |
||
279 | 279 | * @param string $id |
280 | 280 | * @return string |
281 | 281 | */ |
282 | - public static function the_title( $title = '', $id = '' ) { |
|
282 | + public static function the_title($title = '', $id = '') { |
|
283 | 283 | global $post; |
284 | - if ( $post instanceof WP_Post ) { |
|
285 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
284 | + if ($post instanceof WP_Post) { |
|
285 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
286 | 286 | } |
287 | 287 | return $title; |
288 | 288 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @param string $content |
297 | 297 | * @return string |
298 | 298 | */ |
299 | - public static function event_details( $content ) { |
|
299 | + public static function event_details($content) { |
|
300 | 300 | global $post; |
301 | 301 | static $current_post_ID = 0; |
302 | 302 | if ( |
@@ -305,8 +305,8 @@ discard block |
||
305 | 305 | && ! EED_Events_Archive::$using_get_the_excerpt |
306 | 306 | && ! post_password_required() |
307 | 307 | && ( |
308 | - apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false ) |
|
309 | - || ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false ) |
|
308 | + apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false) |
|
309 | + || ! apply_filters('FHEE__content_espresso_events__template_loaded', false) |
|
310 | 310 | ) |
311 | 311 | ) { |
312 | 312 | // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
@@ -315,8 +315,8 @@ discard block |
||
315 | 315 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
316 | 316 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
317 | 317 | // so the following allows this filter to be applied multiple times, but only once for real |
318 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
319 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) { |
|
318 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
319 | + if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) { |
|
320 | 320 | $content = \EED_Events_Archive::use_sortable_display_order(); |
321 | 321 | } else { |
322 | 322 | $content = \EED_Events_Archive::use_filterable_display_order(); |
@@ -335,20 +335,20 @@ discard block |
||
335 | 335 | */ |
336 | 336 | protected static function use_sortable_display_order() { |
337 | 337 | // no further password checks required atm |
338 | - add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
338 | + add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
339 | 339 | // we need to first remove this callback from being applied to the_content() or the_excerpt() (otherwise it will recurse and blow up the interweb) |
340 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
341 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
342 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
340 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
341 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
342 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
343 | 343 | // now add additional content depending on whether event is using the_excerpt() or the_content() |
344 | 344 | EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
345 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
346 | - $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content ); |
|
345 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
346 | + $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); |
|
347 | 347 | // re-add our main filters (or else the next event won't have them) |
348 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
349 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
350 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
351 | - remove_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
348 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
349 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
350 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
351 | + remove_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
352 | 352 | return $content; |
353 | 353 | } |
354 | 354 | |
@@ -363,22 +363,22 @@ discard block |
||
363 | 363 | protected static function use_filterable_display_order() { |
364 | 364 | // we need to first remove this callback from being applied to the_content() |
365 | 365 | // (otherwise it will recurse and blow up the interweb) |
366 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
367 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
368 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
366 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
367 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
368 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
369 | 369 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
370 | 370 | EED_Events_Archive::_add_additional_excerpt_filters(); |
371 | 371 | EED_Events_Archive::_add_additional_content_filters(); |
372 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' ); |
|
372 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters'); |
|
373 | 373 | // now load our template |
374 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
374 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
375 | 375 | // re-add our main filters (or else the next event won't have them) |
376 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
377 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
378 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
376 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
377 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
378 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
379 | 379 | // but remove the other filters so that they don't get applied to the next post |
380 | 380 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
381 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' ); |
|
381 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters'); |
|
382 | 382 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
383 | 383 | //return ! empty( $template ) ? $template : $content; |
384 | 384 | return $content; |
@@ -393,11 +393,11 @@ discard block |
||
393 | 393 | * @param string $content |
394 | 394 | * @return string |
395 | 395 | */ |
396 | - public static function event_datetimes( $content ) { |
|
397 | - if ( post_password_required() ) { |
|
396 | + public static function event_datetimes($content) { |
|
397 | + if (post_password_required()) { |
|
398 | 398 | return $content; |
399 | 399 | } |
400 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
400 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | /** |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | * @param string $content |
408 | 408 | * @return string |
409 | 409 | */ |
410 | - public static function event_tickets( $content ) { |
|
411 | - if ( post_password_required() ) { |
|
410 | + public static function event_tickets($content) { |
|
411 | + if (post_password_required()) { |
|
412 | 412 | return $content; |
413 | 413 | } |
414 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
414 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | * @param string $content |
424 | 424 | * @return string |
425 | 425 | */ |
426 | - public static function event_venue( $content ) { |
|
427 | - return EED_Events_Archive::event_venues( $content ); |
|
426 | + public static function event_venue($content) { |
|
427 | + return EED_Events_Archive::event_venues($content); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -434,11 +434,11 @@ discard block |
||
434 | 434 | * @param string $content |
435 | 435 | * @return string |
436 | 436 | */ |
437 | - public static function event_venues( $content ) { |
|
438 | - if ( post_password_required() ) { |
|
437 | + public static function event_venues($content) { |
|
438 | + if (post_password_required()) { |
|
439 | 439 | return $content; |
440 | 440 | } |
441 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
441 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | * @return void |
451 | 451 | */ |
452 | 452 | private static function _add_additional_excerpt_filters() { |
453 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
454 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
455 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
453 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
454 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
455 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | |
@@ -464,9 +464,9 @@ discard block |
||
464 | 464 | * @return void |
465 | 465 | */ |
466 | 466 | private static function _add_additional_content_filters() { |
467 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
468 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
469 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
467 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
468 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
469 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | |
@@ -478,12 +478,12 @@ discard block |
||
478 | 478 | * @return void |
479 | 479 | */ |
480 | 480 | private static function _remove_additional_events_archive_filters() { |
481 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
482 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
483 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
484 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
485 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
486 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
481 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
482 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
483 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
484 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
485 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
486 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | |
@@ -496,17 +496,17 @@ discard block |
||
496 | 496 | */ |
497 | 497 | public static function remove_all_events_archive_filters() { |
498 | 498 | //remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
499 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100 ); |
|
500 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
501 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
502 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
503 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
504 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
505 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
506 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
507 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
499 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100); |
|
500 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
501 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
502 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
503 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
504 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
505 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
506 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
507 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
508 | 508 | // don't display entry meta because the existing theme will take care of that |
509 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
509 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -521,15 +521,15 @@ discard block |
||
521 | 521 | * @return void |
522 | 522 | */ |
523 | 523 | public function load_event_list_assets() { |
524 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
525 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
526 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
527 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
528 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
529 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
530 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
524 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
525 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
526 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
527 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
528 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
529 | + EE_Registry::instance()->load_helper('Maps'); |
|
530 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
531 | 531 | } |
532 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
532 | + EE_Registry::instance()->load_helper('Event_View'); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | |
@@ -545,14 +545,14 @@ discard block |
||
545 | 545 | */ |
546 | 546 | public function wp_enqueue_scripts() { |
547 | 547 | // get some style |
548 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
548 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
549 | 549 | // first check uploads folder |
550 | - EE_Registry::instance()->load_helper( 'File' ); |
|
551 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
552 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
550 | + EE_Registry::instance()->load_helper('File'); |
|
551 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
552 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
553 | 553 | } else { |
554 | 554 | } |
555 | - wp_enqueue_style( $this->theme ); |
|
555 | + wp_enqueue_style($this->theme); |
|
556 | 556 | |
557 | 557 | } |
558 | 558 | } |
@@ -570,8 +570,8 @@ discard block |
||
570 | 570 | */ |
571 | 571 | public static function template_settings_form() { |
572 | 572 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
573 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
574 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
573 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
574 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
575 | 575 | $events_archive_settings = array( |
576 | 576 | 'display_status_banner' => 0, |
577 | 577 | 'display_description' => 1, |
@@ -580,8 +580,8 @@ discard block |
||
580 | 580 | 'display_venue' => 0, |
581 | 581 | 'display_expired_events' => 0 |
582 | 582 | ); |
583 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
584 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
583 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
584 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -597,16 +597,16 @@ discard block |
||
597 | 597 | * @param EE_Request_Handler $REQ |
598 | 598 | * @return EE_Template_Config |
599 | 599 | */ |
600 | - public static function update_template_settings( $CFG, $REQ ) { |
|
600 | + public static function update_template_settings($CFG, $REQ) { |
|
601 | 601 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
602 | 602 | // unless we are resetting the config... |
603 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
604 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
605 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
606 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
607 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
608 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
609 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
603 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
604 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
605 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
606 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
607 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
608 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
609 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
610 | 610 | return $CFG; |
611 | 611 | } |
612 | 612 | |
@@ -619,10 +619,10 @@ discard block |
||
619 | 619 | * @param string $extra_class |
620 | 620 | * @return string |
621 | 621 | */ |
622 | - public static function event_list_css( $extra_class = '' ) { |
|
623 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
622 | + public static function event_list_css($extra_class = '') { |
|
623 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
624 | 624 | $event_list_css[] = 'espresso-event-list-event'; |
625 | - return implode( ' ', $event_list_css ); |
|
625 | + return implode(' ', $event_list_css); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | |
@@ -649,9 +649,9 @@ discard block |
||
649 | 649 | * @param $value |
650 | 650 | * @return bool |
651 | 651 | */ |
652 | - public static function display_description( $value ) { |
|
652 | + public static function display_description($value) { |
|
653 | 653 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
654 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
654 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
655 | 655 | return $display_description === $value ? TRUE : FALSE; |
656 | 656 | } |
657 | 657 | |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | */ |
665 | 665 | public static function display_ticket_selector() { |
666 | 666 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
667 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
667 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | |
@@ -676,9 +676,9 @@ discard block |
||
676 | 676 | * @return bool |
677 | 677 | */ |
678 | 678 | public static function display_venue() { |
679 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
679 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
680 | 680 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
681 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
681 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | */ |
691 | 691 | public static function display_datetimes() { |
692 | 692 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
693 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
693 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
694 | 694 | } |
695 | 695 | |
696 | 696 | |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | * @return string |
706 | 706 | */ |
707 | 707 | public static function event_list_title() { |
708 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
708 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
709 | 709 | } |
710 | 710 | |
711 | 711 | |
@@ -714,11 +714,11 @@ discard block |
||
714 | 714 | /** |
715 | 715 | * @since 4.4.0 |
716 | 716 | */ |
717 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
717 | + public static function _doing_it_wrong_notice($function = '') { |
|
718 | 718 | EE_Error::doing_it_wrong( |
719 | 719 | __FUNCTION__, |
720 | 720 | sprintf( |
721 | - __( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ), |
|
721 | + __('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'), |
|
722 | 722 | $function, |
723 | 723 | '<br />', |
724 | 724 | '4.6.0' |
@@ -734,107 +734,107 @@ discard block |
||
734 | 734 | * @since 4.4.0 |
735 | 735 | */ |
736 | 736 | public function get_post_data() { |
737 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
737 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
738 | 738 | EEH_Event_Query::set_query_params(); |
739 | 739 | } |
740 | 740 | /** |
741 | 741 | * @deprecated |
742 | 742 | * @since 4.4.0 |
743 | 743 | */ |
744 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
745 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
746 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
747 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
744 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
745 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
746 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
747 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
748 | 748 | } |
749 | 749 | /** |
750 | 750 | * @deprecated |
751 | 751 | * @since 4.4.0 |
752 | 752 | */ |
753 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
754 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
755 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
756 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
753 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
754 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
755 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
756 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
757 | 757 | } |
758 | 758 | /** |
759 | 759 | * @deprecated |
760 | 760 | * @since 4.4.0 |
761 | 761 | */ |
762 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
763 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
764 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
765 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
762 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
763 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
764 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
765 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
766 | 766 | } |
767 | 767 | /** |
768 | 768 | * @deprecated |
769 | 769 | * @since 4.4.0 |
770 | 770 | */ |
771 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
772 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
773 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
774 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
771 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
772 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
773 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
774 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
775 | 775 | } |
776 | 776 | /** |
777 | 777 | * @deprecated |
778 | 778 | * @since 4.4.0 |
779 | 779 | */ |
780 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
781 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
782 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
783 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
780 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
781 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
782 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
783 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
784 | 784 | } |
785 | 785 | /** |
786 | 786 | * @deprecated |
787 | 787 | * @since 4.4.0 |
788 | 788 | */ |
789 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
790 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
791 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
792 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
789 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
790 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
791 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
792 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
793 | 793 | } |
794 | 794 | /** |
795 | 795 | * @deprecated |
796 | 796 | * @since 4.4.0 |
797 | 797 | */ |
798 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
799 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
800 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
801 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
798 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
799 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
800 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
801 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
802 | 802 | } |
803 | 803 | /** |
804 | 804 | * @deprecated |
805 | 805 | * @since 4.4.0 |
806 | 806 | */ |
807 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
808 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
809 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
810 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
807 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
808 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
809 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
810 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
811 | 811 | } |
812 | 812 | /** |
813 | 813 | * @deprecated |
814 | 814 | * @since 4.4.0 |
815 | 815 | */ |
816 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
817 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
818 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
819 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
816 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
817 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
818 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
819 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
820 | 820 | } |
821 | 821 | /** |
822 | 822 | * @deprecated |
823 | 823 | * @since 4.4.0 |
824 | 824 | */ |
825 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
826 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
827 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
828 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
825 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
826 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
827 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
828 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
829 | 829 | } |
830 | 830 | /** |
831 | 831 | * @deprecated |
832 | 832 | * @since 4.4.0 |
833 | 833 | */ |
834 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
835 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
836 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
837 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
834 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
835 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
836 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
837 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | |
@@ -865,8 +865,8 @@ discard block |
||
865 | 865 | * @param string $extra_class |
866 | 866 | * @return string |
867 | 867 | */ |
868 | -function espresso_event_list_css( $extra_class = '' ) { |
|
869 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
868 | +function espresso_event_list_css($extra_class = '') { |
|
869 | + return EED_Events_Archive::event_list_css($extra_class); |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | /** |
@@ -880,14 +880,14 @@ discard block |
||
880 | 880 | * @return bool |
881 | 881 | */ |
882 | 882 | function espresso_display_full_description_in_event_list() { |
883 | - return EED_Events_Archive::display_description( 2 ); |
|
883 | + return EED_Events_Archive::display_description(2); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | /** |
887 | 887 | * @return bool |
888 | 888 | */ |
889 | 889 | function espresso_display_excerpt_in_event_list() { |
890 | - return EED_Events_Archive::display_description( 1 ); |
|
890 | + return EED_Events_Archive::display_description(1); |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | /** |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | * @param WP $WP |
52 | 52 | * @return void |
53 | 53 | */ |
54 | - public function run( WP $WP ) { |
|
55 | - if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) { |
|
54 | + public function run(WP $WP) { |
|
55 | + if (did_action('pre_get_posts') && did_action('send_headers')) { |
|
56 | 56 | global $wp_query; |
57 | 57 | EED_Single_Page_Checkout::load_reg_steps(); |
58 | - EED_Single_Page_Checkout::init( $wp_query ); |
|
58 | + EED_Single_Page_Checkout::init($wp_query); |
|
59 | 59 | } else { |
60 | 60 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
61 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
61 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
62 | 62 | // this will trigger the EED_Single_Page_Checkout module's run() method during the pre_get_posts hook point, |
63 | 63 | // this allows us to initialize things, enqueue assets, etc, |
64 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'init' ), 10, 1 ); |
|
64 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'init'), 10, 1); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param array $attributes |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function process_shortcode( $attributes = array() ) { |
|
77 | + public function process_shortcode($attributes = array()) { |
|
78 | 78 | return EE_Registry::instance()->REQ->get_output(); |
79 | 79 | } |
80 | 80 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @access public |
51 | 51 | * @param \WP $WP |
52 | 52 | */ |
53 | - public function run( WP $WP ) { |
|
53 | + public function run(WP $WP) { |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | * @param array $attributes |
61 | 61 | * @return string |
62 | 62 | */ |
63 | - public function process_shortcode( $attributes = array() ) { |
|
64 | - extract( $attributes ); |
|
65 | - $event_id = isset( $event_id ) ? $event_id : 0; |
|
66 | - $event = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $event_id ); |
|
63 | + public function process_shortcode($attributes = array()) { |
|
64 | + extract($attributes); |
|
65 | + $event_id = isset($event_id) ? $event_id : 0; |
|
66 | + $event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id); |
|
67 | 67 | ob_start(); |
68 | - do_action( 'AHEE_event_details_before_post', $event_id ); |
|
69 | - espresso_ticket_selector( $event ); |
|
70 | - do_action( 'AHEE_event_details_after_post' ); |
|
68 | + do_action('AHEE_event_details_before_post', $event_id); |
|
69 | + espresso_ticket_selector($event); |
|
70 | + do_action('AHEE_event_details_after_post'); |
|
71 | 71 | return ob_get_clean(); |
72 | 72 | } |
73 | 73 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * @param WP $WP |
51 | 51 | * @return void |
52 | 52 | */ |
53 | - public function run( WP $WP ) { |
|
54 | - if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) { |
|
53 | + public function run(WP $WP) { |
|
54 | + if (did_action('pre_get_posts') && did_action('send_headers')) { |
|
55 | 55 | EED_Events_Archive::instance()->event_list(); |
56 | 56 | } else { |
57 | 57 | // this will trigger the EED_Events_Archive module's event_list() method during the pre_get_posts hook point, |
58 | 58 | // this allows us to initialize things, enqueue assets, etc, |
59 | 59 | // as well, this saves an instantiation of the module in an array using 'espresso_events' as the key, so that we can retrieve it |
60 | - add_action( 'pre_get_posts', array( EED_Events_Archive::instance(), 'event_list' ) ); |
|
60 | + add_action('pre_get_posts', array(EED_Events_Archive::instance(), 'event_list')); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | * @param array $attributes |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - public function process_shortcode( $attributes = array() ) { |
|
82 | + public function process_shortcode($attributes = array()) { |
|
83 | 83 | // make sure EED_Events_Archive is setup properly |
84 | - if ( apply_filters( 'FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE )) { |
|
84 | + if (apply_filters('FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE)) { |
|
85 | 85 | EED_Events_Archive::instance()->event_list(); |
86 | 86 | } |
87 | 87 | // merge in any attributes passed via fallback shortcode processor |
88 | - $attributes = array_merge( (array)$attributes, (array)$this->_attributes ); |
|
88 | + $attributes = array_merge((array) $attributes, (array) $this->_attributes); |
|
89 | 89 | //set default attributes |
90 | 90 | $default_espresso_events_shortcode_atts = array( |
91 | 91 | 'title' => NULL, |
@@ -99,26 +99,26 @@ discard block |
||
99 | 99 | 'fallback_shortcode_processor' => FALSE |
100 | 100 | ); |
101 | 101 | // allow the defaults to be filtered |
102 | - $default_espresso_events_shortcode_atts = apply_filters( 'EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts ); |
|
102 | + $default_espresso_events_shortcode_atts = apply_filters('EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts); |
|
103 | 103 | // grab attributes and merge with defaults, then extract |
104 | - $attributes = array_merge( $default_espresso_events_shortcode_atts, $attributes ); |
|
104 | + $attributes = array_merge($default_espresso_events_shortcode_atts, $attributes); |
|
105 | 105 | // make sure we use the_excerpt() |
106 | - add_filter( 'FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true' ); |
|
106 | + add_filter('FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true'); |
|
107 | 107 | // apply query filters |
108 | - add_filter( 'FHEE__EEH_Event_Query__apply_query_filters', '__return_true' ); |
|
108 | + add_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true'); |
|
109 | 109 | // run the query |
110 | 110 | global $wp_query; |
111 | - $wp_query = new EE_Event_List_Query( $attributes ); |
|
111 | + $wp_query = new EE_Event_List_Query($attributes); |
|
112 | 112 | // check what template is loaded and load filters accordingly |
113 | - EED_Events_Archive::instance()->template_include( 'loop-espresso_events.php' ); |
|
113 | + EED_Events_Archive::instance()->template_include('loop-espresso_events.php'); |
|
114 | 114 | // load our template |
115 | - $event_list = EEH_Template::locate_template( 'loop-espresso_events.php', array(), TRUE, TRUE ); |
|
115 | + $event_list = EEH_Template::locate_template('loop-espresso_events.php', array(), TRUE, TRUE); |
|
116 | 116 | // now reset the query and postdata |
117 | 117 | wp_reset_query(); |
118 | 118 | wp_reset_postdata(); |
119 | 119 | EED_Events_Archive::remove_all_events_archive_filters(); |
120 | 120 | // remove query filters |
121 | - remove_filter( 'FHEE__EEH_Event_Query__apply_query_filters', '__return_true' ); |
|
121 | + remove_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true'); |
|
122 | 122 | // pull our content from the output buffer and return it |
123 | 123 | return $event_list; |
124 | 124 | } |
@@ -163,46 +163,46 @@ discard block |
||
163 | 163 | * @param array $args |
164 | 164 | * @return \EE_Event_List_Query |
165 | 165 | */ |
166 | - function __construct( $args = array() ) { |
|
166 | + function __construct($args = array()) { |
|
167 | 167 | // EEH_Debug_Tools::printr( $args, '$args <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
168 | 168 | // incoming args could be a mix of WP query args + EE shortcode args |
169 | - foreach ( $args as $key =>$value ) { |
|
170 | - $property = '_' . $key; |
|
169 | + foreach ($args as $key =>$value) { |
|
170 | + $property = '_'.$key; |
|
171 | 171 | // if the arg is a property of this class, then it's an EE shortcode arg |
172 | - if ( property_exists( $this, $property )) { |
|
172 | + if (property_exists($this, $property)) { |
|
173 | 173 | // set the property value |
174 | 174 | $this->$property = $value; |
175 | 175 | // then remove it from the array of args that will later be passed to WP_Query() |
176 | - unset( $args[ $key ] ); |
|
176 | + unset($args[$key]); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | // setup the events list query |
180 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
180 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
181 | 181 | //add query filters |
182 | 182 | EEH_Event_Query::add_query_filters(); |
183 | 183 | // set params that will get used by the filters |
184 | - EEH_Event_Query::set_query_params( $this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort ); |
|
184 | + EEH_Event_Query::set_query_params($this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort); |
|
185 | 185 | // first off, let's remove any filters from previous queries |
186 | - remove_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' )); |
|
187 | - remove_all_filters( 'FHEE__content_espresso_events__event_class' ); |
|
186 | + remove_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title')); |
|
187 | + remove_all_filters('FHEE__content_espresso_events__event_class'); |
|
188 | 188 | // Event List Title ? |
189 | - add_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' ), 10, 1 ); |
|
189 | + add_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title'), 10, 1); |
|
190 | 190 | // add the css class |
191 | - add_filter( 'FHEE__content_espresso_events__event_class', array( $this, 'event_list_css' ), 10, 1 ); |
|
191 | + add_filter('FHEE__content_espresso_events__event_class', array($this, 'event_list_css'), 10, 1); |
|
192 | 192 | // the current "page" we are viewing |
193 | - $paged = max( 1, get_query_var( 'paged' )); |
|
193 | + $paged = max(1, get_query_var('paged')); |
|
194 | 194 | // Force these args |
195 | - $args = array_merge( $args, array( |
|
195 | + $args = array_merge($args, array( |
|
196 | 196 | 'post_type' => 'espresso_events', |
197 | 197 | 'posts_per_page' => $this->_limit, |
198 | 198 | 'update_post_term_cache' => FALSE, |
199 | 199 | 'update_post_meta_cache' => FALSE, |
200 | 200 | 'paged' => $paged, |
201 | - 'offset' => ( $paged - 1 ) * $this->_limit |
|
201 | + 'offset' => ($paged - 1) * $this->_limit |
|
202 | 202 | )); |
203 | 203 | |
204 | 204 | // run the query |
205 | - parent::__construct( $args ); |
|
205 | + parent::__construct($args); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @param string $event_list_title |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public function event_list_title( $event_list_title = '' ) { |
|
219 | - if ( ! empty( $this->_title )) { |
|
218 | + public function event_list_title($event_list_title = '') { |
|
219 | + if ( ! empty($this->_title)) { |
|
220 | 220 | return $this->_title; |
221 | 221 | } |
222 | 222 | return $event_list_title; |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | * @param string $event_list_css |
232 | 232 | * @return array |
233 | 233 | */ |
234 | - public function event_list_css( $event_list_css = '' ) { |
|
235 | - $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
|
236 | - $event_list_css .= ! empty( $this->_css_class ) ? $this->_css_class : ''; |
|
237 | - $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
|
238 | - $event_list_css .= ! empty( $this->_category_slug ) ? $this->_category_slug : ''; |
|
234 | + public function event_list_css($event_list_css = '') { |
|
235 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
236 | + $event_list_css .= ! empty($this->_css_class) ? $this->_css_class : ''; |
|
237 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
238 | + $event_list_css .= ! empty($this->_category_slug) ? $this->_category_slug : ''; |
|
239 | 239 | return $event_list_css; |
240 | 240 | } |
241 | 241 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |