@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - public function __construct( $admin_page ) { |
|
19 | + public function __construct($admin_page) { |
|
20 | 20 | parent::__construct($admin_page); |
21 | 21 | $this->_status = $this->_admin_page->get_registration_status_array(); |
22 | 22 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | protected function _setup_data() { |
28 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE ); |
|
29 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees( $this->_per_page, TRUE, TRUE); |
|
28 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE); |
|
29 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function _set_properties() { |
36 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
36 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
37 | 37 | |
38 | 38 | $this->_wp_list_args = array( |
39 | 39 | 'singular' => __('registrant', 'event_espresso'), |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $columns = array(); |
46 | 46 | //$columns['_Reg_Status'] = ''; |
47 | - if ( !empty( $evt_id ) ) { |
|
47 | + if ( ! empty($evt_id)) { |
|
48 | 48 | $columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text |
49 | 49 | $this->_has_checkbox_column = true; |
50 | 50 | } |
@@ -60,43 +60,43 @@ discard block |
||
60 | 60 | 'TXN_total' => __('Total', 'event_espresso') |
61 | 61 | ); |
62 | 62 | |
63 | - $this->_columns = array_merge( $columns, $this->_columns); |
|
63 | + $this->_columns = array_merge($columns, $this->_columns); |
|
64 | 64 | |
65 | 65 | $this->_primary_column = '_REG_att_checked_in'; |
66 | 66 | |
67 | - if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id ) ) { |
|
67 | + if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) { |
|
68 | 68 | $this->_bottom_buttons = array( |
69 | 69 | 'report'=> array( |
70 | 70 | 'route' => 'registrations_report', |
71 | 71 | 'extra_request' => |
72 | 72 | array( |
73 | 73 | 'EVT_ID'=> $evt_id, |
74 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
74 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") ) |
|
75 | 75 | ) |
76 | 76 | ); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $this->_sortable_columns = array( |
80 | 80 | //true means its already sorted |
81 | - 'ATT_name' => array( 'ATT_name' => TRUE ), |
|
82 | - 'Event' => array( 'Event.EVT.Name' => FALSE ) |
|
81 | + 'ATT_name' => array('ATT_name' => TRUE), |
|
82 | + 'Event' => array('Event.EVT.Name' => FALSE) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | $this->_hidden_columns = array(); |
86 | 86 | |
87 | 87 | $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id); |
88 | - $this->_dtts_for_event = !empty($evt_id) ? $this->_evt->datetimes_ordered() : array(); |
|
88 | + $this->_dtts_for_event = ! empty($evt_id) ? $this->_evt->datetimes_ordered() : array(); |
|
89 | 89 | |
90 | 90 | } |
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | 94 | |
95 | - protected function _get_row_class( $item ) { |
|
96 | - $class = parent::_get_row_class( $item ); |
|
95 | + protected function _get_row_class($item) { |
|
96 | + $class = parent::_get_row_class($item); |
|
97 | 97 | //add status class |
98 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
99 | - if ( $this->_has_checkbox_column ) { |
|
98 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
99 | + if ($this->_has_checkbox_column) { |
|
100 | 100 | $class .= ' has-checkbox-column'; |
101 | 101 | } |
102 | 102 | return $class; |
@@ -108,42 +108,42 @@ discard block |
||
108 | 108 | $filters = $where = array(); |
109 | 109 | |
110 | 110 | |
111 | - if ( empty( $this->_dtts_for_event ) ) { |
|
111 | + if (empty($this->_dtts_for_event)) { |
|
112 | 112 | //this means we don't have an event so let's setup a filter dropdown for all the events to select |
113 | 113 | //note possible capability restrictions |
114 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) { |
|
115 | - $where['status**'] = array( '!=', 'private' ); |
|
114 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
115 | + $where['status**'] = array('!=', 'private'); |
|
116 | 116 | } |
117 | 117 | |
118 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
119 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
118 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
119 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
120 | 120 | } |
121 | 121 | |
122 | - $events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) ); |
|
123 | - $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') ); |
|
124 | - foreach ( $events as $evt ) { |
|
122 | + $events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'))); |
|
123 | + $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso')); |
|
124 | + foreach ($events as $evt) { |
|
125 | 125 | //any registrations for this event? |
126 | - if ( ! $evt->get_count_of_all_registrations() ) |
|
126 | + if ( ! $evt->get_count_of_all_registrations()) |
|
127 | 127 | continue; |
128 | 128 | $evts[] = array( |
129 | 129 | 'id' => $evt->ID(), |
130 | - 'text' => $evt->get( 'EVT_name' ), |
|
130 | + 'text' => $evt->get('EVT_name'), |
|
131 | 131 | 'class' => $evt->is_expired() ? 'ee-expired-event' : '' |
132 | 132 | ); |
133 | 133 | } |
134 | 134 | $event_filter = '<div class="ee-event-filter">'; |
135 | - $event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts ); |
|
136 | - $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>'; |
|
135 | + $event_filter .= EEH_Form_Fields::select_input('event_id', $evts); |
|
136 | + $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>'; |
|
137 | 137 | $event_filter .= '</div>'; |
138 | 138 | $filters[] = $event_filter; |
139 | 139 | |
140 | 140 | } else { |
141 | 141 | //DTT datetimes filter |
142 | - $cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
142 | + $cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); |
|
143 | 143 | $dtts = array(); |
144 | - foreach ( $this->_dtts_for_event as $dtt ) { |
|
145 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time(); |
|
146 | - $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string ); |
|
144 | + foreach ($this->_dtts_for_event as $dtt) { |
|
145 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time(); |
|
146 | + $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string); |
|
147 | 147 | } |
148 | 148 | $filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt); |
149 | 149 | } |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | |
165 | 165 | |
166 | 166 | protected function _get_total_event_attendees() { |
167 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
168 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
167 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
168 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
169 | 169 | $query_params = array(); |
170 | - if ($EVT_ID){ |
|
171 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
170 | + if ($EVT_ID) { |
|
171 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
172 | 172 | } |
173 | 173 | //if DTT is included we do multiple datetimes. Otherwise we just do primary datetime |
174 | - if ( $DTT_ID ) { |
|
174 | + if ($DTT_ID) { |
|
175 | 175 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
176 | 176 | } |
177 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
177 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
178 | 178 | |
179 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
179 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
180 | 180 | |
181 | 181 | return EEM_Registration::instance()->count($query_params); |
182 | 182 | } |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | |
188 | 188 | |
189 | 189 | |
190 | - function column__Reg_Status( EE_Registration $item ) { |
|
191 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
190 | + function column__Reg_Status(EE_Registration $item) { |
|
191 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>'; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | |
198 | 198 | function column_cb($item) { |
199 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() ); |
|
199 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -209,18 +209,18 @@ discard block |
||
209 | 209 | /** |
210 | 210 | * column_REG_att_checked_in |
211 | 211 | */ |
212 | - function column__REG_att_checked_in(EE_Registration $item){ |
|
212 | + function column__REG_att_checked_in(EE_Registration $item) { |
|
213 | 213 | $attendee = $item->attendee(); |
214 | 214 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
215 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0; |
|
215 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
216 | 216 | $checkinstatus = $item->check_in_status_for_datetime($DTT_ID); |
217 | 217 | $nonce = wp_create_nonce('checkin_nonce'); |
218 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL; |
|
219 | - $toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : ''; |
|
218 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL; |
|
219 | + $toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : ''; |
|
220 | 220 | |
221 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
221 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>'; |
|
222 | 222 | |
223 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content; |
|
223 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -229,43 +229,43 @@ discard block |
||
229 | 229 | |
230 | 230 | function column_ATT_name(EE_Registration $item) { |
231 | 231 | $attendee = $item->attendee(); |
232 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
232 | + if ( ! $attendee instanceof EE_Attendee) { |
|
233 | 233 | return __('No contact record for this registration.', 'event_espresso'); |
234 | 234 | } |
235 | 235 | |
236 | 236 | // edit attendee link |
237 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL ); |
|
238 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name(); |
|
237 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL); |
|
238 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name(); |
|
239 | 239 | $name_link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' : ''; |
240 | 240 | |
241 | 241 | //add group details |
242 | - $name_link .= ' ' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size()); |
|
242 | + $name_link .= ' '.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
243 | 243 | |
244 | 244 | //add regcode |
245 | - $link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL ); |
|
245 | + $link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL); |
|
246 | 246 | $name_link .= '<br>'; |
247 | - $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() ) |
|
248 | - ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>' |
|
247 | + $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID()) |
|
248 | + ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>' |
|
249 | 249 | : $item->reg_code(); |
250 | 250 | |
251 | 251 | //status |
252 | - $name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
252 | + $name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
253 | 253 | |
254 | 254 | $actions = array(); |
255 | - $DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
256 | - $DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID; |
|
255 | + $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
256 | + $DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID; |
|
257 | 257 | |
258 | - if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) { |
|
259 | - $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
260 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>'; |
|
258 | + if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) { |
|
259 | + $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); |
|
260 | + $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
261 | 261 | } |
262 | 262 | |
263 | - return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link; |
|
263 | + return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
267 | 267 | |
268 | - function column_ATT_email( EE_Registration $item ) { |
|
268 | + function column_ATT_email(EE_Registration $item) { |
|
269 | 269 | $attendee = $item->attendee(); |
270 | 270 | return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
271 | 271 | return $item->get_first_related('Attendee')->email(); |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | |
278 | 278 | function column_Event(EE_Registration $item) { |
279 | 279 | $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
280 | - $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL ); |
|
281 | - $event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ? '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name(); |
|
280 | + $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL); |
|
281 | + $event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name(); |
|
282 | 282 | return $event_label; |
283 | 283 | } |
284 | 284 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | |
288 | 288 | |
289 | - function column_PRC_name(EE_Registration $item){ |
|
289 | + function column_PRC_name(EE_Registration $item) { |
|
290 | 290 | return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso"); |
291 | 291 | } |
292 | 292 | |
@@ -298,8 +298,8 @@ discard block |
||
298 | 298 | /** |
299 | 299 | * column_REG_final_price |
300 | 300 | */ |
301 | - function column__REG_final_price(EE_Registration $item){ |
|
302 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
301 | + function column__REG_final_price(EE_Registration $item) { |
|
302 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>'; |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -309,20 +309,20 @@ discard block |
||
309 | 309 | /** |
310 | 310 | * column_TXN_paid |
311 | 311 | */ |
312 | - function column_TXN_paid(EE_Registration $item){ |
|
312 | + function column_TXN_paid(EE_Registration $item) { |
|
313 | 313 | |
314 | - if ( $item->count() == 1 ) { |
|
314 | + if ($item->count() == 1) { |
|
315 | 315 | |
316 | - if ( $item->transaction()->paid() >= $item->transaction()->total() ) { |
|
316 | + if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
317 | 317 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
318 | 318 | } else { |
319 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL ); |
|
320 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
319 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL); |
|
320 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
321 | 321 | <span class="reg-pad-rght"> |
322 | - <a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'" title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '"> |
|
323 | - ' . $item->transaction()->pretty_paid(). ' |
|
322 | + <a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"> |
|
323 | + ' . $item->transaction()->pretty_paid().' |
|
324 | 324 | </a> |
325 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
325 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
326 | 326 | } |
327 | 327 | } else { |
328 | 328 | return '<span class="reg-pad-rght"></span>'; |
@@ -336,13 +336,13 @@ discard block |
||
336 | 336 | /** |
337 | 337 | * column_TXN_total |
338 | 338 | */ |
339 | - function column_TXN_total(EE_Registration $item){ |
|
339 | + function column_TXN_total(EE_Registration $item) { |
|
340 | 340 | $txn = $item->transaction(); |
341 | - $view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
|
342 | - if ( $item->get('REG_count') == 1 ) { |
|
341 | + $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
342 | + if ($item->get('REG_count') == 1) { |
|
343 | 343 | $line_total_obj = $txn->total_line_item(); |
344 | 344 | $txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso'); |
345 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
345 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; |
|
346 | 346 | } else { |
347 | 347 | return '<span class="reg-pad-rght"></span>'; |
348 | 348 | } |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
2 | +add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
3 | 3 | $values = EEH_Form_Fields::prep_answer_options( |
4 | 4 | array( |
5 | - array( 'id' => 1, 'text' => __( 'Yes', 'event_espresso' ) ), |
|
6 | - array( 'id' => 0, 'text' => __( 'No', 'event_espresso' ) ) |
|
5 | + array('id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
6 | + array('id' => 0, 'text' => __('No', 'event_espresso')) |
|
7 | 7 | ) |
8 | 8 | ); |
9 | 9 | ?> |
@@ -22,27 +22,27 @@ discard block |
||
22 | 22 | </label> |
23 | 23 | </th> |
24 | 24 | <td> |
25 | - <?php echo EEH_Form_Fields::select( 'display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single' ); ?> |
|
26 | - <p class="description"><?php _e( 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso' ); ?></p> |
|
25 | + <?php echo EEH_Form_Fields::select('display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single'); ?> |
|
26 | + <p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso'); ?></p> |
|
27 | 27 | </td> |
28 | 28 | </tr> |
29 | 29 | |
30 | 30 | <tr> |
31 | 31 | <th> |
32 | 32 | <label for="display_venue"> |
33 | - <?php _e( 'Display Venue Details', 'event_espresso' ); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?> |
|
33 | + <?php _e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?> |
|
34 | 34 | </label> |
35 | 35 | </th> |
36 | 36 | <td> |
37 | - <?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'display_venue', 'display_venue' ); ?> |
|
38 | - <p class="description"><?php _e( 'Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso' ); ?></p> |
|
37 | + <?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'display_venue', 'display_venue'); ?> |
|
38 | + <p class="description"><?php _e('Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso'); ?></p> |
|
39 | 39 | </td> |
40 | 40 | </tr> |
41 | 41 | |
42 | 42 | <tr> |
43 | 43 | <th> |
44 | 44 | <label for="EED_Events_Single_use_sortable_display_order"> |
45 | - <?php _e( 'Use Custom Display Order?', 'event_espresso' ); ?> |
|
45 | + <?php _e('Use Custom Display Order?', 'event_espresso'); ?> |
|
46 | 46 | </label> |
47 | 47 | </th> |
48 | 48 | <td> |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | <p class="description "> |
59 | 59 | <?php |
60 | 60 | echo sprintf( |
61 | - __( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ), |
|
61 | + __('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'), |
|
62 | 62 | '<span class="important-notice">', |
63 | 63 | '</span>', |
64 | 64 | '<br />' |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | |
71 | 71 | <tr> |
72 | 72 | <th> |
73 | - <?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?> |
|
73 | + <?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?> |
|
74 | 74 | </th> |
75 | 75 | <td> |
76 | 76 | |
77 | - <?php wp_nonce_field( 'espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false ); ?> |
|
77 | + <?php wp_nonce_field('espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false); ?> |
|
78 | 78 | <?php echo $event_single_display_order; ?> |
79 | 79 | |
80 | 80 | <p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the single event page.', 'event_espresso'); ?></p> |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
2 | +add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
3 | 3 | |
4 | -$values = EEH_Form_Fields::prep_answer_options( array( |
|
5 | - array( 'id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
6 | - array( 'id' => 0, 'text' => __('No', 'event_espresso')) |
|
4 | +$values = EEH_Form_Fields::prep_answer_options(array( |
|
5 | + array('id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
6 | + array('id' => 0, 'text' => __('No', 'event_espresso')) |
|
7 | 7 | )); |
8 | 8 | |
9 | -$description = EEH_Form_Fields::prep_answer_options( array( |
|
10 | - array( 'id' => 0, 'text' => __('none', 'event_espresso')), |
|
11 | - array( 'id' => 1, 'text' => __('excerpt (short desc)', 'event_espresso')), |
|
12 | - array( 'id' => 2, 'text' => __('full description', 'event_espresso')) |
|
9 | +$description = EEH_Form_Fields::prep_answer_options(array( |
|
10 | + array('id' => 0, 'text' => __('none', 'event_espresso')), |
|
11 | + array('id' => 1, 'text' => __('excerpt (short desc)', 'event_espresso')), |
|
12 | + array('id' => 2, 'text' => __('full description', 'event_espresso')) |
|
13 | 13 | )); |
14 | 14 | |
15 | 15 | ?> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | <tr> |
28 | 28 | <th> |
29 | 29 | <label for="event_listings_url"> |
30 | - <?php _e('Event Listings URL', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('event_listings_url_info');?> |
|
30 | + <?php _e('Event Listings URL', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('event_listings_url_info'); ?> |
|
31 | 31 | </label> |
32 | 32 | </th> |
33 | 33 | <td> |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | </label> |
43 | 43 | </th> |
44 | 44 | <td> |
45 | - <p><?php echo site_url() . '/ ' . EEH_Form_Fields::text( 'not_used', EE_Registry::instance()->CFG->core->event_cpt_slug, 'event_cpt_slug', 'event_cpt_slug', 'regular' ); ?></p> |
|
45 | + <p><?php echo site_url().'/ '.EEH_Form_Fields::text('not_used', EE_Registry::instance()->CFG->core->event_cpt_slug, 'event_cpt_slug', 'event_cpt_slug', 'regular'); ?></p> |
|
46 | 46 | <p class="description"><?php _e('This allows you to configure what slug is used for the url of all event pages.', 'event_espresso'); ?></p> |
47 | - <?php if ( has_filter( 'FHEE__EE_Register_CPTs__register_CPT__rewrite' ) ) : ?> |
|
47 | + <?php if (has_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite')) : ?> |
|
48 | 48 | <p class="important-notice"> |
49 | 49 | <?php |
50 | 50 | sprintf( |
51 | - __( 'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', 'event_espresso' ), |
|
51 | + __('Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', 'event_espresso'), |
|
52 | 52 | '<code>', |
53 | 53 | '</code>' |
54 | 54 | ); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | </label> |
66 | 66 | </th> |
67 | 67 | <td> |
68 | - <?php echo EEH_Form_Fields::select( 'display_status_banner', $display_status_banner, $values, 'EED_Events_Archive_display_status_banner', 'EED_Events_Archive_display_status_banner' );?> |
|
68 | + <?php echo EEH_Form_Fields::select('display_status_banner', $display_status_banner, $values, 'EED_Events_Archive_display_status_banner', 'EED_Events_Archive_display_status_banner'); ?> |
|
69 | 69 | <p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.', 'event_espresso'); ?></p> |
70 | 70 | </td> |
71 | 71 | </tr> |
@@ -73,55 +73,55 @@ discard block |
||
73 | 73 | <tr> |
74 | 74 | <th> |
75 | 75 | <label for="EED_Events_Archive_display_description"> |
76 | - <?php _e('Display Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_description_info');?> |
|
76 | + <?php _e('Display Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_description_info'); ?> |
|
77 | 77 | </label> |
78 | 78 | </th> |
79 | 79 | <td> |
80 | - <?php echo EEH_Form_Fields::select( 'description', $display_description, $description, 'EED_Events_Archive_display_description', 'EED_Events_Archive_display_description' );?> |
|
80 | + <?php echo EEH_Form_Fields::select('description', $display_description, $description, 'EED_Events_Archive_display_description', 'EED_Events_Archive_display_description'); ?> |
|
81 | 81 | </td> |
82 | 82 | </tr> |
83 | 83 | |
84 | 84 | <tr> |
85 | 85 | <th> |
86 | 86 | <label for="EED_Events_Archive_display_ticket_selector"> |
87 | - <?php _e('Display Ticket Selector', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_ticket_selector_info');?> |
|
87 | + <?php _e('Display Ticket Selector', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_ticket_selector_info'); ?> |
|
88 | 88 | </label> |
89 | 89 | </th> |
90 | 90 | <td> |
91 | - <?php echo EEH_Form_Fields::select( 'ticket_selector', $display_ticket_selector, $values, 'EED_Events_Archive_display_ticket_selector', 'EED_Events_Archive_display_ticket_selector' );?> |
|
91 | + <?php echo EEH_Form_Fields::select('ticket_selector', $display_ticket_selector, $values, 'EED_Events_Archive_display_ticket_selector', 'EED_Events_Archive_display_ticket_selector'); ?> |
|
92 | 92 | </td> |
93 | 93 | </tr> |
94 | 94 | |
95 | 95 | <tr> |
96 | 96 | <th> |
97 | 97 | <label for="EED_Events_Archive_display_datetimes"> |
98 | - <?php _e('Display Datetimes', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_datetimes_info');?> |
|
98 | + <?php _e('Display Datetimes', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_datetimes_info'); ?> |
|
99 | 99 | </label> |
100 | 100 | </th> |
101 | 101 | <td> |
102 | - <?php echo EEH_Form_Fields::select( 'venue_details', $display_datetimes, $values, 'EED_Events_Archive_display_datetimes', 'EED_Events_Archive_display_datetimes' );?> |
|
102 | + <?php echo EEH_Form_Fields::select('venue_details', $display_datetimes, $values, 'EED_Events_Archive_display_datetimes', 'EED_Events_Archive_display_datetimes'); ?> |
|
103 | 103 | </td> |
104 | 104 | </tr> |
105 | 105 | |
106 | 106 | <tr> |
107 | 107 | <th> |
108 | 108 | <label for="EED_Events_Archive_display_venue"> |
109 | - <?php _e('Display Venue Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_venue_details_info');?> |
|
109 | + <?php _e('Display Venue Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_venue_details_info'); ?> |
|
110 | 110 | </label> |
111 | 111 | </th> |
112 | 112 | <td> |
113 | - <?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'EED_Events_Archive_display_venue', 'EED_Events_Archive_display_venue' );?> |
|
113 | + <?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'EED_Events_Archive_display_venue', 'EED_Events_Archive_display_venue'); ?> |
|
114 | 114 | </td> |
115 | 115 | </tr> |
116 | 116 | |
117 | 117 | <tr> |
118 | 118 | <th> |
119 | 119 | <label for="EED_Events_Archive_display_expired_events"> |
120 | - <?php _e('Display Expired Events', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_expired_events_info');?> |
|
120 | + <?php _e('Display Expired Events', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_expired_events_info'); ?> |
|
121 | 121 | </label> |
122 | 122 | </th> |
123 | 123 | <td> |
124 | - <?php echo EEH_Form_Fields::select( 'expired_events', $display_expired_events, $values, 'EED_Events_Archive_display_expired_events', 'EED_Events_Archive_display_expired_events' );?> |
|
124 | + <?php echo EEH_Form_Fields::select('expired_events', $display_expired_events, $values, 'EED_Events_Archive_display_expired_events', 'EED_Events_Archive_display_expired_events'); ?> |
|
125 | 125 | </td> |
126 | 126 | </tr> |
127 | 127 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | </label> |
133 | 133 | </th> |
134 | 134 | <td> |
135 | - <?php echo EEH_Form_Fields::select( 'use_sortable_display_order', $use_sortable_display_order, $values, 'EED_Events_Archive_use_sortable_display_order', 'EED_Events_Archive_use_sortable_display_order' );?> |
|
135 | + <?php echo EEH_Form_Fields::select('use_sortable_display_order', $use_sortable_display_order, $values, 'EED_Events_Archive_use_sortable_display_order', 'EED_Events_Archive_use_sortable_display_order'); ?> |
|
136 | 136 | <p class="description "> |
137 | 137 | <?php |
138 | 138 | echo sprintf( |
139 | - __( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Archive listings, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ), |
|
139 | + __('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Archive listings, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'), |
|
140 | 140 | '<span class="important-notice">', |
141 | 141 | '</span>', |
142 | 142 | '<br />' |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | |
149 | 149 | <tr> |
150 | 150 | <th> |
151 | - <?php _e( 'Display Order', 'event_espresso' ); ?><?php //echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
151 | + <?php _e('Display Order', 'event_espresso'); ?><?php //echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
152 | 152 | </th> |
153 | 153 | <td> |
154 | 154 | |
155 | - <?php wp_nonce_field( 'espresso_update_event_archive_order', 'espresso_update_event_archive_order_nonce', false ); ?> |
|
155 | + <?php wp_nonce_field('espresso_update_event_archive_order', 'espresso_update_event_archive_order_nonce', false); ?> |
|
156 | 156 | <?php echo $event_archive_display_order; ?> |
157 | 157 | |
158 | - <p class="description"><?php _e( 'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', 'event_espresso' ); ?></p> |
|
158 | + <p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', 'event_espresso'); ?></p> |
|
159 | 159 | |
160 | 160 | </td> |
161 | 161 | </tr> |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | <tr> |
164 | 164 | <th> |
165 | 165 | <label for="EED_Events_Archive_reset_event_list_settings"> |
166 | - <?php _e( 'Reset Event List Settings', 'event_espresso' ); ?> |
|
166 | + <?php _e('Reset Event List Settings', 'event_espresso'); ?> |
|
167 | 167 | </label> |
168 | 168 | </th> |
169 | 169 | <td> |
170 | - <?php echo EEH_Form_Fields::select( 'reset_event_list_settings', 0, $values, 'EED_Events_Archive_reset_event_list_settings', 'EED_Events_Archive_reset_event_list_settings' ); ?> |
|
170 | + <?php echo EEH_Form_Fields::select('reset_event_list_settings', 0, $values, 'EED_Events_Archive_reset_event_list_settings', 'EED_Events_Archive_reset_event_list_settings'); ?> |
|
171 | 171 | </td> |
172 | 172 | </tr> |
173 | 173 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param WP $WP |
20 | 20 | * @return void |
21 | 21 | */ |
22 | - public function run( WP $WP ) {} |
|
22 | + public function run(WP $WP) {} |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * @param array $attributes |
70 | 70 | * @return string |
71 | 71 | */ |
72 | - public function process_shortcode( $attributes = array() ) { |
|
72 | + public function process_shortcode($attributes = array()) { |
|
73 | 73 | |
74 | 74 | // merge in any attributes passed via fallback shortcode processor |
75 | - $attributes = array_merge( (array) $attributes, (array) $this->_attributes ); |
|
75 | + $attributes = array_merge((array) $attributes, (array) $this->_attributes); |
|
76 | 76 | |
77 | 77 | //set default attributes |
78 | 78 | $default_shortcode_attributes = array( |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | ); |
85 | 85 | |
86 | 86 | // allow the defaults to be filtered |
87 | - $default_shortcode_attributes = apply_filters( 'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes ); |
|
87 | + $default_shortcode_attributes = apply_filters('EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes); |
|
88 | 88 | // grab attributes and merge with defaults, then extract |
89 | - $attributes = array_merge( $default_shortcode_attributes, $attributes ); |
|
89 | + $attributes = array_merge($default_shortcode_attributes, $attributes); |
|
90 | 90 | |
91 | 91 | $template_args = array( |
92 | 92 | 'contacts' => array(), |
@@ -102,31 +102,31 @@ discard block |
||
102 | 102 | $error = false; |
103 | 103 | |
104 | 104 | //what event? |
105 | - if ( empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) && empty( $attributes['ticket_id'] ) ) { |
|
105 | + if (empty($attributes['event_id']) && empty($attributes['datetime_id']) && empty($attributes['ticket_id'])) { |
|
106 | 106 | //seems like is_espresso_event_single() isn't working as expected. So using alternate method. |
107 | - if ( is_single() && is_espresso_event() ) { |
|
107 | + if (is_single() && is_espresso_event()) { |
|
108 | 108 | $event = EEH_Event_View::get_event(); |
109 | - if ( $event instanceof EE_Event ) { |
|
109 | + if ($event instanceof EE_Event) { |
|
110 | 110 | $template_args['event'] = $event; |
111 | 111 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
112 | 112 | } |
113 | 113 | } else { |
114 | 114 | //try getting the earliest active event if none then get the |
115 | - $events = EEM_Event::instance()->get_active_events( array( 'limit' => 1, |
|
116 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
117 | - ) ); |
|
118 | - $events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit' => 1, |
|
119 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
120 | - ) ) : $events; |
|
121 | - $event = reset( $events ); |
|
122 | - if ( $event instanceof EE_Event ) { |
|
115 | + $events = EEM_Event::instance()->get_active_events(array('limit' => 1, |
|
116 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
117 | + )); |
|
118 | + $events = empty($events) ? EEM_Event::instance()->get_upcoming_events(array('limit' => 1, |
|
119 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
120 | + )) : $events; |
|
121 | + $event = reset($events); |
|
122 | + if ($event instanceof EE_Event) { |
|
123 | 123 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
124 | 124 | $template_args['event'] = $event; |
125 | 125 | } |
126 | 126 | } |
127 | - } elseif ( ! empty( $attributes['event_id'] ) ) { |
|
128 | - $event = EEM_Event::instance()->get_one_by_ID( $attributes['event_id'] ); |
|
129 | - if ( $event instanceof EE_Event ) { |
|
127 | + } elseif ( ! empty($attributes['event_id'])) { |
|
128 | + $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']); |
|
129 | + if ($event instanceof EE_Event) { |
|
130 | 130 | $query[0]['Registration.EVT_ID'] = $attributes['event_id']; |
131 | 131 | $template_args['event'] = $event; |
132 | 132 | } else { |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | //datetime? |
138 | - if ( ! empty( $attributes['datetime_id'] ) && empty( $attributes['event_id'] ) ) { |
|
139 | - $datetime = EEM_Datetime::instance()->get_one_by_ID( $attributes['datetime_id'] ); |
|
140 | - if ( $datetime instanceof EE_Datetime ) { |
|
138 | + if ( ! empty($attributes['datetime_id']) && empty($attributes['event_id'])) { |
|
139 | + $datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']); |
|
140 | + if ($datetime instanceof EE_Datetime) { |
|
141 | 141 | $query[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id']; |
142 | 142 | $query['default_where_conditions'] = 'this_model_only'; |
143 | 143 | $template_args['datetime'] = $datetime; |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | //ticket?just |
151 | - if ( ! empty( $attributes['ticket_id'] ) && empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) ) { |
|
152 | - $ticket = EEM_Ticket::instance()->get_one_by_ID( $attributes['ticket_id'] ); |
|
153 | - if ( $ticket instanceof EE_Ticket ) { |
|
151 | + if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) { |
|
152 | + $ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']); |
|
153 | + if ($ticket instanceof EE_Ticket) { |
|
154 | 154 | $query[0]['Registration.TKT_ID'] = $attributes['ticket_id']; |
155 | 155 | $template_args['ticket'] = $ticket; |
156 | 156 | $template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime ? $ticket->first_datetime()->event() : null; |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | |
162 | 162 | //status |
163 | 163 | $reg_status_array = EEM_Registration::reg_status_array(); |
164 | - if ( $attributes['status'] != 'all' && isset( $reg_status_array[$attributes['status']] ) ) { |
|
164 | + if ($attributes['status'] != 'all' && isset($reg_status_array[$attributes['status']])) { |
|
165 | 165 | $query[0]['Registration.STS_ID'] = $attributes['status']; |
166 | 166 | } |
167 | - $query['group_by'] = array( 'ATT_ID' ); |
|
168 | - $query['order_by'] = apply_filters( 'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array( 'ATT_lname' => 'ASC', 'ATT_fname' => 'ASC' ) ); |
|
167 | + $query['group_by'] = array('ATT_ID'); |
|
168 | + $query['order_by'] = apply_filters('FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')); |
|
169 | 169 | |
170 | 170 | //if we have NO query where conditions, then there was an invalid parameter or the shortcode was used incorrectly |
171 | 171 | //so when WP_DEBUG is set and true, we'll show a message, otherwise we'll just return an empty string. |
172 | - if ( ( ! isset( $query[0] ) || ! is_array( $query[0] ) ) || $error ) { |
|
173 | - if ( WP_DEBUG ) { |
|
174 | - return '<div class="important-notice ee-attention">' . __( 'The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso' ) . '</div>'; |
|
172 | + if (( ! isset($query[0]) || ! is_array($query[0])) || $error) { |
|
173 | + if (WP_DEBUG) { |
|
174 | + return '<div class="important-notice ee-attention">'.__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso').'</div>'; |
|
175 | 175 | } else { |
176 | 176 | return ''; |
177 | 177 | } |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | //get contacts! |
182 | - $template_args['contacts'] = EEM_Attendee::instance()->get_all( $query ); |
|
182 | + $template_args['contacts'] = EEM_Attendee::instance()->get_all($query); |
|
183 | 183 | |
184 | 184 | |
185 | 185 | //all set let's load up the template and return. |
186 | - return EEH_Template::locate_template( 'loop-espresso_event_attendees.php', $template_args, true, true ); |
|
186 | + return EEH_Template::locate_template('loop-espresso_event_attendees.php', $template_args, true, true); |
|
187 | 187 | |
188 | 188 | } |
189 | 189 |
@@ -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,44 +163,44 @@ 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 | //add query filters |
180 | 180 | EEH_Event_Query::add_query_filters(); |
181 | 181 | // set params that will get used by the filters |
182 | - EEH_Event_Query::set_query_params( $this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort ); |
|
182 | + EEH_Event_Query::set_query_params($this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort); |
|
183 | 183 | // first off, let's remove any filters from previous queries |
184 | - remove_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' )); |
|
185 | - remove_all_filters( 'FHEE__content_espresso_events__event_class' ); |
|
184 | + remove_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title')); |
|
185 | + remove_all_filters('FHEE__content_espresso_events__event_class'); |
|
186 | 186 | // Event List Title ? |
187 | - add_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' ), 10, 1 ); |
|
187 | + add_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title'), 10, 1); |
|
188 | 188 | // add the css class |
189 | - add_filter( 'FHEE__content_espresso_events__event_class', array( $this, 'event_list_css' ), 10, 1 ); |
|
189 | + add_filter('FHEE__content_espresso_events__event_class', array($this, 'event_list_css'), 10, 1); |
|
190 | 190 | // the current "page" we are viewing |
191 | - $paged = max( 1, get_query_var( 'paged' )); |
|
191 | + $paged = max(1, get_query_var('paged')); |
|
192 | 192 | // Force these args |
193 | - $args = array_merge( $args, array( |
|
193 | + $args = array_merge($args, array( |
|
194 | 194 | 'post_type' => 'espresso_events', |
195 | 195 | 'posts_per_page' => $this->_limit, |
196 | 196 | 'update_post_term_cache' => FALSE, |
197 | 197 | 'update_post_meta_cache' => FALSE, |
198 | 198 | 'paged' => $paged, |
199 | - 'offset' => ( $paged - 1 ) * $this->_limit |
|
199 | + 'offset' => ($paged - 1) * $this->_limit |
|
200 | 200 | )); |
201 | 201 | |
202 | 202 | // run the query |
203 | - parent::__construct( $args ); |
|
203 | + parent::__construct($args); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | * @param string $event_list_title |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public function event_list_title( $event_list_title = '' ) { |
|
217 | - if ( ! empty( $this->_title )) { |
|
216 | + public function event_list_title($event_list_title = '') { |
|
217 | + if ( ! empty($this->_title)) { |
|
218 | 218 | return $this->_title; |
219 | 219 | } |
220 | 220 | return $event_list_title; |
@@ -229,11 +229,11 @@ discard block |
||
229 | 229 | * @param string $event_list_css |
230 | 230 | * @return array |
231 | 231 | */ |
232 | - public function event_list_css( $event_list_css = '' ) { |
|
233 | - $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
|
234 | - $event_list_css .= ! empty( $this->_css_class ) ? $this->_css_class : ''; |
|
235 | - $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
|
236 | - $event_list_css .= ! empty( $this->_category_slug ) ? $this->_category_slug : ''; |
|
232 | + public function event_list_css($event_list_css = '') { |
|
233 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
234 | + $event_list_css .= ! empty($this->_css_class) ? $this->_css_class : ''; |
|
235 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
236 | + $event_list_css .= ! empty($this->_category_slug) ? $this->_category_slug : ''; |
|
237 | 237 | return $event_list_css; |
238 | 238 | } |
239 | 239 |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | * All children of this must call parent::__construct() at the end of their constructor or suffer the consequences! |
118 | 118 | */ |
119 | 119 | public function __construct() { |
120 | - $this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages',$this->_migration_stages); |
|
121 | - foreach($this->_migration_stages as $migration_stage){ |
|
122 | - if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) { |
|
120 | + $this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages', $this->_migration_stages); |
|
121 | + foreach ($this->_migration_stages as $migration_stage) { |
|
122 | + if ($migration_stage instanceof EE_Data_Migration_Script_Stage) { |
|
123 | 123 | $migration_stage->_construct_finalize($this); |
124 | 124 | } |
125 | 125 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Place to add hooks and filters for tweaking the migrations page, in order |
133 | 133 | * to customize it |
134 | 134 | */ |
135 | - public function migration_page_hooks(){ |
|
135 | + public function migration_page_hooks() { |
|
136 | 136 | //by default none are added because we normally like the default look of the migration page |
137 | 137 | } |
138 | 138 | |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * @param int|string $new_pk eg posts.ID |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function set_mapping($old_table,$old_pk,$new_table,$new_pk){ |
|
150 | + public function set_mapping($old_table, $old_pk, $new_table, $new_pk) { |
|
151 | 151 | //make sure it has the needed keys |
152 | - if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){ |
|
152 | + if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) { |
|
153 | 153 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
154 | 154 | } |
155 | 155 | $this->_mappings[$old_table][$new_table][$old_pk] = $new_pk; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts |
166 | 166 | * @return mixed the primary key on the new table |
167 | 167 | */ |
168 | - public function get_mapping_new_pk($old_table,$old_pk,$new_table){ |
|
169 | - if( ! isset($this->_mappings[$old_table]) || |
|
170 | - ! isset($this->_mappings[$old_table][$new_table])){ |
|
168 | + public function get_mapping_new_pk($old_table, $old_pk, $new_table) { |
|
169 | + if ( ! isset($this->_mappings[$old_table]) || |
|
170 | + ! isset($this->_mappings[$old_table][$new_table])) { |
|
171 | 171 | //try fetching the option |
172 | 172 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
173 | 173 | } |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | * @param mixed $new_pk |
185 | 185 | * @return mixed |
186 | 186 | */ |
187 | - public function get_mapping_old_pk($old_table,$new_table,$new_pk){ |
|
188 | - if( ! isset($this->_mappings[$old_table]) || |
|
189 | - ! isset($this->_mappings[$old_table][$new_table])){ |
|
187 | + public function get_mapping_old_pk($old_table, $new_table, $new_pk) { |
|
188 | + if ( ! isset($this->_mappings[$old_table]) || |
|
189 | + ! isset($this->_mappings[$old_table][$new_table])) { |
|
190 | 190 | //try fetching the option |
191 | 191 | $this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table); |
192 | 192 | } |
193 | - if(isset($this->_mappings[$old_table][$new_table])){ |
|
193 | + if (isset($this->_mappings[$old_table][$new_table])) { |
|
194 | 194 | $new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]); |
195 | - if(isset($new_pk_to_old_pk[$new_pk])){ |
|
195 | + if (isset($new_pk_to_old_pk[$new_pk])) { |
|
196 | 196 | return $new_pk_to_old_pk[$new_pk]; |
197 | 197 | } |
198 | 198 | } |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * @param string $new_table_name |
208 | 208 | * @return array |
209 | 209 | */ |
210 | - protected function _get_mapping_option($old_table_name,$new_table_name){ |
|
211 | - $option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array()); |
|
210 | + protected function _get_mapping_option($old_table_name, $new_table_name) { |
|
211 | + $option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array()); |
|
212 | 212 | return $option; |
213 | 213 | } |
214 | 214 | |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | * @param array $mapping_array |
222 | 222 | * @return boolean success of updating option |
223 | 223 | */ |
224 | - protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){ |
|
224 | + protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) { |
|
225 | 225 | // echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>"; |
226 | - $success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array); |
|
226 | + $success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array); |
|
227 | 227 | return $success; |
228 | 228 | } |
229 | 229 | |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | * @param string $new_table_name |
236 | 236 | * @return string |
237 | 237 | */ |
238 | - protected function _get_mapping_option_name($old_table_name,$new_table_name){ |
|
238 | + protected function _get_mapping_option_name($old_table_name, $new_table_name) { |
|
239 | 239 | global $wpdb; |
240 | - $old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name); |
|
241 | - $new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name); |
|
240 | + $old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name); |
|
241 | + $new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name); |
|
242 | 242 | $migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this)); |
243 | - return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 ); |
|
243 | + return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete. |
258 | 258 | * @return int |
259 | 259 | */ |
260 | - protected function _count_records_to_migrate(){ |
|
260 | + protected function _count_records_to_migrate() { |
|
261 | 261 | $count = 0; |
262 | - foreach($this->stages() as $stage){ |
|
263 | - $count+= $stage->count_records_to_migrate(); |
|
262 | + foreach ($this->stages() as $stage) { |
|
263 | + $count += $stage->count_records_to_migrate(); |
|
264 | 264 | } |
265 | 265 | return $count; |
266 | 266 | } |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | * by just setting a transient and updating it after each migration_step |
273 | 273 | * @return int |
274 | 274 | */ |
275 | - public function count_records_migrated(){ |
|
275 | + public function count_records_migrated() { |
|
276 | 276 | $count = 0; |
277 | - foreach($this->stages() as $stage){ |
|
278 | - $count+= $stage->count_records_migrated(); |
|
277 | + foreach ($this->stages() as $stage) { |
|
278 | + $count += $stage->count_records_migrated(); |
|
279 | 279 | } |
280 | 280 | $this->_records_migrated = $count; |
281 | 281 | return $count; |
@@ -289,24 +289,24 @@ discard block |
||
289 | 289 | * @throws EE_Error |
290 | 290 | * @throws Exception |
291 | 291 | */ |
292 | - public function migration_step($num_records_to_migrate_limit){ |
|
292 | + public function migration_step($num_records_to_migrate_limit) { |
|
293 | 293 | //reset the feedback message |
294 | 294 | $this->_feedback_message = ''; |
295 | 295 | //if we haven't yet done the 1st schema changes, do them now. buffer any output |
296 | 296 | $this->_maybe_do_schema_changes(true); |
297 | 297 | |
298 | - $num_records_actually_migrated =0; |
|
298 | + $num_records_actually_migrated = 0; |
|
299 | 299 | $records_migrated_per_stage = array(); |
300 | 300 | //setup the 'stage' variable, which should hold the last run stage of the migration (or none at all if nothing runs) |
301 | 301 | $stage = null; |
302 | 302 | //get the next stage that isn't complete |
303 | - foreach($this->stages() as $stage){ |
|
304 | - if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){ |
|
305 | - try{ |
|
303 | + foreach ($this->stages() as $stage) { |
|
304 | + if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) { |
|
305 | + try { |
|
306 | 306 | $records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated); |
307 | 307 | $num_records_actually_migrated += $records_migrated_during_stage; |
308 | 308 | $records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage; |
309 | - }catch(Exception $e){ |
|
309 | + } catch (Exception $e) { |
|
310 | 310 | //yes if we catch an exception here, we consider that migration stage borked. |
311 | 311 | $stage->set_status(EE_Data_Migration_Manager::status_fatal_error); |
312 | 312 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | throw $e; |
315 | 315 | } |
316 | 316 | //check that the migration stage didn't mark itself as having a fatal error |
317 | - if($stage->is_broken()){ |
|
317 | + if ($stage->is_broken()) { |
|
318 | 318 | $this->set_broken(); |
319 | 319 | throw new EE_Error($stage->get_last_error()); |
320 | 320 | } |
@@ -322,24 +322,24 @@ discard block |
||
322 | 322 | //once we've migrated all the number we intended to (possibly from different stages), stop migrating |
323 | 323 | //or if we had a fatal error |
324 | 324 | //or if the current script stopped early- its not done, but it's done all it thinks we should do on this step |
325 | - if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){ |
|
325 | + if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) { |
|
326 | 326 | break; |
327 | 327 | } |
328 | 328 | } |
329 | 329 | //check if we're all done this data migration... |
330 | 330 | //which is indicated by being done early AND the last stage claims to be done |
331 | - if($stage == NULL){ |
|
331 | + if ($stage == NULL) { |
|
332 | 332 | //this migration script apparently has NO stages... which is super weird, but whatever |
333 | 333 | $this->set_completed(); |
334 | 334 | $this->_maybe_do_schema_changes(false); |
335 | - }else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){ |
|
335 | + } else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) { |
|
336 | 336 | //apparently we're done, because we couldn't migrate the number we intended to |
337 | 337 | $this->set_completed(); |
338 | 338 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
339 | 339 | //do schema changes for after the migration now |
340 | 340 | //first double-check we haven't already done this |
341 | 341 | $this->_maybe_do_schema_changes(false); |
342 | - }else{ |
|
342 | + } else { |
|
343 | 343 | //update feedback message, keeping in mind that we show them with the most recent at the top |
344 | 344 | $this->_update_feedback_message(array_reverse($records_migrated_per_stage)); |
345 | 345 | } |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage |
354 | 354 | * @return void |
355 | 355 | */ |
356 | - private function _update_feedback_message($records_migrated_per_stage){ |
|
356 | + private function _update_feedback_message($records_migrated_per_stage) { |
|
357 | 357 | $feedback_message_array = array(); |
358 | - foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){ |
|
359 | - $feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ; |
|
358 | + foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) { |
|
359 | + $feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name); |
|
360 | 360 | } |
361 | - $this->_feedback_message .= implode("<br>",$feedback_message_array); |
|
361 | + $this->_feedback_message .= implode("<br>", $feedback_message_array); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | |
@@ -370,27 +370,27 @@ discard block |
||
370 | 370 | * @throws Exception |
371 | 371 | * @return void |
372 | 372 | */ |
373 | - private function _maybe_do_schema_changes($before = true){ |
|
373 | + private function _maybe_do_schema_changes($before = true) { |
|
374 | 374 | //so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran |
375 | - $property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran'; |
|
376 | - if ( ! $this->{$property_name} ){ |
|
377 | - try{ |
|
375 | + $property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran'; |
|
376 | + if ( ! $this->{$property_name} ) { |
|
377 | + try { |
|
378 | 378 | ob_start(); |
379 | - if($before){ |
|
379 | + if ($before) { |
|
380 | 380 | $this->schema_changes_before_migration(); |
381 | - }else{ |
|
381 | + } else { |
|
382 | 382 | $this->schema_changes_after_migration(); |
383 | 383 | } |
384 | 384 | $output = ob_get_contents(); |
385 | 385 | ob_end_clean(); |
386 | - }catch(Exception $e){ |
|
386 | + } catch (Exception $e) { |
|
387 | 387 | $this->set_status(EE_Data_Migration_Manager::status_fatal_error); |
388 | 388 | throw $e; |
389 | 389 | } |
390 | 390 | //record that we've done these schema changes |
391 | 391 | $this->{$property_name} = true; |
392 | 392 | //if there were any warnings etc, record them as non-fatal errors |
393 | - if( $output ){ |
|
393 | + if ($output) { |
|
394 | 394 | //there were some warnings |
395 | 395 | $this->_errors[] = $output; |
396 | 396 | } |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | * @param string $table_definition_sql |
418 | 418 | * @param string $engine_string |
419 | 419 | */ |
420 | - protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){ |
|
420 | + protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') { |
|
421 | 421 | // EEH_Debug_Tools::instance()->start_timer( '_table_is_new_in_this_version_' . $table_name ); |
422 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( true ) ); |
|
422 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(true)); |
|
423 | 423 | // EEH_Debug_Tools::instance()->stop_timer( '_table_is_new_in_this_version_' . $table_name ); |
424 | 424 | } |
425 | 425 | |
@@ -433,9 +433,9 @@ discard block |
||
433 | 433 | * @param string $table_definition_sql |
434 | 434 | * @param string $engine_string |
435 | 435 | */ |
436 | - protected function _table_is_changed_in_this_version($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
436 | + protected function _table_is_changed_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
437 | 437 | // EEH_Debug_Tools::instance()->start_timer( '_table_is_changed_in_this_version' . $table_name ); |
438 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
438 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
439 | 439 | // EEH_Debug_Tools::instance()->stop_timer( '_table_is_changed_in_this_version' . $table_name ); |
440 | 440 | } |
441 | 441 | |
@@ -446,8 +446,8 @@ discard block |
||
446 | 446 | * @param string $table_name |
447 | 447 | * @return boolean |
448 | 448 | */ |
449 | - protected function _old_table_exists( $table_name ) { |
|
450 | - return EEH_Activation::table_exists( $table_name ); |
|
449 | + protected function _old_table_exists($table_name) { |
|
450 | + return EEH_Activation::table_exists($table_name); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | * @param string $table_name |
458 | 458 | * @return boolean |
459 | 459 | */ |
460 | - protected function _delete_table_if_empty( $table_name ) { |
|
461 | - return EEH_Activation::delete_db_table_if_empty( $table_name ); |
|
460 | + protected function _delete_table_if_empty($table_name) { |
|
461 | + return EEH_Activation::delete_db_table_if_empty($table_name); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
@@ -477,9 +477,9 @@ discard block |
||
477 | 477 | * @param string $table_definition_sql |
478 | 478 | * @param string $engine_string |
479 | 479 | */ |
480 | - protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
480 | + protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
481 | 481 | // EEH_Debug_Tools::instance()->start_timer( '_table_should_exist_previously' . $table_name ); |
482 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
482 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
483 | 483 | // EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name ); |
484 | 484 | } |
485 | 485 | |
@@ -494,13 +494,13 @@ discard block |
||
494 | 494 | * @param string $table_definition_sql |
495 | 495 | * @param string $engine_string |
496 | 496 | */ |
497 | - protected function _table_has_not_changed_since_previous( $table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){ |
|
498 | - if( $this->_currently_migrating() ) { |
|
497 | + protected function _table_has_not_changed_since_previous($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') { |
|
498 | + if ($this->_currently_migrating()) { |
|
499 | 499 | //if we're doing a migration, and this table apparently already exists, then we don't need do anything right? |
500 | 500 | // EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name ); |
501 | 501 | return; |
502 | 502 | } |
503 | - $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped( false ) ); |
|
503 | + $this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false)); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | /** |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | protected function _currently_migrating() { |
511 | 511 | //we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM) |
512 | 512 | return $this->_migrating && |
513 | - $this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) && |
|
513 | + $this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) && |
|
514 | 514 | EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance; |
515 | 515 | } |
516 | 516 | |
@@ -521,17 +521,17 @@ discard block |
||
521 | 521 | * @param boolean $table_is_new |
522 | 522 | * @return boolean |
523 | 523 | */ |
524 | - protected function _pre_existing_table_should_be_dropped( $table_is_new ) { |
|
525 | - if( $table_is_new ) { |
|
526 | - if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating() ){ |
|
524 | + protected function _pre_existing_table_should_be_dropped($table_is_new) { |
|
525 | + if ($table_is_new) { |
|
526 | + if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating()) { |
|
527 | 527 | return true; |
528 | - }else{ |
|
528 | + } else { |
|
529 | 529 | return false; |
530 | 530 | } |
531 | - }else{ |
|
532 | - if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){ |
|
531 | + } else { |
|
532 | + if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) { |
|
533 | 533 | return true; |
534 | - }else{ |
|
534 | + } else { |
|
535 | 535 | return false; |
536 | 536 | } |
537 | 537 | } |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | * @param string $engine_string |
545 | 545 | * @param boolean $drop_pre_existing_tables |
546 | 546 | */ |
547 | - private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){ |
|
548 | - try{ |
|
549 | - EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
550 | - }catch( EE_Error $e ) { |
|
551 | - $message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString(); |
|
552 | - $this->add_error( $message ); |
|
547 | + private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) { |
|
548 | + try { |
|
549 | + EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables); |
|
550 | + } catch (EE_Error $e) { |
|
551 | + $message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString(); |
|
552 | + $this->add_error($message); |
|
553 | 553 | $this->_feedback_message .= $message; |
554 | 554 | } |
555 | 555 | } |
@@ -561,15 +561,15 @@ discard block |
||
561 | 561 | * @return int one of EE_System::_req_type_* constants |
562 | 562 | * @throws EE_Error |
563 | 563 | */ |
564 | - private function _get_req_type_for_plugin_corresponding_to_this_dms(){ |
|
565 | - if($this->slug() == 'Core'){ |
|
564 | + private function _get_req_type_for_plugin_corresponding_to_this_dms() { |
|
565 | + if ($this->slug() == 'Core') { |
|
566 | 566 | return EE_System::instance()->detect_req_type(); |
567 | - }else{//it must be for an addon |
|
567 | + } else {//it must be for an addon |
|
568 | 568 | $addon_name = $this->slug(); |
569 | - if( EE_Registry::instance()->get_addon_by_name($addon_name)){ |
|
569 | + if (EE_Registry::instance()->get_addon_by_name($addon_name)) { |
|
570 | 570 | return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type(); |
571 | - }else{ |
|
572 | - throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ; |
|
571 | + } else { |
|
572 | + throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name())))); |
|
573 | 573 | } |
574 | 574 | } |
575 | 575 | } |
@@ -580,13 +580,13 @@ discard block |
||
580 | 580 | * returns an array of strings describing errors by all the script's stages |
581 | 581 | * @return array |
582 | 582 | */ |
583 | - public function get_errors(){ |
|
583 | + public function get_errors() { |
|
584 | 584 | $all_errors = $this->_errors; |
585 | - if( ! is_array($all_errors)){ |
|
585 | + if ( ! is_array($all_errors)) { |
|
586 | 586 | $all_errors = array(); |
587 | 587 | } |
588 | - foreach($this->stages() as $stage){ |
|
589 | - $all_errors = array_merge($stage->get_errors(),$all_errors); |
|
588 | + foreach ($this->stages() as $stage) { |
|
589 | + $all_errors = array_merge($stage->get_errors(), $all_errors); |
|
590 | 590 | } |
591 | 591 | return $all_errors; |
592 | 592 | } |
@@ -597,8 +597,8 @@ discard block |
||
597 | 597 | * Indicates whether or not this migration script should continue |
598 | 598 | * @return boolean |
599 | 599 | */ |
600 | - public function can_continue(){ |
|
601 | - return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script); |
|
600 | + public function can_continue() { |
|
601 | + return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | |
@@ -610,8 +610,8 @@ discard block |
||
610 | 610 | * get ordered by the indexes |
611 | 611 | * @return EE_Data_Migration_Script_Stage[] |
612 | 612 | */ |
613 | - protected function stages(){ |
|
614 | - $stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages ); |
|
613 | + protected function stages() { |
|
614 | + $stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages); |
|
615 | 615 | ksort($stages); |
616 | 616 | return $stages; |
617 | 617 | } |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | * can be displayed to the user |
624 | 624 | * @return string |
625 | 625 | */ |
626 | - public function get_feedback_message(){ |
|
626 | + public function get_feedback_message() { |
|
627 | 627 | return $this->_feedback_message; |
628 | 628 | } |
629 | 629 | |
@@ -635,16 +635,16 @@ discard block |
||
635 | 635 | * possible that this class is defined when it goes to sleep, but NOT available when it |
636 | 636 | * awakes (eg, this class is part of an addon that is deactivated at some point). |
637 | 637 | */ |
638 | - public function properties_as_array(){ |
|
638 | + public function properties_as_array() { |
|
639 | 639 | $properties = parent::properties_as_array(); |
640 | 640 | $properties['_migration_stages'] = array(); |
641 | - foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){ |
|
641 | + foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) { |
|
642 | 642 | $properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array(); |
643 | 643 | } |
644 | 644 | unset($properties['_mappings']); |
645 | 645 | |
646 | - foreach($this->_mappings as $old_table_name => $mapping_to_new_table){ |
|
647 | - foreach($mapping_to_new_table as $new_table_name => $mapping){ |
|
646 | + foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) { |
|
647 | + foreach ($mapping_to_new_table as $new_table_name => $mapping) { |
|
648 | 648 | $this->_set_mapping_option($old_table_name, $new_table_name, $mapping); |
649 | 649 | } |
650 | 650 | } |
@@ -659,19 +659,19 @@ discard block |
||
659 | 659 | * @param array $array_of_properties like what's produced from properties_as_array() method |
660 | 660 | * @return void |
661 | 661 | */ |
662 | - public function instantiate_from_array_of_properties($array_of_properties){ |
|
662 | + public function instantiate_from_array_of_properties($array_of_properties) { |
|
663 | 663 | $stages_properties_arrays = $array_of_properties['_migration_stages']; |
664 | 664 | unset($array_of_properties['_migration_stages']); |
665 | 665 | unset($array_of_properties['class']); |
666 | - foreach($array_of_properties as $property_name => $property_value){ |
|
666 | + foreach ($array_of_properties as $property_name => $property_value) { |
|
667 | 667 | $this->{$property_name} = $property_value; |
668 | 668 | } |
669 | 669 | //_migration_stages are already instantiated, but have only default data |
670 | - foreach($this->_migration_stages as $stage){ |
|
671 | - $stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays); |
|
670 | + foreach ($this->_migration_stages as $stage) { |
|
671 | + $stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays); |
|
672 | 672 | //SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by |
673 | 673 | //an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet) |
674 | - if($stage_data){ |
|
674 | + if ($stage_data) { |
|
675 | 675 | $stage->instantiate_from_array_of_properties($stage_data); |
676 | 676 | } |
677 | 677 | } |
@@ -687,9 +687,9 @@ discard block |
||
687 | 687 | * @param array $migration_stage_data_arrays |
688 | 688 | * @return null |
689 | 689 | */ |
690 | - private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){ |
|
691 | - foreach($migration_stage_data_arrays as $migration_stage_data_array){ |
|
692 | - if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){ |
|
690 | + private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) { |
|
691 | + foreach ($migration_stage_data_arrays as $migration_stage_data_array) { |
|
692 | + if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) { |
|
693 | 693 | return $migration_stage_data_array; |
694 | 694 | } |
695 | 695 | } |
@@ -705,8 +705,8 @@ discard block |
||
705 | 705 | * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin |
706 | 706 | * that will be updated to. Eg array('Core','4.1.0') |
707 | 707 | */ |
708 | - public final function migrates_to_version(){ |
|
709 | - return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) ); |
|
708 | + public final function migrates_to_version() { |
|
709 | + return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this)); |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | |
@@ -718,10 +718,10 @@ discard block |
||
718 | 718 | * Or 'Core' for core (non-addon). |
719 | 719 | * @return string |
720 | 720 | */ |
721 | - public function slug(){ |
|
721 | + public function slug() { |
|
722 | 722 | $migrates_to_version_info = $this->migrates_to_version(); |
723 | 723 | //the slug is the first part of the array |
724 | - return $migrates_to_version_info[ 'slug' ]; |
|
724 | + return $migrates_to_version_info['slug']; |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | * the database up so it can run), then you can set "A" to priority 3 or something. |
736 | 736 | * @return int |
737 | 737 | */ |
738 | - public function priority(){ |
|
738 | + public function priority() { |
|
739 | 739 | return $this->_priority; |
740 | 740 | } |
741 | 741 | |
@@ -748,18 +748,18 @@ discard block |
||
748 | 748 | * @param boolean $migrating |
749 | 749 | * @return void |
750 | 750 | */ |
751 | - public function set_migrating( $migrating = TRUE ){ |
|
751 | + public function set_migrating($migrating = TRUE) { |
|
752 | 752 | $this->_migrating = $migrating; |
753 | 753 | } |
754 | 754 | |
755 | 755 | /** |
756 | 756 | * Marks that we think this migration class can continue to migrate |
757 | 757 | */ |
758 | - public function reattempt(){ |
|
758 | + public function reattempt() { |
|
759 | 759 | parent::reattempt(); |
760 | 760 | //also, we want to reattempt any stages that were marked as borked |
761 | - foreach( $this->stages() as $stage ) { |
|
762 | - if( $stage->is_broken() ) { |
|
761 | + foreach ($this->stages() as $stage) { |
|
762 | + if ($stage->is_broken()) { |
|
763 | 763 | $stage->reattempt(); |
764 | 764 | } |
765 | 765 | } |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | // (all other times it gets resurrected from a wordpress option) |
15 | 15 | $stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*'); |
16 | 16 | $class_to_filepath = array(); |
17 | -foreach($stages as $filepath){ |
|
17 | +foreach ($stages as $filepath) { |
|
18 | 18 | $matches = array(); |
19 | - preg_match('~4_7_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
19 | + preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | 20 | $class_to_filepath[$matches[1]] = $filepath; |
21 | 21 | } |
22 | 22 | //give addons a chance to autoload their stages too |
23 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages',$class_to_filepath); |
|
23 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
|
24 | 24 | EEH_Autoloader::register_autoloader($class_to_filepath); |
25 | 25 | |
26 | 26 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @since 4.7.0 |
37 | 37 | * |
38 | 38 | */ |
39 | -class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{ |
|
39 | +class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base { |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * return EE_DMS_Core_4_7_0 |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | public function can_migrate_from_version($version_array) { |
61 | 61 | $version_string = $version_array['Core']; |
62 | 62 | if ( |
63 | - ( $version_string <= '4.7.0' && $version_string >= '4.6.0' ) |
|
63 | + ($version_string <= '4.7.0' && $version_string >= '4.6.0') |
|
64 | 64 | || |
65 | - ( $version_string >= '4.7.0' && |
|
66 | - ! EEH_Activation::table_exists( 'esp_registration_payment' ) && |
|
67 | - EEH_Activation::table_exists( 'esp_registration' ) ) ) { |
|
65 | + ($version_string >= '4.7.0' && |
|
66 | + ! EEH_Activation::table_exists('esp_registration_payment') && |
|
67 | + EEH_Activation::table_exists('esp_registration')) ) { |
|
68 | 68 | return true; |
69 | - } elseif ( ! $version_string ) { |
|
69 | + } elseif ( ! $version_string) { |
|
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
71 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | 72 | } else { |
73 | 73 | return false; |
74 | 74 | } |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function schema_changes_before_migration() { |
92 | 92 | //relies on 4.1's EEH_Activation::create_table |
93 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
94 | - $table_name='esp_answer'; |
|
95 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
93 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
94 | + $table_name = 'esp_answer'; |
|
95 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
96 | 96 | REG_ID INT UNSIGNED NOT NULL, |
97 | 97 | QST_ID INT UNSIGNED NOT NULL, |
98 | 98 | ANS_value TEXT NOT NULL, |
99 | 99 | PRIMARY KEY (ANS_ID), |
100 | 100 | KEY REG_ID (REG_ID), |
101 | 101 | KEY QST_ID (QST_ID)"; |
102 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
102 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
103 | 103 | |
104 | 104 | $table_name = 'esp_attendee_meta'; |
105 | 105 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | CNT_is_EU TINYINT(1) DEFAULT '0', |
140 | 140 | CNT_active TINYINT(1) DEFAULT '0', |
141 | 141 | PRIMARY KEY (CNT_ISO)"; |
142 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
142 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
143 | 143 | |
144 | 144 | $table_name = 'esp_currency'; |
145 | 145 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
150 | 150 | CUR_active TINYINT(1) DEFAULT '0', |
151 | 151 | PRIMARY KEY (CUR_code)"; |
152 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
152 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
153 | 153 | |
154 | 154 | |
155 | 155 | $table_name = 'esp_currency_payment_method'; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | KEY EVT_ID (EVT_ID), |
180 | 180 | KEY DTT_is_primary (DTT_is_primary)"; |
181 | 181 | |
182 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
182 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
183 | 183 | |
184 | 184 | $table_name = 'esp_event_meta'; |
185 | 185 | $sql = " |
@@ -198,44 +198,44 @@ discard block |
||
198 | 198 | EVT_donations TINYINT(1) NULL, |
199 | 199 | PRIMARY KEY (EVTM_ID), |
200 | 200 | KEY EVT_ID (EVT_ID)"; |
201 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
201 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
202 | 202 | |
203 | 203 | |
204 | 204 | |
205 | - $table_name='esp_event_question_group'; |
|
206 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
205 | + $table_name = 'esp_event_question_group'; |
|
206 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
207 | 207 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
208 | 208 | QSG_ID INT UNSIGNED NOT NULL, |
209 | 209 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
210 | 210 | PRIMARY KEY (EQG_ID), |
211 | 211 | KEY EVT_ID (EVT_ID), |
212 | 212 | KEY QSG_ID (QSG_ID)"; |
213 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
213 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
214 | 214 | |
215 | 215 | |
216 | 216 | |
217 | - $table_name='esp_event_venue'; |
|
218 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
217 | + $table_name = 'esp_event_venue'; |
|
218 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
219 | 219 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
220 | 220 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
221 | 221 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
222 | 222 | PRIMARY KEY (EVV_ID)"; |
223 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
223 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
224 | 224 | |
225 | 225 | |
226 | 226 | |
227 | - $table_name='esp_extra_meta'; |
|
228 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
227 | + $table_name = 'esp_extra_meta'; |
|
228 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
229 | 229 | OBJ_ID INT(11) DEFAULT NULL, |
230 | 230 | EXM_type VARCHAR(45) DEFAULT NULL, |
231 | 231 | EXM_key VARCHAR(45) DEFAULT NULL, |
232 | 232 | EXM_value TEXT, |
233 | 233 | PRIMARY KEY (EXM_ID), |
234 | 234 | KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))"; |
235 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
235 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
236 | 236 | |
237 | - $table_name='esp_line_item'; |
|
238 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
237 | + $table_name = 'esp_line_item'; |
|
238 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
239 | 239 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
240 | 240 | TXN_ID INT(11) DEFAULT NULL, |
241 | 241 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | PRIMARY KEY (LIN_ID), |
254 | 254 | KEY LIN_code (LIN_code(191)), |
255 | 255 | KEY TXN_ID (TXN_ID)"; |
256 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
256 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
257 | 257 | |
258 | 258 | $table_name = 'esp_log'; |
259 | 259 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
294 | 294 | PRIMARY KEY (GRP_ID), |
295 | 295 | KEY MTP_user_id (MTP_user_id)"; |
296 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
296 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
297 | 297 | |
298 | 298 | $table_name = 'esp_event_message_template'; |
299 | 299 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | PRIMARY KEY (EMT_ID), |
303 | 303 | KEY EVT_ID (EVT_ID), |
304 | 304 | KEY GRP_ID (GRP_ID)"; |
305 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
305 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
306 | 306 | |
307 | 307 | |
308 | 308 | $table_name = 'esp_payment'; |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | PRIMARY KEY (TTM_ID)"; |
376 | 376 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
377 | 377 | |
378 | - $table_name='esp_question'; |
|
379 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
378 | + $table_name = 'esp_question'; |
|
379 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
380 | 380 | QST_display_text TEXT NOT NULL, |
381 | 381 | QST_admin_label VARCHAR(255) NOT NULL, |
382 | 382 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -389,22 +389,22 @@ discard block |
||
389 | 389 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
390 | 390 | PRIMARY KEY (QST_ID), |
391 | 391 | KEY QST_order (QST_order)'; |
392 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
392 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
393 | 393 | |
394 | - $table_name='esp_question_group_question'; |
|
395 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
394 | + $table_name = 'esp_question_group_question'; |
|
395 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
396 | 396 | QSG_ID INT UNSIGNED NOT NULL, |
397 | 397 | QST_ID INT UNSIGNED NOT NULL, |
398 | 398 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
399 | 399 | PRIMARY KEY (QGQ_ID), |
400 | 400 | KEY QST_ID (QST_ID), |
401 | 401 | KEY QSG_ID_order (QSG_ID, QGQ_order)"; |
402 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
402 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
403 | 403 | |
404 | 404 | |
405 | 405 | |
406 | - $table_name='esp_question_option'; |
|
407 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
406 | + $table_name = 'esp_question_option'; |
|
407 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
408 | 408 | QSO_value VARCHAR(255) NOT NULL, |
409 | 409 | QSO_desc TEXT NOT NULL, |
410 | 410 | QST_ID INT UNSIGNED NOT NULL, |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | PRIMARY KEY (QSO_ID), |
414 | 414 | KEY QST_ID (QST_ID), |
415 | 415 | KEY QSO_order (QSO_order)"; |
416 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
416 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
417 | 417 | |
418 | 418 | |
419 | 419 | |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | |
460 | 460 | |
461 | 461 | |
462 | - $table_name='esp_checkin'; |
|
463 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
462 | + $table_name = 'esp_checkin'; |
|
463 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
464 | 464 | REG_ID INT(10) UNSIGNED NOT NULL, |
465 | 465 | DTT_ID INT(10) UNSIGNED NOT NULL, |
466 | 466 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
556 | 556 | PRIMARY KEY (PRC_ID), |
557 | 557 | KEY PRT_ID (PRT_ID)"; |
558 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
558 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
559 | 559 | |
560 | 560 | $table_name = "esp_price_type"; |
561 | 561 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -593,10 +593,10 @@ discard block |
||
593 | 593 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
594 | 594 | PRIMARY KEY (TKT_ID), |
595 | 595 | KEY TKT_start_date (TKT_start_date)"; |
596 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
596 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
597 | 597 | |
598 | 598 | $table_name = 'esp_question_group'; |
599 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
599 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
600 | 600 | QSG_name VARCHAR(255) NOT NULL, |
601 | 601 | QSG_identifier VARCHAR(100) NOT NULL, |
602 | 602 | QSG_desc TEXT NULL, |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | PRIMARY KEY (QSG_ID), |
610 | 610 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
611 | 611 | KEY QSG_order (QSG_order)'; |
612 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
612 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
613 | 613 | |
614 | 614 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
615 | 615 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | return true; |
642 | 642 | } |
643 | 643 | |
644 | - public function migration_page_hooks(){ |
|
644 | + public function migration_page_hooks() { |
|
645 | 645 | |
646 | 646 | } |
647 | 647 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * Just initializes the status of the migration |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - $this->_pretty_name = __( 'Update Invoice Gateway Settings', 'event_espresso' ); |
|
32 | + $this->_pretty_name = __('Update Invoice Gateway Settings', 'event_espresso'); |
|
33 | 33 | parent::__construct(); |
34 | 34 | } |
35 | 35 | |
@@ -56,39 +56,39 @@ discard block |
||
56 | 56 | * @throws EE_Error |
57 | 57 | * @return int number of items ACTUALLY migrated |
58 | 58 | */ |
59 | - protected function _migration_step( $num_items = 1 ){ |
|
59 | + protected function _migration_step($num_items = 1) { |
|
60 | 60 | // if this isn't set then something is really wrong |
61 | - if ( ! EE_Config::instance()->gateway instanceof EE_Gateway_Config ) { |
|
62 | - throw new EE_Error( __( 'It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso' )); |
|
61 | + if ( ! EE_Config::instance()->gateway instanceof EE_Gateway_Config) { |
|
62 | + throw new EE_Error(__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso')); |
|
63 | 63 | } |
64 | - $invoice_settings = isset( EE_Config::instance()->gateway->payment_settings[ 'Invoice' ] ) ? EE_Config::instance()->gateway->payment_settings[ 'Invoice' ] : NULL; |
|
65 | - if( ! $invoice_settings ){ |
|
66 | - $this->add_error( __( 'Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso' ) ); |
|
67 | - }else{ |
|
68 | - $invoice_settings[ 'template_payment_instructions' ] = $invoice_settings[ 'pdf_instructions' ]; |
|
69 | - $invoice_settings[ 'template_invoice_payee_name' ] = $invoice_settings[ 'payable_to' ]; |
|
70 | - $invoice_settings[ 'template_invoice_address' ] = $invoice_settings[ 'payment_address' ]; |
|
71 | - $invoice_settings[ 'template_invoice_email' ] = ''; |
|
72 | - $invoice_settings[ 'template_invoice_tax_number' ] = ''; |
|
73 | - unset( $invoice_settings[ 'pdf_instructions' ] ); |
|
74 | - unset( $invoice_settings[ 'payable_to' ] ); |
|
75 | - unset( $invoice_settings[ 'payment_address' ] ); |
|
76 | - EE_Config::instance()->gateway->payment_settings[ 'Invoice' ] = $invoice_settings; |
|
77 | - EE_Config::instance()->update_espresso_config(false,false); |
|
64 | + $invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : NULL; |
|
65 | + if ( ! $invoice_settings) { |
|
66 | + $this->add_error(__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso')); |
|
67 | + } else { |
|
68 | + $invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions']; |
|
69 | + $invoice_settings['template_invoice_payee_name'] = $invoice_settings['payable_to']; |
|
70 | + $invoice_settings['template_invoice_address'] = $invoice_settings['payment_address']; |
|
71 | + $invoice_settings['template_invoice_email'] = ''; |
|
72 | + $invoice_settings['template_invoice_tax_number'] = ''; |
|
73 | + unset($invoice_settings['pdf_instructions']); |
|
74 | + unset($invoice_settings['payable_to']); |
|
75 | + unset($invoice_settings['payment_address']); |
|
76 | + EE_Config::instance()->gateway->payment_settings['Invoice'] = $invoice_settings; |
|
77 | + EE_Config::instance()->update_espresso_config(false, false); |
|
78 | 78 | |
79 | 79 | //@todo: check 'invoice_css' too because we can't easily affect that so we might need to set a persistent notice |
80 | 80 | //(why is it tough to change? because we want to update the receipt and invoice message template, but |
81 | 81 | //message templates are only initialized AFTER migrations and those two are new in 4.5. So if we wanted to |
82 | 82 | //update them from a DMS, we'd need to have the DMS create the message templates which is quite a lot of code; |
83 | 83 | //also we don't want to build a dependency on the messages code because it is likely to change soon |
84 | - if( ! in_array( $invoice_settings[ 'invoice_css' ], array( '', 'simple.css' ) ) ){ |
|
85 | - EE_Error::add_persistent_admin_notice( 'invoice_css_not_updated', sprintf( __( 'You had previously set your Invoice Payment Method\'s stylesheet to be %1$s, but that setting has moved. PDF and HTML Invoices and Receipts are now Messages, which means you can easily modify them from your Wordpress Dashboard instead of using filters or uploading template files. Please visit Messages -> Receipt and Messages -> Invoice to change their stylesheets.', 'event_espresso'), $invoice_settings[ 'invoice_css' ] ), FALSE ); |
|
84 | + if ( ! in_array($invoice_settings['invoice_css'], array('', 'simple.css'))) { |
|
85 | + EE_Error::add_persistent_admin_notice('invoice_css_not_updated', sprintf(__('You had previously set your Invoice Payment Method\'s stylesheet to be %1$s, but that setting has moved. PDF and HTML Invoices and Receipts are now Messages, which means you can easily modify them from your Wordpress Dashboard instead of using filters or uploading template files. Please visit Messages -> Receipt and Messages -> Invoice to change their stylesheets.', 'event_espresso'), $invoice_settings['invoice_css']), FALSE); |
|
86 | 86 | } |
87 | 87 | $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
88 | - $overridden_invoice_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', NULL, FALSE, FALSE, TRUE ); |
|
89 | - $overridden_receipt_body= EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', NULL, FALSE, FALSE, TRUE ); |
|
90 | - if( $overridden_invoice_body || $overridden_receipt_body ) { |
|
91 | - EE_Error::add_persistent_admin_notice( 'invoice_overriding_templates', sprintf( __( 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents. We recommend deleting your old Invoice/Receipt templates and modifying the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE ); |
|
88 | + $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', NULL, FALSE, FALSE, TRUE); |
|
89 | + $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', NULL, FALSE, FALSE, TRUE); |
|
90 | + if ($overridden_invoice_body || $overridden_receipt_body) { |
|
91 | + EE_Error::add_persistent_admin_notice('invoice_overriding_templates', sprintf(__('Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents. We recommend deleting your old Invoice/Receipt templates and modifying the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * Just initializes the status of the migration |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - $this->_pretty_name = __( 'Update Invoice Settings', 'event_espresso' ); |
|
30 | + $this->_pretty_name = __('Update Invoice Settings', 'event_espresso'); |
|
31 | 31 | parent::__construct(); |
32 | 32 | } |
33 | 33 | |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | * @throws EE_Error |
55 | 55 | * @return int number of items ACTUALLY migrated |
56 | 56 | */ |
57 | - protected function _migration_step( $num_items = 1 ){ |
|
57 | + protected function _migration_step($num_items = 1) { |
|
58 | 58 | |
59 | 59 | $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
60 | - $overridden_invoice_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', NULL, FALSE, FALSE, TRUE ); |
|
61 | - $overridden_receipt_body= EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', NULL, FALSE, FALSE, TRUE ); |
|
62 | - if( $overridden_invoice_body || $overridden_receipt_body ) { |
|
63 | - EE_Error::add_persistent_admin_notice( 'invoice_overriding_templates', sprintf( __( 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE ); |
|
60 | + $overridden_invoice_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', NULL, FALSE, FALSE, TRUE); |
|
61 | + $overridden_receipt_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', NULL, FALSE, FALSE, TRUE); |
|
62 | + if ($overridden_invoice_body || $overridden_receipt_body) { |
|
63 | + EE_Error::add_persistent_admin_notice('invoice_overriding_templates', sprintf(__('Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | //regardless of whether it worked or not, we ought to continue the migration |